39#if ENGINE_MAJOR_VERSION >= 5
40 inline static const FString
PreConfigFileName = TEXT(
"LootLockerServerPreConfig.bytes");
44 UPROPERTY(Config, VisibleAnywhere, BlueprintReadOnly, Category =
"LootLockerServer",
Meta = (EditCondition =
"bIsFileConfigLocked", EditConditionHides),
Meta = (MultiLine =
true),
Meta = (DisplayName =
"INFO:"), Transient)
45 FString
FileConfigActiveNotice =
"Settings are governed by the pre-configured file config shipped with the plugin and cannot be changed from the editor.";
46 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLockerServer",
Meta = (EditCondition =
"!bIsFileConfigLocked"))
48 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLockerServer",
Meta = (EditCondition =
"!bIsFileConfigLocked"))
50 UPROPERTY(Config, VisibleAnywhere, BlueprintReadOnly, Category =
"LootLockerServer",
Meta = (EditCondition =
"IsLegacyKey", EditConditionHides),
Meta = (MultiLine = true),
Meta = (DisplayName =
"WARNING:"), Transient)
51 FString
LegacyKeyWarning =
"You are using a legacy API Key, please generate a new one here: https://console.lootlocker.com/settings/api-keys";
52 UPROPERTY(Config, VisibleAnywhere, BlueprintReadOnly, Category =
"LootLockerServer",
Meta = (EditCondition =
"!IsValidGameVersion", EditConditionHides),
Meta = (MultiLine = true),
Meta = (DisplayName =
"WARNING:"), Transient)
54 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLockerServer",
Meta = (EditCondition =
"!bIsFileConfigLocked"))
56 UPROPERTY(Config, VisibleAnywhere, BlueprintReadOnly,
Meta = (EditCondition =
"false", EditConditionHides), Category =
"LootLockerServer")
59 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLockerServer|Logging",
Meta = (EditCondition =
"!bIsFileConfigLocked"))
61 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLockerServer|Logging",
Meta = (EditCondition =
"!bIsFileConfigLocked"))
63 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLockerServer|Logging",
Meta = (EditCondition =
"!bIsFileConfigLocked"))
65 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLockerServer|Logging",
Meta = (EditCondition =
"bEnableFileLogging && !bIsFileConfigLocked", EditConditionHides))
67 UPROPERTY(Config, VisibleAnywhere, BlueprintReadOnly, Category =
"LootLockerServer|Logging",
Meta = (EditCondition =
"bEnableFileLogging", EditConditionHides),
Meta = (MultiLine = true),
Meta = (DisplayName =
"Actual Log File (on current device)"), Transient)
70 FString LogFilePath =
"";
75 return GetDefault<ULootLockerServerConfig>()->LimitLogLevelTo;
82 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Logging")
88 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Logging")
95 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Logging")
101 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Logging")
107 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Logging")
113 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Logging")
119 bool IsLegacyAPIKey()
const
125 static
bool ShouldLog()
130 return GetDefault<ULootLockerServerConfig>()->LogOutsideOfEditor;
135 static
bool IsSemverString(const FString& str)
137#if ENGINE_MAJOR_VERSION >= 5
138 return std::regex_match(TCHAR_TO_UTF8(*str), SemverPattern);
144 virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
override
146 if (PropertyChangedEvent.GetPropertyName() ==
"LootLockerServerKey")
148 IsLegacyKey = IsLegacyAPIKey();
150 if (PropertyChangedEvent.GetPropertyName() ==
"GameVersion")
152 IsValidGameVersion = IsSemverString(GameVersion);
154 if (PropertyChangedEvent.GetPropertyName() ==
"bEnableFileLogging" || PropertyChangedEvent.GetPropertyName() ==
"LogFileName")
156 if (bEnableFileLogging)
158 EnableFileLogging(LogFileName.IsEmpty() ?
"LootLockerServerLog" : LogFileName);
162 DisableFileLogging();
165 UObject::PostEditChangeProperty(PropertyChangedEvent);
168 virtual void PostInitProperties()
override
170 IsLegacyKey = IsLegacyAPIKey();
171 IsValidGameVersion = IsSemverString(GameVersion);
173 ApplyFileConfigIfPresent();
177 if (!bIsFileConfigLocked)
179 if(bEnableFileLogging)
181 EnableFileLogging(LogFileName.IsEmpty() ?
"LootLockerServerLog" : LogFileName);
185 DisableFileLogging();
188 UObject::PostInitProperties();
191 UPROPERTY(Config, VisibleInstanceOnly,
Meta = (EditCondition =
"false", EditConditionHides), Transient, Category =
"LootLockerServer")
192 bool IsLegacyKey = false;
193 UPROPERTY(Config, VisibleInstanceOnly,
Meta = (EditCondition =
"false", EditConditionHides), Transient, Category =
"LootLockerServer")
194 bool IsValidGameVersion = true;
195 UPROPERTY(Config, VisibleInstanceOnly,
Meta = (EditCondition =
"false", EditConditionHides), Transient, Category =
"LootLockerServer")
196 bool bIsFileConfigLocked = false;
197#if ENGINE_MAJOR_VERSION >= 5
198 inline static bool bFileConfigChecked =
false;
199 inline static TOptional<FLootLockerServerFileConfig> FileConfig;
201 static bool bFileConfigChecked;
202 static TOptional<FLootLockerServerFileConfig> FileConfig;
204 static void LoadFileConfig();
205 void ApplyFileConfigIfPresent();
206#if ENGINE_MAJOR_VERSION >= 5
207 inline static const std::regex SemverPattern = std::regex(
"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:\\.(0|[1-9]\\d*))?(?:\\.(0|[1-9]\\d*))?$");