private IEnumerator Change(string _name, bool _animated, params object[] _data) { if (loadingView != null && _animated) { yield return(loadingView.StartAnimation()); } var beforeState = currentState; if (beforeState != null) { beforeState.Release(); Destroy(beforeState.gameObject); } if (states.ContainsKey(_name)) { currentState = Instantiate(states[_name]); } else { Debug.LogFormat("state key is not contain : {0}", _name); currentState = beforeState; } yield return(currentState.Initialize(_data)); if (loadingView != null && _animated) { //loadingView.SetActive(false); yield return(loadingView.FinishAnimation()); } currentState.Begin(); }
public void ShowLoading() { if (_isBusy) { return; } //var currenWindow = UIApplication.SharedApplication.KeyWindow; if (loadingView == null) { loadingView = LoadingView.Create(); loadingView.ConfigureView(View.Frame); View.Add(loadingView); //loadingView.ConfigureView(currenWindow.Frame); //currenWindow.Add(loadingView); } else if (!View.Subviews.Contains <UIView>(loadingView)) { View.Add(loadingView); } else { View.BringSubviewToFront(loadingView); } /*else if (!currenWindow.Subviews.Contains<UIView>(loadingView)) * { * currenWindow.Add(loadingView); * } * else * { * currenWindow.BringSubviewToFront(loadingView); * }*/ loadingView.StartAnimation(); _isBusy = true; }