|
|
|
|
| #pragma once
|
|
|
| #include "GameplayTagContainer.h"
|
| #include "Components/SlateWrapperTypes.h"
|
| #include "GameSettingFilterState.h"
|
| #include "GameplayTagContainer.h"
|
|
|
| #include "GameSetting.generated.h"
|
|
|
| #define UE_API GAMESETTINGS_API
|
|
|
| class ULocalPlayer;
|
| class UGameSettingRegistry;
|
|
|
|
|
|
|
|
|
|
|
| DECLARE_DELEGATE_RetVal_OneParam(FText, FGetGameSettingsDetails, ULocalPlayer& );
|
|
|
| |
| |
|
|
| UCLASS(MinimalAPI, Abstract, BlueprintType)
|
| class UGameSetting : public UObject
|
| {
|
| GENERATED_BODY()
|
|
|
| public:
|
| UGameSetting() { }
|
|
|
| public:
|
| DECLARE_EVENT_TwoParams(UGameSetting, FOnSettingChanged, UGameSetting* , EGameSettingChangeReason );
|
| DECLARE_EVENT_OneParam(UGameSetting, FOnSettingApplied, UGameSetting* );
|
| DECLARE_EVENT_OneParam(UGameSetting, FOnSettingEditConditionChanged, UGameSetting* );
|
|
|
| FOnSettingChanged OnSettingChangedEvent;
|
| FOnSettingApplied OnSettingAppliedEvent;
|
| FOnSettingEditConditionChanged OnSettingEditConditionChangedEvent;
|
|
|
| public:
|
|
|
| |
| |
| |
|
|
| UFUNCTION(BlueprintCallable)
|
| FName GetDevName() const { return DevName; }
|
| void SetDevName(const FName& Value) { DevName = Value; }
|
|
|
| bool GetAdjustListViewPostRefresh() const { return bAdjustListViewPostRefresh; }
|
| void SetAdjustListViewPostRefresh(const bool Value) { bAdjustListViewPostRefresh = Value; }
|
|
|
| UFUNCTION(BlueprintCallable)
|
| FText GetDisplayName() const { return DisplayName; }
|
| void SetDisplayName(const FText& Value) { DisplayName = Value; }
|
| #if !UE_BUILD_SHIPPING
|
| void SetDisplayName(const FString& Value) { SetDisplayName(FText::FromString(Value)); }
|
| #endif
|
| UFUNCTION(BlueprintCallable)
|
| ESlateVisibility GetDisplayNameVisibility() { return DisplayNameVisibility; }
|
| void SetNameDisplayVisibility(ESlateVisibility InVisibility) { DisplayNameVisibility = InVisibility; }
|
|
|
| UFUNCTION(BlueprintCallable)
|
| FText GetDescriptionRichText() const { return DescriptionRichText; }
|
| void SetDescriptionRichText(const FText& Value) { DescriptionRichText = Value; InvalidateSearchableText(); }
|
| #if !UE_BUILD_SHIPPING
|
|
|
| void SetDescriptionRichText(const FString& Value) { SetDescriptionRichText(FText::FromString(Value)); }
|
| #endif
|
|
|
| UFUNCTION(BlueprintCallable)
|
| const FGameplayTagContainer& GetTags() const { return Tags; }
|
| void AddTag(const FGameplayTag& TagToAdd) { Tags.AddTag(TagToAdd); }
|
|
|
| void SetRegistry(UGameSettingRegistry* InOwningRegistry) { OwningRegistry = InOwningRegistry; }
|
|
|
|
|
| UE_API const FString& GetDescriptionPlainText() const;
|
|
|
|
|
| UE_API void Initialize(ULocalPlayer* InLocalPlayer);
|
|
|
|
|
| ULocalPlayer* GetOwningLocalPlayer() const { return LocalPlayer; }
|
|
|
|
|
| void SetDynamicDetails(const FGetGameSettingsDetails& InDynamicDetails) { DynamicDetails = InDynamicDetails; }
|
|
|
| |
| |
| |
|
|
| UFUNCTION(BlueprintCallable)
|
| UE_API FText GetDynamicDetails() const;
|
|
|
| UFUNCTION(BlueprintCallable)
|
| FText GetWarningRichText() const { return WarningRichText; }
|
| void SetWarningRichText(const FText& Value) { WarningRichText = Value; InvalidateSearchableText(); }
|
| #if !UE_BUILD_SHIPPING
|
|
|
| void SetWarningRichText(const FString& Value) { SetWarningRichText(FText::FromString(Value)); }
|
| #endif
|
|
|
| |
| |
| |
|
|
| const FGameSettingEditableState& GetEditState() const { return EditableStateCache; }
|
|
|
|
|
| UE_API void AddEditCondition(const TSharedRef<FGameSettingEditCondition>& InEditCondition);
|
|
|
|
|
| UE_API void AddEditDependency(UGameSetting* DependencySetting);
|
|
|
|
|
| UE_API void SetSettingParent(UGameSetting* InSettingParent);
|
| UGameSetting* GetSettingParent() const { return SettingParent; }
|
|
|
|
|
| bool GetIsReportedToAnalytics() const { return bReportAnalytics; }
|
| void SetIsReportedToAnalytics(bool bReport) { bReportAnalytics = bReport; }
|
|
|
|
|
| virtual FString GetAnalyticsValue() const { return TEXT(""); }
|
|
|
| |
| |
| |
|
|
| bool IsReady() const { return bReady; }
|
|
|
| |
| |
| |
| |
| |
|
|
| virtual TArray<UGameSetting*> GetChildSettings() { return TArray<UGameSetting*>(); }
|
|
|
| |
| |
| |
|
|
| UE_API void RefreshEditableState(bool bNotifyEditConditionsChanged = true);
|
|
|
| |
| |
| |
| |
|
|
| UE_API void Apply();
|
|
|
|
|
| UE_API virtual UWorld* GetWorld() const override;
|
|
|
| protected:
|
|
|
| UE_API virtual void Startup();
|
| UE_API void StartupComplete();
|
|
|
| UE_API virtual void OnInitialized();
|
| UE_API virtual void OnApply();
|
| UE_API virtual void OnGatherEditState(FGameSettingEditableState& InOutEditState) const;
|
| UE_API virtual void OnDependencyChanged();
|
|
|
|
|
| UE_API virtual FText GetDynamicDetailsInternal() const;
|
|
|
|
|
| UE_API void HandleEditDependencyChanged(UGameSetting* DependencySetting, EGameSettingChangeReason Reason);
|
| UE_API void HandleEditDependencyChanged(UGameSetting* DependencySetting);
|
|
|
|
|
| UE_API void RefreshPlainText() const;
|
| void InvalidateSearchableText() { bRefreshPlainSearchableText = true; }
|
|
|
|
|
| UE_API void NotifySettingChanged(EGameSettingChangeReason Reason);
|
| UE_API virtual void OnSettingChanged(EGameSettingChangeReason Reason);
|
|
|
|
|
| UE_API void NotifyEditConditionsChanged();
|
| UE_API virtual void OnEditConditionsChanged();
|
|
|
|
|
| UE_API FGameSettingEditableState ComputeEditableState() const;
|
|
|
| protected:
|
|
|
| UPROPERTY(Transient)
|
| TObjectPtr<ULocalPlayer> LocalPlayer;
|
|
|
| UPROPERTY(Transient)
|
| TObjectPtr<UGameSetting> SettingParent;
|
|
|
| UPROPERTY(Transient)
|
| TObjectPtr<UGameSettingRegistry> OwningRegistry;
|
|
|
| FName DevName;
|
| FText DisplayName;
|
| ESlateVisibility DisplayNameVisibility = ESlateVisibility::SelfHitTestInvisible;
|
| FText DescriptionRichText;
|
| FText WarningRichText;
|
|
|
|
|
| FGameplayTagContainer Tags;
|
|
|
| FGetGameSettingsDetails DynamicDetails;
|
|
|
|
|
| TArray<TSharedRef<FGameSettingEditCondition>> EditConditions;
|
|
|
| class FStringCultureCache
|
| {
|
| FStringCultureCache(TFunction<FString()> InStringGetter);
|
|
|
| void Invalidate();
|
|
|
| FString Get() const;
|
|
|
| private:
|
| mutable FString StringCache;
|
| mutable FCultureRef Culture;
|
| TFunction<FString()> StringGetter;
|
| };
|
|
|
|
|
| mutable bool bRefreshPlainSearchableText = true;
|
|
|
| mutable FString AutoGenerated_DescriptionPlainText;
|
|
|
|
|
| bool bReportAnalytics = false;
|
|
|
| private:
|
|
|
|
|
| bool bReady = false;
|
|
|
|
|
| bool bOnSettingChangedEventGuard = false;
|
|
|
|
|
| bool bOnEditConditionsChangedEventGuard = false;
|
|
|
|
|
| bool bAdjustListViewPostRefresh = true;
|
|
|
|
|
| FGameSettingEditableState EditableStateCache;
|
| };
|
|
|
| #undef UE_API
|
|
|