1
1
using System ;
2
2
using System . IO ;
3
+ using System . Reflection ;
3
4
using UnityEngine ;
4
5
using UnityEngine . SceneManagement ;
5
6
using UnityExplorer . Config ;
@@ -16,14 +17,30 @@ namespace UnityExplorer
16
17
public class ExplorerCore
17
18
{
18
19
public const string NAME = "UnityExplorer" ;
19
- public const string VERSION = "3.1.6 " ;
20
+ public const string VERSION = "3.1.7 " ;
20
21
public const string AUTHOR = "Sinai" ;
21
22
public const string GUID = "com.sinai.unityexplorer" ;
22
23
23
24
#if ML
24
25
public const string EXPLORER_FOLDER = @"Mods\UnityExplorer" ;
25
26
#elif BIE
26
27
public static string EXPLORER_FOLDER = Path . Combine ( BepInEx . Paths . ConfigPath , "UnityExplorer" ) ;
28
+ #elif STANDALONE
29
+ public static string EXPLORER_FOLDER
30
+ {
31
+ get
32
+ {
33
+ if ( s_explorerFolder == null )
34
+ {
35
+ s_explorerFolder = ( new Uri ( Assembly . GetExecutingAssembly ( ) . CodeBase ) ) . AbsolutePath ;
36
+ s_explorerFolder = Uri . UnescapeDataString ( s_explorerFolder ) ;
37
+ s_explorerFolder = Path . GetDirectoryName ( s_explorerFolder ) ;
38
+ }
39
+
40
+ return s_explorerFolder ;
41
+ }
42
+ }
43
+ private static string s_explorerFolder ;
27
44
#endif
28
45
29
46
public static ExplorerCore Instance { get ; private set ; }
@@ -166,6 +183,12 @@ private void OnUnityLog(string message, string stackTrace, LogType type)
166
183
}
167
184
}
168
185
186
+ #if STANDALONE
187
+ public static Action < string > OnLogMessage ;
188
+ public static Action < string > OnLogWarning ;
189
+ public static Action < string > OnLogError ;
190
+ #endif
191
+
169
192
public static void Log ( object message , bool unity = false )
170
193
{
171
194
DebugConsole . Log ( message ? . ToString ( ) ) ;
@@ -175,8 +198,10 @@ public static void Log(object message, bool unity = false)
175
198
176
199
#if ML
177
200
MelonLoader . MelonLogger . Log ( message ? . ToString ( ) ) ;
178
- #else
201
+ #elif BIE
179
202
ExplorerBepInPlugin . Logging ? . LogMessage ( message ? . ToString ( ) ) ;
203
+ #elif STANDALONE
204
+ OnLogMessage ? . Invoke ( message ? . ToString ( ) ) ;
180
205
#endif
181
206
}
182
207
@@ -189,8 +214,10 @@ public static void LogWarning(object message, bool unity = false)
189
214
190
215
#if ML
191
216
MelonLoader . MelonLogger . LogWarning ( message ? . ToString ( ) ) ;
192
- #else
193
- ExplorerBepInPlugin . Logging ? . LogWarning ( message ? . ToString ( ) ) ;
217
+ #elif BIE
218
+ ExplorerBepInPlugin . Logging ? . LogWarning ( message ? . ToString ( ) ) ;
219
+ #elif STANDALONE
220
+ OnLogWarning ? . Invoke ( message ? . ToString ( ) ) ;
194
221
#endif
195
222
}
196
223
@@ -203,8 +230,10 @@ public static void LogError(object message, bool unity = false)
203
230
204
231
#if ML
205
232
MelonLoader . MelonLogger . LogError ( message ? . ToString ( ) ) ;
206
- #else
207
- ExplorerBepInPlugin . Logging ? . LogError ( message ? . ToString ( ) ) ;
233
+ #elif BIE
234
+ ExplorerBepInPlugin . Logging ? . LogError ( message ? . ToString ( ) ) ;
235
+ #elif STANDALONE
236
+ OnLogError ? . Invoke ( message ? . ToString ( ) ) ;
208
237
#endif
209
238
}
210
239
0 commit comments