// Copyright Epic Games, Inc. All Rights Reserved. #include "EditCondition/WhenPlatformHasTrait.h" #include "CommonUIVisibilitySubsystem.h" #include "GameSettingFilterState.h" #include "Misc/AssertionMacros.h" #define LOCTEXT_NAMESPACE "GameSetting" TSharedRef FWhenPlatformHasTrait::KillIfMissing(FGameplayTag InVisibilityTag, const FString& InKillReason) { check(InVisibilityTag.IsValid()); check(!InKillReason.IsEmpty()); TSharedRef Result = MakeShared(); Result->VisibilityTag = InVisibilityTag; Result->KillReason = InKillReason; Result->bTagDesired = true; return Result; } TSharedRef FWhenPlatformHasTrait::DisableIfMissing(FGameplayTag InVisibilityTag, const FText& InDisableReason) { check(InVisibilityTag.IsValid()); check(!InDisableReason.IsEmpty()); TSharedRef Result = MakeShared(); Result->VisibilityTag = InVisibilityTag; Result->DisableReason = InDisableReason; Result->bTagDesired = true; return Result; } TSharedRef FWhenPlatformHasTrait::KillIfPresent(FGameplayTag InVisibilityTag, const FString& InKillReason) { check(InVisibilityTag.IsValid()); check(!InKillReason.IsEmpty()); TSharedRef Result = MakeShared(); Result->VisibilityTag = InVisibilityTag; Result->KillReason = InKillReason; Result->bTagDesired = false; return Result; } TSharedRef FWhenPlatformHasTrait::DisableIfPresent(FGameplayTag InVisibilityTag, const FText& InDisableReason) { check(InVisibilityTag.IsValid()); check(!InDisableReason.IsEmpty()); TSharedRef Result = MakeShared(); Result->VisibilityTag = InVisibilityTag; Result->DisableReason = InDisableReason; Result->bTagDesired = false; return Result; } void FWhenPlatformHasTrait::GatherEditState(const ULocalPlayer* InLocalPlayer, FGameSettingEditableState& InOutEditState) const { if (UCommonUIVisibilitySubsystem::GetChecked(InLocalPlayer)->HasVisibilityTag(VisibilityTag) != bTagDesired) { if (KillReason.IsEmpty()) { InOutEditState.Disable(DisableReason); } else { InOutEditState.Kill(KillReason); } } } #undef LOCTEXT_NAMESPACE