예제 #1
0
    /// <summary>
    /// 显示面板
    /// </summary>
    /// <param name="panelShowData"></param>
    private UIPanelBase ShowPanel(PanelShowData panelShowData)
    {
        UIPanelBase pBase = GetPanel(panelShowData.PID);

        if (null == pBase)
        {
            Engine.Utility.Log.Error("UIPanelManager->ShowPanel pBase null,pid:{0}", panelShowData.PID);
            return(pBase);
        }

        if (IsShowPanel(panelShowData.PID))
        {
            pBase.PrePanelData = panelShowData.PrePanelData;
            pBase.ShowPanel(panelShowData.Data, jumpData: panelShowData.JumpData);
            Engine.Utility.Log.Warning(CLASS_NAME + "-> ShowPanel failed,panelId = {0} already show!", panelShowData.PID.ToString());
            return(pBase);
        }

        //如果存在互斥面板已经显示则直接返回
        LocalPanelInfo panelInfo = null;

        if (TryGetLocalPanelInfo(panelShowData.PID, out panelInfo))
        {
            List <PanelID> mutexPanels = panelInfo.MutexPanels;
            if (null != mutexPanels)
            {
                for (int i = 0; i < mutexPanels.Count; i++)
                {
                    if (IsShowPanel(mutexPanels[i]))
                    {
                        DealShowPanelMutex(panelShowData.PID);
                        return(null);
                    }
                }
            }
        }



        //if (panelShowData.PID == PanelID.MainPanel || panelShowData.PID == PanelID.MissionAndTeamPanel)
        //{
        //    UIRootHelper.Instance.SetPanelRootStatusByType(PanelRootType.Main, true);
        //}

        ReadyPanel(pBase, panelShowData.IgnoreCache);

        if (pBase.PanelInfo.IsStartPanel || panelShowData.ForceResetPanel)
        {
            pBase.ResetPanel();
        }

        DoShowPanel(pBase, panelShowData.PrePanelData, panelShowData.Data, panelShowData.JumpData);
        if (pBase.PanelInfo.IsStartPanel || panelShowData.ForceClearCacheBack)
        {
            ClearCacheStack();
        }
        return(pBase);
    }
예제 #2
0
 /// <summary>
 /// 处理面板显示互斥
 /// </summary>
 /// <param name="pid"></param>
 private void DealShowPanelMutex(PanelID pid)
 {
     if (pid == PanelID.CommonBgPanel || pid == PanelID.TopBarPanel)
     {
         return;
     }
     if (null != m_lstWaitingShow && m_lstWaitingShow.Count > 0)
     {
         PanelShowData pSD = m_lstWaitingShow[0];
         if (pSD.PID == pid)
         {
             m_lstWaitingShow.RemoveAt(0);
         }
         ProccessPanelShowing();
     }
 }
예제 #3
0
    /// <summary>
    /// 是否下一个将要显示的面板ready
    /// </summary>
    /// <param name="pid"></param>
    /// <returns></returns>
    private bool IsNextShowPanelReady(ref PanelID pid)
    {
        nextShowPanelID = PanelID.None;
        bool ready = false;

        if (m_lstWaitingShow.Count > 0)
        {
            PanelShowData nextShowData = m_lstWaitingShow[0];
            nextShowPanelID = nextShowData.PID;
            LocalPanelInfo localInfo = null;
            if (TryGetLocalPanelInfo(pid, out localInfo))
            {
                ready = IsPanelAssetReady(localInfo);
            }
        }

        return(ready);
    }
예제 #4
0
    /// <summary>
    /// 执行面板显示
    /// </summary>
    private void ProccessPanelShowing()
    {
        LocalPanelInfo localPanelInfo = null;

        if (IsNextShowPanelReady(ref nextShowPanelID))
        {
            if (TryGetLocalPanelInfo(nextShowPanelID, out localPanelInfo))
            {
                PanelShowData nextShowData = new PanelShowData();
                if (nextShowPanelID != PanelID.CommonBgPanel &&
                    nextShowPanelID != PanelID.TopBarPanel)
                {
                    if (localPanelInfo.NeedBg)
                    {
                        nextShowData.PID = PanelID.CommonBgPanel;
                        ShowPanel(nextShowData);
                    }

                    if (localPanelInfo.NeedTopBar)
                    {
                        nextShowData.PID  = PanelID.TopBarPanel;
                        nextShowData.Data = localPanelInfo;
                        ShowPanel(nextShowData);
                    }
                }

                if (m_lstWaitingShow.Count > 0)
                {
                    nextShowData = m_lstWaitingShow[0];
                    ShowPanel(nextShowData);
                }
            }
        }
        else if (m_lstWaitingShow.Count > 0)
        {
            PanelShowData psd = m_lstWaitingShow[0];
            if (TryGetLocalPanelInfo(psd.PID, out localPanelInfo) && !IsPanelAssetReady(localPanelInfo))
            {
                ReadyPanelAsset(localPanelInfo);
            }
        }
    }
