Skip to content

Commit 0c64a96

Browse files
committed
Fixed issue with config
1 parent 5e44d70 commit 0c64a96

33 files changed

+200
-891
lines changed

Runtime/Client/LootLockerConfig.cs

Lines changed: 10 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,8 @@ namespace LootLocker
1111
public class LootLockerConfig : ScriptableObject
1212
{
1313

14-
#if UNITY_EDITOR
15-
static LootLockerConfig()
16-
{
17-
ProjectSettingsBuildProcessor.OnBuild += OnProjectSettingsBuild;
18-
}
19-
20-
private static void OnProjectSettingsBuild(List<ScriptableObject> list, List<string> names)
21-
{
22-
list.Add(Get());
23-
names.Add("LootLockerConfig");
24-
}
25-
#endif
26-
2714
private static LootLockerConfig settingsInstance;
2815

29-
public string SettingsPath
30-
{
31-
get
32-
{
33-
#if UNITY_EDITOR
34-
return $"{ProjectSettingsConsts.ROOT_FOLDER}/{SettingName}.asset";
35-
#else
36-
return $"{ProjectSettingsConsts.PACKAGE_NAME}/{SettingName}";
37-
#endif
38-
}
39-
}
40-
4116
public virtual string SettingName { get { return "LootLockerConfig"; } }
4217

4318
public static LootLockerConfig Get()
@@ -46,47 +21,27 @@ public static LootLockerConfig Get()
4621
{
4722
return settingsInstance;
4823
}
49-
50-
LootLockerConfig tempInstance = CreateInstance<LootLockerConfig>();
51-
#if UNITY_EDITOR
52-
string path = tempInstance.SettingsPath;
53-
54-
if (!File.Exists(path))
55-
{
56-
settingsInstance = CreateInstance<LootLockerConfig>();
57-
ProjectSettingsHelper.Save(settingsInstance, path);
58-
}
59-
else
60-
{
61-
settingsInstance = ProjectSettingsHelper.Load<LootLockerConfig>(path);
62-
}
63-
64-
settingsInstance.hideFlags = HideFlags.HideAndDontSave;
65-
return settingsInstance;
66-
#else
67-
settingsInstance = Resources.Load<LootLockerConfig>(tempInstance.SettingsPath);
24+
settingsInstance = Resources.Load<LootLockerConfig>("Config/LootLockerConfig");
6825
return settingsInstance;
69-
#endif
7026
}
7127

72-
public static bool CreateNewSettings(string apiKey, string gameVersion, platformType platform, bool onDevelopmentMode)
28+
public static bool CreateNewSettings(string apiKey, string gameVersion, platformType platform, bool onDevelopmentMode, DebugLevel debugLevel = DebugLevel.Off, bool allowTokenRefresh = false)
7329
{
74-
settingsInstance = CreateInstance<LootLockerConfig>();
30+
settingsInstance = Resources.Load<LootLockerConfig>("Config/LootLockerConfig");
31+
32+
if (settingsInstance == null)
33+
settingsInstance = CreateInstance<LootLockerConfig>();
34+
7535
settingsInstance.apiKey = apiKey;
7636
settingsInstance.game_version = gameVersion;
7737
settingsInstance.platform = platform;
7838
settingsInstance.developmentMode = onDevelopmentMode;
39+
settingsInstance.currentDebugLevel = debugLevel;
40+
settingsInstance.allowTokenRefresh = allowTokenRefresh;
7941

8042
return true;
8143
}
8244

83-
#if UNITY_EDITOR
84-
public void EditorSave()
85-
{
86-
ProjectSettingsHelper.Save(settingsInstance, SettingsPath);
87-
}
88-
#endif
89-
9045
private static LootLockerConfig _current;
9146

9247
public static LootLockerConfig current
@@ -111,7 +66,7 @@ public static LootLockerConfig current
11166
[HideInInspector]
11267
public string deviceID = "defaultPlayerId";
11368
public platformType platform;
114-
public enum platformType { Android, iOS, Steam, Windows, GoG, Xbox, PlayStationNetwork, EpicStore, NintendoSwitch, Web ,Other }
69+
public enum platformType { Android, iOS, Steam, Windows, GoG, Xbox, PlayStationNetwork, EpicStore, NintendoSwitch, Web, Other }
11570

11671
public bool developmentMode;
11772
[HideInInspector]

Runtime/Client/LootLockerEndPoints.cs

Lines changed: 93 additions & 111 deletions
Large diffs are not rendered by default.

Runtime/Client/ProjectSettingsBuildProcessor.cs

Lines changed: 0 additions & 106 deletions
This file was deleted.

Runtime/Client/ProjectSettingsBuildProcessor.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Runtime/Client/ProjectSettingsConsts.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

Runtime/Client/ProjectSettingsConsts.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Runtime/Client/ProjectSettingsHelper.cs

Lines changed: 0 additions & 71 deletions
This file was deleted.

Runtime/Client/ProjectSettingsHelper.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)