private IEnumerator loadScene() { yield return(SceneManager.LoadSceneAsync(SceneNames[(int)NextFlow])); _OnChangeFlowEvent?.Invoke(true); switch (_State) { case FlowState.NextAsyncLoading: { FlowHistory.Add(NextFlow); if (FlowHistory.Count >= _FLOW_HISTORY_NUM) { FlowHistory.RemoveAt(0); } } break; case FlowState.BackAsyncLoading: { FlowHistory.RemoveAt(FlowHistory.Count - 1); } break; } _State = FlowState.Idle; CurrentFlow = NextFlow; NextFlow = Flow.None; }
public void Next(Flow nextFlow) { if (_State != FlowState.Idle) { return; } if (((int)nextFlow < 0) || ((int)nextFlow >= SceneNames.Length)) { return; } SceneManager.LoadScene(SceneNames[(int)nextFlow], LoadSceneMode.Single); FlowHistory.Add(nextFlow); if (FlowHistory.Count >= _FLOW_HISTORY_NUM) { FlowHistory.RemoveAt(0); } }
public void Back() { if (_State != FlowState.Idle) { return; } if (FlowHistory.Count < 1) { return; } int index = FlowHistory.Count - 1; var next = FlowHistory[index]; if (((int)next < 0) || ((int)next >= SceneNames.Length)) { return; } SceneManager.LoadScene(SceneNames[(int)next]); FlowHistory.RemoveAt(index); }