/// <summary> /// Load target scene asynchronously through preloader scene /// </summary> public AsyncOperation LoadSceneViaPreloader(StageAppType stageAppType, Action <float> onNext = null, Action callBack = null) { _appStateHandler.SetData(StageAppType.Preloader, stageAppType); _localDataProvider.Save(stageAppType); return(LoadScene(StageAppType.Preloader, onNext, callBack)); }
public void SetData <TData>(StageAppType state, TData data) { if (data == null) { return; } var type = typeof(TData); if (_stateData.ContainsKey(state)) { if (_stateData[state].ContainsKey(type)) { _stateData[state][type] = data; } else { _stateData[state].Add(type, data); } } else { _stateData.Add(state, new Dictionary <Type, object> { { type, data } }); } }
public void ClearData(StageAppType state) { if (_stateData.ContainsKey(state)) { _stateData.Remove(state); } }
public void ChangeState(StageAppType state) { if (State != state) { State = state; } }
/// <summary> /// Load target scene asynchronously /// </summary> public AsyncOperation LoadScene(StageAppType stageAppType, Action <float> onNext = null, Action callBack = null) { IsLoading = true; return(LoadSceneObservable(stageAppType.ToString(), s => { onNext?.Invoke(s); }, () => { _appStateHandler.ChangeState(stageAppType); IsLoading = false; callBack?.Invoke(); })); }