feat(cordis): 接入上下文组合与模组事务热替换
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace ShrinkModFramework
|
||||
{
|
||||
public static class ShrinkModRuntimeBootstrap
|
||||
{
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void ResetStaticStateForPlayMode()
|
||||
{
|
||||
ShrinkModLoader.ResetForDomainReload();
|
||||
ShrinkModNetworkManager.ResetForDomainReload();
|
||||
}
|
||||
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
|
||||
private static void AutoLoad()
|
||||
{
|
||||
var settings = ShrinkModFrameworkSettings.Instance;
|
||||
ShrinkModRuntimeDriver.EnsureCreated(settings);
|
||||
|
||||
if (settings && !settings.autoLoadOnStartup)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
ShrinkModLoader.LoadAll(settings);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Debug.LogException(ex);
|
||||
Debug.LogError($"[ShrinkModFramework] 自动启动失败:{ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user