7
7
using UnityExplorer . Helpers ;
8
8
using UnityExplorer . Input ;
9
9
using UnityExplorer . Inspectors ;
10
+ using UnityExplorer . Runtime ;
10
11
using UnityExplorer . UI ;
11
12
using UnityExplorer . UI . Modules ;
12
13
@@ -21,17 +22,16 @@ public class ExplorerCore
21
22
22
23
public static ExplorerCore Instance { get ; private set ; }
23
24
24
- private static IExplorerLoader s_loader ;
25
- public static IExplorerLoader Loader => s_loader
25
+ public static IExplorerLoader Loader =>
26
26
#if ML
27
- ?? ( s_loader = ExplorerMelonMod . Instance ) ;
27
+ ExplorerMelonMod . Instance ;
28
28
#elif BIE
29
- ?? ( s_loader = ExplorerBepInPlugin . Instance ) ;
29
+ ExplorerBepInPlugin . Instance ;
30
30
#elif STANDALONE
31
- ?? ( s_loader = ExplorerStandalone . Instance ) ;
31
+ ExplorerStandalone . Instance ;
32
32
#endif
33
33
34
- public static string ExplorerFolder => Loader . ExplorerFolder ;
34
+ public static string EXPLORER_FOLDER => Loader . ExplorerFolder ;
35
35
36
36
public ExplorerCore ( )
37
37
{
@@ -43,19 +43,16 @@ public ExplorerCore()
43
43
44
44
Instance = this ;
45
45
46
- #if CPP
47
- ReflectionHelpers . TryLoadGameModules ( ) ;
48
- #endif
46
+ RuntimeProvider . Init ( ) ;
49
47
50
- if ( ! Directory . Exists ( ExplorerFolder ) )
51
- Directory . CreateDirectory ( ExplorerFolder ) ;
48
+ if ( ! Directory . Exists ( EXPLORER_FOLDER ) )
49
+ Directory . CreateDirectory ( EXPLORER_FOLDER ) ;
52
50
53
51
ExplorerConfig . OnLoad ( ) ;
54
52
55
53
InputManager . Init ( ) ;
56
- ForceUnlockCursor . Init ( ) ;
57
54
58
- SetupEvents ( ) ;
55
+ ForceUnlockCursor . Init ( ) ;
59
56
60
57
UIManager . ShowMenu = true ;
61
58
@@ -72,33 +69,7 @@ public static void Update()
72
69
UIManager . Update ( ) ;
73
70
}
74
71
75
- private void SetupEvents ( )
76
- {
77
- #if CPP
78
- try
79
- {
80
- Application . add_logMessageReceived ( new Action < string , string , LogType > ( OnUnityLog ) ) ;
81
-
82
- SceneManager . add_sceneLoaded ( new Action < Scene , LoadSceneMode > ( ( Scene a , LoadSceneMode b ) => { OnSceneLoaded ( ) ; } ) ) ;
83
- SceneManager . add_activeSceneChanged ( new Action < Scene , Scene > ( ( Scene a , Scene b ) => { OnSceneLoaded ( ) ; } ) ) ;
84
- }
85
- catch
86
- {
87
- // exceptions here are non-fatal, just ignore.
88
- }
89
- #else
90
- Application . logMessageReceived += OnUnityLog ;
91
- SceneManager . sceneLoaded += ( Scene a , LoadSceneMode b ) => { OnSceneLoaded ( ) ; } ;
92
- SceneManager . activeSceneChanged += ( Scene a , Scene b ) => { OnSceneLoaded ( ) ; } ;
93
- #endif
94
- }
95
-
96
- internal void OnSceneLoaded ( )
97
- {
98
- UIManager . OnSceneChange ( ) ;
99
- }
100
-
101
- private void OnUnityLog ( string message , string stackTrace , LogType type )
72
+ public void OnUnityLog ( string message , string stackTrace , LogType type )
102
73
{
103
74
if ( ! DebugConsole . LogUnity )
104
75
return ;
0 commit comments