35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
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}");
|
|
}
|
|
}
|
|
}
|
|
}
|