@@ -11,33 +11,8 @@ namespace LootLocker
11
11
public class LootLockerConfig : ScriptableObject
12
12
{
13
13
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
-
27
14
private static LootLockerConfig settingsInstance ;
28
15
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
-
41
16
public virtual string SettingName { get { return "LootLockerConfig" ; } }
42
17
43
18
public static LootLockerConfig Get ( )
@@ -46,47 +21,27 @@ public static LootLockerConfig Get()
46
21
{
47
22
return settingsInstance ;
48
23
}
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" ) ;
68
25
return settingsInstance ;
69
- #endif
70
26
}
71
27
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 )
73
29
{
74
- settingsInstance = CreateInstance < LootLockerConfig > ( ) ;
30
+ settingsInstance = Resources . Load < LootLockerConfig > ( "Config/LootLockerConfig" ) ;
31
+
32
+ if ( settingsInstance == null )
33
+ settingsInstance = CreateInstance < LootLockerConfig > ( ) ;
34
+
75
35
settingsInstance . apiKey = apiKey ;
76
36
settingsInstance . game_version = gameVersion ;
77
37
settingsInstance . platform = platform ;
78
38
settingsInstance . developmentMode = onDevelopmentMode ;
39
+ settingsInstance . currentDebugLevel = debugLevel ;
40
+ settingsInstance . allowTokenRefresh = allowTokenRefresh ;
79
41
80
42
return true ;
81
43
}
82
44
83
- #if UNITY_EDITOR
84
- public void EditorSave ( )
85
- {
86
- ProjectSettingsHelper . Save ( settingsInstance , SettingsPath ) ;
87
- }
88
- #endif
89
-
90
45
private static LootLockerConfig _current ;
91
46
92
47
public static LootLockerConfig current
@@ -111,7 +66,7 @@ public static LootLockerConfig current
111
66
[ HideInInspector ]
112
67
public string deviceID = "defaultPlayerId" ;
113
68
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 }
115
70
116
71
public bool developmentMode ;
117
72
[ HideInInspector ]
0 commit comments