33 lines
943 B
C#
33 lines
943 B
C#
#nullable enable
|
|
#if UNITY_5_3_OR_NEWER
|
|
using UnityEngine;
|
|
#endif
|
|
|
|
namespace ShrinkContext
|
|
{
|
|
/// <summary>
|
|
/// 默认运行时入口 + Domain Reload 安全重置。
|
|
/// 不自动启动任何组件;上层 composition root 通过 ShrinkContextLoader 提交期望组合。
|
|
/// </summary>
|
|
public static class ShrinkContextDefaults
|
|
{
|
|
private static ShrinkContextRuntime? _default;
|
|
|
|
public static ShrinkContextRuntime Default => _default ??= new ShrinkContextRuntime();
|
|
|
|
#if UNITY_5_3_OR_NEWER
|
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
#endif
|
|
private static void ResetStaticState()
|
|
{
|
|
_default = null;
|
|
}
|
|
|
|
/// <summary>测试用:丢弃默认运行时,下次访问时重建(模拟 Domain Reload)。</summary>
|
|
public static void ResetForTesting()
|
|
{
|
|
_default = null;
|
|
}
|
|
}
|
|
}
|