コード例 #1
0
 /// <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));
 }
コード例 #2
0
        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 }
                });
            }
        }
コード例 #3
0
 public void ClearData(StageAppType state)
 {
     if (_stateData.ContainsKey(state))
     {
         _stateData.Remove(state);
     }
 }
コード例 #4
0
 public void ChangeState(StageAppType state)
 {
     if (State != state)
     {
         State = state;
     }
 }
コード例 #5
0
        /// <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();
            }));
        }