8#include "Runtime/Launch/Resources/Version.h"
9#if ENGINE_MAJOR_VERSION >= 5
12#include "CoreMinimal.h"
13#include "Logging/LogVerbosity.h"
14#include "LootLockerLogLevel.h"
17#include "LootLockerConfig.generated.h"
28UENUM(BlueprintType, Category =
"LootLocker")
68UCLASS(Config =
Game, DefaultConfig, meta = (DisplayName =
"LootLocker SDK Settings"))
77#if ENGINE_MAJOR_VERSION >= 5
78 return std::regex_match(TCHAR_TO_UTF8(*str), SemverPattern);
103#if ENGINE_MAJOR_VERSION >= 5
104 inline static const FString
PreConfigFileName = TEXT(
"LootLockerPreConfig.bytes");
110 virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
override
112 if (PropertyChangedEvent.GetPropertyName() ==
"GameVersion")
116 if (PropertyChangedEvent.GetPropertyName() ==
"bEnableFileLogging" || PropertyChangedEvent.GetPropertyName() ==
"LogFileName")
128 UObject::PostEditChangeProperty(PropertyChangedEvent);
134 MigrateSettingsIfNeeded();
136 ApplyFileConfigIfPresent();
139 if (!bIsFileConfigLocked)
150 UObject::PostInitProperties();
153 UPROPERTY(Config, VisibleAnywhere, BlueprintReadOnly, Category =
"LootLocker",
Meta = (EditCondition =
"IsOutdatedSDK", EditConditionHides),
Meta = (MultiLine =
true),
Meta = (DisplayName =
"WARNING:"), Transient)
154 FString
OutdatedSDKWarning =
"This version of LootLocker is no longer updated through fab because of fab guidelines. Please use GitHub releases to update: https://github.com/lootlocker/unreal-sdk/releases";
155 UPROPERTY(Config, VisibleAnywhere, BlueprintReadOnly, Category =
"LootLocker",
Meta = (EditCondition =
"bIsFileConfigLocked", EditConditionHides),
Meta = (MultiLine = true),
Meta = (DisplayName =
"INFO:"), Transient)
156 FString
FileConfigActiveNotice =
"Settings are governed by the pre-configured file config shipped with the plugin and cannot be changed from the editor.";
158 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker",
Meta = (DisplayName =
"LootLocker API Key", EditCondition =
"!bIsFileConfigLocked"))
160 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker",
Meta = (EditCondition =
"!bIsFileConfigLocked"))
162 UPROPERTY(Config, VisibleAnywhere, BlueprintReadOnly, Category =
"LootLocker",
Meta = (EditCondition =
"!IsValidGameVersion", EditConditionHides),
Meta = (MultiLine = true),
Meta = (DisplayName =
"WARNING:"), Transient)
163 FString
InvalidGameVersionWarning =
"Game version needs to follow a numeric Semantic Versioning pattern: X.Y.Z.B with the sections denoting MAJOR.MINOR.PATCH.BUILD and the last two being optional. Read more at https://docs.lootlocker.com/the-basics/core-concepts/glossary#game-version";
164 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker",
Meta = (EditCondition =
"!bIsFileConfigLocked"))
167 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker",
Meta = (EditCondition =
"!bIsFileConfigLocked"))
174 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker",
Meta = (DisplayName =
"Use Legacy HTTP Stack", EditCondition =
"!bIsFileConfigLocked"))
177 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker|Logging",
Meta = (EditCondition =
"!bIsFileConfigLocked"))
179 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker|Logging",
Meta = (DisplayName =
"LootLocker Log Level", EditCondition =
"!bIsFileConfigLocked"))
188 return GetDefault<ULootLockerConfig>()->LogOutsideOfEditor;
195 return GetDefault<ULootLockerConfig>()->LootLockerLogLevel;
201 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Logging")
206 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Logging")
212 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Logging")
217 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Logging")
222 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Logging")
227 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Logging")
237 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Presence")
243 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Presence")
249 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Presence")
255 UFUNCTION(BlueprintCallable, Category =
"LootLocker|Presence")
258 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker|Logging",
Meta = (DisplayName =
"Enable File Logging", EditCondition =
"!bIsFileConfigLocked"))
260 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker|Logging",
Meta = (DisplayName =
"Name of LootLocker Log File", EditCondition =
"bEnableFileLogging && !bIsFileConfigLocked", EditConditionHides))
262 UPROPERTY(Config, VisibleAnywhere, BlueprintReadOnly, Category =
"LootLocker|Logging",
Meta = (EditCondition =
"bEnableFileLogging", EditConditionHides),
Meta = (MultiLine = true),
Meta = (DisplayName =
"Actual Log File (on current device)"), Transient)
270 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker|Presence",
Meta = (DisplayName =
"Enable Presence System", EditCondition =
"!bIsFileConfigLocked"))
274 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker|Presence",
Meta = (DisplayName =
"Auto-Connect on Session Start", EditCondition =
"bEnablePresence && !bIsFileConfigLocked", EditConditionHides))
278 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker|Presence",
Meta = (DisplayName =
"Auto-Disconnect on Focus Loss", EditCondition =
"bEnablePresence && !bIsFileConfigLocked", EditConditionHides))
282 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker|Presence",
Meta = (DisplayName =
"Enable In Editor", EditCondition =
"bEnablePresence && !bIsFileConfigLocked", EditConditionHides))
302 UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category =
"LootLocker|Multi User",
Meta = (DisplayName =
"Multi User Session Mode", EditCondition =
"!bIsFileConfigLocked"))
305 FString LogFilePath =
"";
306 UPROPERTY(Config, VisibleInstanceOnly,
Meta = (EditCondition =
"false", EditConditionHides), Transient, Category =
"LootLocker")
307 bool IsValidGameVersion = true;
308 UPROPERTY(Config, VisibleInstanceOnly,
Meta = (EditCondition =
"false", EditConditionHides), Transient, Category =
"LootLocker")
309 bool bIsFileConfigLocked = false;
310#if ENGINE_MAJOR_VERSION >= 5
311 inline static bool bFileConfigChecked =
false;
312 inline static TOptional<FLootLockerFileConfig> FileConfig;
314 static bool bFileConfigChecked;
315 static TOptional<FLootLockerFileConfig> FileConfig;
317 UPROPERTY(Config, VisibleInstanceOnly,
Meta = (EditCondition =
"false", EditConditionHides), Transient, Category =
"LootLocker")
319#ifdef LOOTLOCKER_SHOW_OUTDATED_SDK_MESSAGE
325#if ENGINE_MAJOR_VERSION >= 5
326 inline static const std::regex SemverPattern = std::regex(
"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:\\.(0|[1-9]\\d*))?(?:\\.(0|[1-9]\\d*))?$" );
333 void MigrateSettingsIfNeeded();
335 static void LoadFileConfig();
336 void ApplyFileConfigIfPresent();
Definition LootLockerConfig.h:70
bool bUseLegacyHTTPStack
When true, HTTP requests are routed through the legacy ULootLockerHttpClient stack instead of the new...
Definition LootLockerConfig.h:175
static const FString PreConfigFileName
Filename of the pre-config file that the SDK looks for in the plugin's Config directory.
Definition LootLockerConfig.h:106
FString LootLockerGameKey
API Key used to talk to LootLocker. The API key can be found in Settings > API Keys in the Web Consol...
Definition LootLockerConfig.h:159
FLootLockerConfigurationUpdateDelegate OnConfigurationUpdated
Definition LootLockerConfig.h:84
static ELootLockerLogLevel GetConfiguredLogLevel()
Definition LootLockerConfig.h:193
bool bEnableFileLogging
Definition LootLockerConfig.h:259
static bool IsFileConfigActive()
Returns true when a pre-configured file config is active and governing settings.
FString LongLogFilePath
Definition LootLockerConfig.h:263
static bool IsPresenceEnabledInEditor()
Check if presence is enabled in the editor.
FString OutdatedSDKWarning
Definition LootLockerConfig.h:154
static bool IsFileLoggingEnabled()
Returns true if file logging is enabled and a log file name is set.
bool bEnablePresenceAutoConnect
Whether to automatically connect presence when sessions are established.
Definition LootLockerConfig.h:275
static void DisableFileLogging()
Disables file logging.
static ELootLockerLogLevel GetRuntimeLogLevel()
Gets the current runtime log level (runtime override or config).
bool bEnablePresence
Enable or disable the entire Presence system globally.
Definition LootLockerConfig.h:271
bool bEnablePresenceInEditor
Enable presence features in the editor (for testing purposes).
Definition LootLockerConfig.h:283
static void SetRuntimeLogLevel(ELootLockerLogLevel NewLevel)
Sets the log level at runtime (not persisted).
FString InvalidGameVersionWarning
Definition LootLockerConfig.h:163
bool bEnablePresenceAutoDisconnectOnFocusChange
Whether to automatically disconnect presence when the application loses focus or goes to background.
Definition LootLockerConfig.h:279
FString FileConfigActiveNotice
Definition LootLockerConfig.h:156
static bool IsSemverString(const FString &str)
Definition LootLockerConfig.h:75
bool AllowTokenRefresh
Definition LootLockerConfig.h:165
static FString GetLogFilePath()
Returns the current log file path (may be empty if not enabled).
bool LogOutsideOfEditor
Allow LootLocker to log non error logs outside the editor. This is false by default to avoid log spam...
Definition LootLockerConfig.h:178
virtual void PostInitProperties() override
Definition LootLockerConfig.h:131
FString GameVersion
Definition LootLockerConfig.h:161
ELootLockerMultiUserSessionMode MultiUserSessionMode
Controls how the SDK handles multiple player sessions when a new authentication succeeds.
Definition LootLockerConfig.h:303
static bool ShouldLog()
Definition LootLockerConfig.h:183
FString DomainKey
Domain Key used to talk to LootLocker. The Domain key can be found in Settings > API Keys in the Web ...
Definition LootLockerConfig.h:168
static void EnableFileLogging(const FString &FileName)
Enables file logging to the specified file name.
static bool IsPresenceEnabled()
Check if presence system is enabled globally.
static bool IsPresenceAutoDisconnectOnFocusChangeEnabled()
Check if auto-disconnect on focus change is enabled.
FString LogFileName
Definition LootLockerConfig.h:261
static TOptional< FLootLockerFileConfig > ParseFileConfigContent(const FString &Content)
Parses a pre-config file's raw content (plain JSON or encrypted) into an FLootLockerFileConfig.
static bool IsPresenceAutoConnectEnabled()
Check if auto-connect is enabled for presence.
ELootLockerLogLevel LootLockerLogLevel
Definition LootLockerConfig.h:180
@ Game
Definition LootLockerFeedbackRequestHandler.h:24
@ Meta
Definition LootLockerIdentityRequestHandler.h:47
void(* FLootLockerConfigurationUpdateDelegate)(const FString &)
Delegate type for configuration update events.
Definition LootLockerConfig.h:22
ELootLockerMultiUserSessionMode
Controls how the SDK handles multiple player sessions when a new authentication succeeds.
Definition LootLockerConfig.h:30
@ ProfileSwitching
Only one player is active at a time, but historical player sessions are retained in a cold cache.
Definition LootLockerConfig.h:65
@ SingleSession
Only one player session exists at any given time.
Definition LootLockerConfig.h:55
@ Hotseat
Multiple active sessions are allowed simultaneously.
Definition LootLockerConfig.h:46
@ NotSet
[Not yet configured] The SDK will automatically set the correct mode the first time the project is lo...
Definition LootLockerConfig.h:36