示例#1
0
 public UIDialogQueueData(Type uiType, UITransitionType transition, object[] args, UICallback callbacks = null)
 {
     UIType         = uiType;
     TransitionType = transition;
     Args           = args;
     Callbacks      = callbacks;
 }
示例#2
0
 public UIDialogQueueData(Type uiType, UITransitionType transition, object[] args, UICallback callbacks = null)
 {
     this.UIType         = uiType;
     this.TransitionType = transition;
     this.Args           = args;
     this.Callbacks      = callbacks;
 }
示例#3
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);
     }
 }
示例#4
0
        public IPanel OpenUI(string uiBehaviourName, UITransitionType transitionType, UILevel canvasLevel,
                             IUIData uiData = null, string assetBundleName = null, bool CanOpenPrevious = true)
        {
            IPanel retPanel = null;

            if (!mAllUI.TryGetValue(uiBehaviourName, out retPanel))
            {
                retPanel = CreateUI(uiBehaviourName, transitionType, canvasLevel, uiData, assetBundleName, CanOpenPrevious);
            }

            retPanel.Open(uiData);
            retPanel.Show();
            return(retPanel);
        }
示例#5
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);
         }
     }
 }
示例#6
0
        /// <summary>
        /// Enqueues the dialog.
        /// </summary>
        /// <param name="content">Content.</param>
        /// <param name="transition">Transition.</param>
        /// <param name="args">Arguments.</param>
        /// <param name="callback">Callback.</param>
        private void EnqueueDialog(Type uiType, UITransitionType transition, object[] args, UICallback callback)
        {
            var data = new UIDialogQueueData(uiType, transition, args, callback);

            this.dialogQueue.Enqueue(data);
        }
示例#7
0
        // internal static void OpenPanel<T>(IUIData uiData,
        //     UITransitionType transitionType, UnityAction action ) where T : UIPanel
        // {
        //     UIManager.Instance.OpenPanel<T>(UILevel.Common, uiData, transitionType,action);
        // }
        //

        internal static void OpenPanel <T>(IUIData uiData = null, UITransitionType transitionType = UITransitionType.NULL,
                                           UIPanel view   = null, string assetBundleName          = null, string prefabName = null, UnityAction action = null) where T : UIPanel
        {
            UIManager.Instance.OpenPanel <T>(UILevel.Common, uiData, transitionType, view, assetBundleName, prefabName, action);
        }
示例#8
0
        public IPanel CreateUI(string uiBehaviourName, UITransitionType transitionType, UILevel level = UILevel.Common, IUIData uiData = null,
                               string assetBundleName = null, bool CanOpenPrevious = true)
        {
            IPanel ui;

            if (mAllUI.TryGetValue(uiBehaviourName, out ui))
            {
                return(ui);
            }

            ui = UIPanel.Load(uiBehaviourName, assetBundleName);

            switch (level)
            {
            case UILevel.Bg:
                ui.Transform.SetParent(mBgTrans);
                break;

            case UILevel.AnimationUnderPage:
                ui.Transform.SetParent(mAnimationUnderTrans);
                break;

            case UILevel.Common:
                ui.Transform.SetParent(mCommonTrans);
                break;

            case UILevel.AnimationOnPage:
                ui.Transform.SetParent(mAnimationOnTrans);
                break;

            case UILevel.PopUI:
                ui.Transform.SetParent(mPopUITrans);
                break;

            case UILevel.Const:
                ui.Transform.SetParent(mConstTrans);
                break;

            case UILevel.Toast:
                ui.Transform.SetParent(mToastTrans);
                break;

            case UILevel.Forward:
                ui.Transform.SetParent(mForwardTrans);
                break;
            }

            var uiGoRectTrans = ui.Transform as RectTransform;

            uiGoRectTrans.offsetMin          = Vector2.zero;
            uiGoRectTrans.offsetMax          = Vector2.zero;
            uiGoRectTrans.anchoredPosition3D = Vector3.zero;
            uiGoRectTrans.anchorMin          = Vector2.zero;
            uiGoRectTrans.anchorMax          = Vector2.one;

            ui.Transform.LocalScaleIdentity();
            ui.Transform.gameObject.name = uiBehaviourName;

            ui.PanelInfo = new UIPanelInfo
            {
                AssetBundleName = assetBundleName, TransitionType = transitionType, Level = level, PanelName = uiBehaviourName, CanOpenPrevious = CanOpenPrevious
            };

            mAllUI.Add(uiBehaviourName, ui);

            ui.Init(uiData);

            return(ui);
        }