예제 #5
0
    /// <summary>
    /// 面板显示回调
    /// </summary>
    /// <param name="pid"></param>
    private void OnPanelShow(PanelID pid)
    {
        //Debug.LogError("*********ShowPanel pid=" + pid + ",waitingpanelsize:" + m_lstWaitingShow.Count);
        if (!IsShowPanel(pid))
        {
            AddShowPanel(pid);
        }

        if (pid != PanelID.TopBarPanel &&
            pid != PanelID.CommonBgPanel &&
            m_lstWaitingShow.Count > 0)
        {
            PanelShowData showData = m_lstWaitingShow[0];
            if (showData.PID == pid)
            {
                m_lstWaitingShow.RemoveAt(0);
                if (null != showData.PanelShowAction)
                {
                    showData.PanelShowAction.Invoke(GetPanel(pid));
                }
                ProccessPanelShowing();
            }
        }
    }
예제 #6
0
 /// <summary>
 /// 是否等待显示
 /// </summary>
 /// <param name="pid"></param>
 /// <returns></returns>
 public bool IsWaitingShow(PanelID pid)
 {
     if (null != m_lstWaitingShow)
     {
         int count = m_lstWaitingShow.Count;
         if (count > 0)
         {
             PanelShowData psd = m_lstWaitingShow[count - 1];
             if (psd.PID == pid)
             {
                 return(true);
             }
         }
     }
     //var enumerator = m_lstWaitingShow.GetEnumerator();
     //while(enumerator.MoveNext())
     //{
     //    if (enumerator.Current.PID == pid)
     //    {
     //        return true;
     //    }
     //}
     return(false);
 }
예제 #7
0
    private void ShowPanel(PanelID panelId, UIPanelBase.PanelData prePanelData, bool ignoreCache, object data = null
                           , UIPanelBase.PanelJumpData jumpData = null, bool forceClearCacheBack = false, bool forceResetPanel = false, Action <UIPanelBase> panelShowAction = null)
    {
        if (panelId == PanelID.LoadingPanel)
        {
            m_lstWaitingShow.Clear();
        }

        if (IsShowPanel(panelId))
        {
            //UIPanelBase pBase = GetPanel(panelId);
            //pBase.PrePanelData = prePanelData;
            //pBase.ShowPanel(data, jumpData: jumpData);
            //if (null != panelShowAction)
            //{
            //    panelShowAction.Invoke(pBase);
            //}
            Engine.Utility.Log.Warning(CLASS_NAME + "-> ShowPanel warning,panelId = {0} already show!", panelId.ToString());
            //return ;
        }

        //如果存在互斥面板已经显示则直接返回
        //不做互斥处理
        LocalPanelInfo panelInfo = null;

        if (!TryGetLocalPanelInfo(panelId, out panelInfo))
        {
            return;
        }
        if (!IsWaitingShow(panelId))
        {
            PanelShowData showData = new PanelShowData()
            {
                PID                 = panelId,
                PrePanelData        = prePanelData,
                Data                = data,
                JumpData            = jumpData,
                ForceClearCacheBack = forceClearCacheBack,
                ForceResetPanel     = forceResetPanel,
                IgnoreCache         = ignoreCache,
                PanelShowAction     = panelShowAction,
            };
            m_lstWaitingShow.Add(showData);
        }
        else
        {
            Engine.Utility.Log.Warning(CLASS_NAME + "-> ShowPanel failed,panelId = {0} already in waitingshow Quene !", panelId.ToString());
        }

        //列表容量保护
        if (m_lstWaitingShow.Count >= MAX_WAITING_SHOW_NUM)
        {
            m_lstWaitingShow = new List <PanelShowData>();
            ShowMain();
            return;
        }

        if (!IsPanelAssetReady(panelInfo))
        {
            ReadyPanelAsset(panelInfo);
        }
        else
        {
            ProccessPanelShowing();
        }
    }