fix(fix-system): 修复维修中心销毁时的依赖清理异常
FixSystemCenter.OnSingletonDestroy 在场景销毁阶段访问的 CameraKit、 BubbleSlotKit 可能已清理,且 Director.QuitCurrentMode 协程依赖的 对象可能已拆除。改为判空访问,并新增 Director.Reset 直接清理状态。
This commit is contained in:
@@ -47,6 +47,19 @@ namespace AibisDream.FixSystem
|
||||
IsTransitioning = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears director state without running cue exits. Used while the owning scene is
|
||||
/// being destroyed, when cue dependencies may already have been torn down.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
CurrentArgs = "";
|
||||
_currentCue = null;
|
||||
CurrentMode = FixSceneMode.Default;
|
||||
HasMode = false;
|
||||
IsTransitioning = false;
|
||||
}
|
||||
|
||||
private IEnumerator TransitionInternal(FixSceneMode nextMode, string args, FixTransitionMode mode)
|
||||
{
|
||||
if (IsTransitioning && mode == FixTransitionMode.Animated)
|
||||
|
||||
@@ -50,9 +50,9 @@ namespace AibisDream.FixSystem
|
||||
public override void OnSingletonDestroy()
|
||||
{
|
||||
IsDirectorReady = false;
|
||||
CameraKit.Instance.RemoveAllCam();
|
||||
BubbleSlotKit.Instance.RemoveAll();
|
||||
GameManager.Instance.StartCoroutine(Director.QuitCurrentMode());
|
||||
CameraKit.Instance?.RemoveAllCam();
|
||||
BubbleSlotKit.Instance?.RemoveAll();
|
||||
Director?.Reset();
|
||||
Context?.Clear();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user