示例#1
0
        /// <summary>
        /// 对加载好的预制做处理
        /// </summary>
        /// <param name="asetName"></param>
        /// <param name="go"></param>
        void OnAssetProcess(string asetName, GameObject go)
        {
            mLoading = false;

            mMenuObject = go;
            mMenuObject.transform.SetParent(parentTransform == null ? mDMono.transform.parent : parentTransform);
            mMenuObject.transform.position   = Vector3.zero;
            mMenuObject.transform.localScale = Vector3.one;
            mMenuObject.transform.rotation   = Quaternion.identity;

            mMenu = mMenuObject.GetComponent <UIController>();
            if (mMenu != null)
            {
                mMenu.MCurrentViewName = asetName;
                mMenu.destroyHandler   = new System.Action <UIController>(DestroyMenuHandler);
            }

            if (mShow)
            {
                if (mMenu != null)
                {
                    mMenu.SetMenuData(mParam);
                    mMenu.PlayTween();
                    if (mQueue)
                    {
                        mMenu.Queue();
                    }
                    else
                    {
                        mMenu.Open();
                    }
                }
                else
                {
                    mMenuObject.CustomSetActive(true);
                    mMenuObject.BroadcastMessage("SetMenuData", mParam, SendMessageOptions.DontRequireReceiver);
                }
            }
            else
            {
                if (mMenu != null)
                {
                    UIStack.Close(mMenu);
                }
                else
                {
                    mMenuObject.CustomSetActive(false);
                }
            }

            if (mOnReady != null)
            {
                mOnReady(mMenuObject);
                mOnReady = null;
            }

            GlobalMenuManager.Instance.OpenUIEnd(menuPrefabName);
        }
示例#2
0
    /// <summary>
    /// shortcut for UIStack.Close
    /// </summary>
    public void Close()
    {
        if (this.gameObject != null)
        {
            EB.Debug.LogUI("执行【<color=#00ff00>{0}</color>】预设UIController中<color=#ff0000>Close</color>方法", this.gameObject.name);
        }

        if (UIStack.Instance != null && UIStack.Instance.gameObject.activeSelf)
        {
            UIStack.Close(this);
            //ToDo:暂时屏蔽
            //if (GlobalMenuManager.Instance != null && gameObject != null)
            //{
            //    GlobalMenuManager.Instance.SetUIEnabled(MCurrentViewName, false);
            //}
            if (gameObject != null)
            {
                GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.GlobalMenuManager", "SetUIEnabledFromILR", MCurrentViewName, false);
            }
        }
        IsFirstLoad    = false;
        HasPlayedTween = false;
    }