コード例 #1
0
    /// <summary>
    /// Set the current active menu for this slot
    /// </summary>
    public void SetMenu(MenuUI Menu, bool StartShown)
    {
        // Same menu, so just update visibility
        if (Menu == mActiveMenu && mActiveMenu != null)
        {
            if (StartShown)
            {
                mActiveMenu.ShowMenu();
            }
            else
            {
                mActiveMenu.HideMenu();
            }
            return;
        }


        // Replace menu
        if (mActiveMenu != null)
        {
            mActiveMenu.DestroyMenu();
        }

        mActiveMenu = Menu;

        if (mActiveMenu == null)
        {
            return;
        }


        // Create and update visibility
        mActiveMenu.CreateMenu(mRectTransform);

        if (StartShown)
        {
            mActiveMenu.ShowMenu();
        }
        else
        {
            mActiveMenu.HideMenu();
        }
    }