Exemple #1
0
 private void ClearPreExit()
 {
     if (exitingAnimations.Count > 0)
     {
         UITweenAnimation uiTweenAnimation = exitingAnimations[0];
         if (uiTweenAnimation != this)
         {
             if (uiTweenAnimation.exitCallBack != null)
             {
                 uiTweenAnimation.exitCallBack();
             }
             exitingAnimations.RemoveAt(0);
             ClearPreExit();
         }
         else
         {
             exitingAnimations.Remove(this);
         }
     }
 }
Exemple #2
0
    public void Show(bool effect)
    {
        IsHiding = false;
        if (!effect)
        {
            gameObject.SetActive(true);
        }
        else
        {
            UITweenAnimation tweenAnimation = gameObject.GetComponent <UITweenAnimation>();
            gameObject.SetActive(false);
            if (tweenAnimation != null && !IsShowing && isSuportEffect)
            {
                Scheduler.Create(this, (sche, t, s) =>
                {
                    PanelBase panelBase = sche.owner as PanelBase;
                    if (panelBase != null && !panelBase.IsHiding)
                    {
                        if (panelBase.gameObject != null)
                        {
                            panelBase.gameObject.SetActive(true);

                            UITweenAnimation tween = panelBase.gameObject.GetComponent <UITweenAnimation>();
                            if (tween != null)
                            {
                                IsShowing = true;
                                tween.OnShow(true, () =>
                                {
                                    IsShowing = false;
                                });
                            }
                        }
                    }
                }, 0, 0, 0.01f);
            }
            else
            {
                gameObject.SetActive(true);
            }
        }
    }
Exemple #3
0
    public void DestroyPanel(string panelName, GameObject panel = null)
    {
        // 是否删除指定panel,否则自己根据名字查找
        panel = panel == null?GetPanel(panelName) : panel;

        if (panel != null)
        {
            //立即销毁正在tween中的界面
            DestroyImmediateInDestroyingPanels();

            EventMgr.instance.TriggerEvent <string>("panelDestroy", panelName);

            var panelBase = panel.GetComponent <PanelBase>();
            if (panelBase != null)
            {
                if (panelBase.isMarkDestroy)
                {
                    return;
                }

                if (panelBase.isFullScreen)
                {
                    --fullScreenPanelNum;
                    if (fullScreenPanelNum <= 0)
                    {
                        fullScreenPanelNum = 0;
                        SetHudVisible(true, false);
                        SetPanelVisible(true);
                    }
                }

                LogMgr.instance.Log(LogLevel.INFO, LogTag.UIMgr, "DestroyPanel:" + panelBase.name);

                try
                {
                    panelBase.Release();
                }
                catch (System.Exception ex)
                {
                    LogMgr.instance.Log(LogLevel.ERROR, LogTag.UIMgr, "Release Panel ex:" + panelName + " msg:" + ex.Message + " exception:" + ex.StackTrace);
                }

                UITweenAnimation tweenAnimation = panelBase.GetComponent <UITweenAnimation>();
                if (tweenAnimation != null && panelBase.isSuportEffect)
                {
                    panelBase.IsDestroying = true;
                    bool onHide = tweenAnimation.OnHide(() =>
                    {
                        panelBase.IsDestroying = false;
                        DoDestroyPanel(panel, panelName);
                    });

                    if (!onHide)
                    {
                        DoDestroyPanel(panel, panelName);
                    }
                }
                else
                {
                    DoDestroyPanel(panel, panelName);
                }
            }
            else
            {
                DoDestroyPanel(panel, panelName);
            }
        }
        else
        {
            //Debug.LogError("DestroyPanel : return " + panelName);
        }
    }