Exemplo n.º 1
0
    public static void OpenUI(int uiId)
    {
        UINameTable uINameTable = DataReader <UINameTable> .Get(uiId);

        if (uINameTable == null)
        {
            return;
        }
        Transform root           = WidgetSystem.GetRoot(uINameTable.parent);
        bool      hideTheVisible = false;

        if (uINameTable.hideTheVisible == 1)
        {
            hideTheVisible = true;
        }
        UIType type = (UIType)uINameTable.type;

        UIManagerControl.Instance.OpenUI(uINameTable.name, root, hideTheVisible, type);
    }
Exemplo n.º 2
0
    public void OpenUI_Async(string prefabName, Action <UIBase> finish_callback = null, Transform parent = null)
    {
        int iD = UIID.GetID(prefabName);

        if (iD <= 0)
        {
            Debug.LogError("ui id is illegal, prefab name = " + prefabName);
            return;
        }
        WaitUI.OpenUI(0u);
        UINameTable dataNT = DataReader <UINameTable> .Get(iD);

        if (parent == null)
        {
            parent = WidgetSystem.GetRoot(dataNT.parent);
        }
        bool flag = false;

        if (dataNT.hideTheVisible == 1)
        {
            flag = true;
        }
        UIType type = (UIType)dataNT.type;

        if (this.IsOpen(dataNT.name))
        {
            UIBase uIIfExist = this.GetUIIfExist(dataNT.name);
            uIIfExist.get_transform().SetParent(parent);
            uIIfExist.get_transform().set_localPosition(Vector3.get_zero());
            uIIfExist.get_transform().set_localRotation(Quaternion.get_identity());
            uIIfExist.get_transform().set_localScale(Vector3.get_one());
            this.RefreshlistOpenUI(uIIfExist, true);
            WaitUI.CloseUI(0u);
            if (finish_callback != null)
            {
                finish_callback.Invoke(uIIfExist);
            }
            return;
        }
        if (!UIManagerControl.IsSpecialUI(dataNT.name))
        {
            UIStateSystem.LockOfWaitOpenUI(dataNT.name);
        }
        if (flag || type == UIType.FullScreen)
        {
            this.HideAllInNormalUIRoot(dataNT.name);
        }
        AssetManager.AssetOfTPManager.LoadAtlas(PreloadUIBaseSystem.GetPreloads(dataNT.name), delegate
        {
            this.LoadUI(dataNT.name, parent, type, delegate(UIBase ub)
            {
                if (ub == null)
                {
                    if (!UIManagerControl.IsSpecialUI(dataNT.name))
                    {
                        EventDispatcher.Broadcast <string>("UIManagerControl.UIOpenOfSuccess", dataNT.name);
                    }
                    Debug.LogError("加载失败 : " + dataNT.name);
                    WaitUI.CloseUI(0u);
                    if (finish_callback != null)
                    {
                        finish_callback.Invoke(null);
                    }
                    return;
                }
                if (!UIManagerControl.IsSpecialUI(dataNT.name))
                {
                    GuideManager.Instance.CheckQueue(false, false);
                }
                this.RefreshlistOpenUI(ub, true);
                ub.Show(true);
                if (!UIManagerControl.IsSpecialUI(dataNT.name))
                {
                    GuideManager.Instance.CheckQueue(true, false);
                    EventDispatcher.Broadcast("GuideManager.LevelNow");
                }
                WaitUI.CloseUI(0u);
                if (finish_callback != null)
                {
                    finish_callback.Invoke(ub);
                }
            });
        }, 0);
    }