Example #1
0
        public void ClosePanel(AbstractPanel panel)
        {
            if (panel == null)
            {
                return;
            }

            PanelInfo panelInfo = FindPanelInfoByPanelID(panel.panelID);

            //该面板的管理失效,直接移除
            if (panelInfo == null)
            {
                panelInfo = GetPanelFromCache(panel.uiID, false);

                if (panelInfo == null)
                {
                    Log.e("Not Find PanelInfo For Panel.");
                    panel.OnPanelClose(true);
                    GameObject.Destroy(panel.gameObject);
                }
                return;
            }

            ClosePanelInfo(panelInfo);
            //ReSortPanel();
            SetPanelSortingOrderDirty();
        }
Example #2
0
        private void OnNextPanelOpen(AbstractPanel panel)
        {
            if (m_NextPanelResLoader != null)
            {
                m_NextPanelResLoader.Recycle2Cache();
                m_NextPanelResLoader = null;
            }

            /*
             * if (panel == null)
             * {
             *  CloseSelfPanel();
             *  return;
             * }
             */
            m_NextPanel = panel;

            if (m_Action.transitionSameTime)
            {
                m_Action.TransitionIn(m_OpenParam.prePanel);
                m_Action.TransitionOut(panel);
            }
            else
            {
                m_Action.TransitionOut(panel);
            }
        }
Example #3
0
        public override void TransitionIn(AbstractPanel panel)
        {
            var color = m_FadeImage.color;

            color.a           = 0;
            m_FadeImage.color = color;
            m_FadeImage.DOFade(1, m_FadeInDuration).SetEase(Ease.Linear)
            .OnComplete(OnFadeInFinish);
        }
Example #4
0
 public override void TransitionOut(AbstractPanel panel)
 {
     if (m_FadeOutDelayTime > 0)
     {
         DOTween.Sequence().AppendInterval(m_FadeOutDelayTime)
         .Append(m_FadeImage.DOFade(0, m_FadeOutDuration).SetEase(Ease.Linear))
         .OnComplete(OnFadeOutFinish);
     }
     else
     {
         m_FadeImage.DOFade(0, m_FadeOutDuration).SetEase(Ease.Linear)
         .OnComplete(OnFadeOutFinish);
     }
 }
Example #5
0
            private void OnPanelResLoadSuccess(GameObject prefab)
            {
                if (m_NextMaster < 0)
                {
                    Log.i("PanelInfo Already Close,But Still Call OnPanelResLoadSuccess");
                    m_PanelState = ePanelState.UnInit;
                    return;
                }

                if (prefab == null)
                {
                    UIData data = UIDataTable.Get(m_UIID);
                    Log.e(string.Format("Failed to Load UI Prefab:{0} Path:{1}", m_UIID, data.fullPath));
                    return;
                }

                m_PanelState = ePanelState.Ready;

                GameObject go = UIMgr.S.InstantiateUIPrefab(prefab);

                go.SetActive(false);
                UIMgr.S.InitPanelParem(go);

                AbstractPanel panel = go.GetComponent <AbstractPanel>();

                if (panel == null)
                {
                    //该类型面板不纳入管理
                    go.gameObject.SetActive(true);
                    Log.e("Not Find Panel Class In Prefab For Panel:" + m_UIID);
                    //需要删除PanelInfo From Activity.
                    return;
                }

                panel.customVisibleFlag = m_CustomVisibleFlag;

                UIData panelData = UIDataTable.Get(m_UIID);

                if (panelData.panelClassType != null)
                {
                    if (panel.GetType() != panelData.panelClassType)
                    {
                        Log.e("ERROR: Prefab Bind C# Class Is Not Same With Define:" + panelData.name);
                    }
                }

                abstractPanel = panel;

                UIMgr.S.SetPanelSortingOrderDirty();
            }
Example #6
0
        protected override void Awake()
        {
            base.Awake();

            if (m_Panel == null)
            {
                m_Panel = gameObject.GetComponent <AbstractPanel>();
            }

            if (m_Panel != null)
            {
                UIMgr.S.uiEventSystem.Register(m_Panel.GetParentPanelID(), OnParentPanelEvent);
            }
        }
Example #7
0
        public void SetPanelVisible(AbstractPanel panel, bool visible)
        {
            if (panel == null)
            {
                return;
            }

            PanelInfo panelInfo = FindPanelInfoByPanelID(panel.panelID);

            if (panelInfo == null)
            {
                return;
            }

            panelInfo.customVisibleFlag = visible;
        }
Example #8
0
            public void ClosePanel(bool destroy)
            {
                if (m_Panel == null)
                {
                    return;
                }

                m_Panel.OnPanelClose(destroy);
                if (destroy)
                {
                    GameObject.Destroy(m_Panel.gameObject);
                    m_Panel = null;
                }
                else
                {
                    SetActive(false, false);
                }
            }
