5#if WITH_EDITORONLY_DATA
6#include "GeneralProjectSettings.h"
7#include "AndroidRuntimeSettings.h"
13#define Log(pmt, ...) UE_LOG(LogPPlatformCoreSettings, Log, TEXT(pmt), ##__VA_ARGS__)
14#define Warn(pmt, ...) UE_LOG(LogPPlatformCoreSettings, Warning, TEXT(pmt), ##__VA_ARGS__)
15#define Error(pmt, ...) UE_LOG(LogPPlatformCoreSettings, Error, TEXT(pmt), ##__VA_ARGS__)
16#define Fatal(pmt, ...) UE_LOG(LogPPlatformCoreSettings, Fatal, TEXT(pmt), ##__VA_ARGS__)
18UPPlatformCoreSettings::UPPlatformCoreSettings(
const FObjectInitializer& ObjectInitializer)
19 : Super(ObjectInitializer)
21 ConfigURL = TEXT(
"https://module.pixovr.com/");
22 ConfigSection = TEXT(
"");
24 ProtocolVersion = TEXT(
"1.0");
25 PlatformName = TEXT(
"");
30 PlatformURL = TEXT(
"https://module.pixovr.com/");
32 ModuleVersion = TEXT(
"1.00.00");
35 ModuleListURLFormat = TEXT(
"{platform_url}/org/{org_id}/modules");
37 bIsMultiplayerEnabled =
false;
38 bServerVersionMatchModule =
false;
39 ServerMatchVersion = ModuleVersion;
40 MatchmakingURL = TEXT(
"wss://match.apex.pixovr.com/matchmake");
42 bIsVoiceChatEnabled =
false;
43 VoiceServerURL = TEXT(
"https://gateway.odin.4players.io");
44 VoiceAccessKey = TEXT(
"");
45 VoiceTokenAudience = TEXT(
"Default");
50 TArray<FString> ModuleVersionArray;
56 int VersionPartCount = Version.ParseIntoArray(ModuleVersionArray, TEXT(
"."));
58 if (VersionPartCount != 3)
63 if (ModuleVersionArray[0].Len() <= 0 || ModuleVersionArray[0].StartsWith(
"0") || !ModuleVersionArray[0].IsNumeric())
68 if (ModuleVersionArray[1].Len() != 2 || !ModuleVersionArray[1].IsNumeric())
73 if (ModuleVersionArray[2].Len() != 2 || !ModuleVersionArray[2].IsNumeric())
81#if WITH_EDITORONLY_DATA
82void UPPlatformCoreSettings::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
84 if (PropertyChangedEvent.Property !=
nullptr)
86 const FName PropertyName(PropertyChangedEvent.Property->GetFName());
90 TArray<FString> ModuleVersionParts;
95 UpdateVersion(ModuleVersionParts);
126 if (PropertyChangedEvent.ChangeType == EPropertyChangeType::ValueSet)
128 Log(
"Checking for the configuration section %s for changes.", *
ConfigSection);
131 if (!PlatformCoreSubsystem->GetSettingsFromRegion(
ConfigSection))
133 Error(
"\"%s\" is an invalid configuration section.");
139 if (PropertyChangedEvent.ChangeType == EPropertyChangeType::ValueSet)
146 Super::PostEditChangeProperty(PropertyChangedEvent);
149void UPPlatformCoreSettings::UpdateVersion(
const TArray<FString>& VersionParts)
151 int MajorVerison = FCString::Atoi(*VersionParts[0]);
152 int MinorVersion = FCString::Atoi(*VersionParts[1]);
153 int PatchVersion = FCString::Atoi(*VersionParts[2]);
155 FString FullVersion = FString::Printf(TEXT(
"%i.%.2i.%.2i"), MajorVerison, MinorVersion, PatchVersion);
157 if (UGeneralProjectSettings* Settings = GetMutableDefault<UGeneralProjectSettings>())
159 Settings->ProjectVersion = FullVersion;
160 Settings->UpdateSinglePropertyInConfigFile(Settings->GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(UGeneralProjectSettings, ProjectVersion)), Settings->GetDefaultConfigFilename());
163 if (UAndroidRuntimeSettings* Settings = GetMutableDefault<UAndroidRuntimeSettings>())
165 Settings->VersionDisplayName = FullVersion;
166 Settings->UpdateSinglePropertyInConfigFile(Settings->GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(UAndroidRuntimeSettings, VersionDisplayName)), Settings->GetDefaultConfigFilename());
168 FString AndroidVersionNumber = FString::Printf(TEXT(
"%i%.2i%.2i"), MajorVerison, MinorVersion, PatchVersion);
169 Settings->StoreVersion = FCString::Atoi(*AndroidVersionNumber);
170 Settings->UpdateSinglePropertyInConfigFile(Settings->GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(UAndroidRuntimeSettings, StoreVersion)), Settings->GetDefaultConfigFilename());