public void OpenCloudFinish()
 {
     if (mCloudState == CloudState.OPENANDCLOSE)
     {
         Mask.Play("CloseCloudAnimation", 0, 0);
     }
     SimpleEventSystem.Publish(new CloudOpenAnimation());
 }
Пример #2
0
 /// <summary>
 /// Create&ShowUI
 /// </summary>
 public void OpenPanel <T>(UILevel canvasLevel = UILevel.Common,
                           IUIData uiData      = null, UITransitionType transitionType = UITransitionType.NULL,
                           UIPanel view        = null, string assetBundleName          = null,
                           string prefabName   = null, UnityAction action              = null) where T : UIPanel
 {
     if (view.IsNotNull())
     {
         Push(view, transitionType);
     }
     if (transitionType == UITransitionType.CIRCLE)
     {
         if (!mIsChangingView)
         {
             mIsChangingView = true;
             mCircleMask.transform.parent.gameObject.Show();
             var tweenerCore = mCircleMask.transform.DOScale(new Vector3(1, 1, 1), 0.5f);
             DOTweenModuleUI.DOFade(mCircleMask, 1, 0.5f);
             tweenerCore.onComplete = delegate()
             {
                 action?.Invoke();
                 OpenUI(prefabName ?? GetUIBehaviourName <T>(), transitionType,
                        canvasLevel, uiData, assetBundleName, view.IsNotNull());
                 var t = mCircleMask.DOFade(0, 0.5f).SetEase(Ease.OutQuint);
                 t.onComplete = delegate()
                 {
                     mCircleMask.transform.parent.gameObject.Hide();
                     mCircleMask.transform.localScale = Vector3.zero;
                     mCircleMask.color = new Color(255, 255, 255, 0);
                     mIsChangingView   = false;
                 };
             };
         }
     }
     else if (transitionType == UITransitionType.CLOUD)
     {
         if (!mIsChangingView)
         {
             mIsChangingView = true;
             mCloudAnimationController.transform.parent.Show();
             mCloudAnimationController.PlayAnimation(CloudState.OPENANDCLOSE);
             IDisposable disposable = null;
             disposable = SimpleEventSystem.GetEvent <CloudOpenAnimation>().Subscribe(_ =>
             {
                 disposable.Dispose();
                 action?.Invoke();
                 OpenUI(prefabName ?? GetUIBehaviourName <T>(), transitionType,
                        canvasLevel, uiData, assetBundleName, view);
             });
         }
     }
     else
     {
         OpenUI(prefabName ?? GetUIBehaviourName <T>(), transitionType,
                canvasLevel, uiData, assetBundleName, view);
     }
 }
Пример #3
0
 public void Push(IPanel view, UITransitionType transitionType = UITransitionType.NULL)
 {
     if (view != null)
     {
         if (transitionType == UITransitionType.CIRCLE)
         {
             if (!isPushingView)
             {
                 isPushingView = true;
                 IDisposable subscribe = null;
                 subscribe = Observable.Timer(TimeSpan.FromSeconds(0.5f)).Subscribe(_ =>
                 {
                     isPushingView = false;
                     mUIStack.Push(view.PanelInfo);
                     view.Close();
                     mAllUI.Remove(view.Transform.name);
                     subscribe.Dispose();
                 });
             }
         }
         else if (transitionType == UITransitionType.CLOUD)
         {
             if (!isPushingView)
             {
                 isPushingView = true;
                 IDisposable subscribe = null;
                 subscribe = SimpleEventSystem.GetEvent <CloudOpenAnimation>().Subscribe(_ =>
                 {
                     isPushingView = false;
                     mUIStack.Push(view.PanelInfo);
                     view.Close();
                     mAllUI.Remove(view.Transform.name);
                     subscribe.Dispose();
                 });
             }
         }
         else if (transitionType == UITransitionType.NULL)
         {
             mUIStack.Push(view.PanelInfo);
             view.Close();
             mAllUI.Remove(view.Transform.name);
         }
     }
 }
Пример #4
0
        private void RequestDrawMedal()
        {
            Dictionary <string, object> paramDict = new Dictionary <string, object>();

            paramDict.Add("babyId", PlayerPrefsUtil.GetBabyId());
            paramDict.Add("medalGrade", mData.medalModel.medalGrade);

            HttpUtil.PostWithSign <object>(UrlConst.DrawMedal, paramDict)
            .Subscribe(result =>
            {
                UIMgr.OpenPanel <MedalSharePanel>(new MedalSharePanelData()
                {
                    medalModel = mData.medalModel,
                }, UITransitionType.CLOUD);
                Back();
                SimpleEventSystem.Publish(new MedalDrawSuccess());
            }, exception =>
            {
            }).AddTo(this);
        }
Пример #5
0
        public void Back(string currentPanelName)
        {
            IPanel behaviour = null;

            mAllUI.TryGetValue(currentPanelName, out behaviour);
            if ((behaviour as UIPanel))
            {
                if (behaviour.PanelInfo.TransitionType == UITransitionType.CIRCLE)
                {
                    if (!mIsChangingView)
                    {
                        mIsChangingView = true;
                        mCircleMask.transform.parent.gameObject.Show();
                        var tweenerCore = mCircleMask.transform.DOScale(new Vector3(1, 1, 1), 0.5f);
                        mCircleMask.DOFade(1, 0.5f);
                        tweenerCore.onComplete = delegate()
                        {
                            if (behaviour.PanelInfo.CanOpenPrevious)
                            {
                                var previousPanelInfo = mUIStack.Pop();
                                OpenUI(previousPanelInfo.PanelName, previousPanelInfo.TransitionType,
                                       previousPanelInfo.Level, previousPanelInfo.UIData,
                                       previousPanelInfo.AssetBundleName, previousPanelInfo.CanOpenPrevious);
                            }
                            CloseUI(currentPanelName);
                            var t = mCircleMask.DOFade(0, 0.5f).SetEase(Ease.Linear);
                            t.onComplete = delegate()
                            {
                                mCircleMask.transform.localScale = Vector3.zero;
                                mCircleMask.transform.parent.gameObject.Hide();
                                mIsChangingView = false;
                            };
                        };
                    }
                }
                else if (behaviour.PanelInfo.TransitionType == UITransitionType.CLOUD)
                {
                    if (!mIsChangingView)
                    {
                        mIsChangingView = true;
                        mCloudAnimationController.transform.parent.Show();
                        mCloudAnimationController.PlayAnimation(CloudState.OPENANDCLOSE);
                        IDisposable subscribe = null;
                        subscribe = SimpleEventSystem.GetEvent <CloudOpenAnimation>().Subscribe(_ =>
                        {
                            if (behaviour.PanelInfo.CanOpenPrevious)
                            {
                                var previousPanelInfo = mUIStack.Pop();
                                OpenUI(previousPanelInfo.PanelName, previousPanelInfo.TransitionType,
                                       previousPanelInfo.Level, previousPanelInfo.UIData,
                                       previousPanelInfo.AssetBundleName, previousPanelInfo.CanOpenPrevious);
                            }
                            CloseUI(currentPanelName);
                            subscribe.Dispose();
                        });
                    }
                }
                else
                {
                    if (behaviour.PanelInfo.CanOpenPrevious)
                    {
                        var previousPanelInfo = mUIStack.Pop();
                        OpenUI(previousPanelInfo.PanelName, previousPanelInfo.TransitionType,
                               previousPanelInfo.Level, previousPanelInfo.UIData,
                               previousPanelInfo.AssetBundleName, previousPanelInfo.CanOpenPrevious);
                    }
                    CloseUI(currentPanelName);
                }
            }
        }