Example #9
0
        protected override void OnClose()
        {
            if (m_Action != null)
            {
                m_Action.OnTransitionDestroy();
            }

            m_OpenParam = null;

            m_Action = null;

            m_NextPanel = null;

            if (m_NextPanelResLoader != null)
            {
                m_NextPanelResLoader.Recycle2Cache();
                m_NextPanelResLoader = null;
            }
        }
Example #10
0
        //编辑器面板强行删除面板
        public void OnPanelForceDestroy(AbstractPanel panel)
        {
            if (panel == null)
            {
                return;
            }

            PanelInfo panelInfo = FindPanelInfoByPanelID(panel.panelID);

            if (panelInfo == null)
            {
                return;
            }

            RemovePanelInfo(panelInfo);
            CheckNeedClosePanel(panelInfo.panelID);
            ObjectPool <PanelInfo> .S.Recycle(panelInfo);

            //ReSortPanel();
            SetPanelSortingOrderDirty();
        }
Example #11
0
        public static RectTransform FindTransformInPanel(string targetPanelName, string targetUINodePath)
        {
            UIData data = UIDataTable.Get(targetPanelName);

            if (data == null)
            {
                return(null);
            }
            //string panelName = string.Format("{0}(Clone)", targetPanelName);
            AbstractPanel panel = UIMgr.S.FindPanel(data.uiID);            //UIMgr.S.uiRoot.panelRoot.Find(targetPanelName);

            if (panel == null)
            {
                return(null);
            }

            Transform targetPanel = panel.transform;

            if (targetPanel == null)
            {
                //Log.w("# FindTransformInPanel Not Find Panel:" + panelName);
                return(null);
            }

            if (string.IsNullOrEmpty(targetUINodePath))
            {
                return(targetPanel as RectTransform);
            }

            RectTransform result = targetPanel.Find(targetUINodePath) as RectTransform;

            if (result == null || !result.gameObject.activeSelf)
            {
                //Log.w(string.Format("# FindTransformInPanel Not Find Node:{0}/{1}", panelName, targetUINodePath));
                return(null);
            }

            return(result);
        }
Example #12
0
        public void Open <T>(T uiID, AbstractPanel masterPanel, params object[] args) where T : IConvertible
        {
            if (m_Stack == null)
            {
                m_Stack = new List <OpenAction>();
            }

            int id = uiID.ToInt32(null);

            OpenAction action = new OpenAction(id, masterPanel);

            action.SetParam(args);

            for (int i = 0; i < m_Stack.Count; ++i)
            {
                m_Stack[i].Hide();
            }

            m_Stack.Add(action);

            action.Show();
        }
Example #13
0
            public void OnCacheReset()
            {
                m_Panel             = null;
                m_NextMaster        = -1;
                m_PanelID           = -1;
                m_UIID              = -1;
                m_SortIndex         = -1;
                m_PanelState        = ePanelState.UnInit;
                m_OpenListeners     = null;
                m_CustomVisibleFlag = true;

                m_ResLoader.Recycle2Cache();
                m_ResLoader = null;

                if (m_PageWrapList != null)
                {
                    m_PageWrapList.Clear();
                }

                if (m_OpenInfoList != null)
                {
                    m_OpenInfoList.Clear();
                }
            }
Example #14
0
        public void CloseParentPanel(AbstractPanel panel, bool allParent = true)
        {
            if (panel == null)
            {
                return;
            }

            PanelInfo panelInfo = FindPanelInfoByPanelID(panel.panelID);

            if (panelInfo == null)
            {
                return;
            }

            do
            {
                if (panelInfo.currentMaster != panelInfo.panelID)
                {
                    var nextInfo = FindPanelInfoByPanelID(panelInfo.currentMaster);
                    if (nextInfo != null)
                    {
                        panelInfo = nextInfo;
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }while (allParent);

            ClosePanel(panelInfo.abstractPanel);
        }
Example #15
0
 public OpenParam SetPrePanel(AbstractPanel panel)
 {
     m_PrePanel = panel;
     return(this);
 }
Example #16
0
 public virtual void TransitionOut(AbstractPanel panel)
 {
     transitionHandler.OnTransitionOutFinish();
 }
Example #17
0
 private void OnPanelOpen(AbstractPanel panel)
 {
     m_Panel = panel;
 }
Example #18
0
 public OpenAction(int uiID, AbstractPanel masterPanel)
 {
     m_UIID        = uiID;
     m_MasterPanel = masterPanel;
 }
Example #19
0
 public void TransitionOut(AbstractPanel panel)
 {
     m_Effect.FadeOut(OnFadeOutFinish);
 }
Example #20
0
 public void TransitionIn(AbstractPanel panel)
 {
     m_Effect.FadeIn(OnFadeInFinish);
 }