Ejemplo n.º 1
0
    /// <summary>
    /// 关闭单个窗口
    /// </summary>
    public void CloseForms(string formsName)
    {
        if (string.IsNullOrEmpty(formsName))
        {
            return;
        }

        UIBaseFormsRoot forms = null;

        if (mFormsDic.TryGetValue(formsName, out forms))
        {
            switch (forms.mFormsLayerType)
            {
            case UIFormsLayer.CommonUILayer:
            {
                if (forms.mFormsType == UIFormsType.Normal)
                {
                    if (forms.mFormsLifeType == UIFormsLifeType.GoldLife)
                    {
                        forms.Hide();
                    }
                    else if (forms.mFormsLifeType == UIFormsLifeType.HumanLife)
                    {
                        DestroyForms(formsName);
                    }

                    PopForms(formsName);
                }
                else if (forms.mFormsType == UIFormsType.Popup)
                {
                    DestroyForms(formsName);
                }
            }
            break;

            default:
                if (forms.mFormsLifeType == UIFormsLifeType.GoldLife)
                {
                    forms.Hide();
                }
                else if (forms.mFormsLifeType == UIFormsLifeType.HumanLife)
                {
                    DestroyForms(formsName);
                }
                break;
            }
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 关闭单个窗口
    /// </summary>
    public void CloseForms(string formsName)
    {
        if (string.IsNullOrEmpty(formsName))
        {
            return;
        }

        UIBaseFormsRoot forms = null;

        if (mFormsDic.TryGetValue(formsName, out forms))
        {
            switch (forms.mFormsLayerType)
            {
            case UIFormsLayer.CommonUILayer:
            {
                if (forms.mFormsType == UIFormsType.Normal)
                {
                    if (forms.mFormsLifeType == UIFormsLifeType.GoldLife)
                    {
                        forms.Hide();
                    }
                    else if (forms.mFormsLifeType == UIFormsLifeType.HumanLife)
                    {
                        DestroyForms(formsName);
                    }

                    PopForms(formsName);

                    // 显示下一层窗口
                    string nextFormsName;
                    mFormsStackIndex.TryGetValue(mCurStackFormsIndex, out nextFormsName);
                    UIBaseFormsRoot nextForms = GetForms(nextFormsName);

                    if (nextForms != null)
                    {
                        if (!nextForms.gameObject.activeSelf)
                        {
                            nextForms.gameObject.SetActive(true);
                        }
                    }
                }
                else if (forms.mFormsType == UIFormsType.Popup)
                {
                    DestroyForms(formsName);
                }
            }
            break;

            default:
                if (forms.mFormsLifeType == UIFormsLifeType.GoldLife)
                {
                    forms.Hide();
                }
                else if (forms.mFormsLifeType == UIFormsLifeType.HumanLife)
                {
                    DestroyForms(formsName);
                }
                break;
            }
        }
    }