@@ -36,38 +36,48 @@ private void Serialize()
36
36
serializedUser = LootLockerJson . SerializeObject ( user ) ;
37
37
}
38
38
39
- [ InitializeOnLoadMethod ]
40
- private static void FirstLoad ( )
41
- {
42
- EditorPrefs . DeleteAll ( ) ;
43
-
44
- string projectPath = Application . dataPath ;
39
+ [ InitializeOnLoadMethod ]
40
+ private static void FirstLoad ( )
41
+ {
42
+ string projectPath = Application . dataPath ;
43
+ DateTime creationTime = Directory . GetCreationTime ( projectPath ) ;
44
+ string configFileEditorPref = "StoredUserCreated" + creationTime . GetHashCode ( ) . ToString ( ) ;
45
+ EditorPrefs . DeleteKey ( configFileEditorPref ) ;
45
46
46
- DateTime creationTime = Directory . GetCreationTime ( projectPath ) ;
47
- string configFileEditorPref = "StoredUserCreated" + creationTime . GetHashCode ( ) . ToString ( ) ;
47
+ if ( EditorPrefs . GetBool ( configFileEditorPref ) == false )
48
+ {
48
49
49
- if ( EditorPrefs . GetBool ( configFileEditorPref ) == false )
50
+ if ( Directory . Exists ( "Packages/com.lootlocker.lootlockersdk" ) )
50
51
{
51
-
52
- if ( Directory . Exists ( "Packages/com.lootlocker.lootlockersdk" ) )
52
+ if ( Directory . Exists ( "Assets/LootLockerSDK/Runtime/Editor/VisualElements" ) )
53
53
{
54
- if ( Directory . Exists ( "Assets/LootLockerSDK/Runtime/Editor/VisualElements" ) )
55
- {
56
- Directory . Delete ( "Assets/LootLockerSDK/Runtime/Editor/VisualElements" , recursive : true ) ;
57
- }
54
+ Directory . Delete ( "Assets/LootLockerSDK/Runtime/Editor/VisualElements" , recursive : true ) ;
55
+ }
58
56
59
- Directory . CreateDirectory ( "Assets/LootLockerSDK/Runtime/Editor/VisualElements/LootLocker MainWindow" ) ;
57
+ Directory . CreateDirectory ( "Assets/LootLockerSDK/Runtime/Editor/VisualElements/LootLocker MainWindow" ) ;
60
58
61
- FileUtil . CopyFileOrDirectory ( "Packages/com.lootlocker.lootlockersdk/Runtime/Editor/VisualElements/LootLocker MainWindow/LootLockerMainWindow.uss" , "Assets/LootLockerSDK/Runtime/Editor/VisualElements/LootLocker MainWindow/LootLockerMainWindow.uss" ) ;
59
+ FileUtil . CopyFileOrDirectory ( "Packages/com.lootlocker.lootlockersdk/Runtime/Editor/VisualElements/LootLocker MainWindow/LootLockerMainWindow.uss" , "Assets/LootLockerSDK/Runtime/Editor/VisualElements/LootLocker MainWindow/LootLockerMainWindow.uss" ) ;
62
60
63
- EditorApplication . delayCall += AssetDatabase . SaveAssets ;
64
- AssetDatabase . Refresh ( ) ;
61
+ string [ ] UxmlFilesToReplaceReferencesIn = new [ ]
62
+ {
63
+ "Packages/com.lootlocker.lootlockersdk/Runtime/Editor/VisualElements/LootLocker MainWindow/LootLockerMainWindow.uxml" ,
64
+ "Packages/com.lootlocker.lootlockersdk/Runtime/Editor/VisualElements/LootLocker MFA/LootLockerMFA.uxml" ,
65
+ "Packages/com.lootlocker.lootlockersdk/Runtime/Editor/VisualElements/LootLocker Setup/LootLockerWizard.uxml"
66
+ } ;
67
+ foreach ( string UxmlFile in UxmlFilesToReplaceReferencesIn )
68
+ {
69
+ string content = File . ReadAllText ( UxmlFile ) ;
70
+ string fixedContent = content . Replace ( "project://database/Assets/LootLockerSDK" ,
71
+ "project://database/Packages/com.lootlocker.lootlockersdk" ) ;
72
+ File . WriteAllText ( UxmlFile , fixedContent ) ;
65
73
}
66
74
67
- EditorPrefs . SetBool ( configFileEditorPref , true ) ;
75
+ EditorApplication . delayCall += AssetDatabase . SaveAssets ;
76
+ AssetDatabase . Refresh ( ) ;
68
77
}
69
-
70
- }
78
+ EditorPrefs . SetBool ( configFileEditorPref , true ) ;
79
+ }
80
+ }
71
81
72
82
private static StoredUser Get ( )
73
83
{
0 commit comments