Exemplo n.º 1
0
        internal void RebuildMenu()
        {
            Close();

            if (MainMenu != null)
            {
                CustomKeyHandler keyHandler = MainMenu.GetComponent <CustomKeyHandler>();
                if (keyHandler != null)
                {
                    UnityEngine.Object.Destroy(keyHandler);
                }

                UnityEngine.Object.Destroy(MainMenu);
#if DEBUG
                UnityEngine.Object.Destroy(DebugMenu);
#endif
            }

            UIView uiView = UIView.GetAView();
            MainMenu = (MainMenuPanel)uiView.AddUIComponent(typeof(MainMenuPanel));
            MainMenu.gameObject.AddComponent <CustomKeyHandler>();
#if DEBUG
            DebugMenu = (DebugMenuPanel)uiView.AddUIComponent(typeof(DebugMenuPanel));
#endif
        }
        /// <summary>
        /// Called from Options and Options-Maintenance tab, when features and options changed,
        /// which might require rebuilding the main menu buttons.
        /// </summary>
        internal void RebuildMenu()
        {
            CloseMainMenu();

            if (MainMenu != null)
            {
                CustomKeyHandler keyHandler = MainMenu.GetComponent <CustomKeyHandler>();
                if (keyHandler != null)
                {
                    UnityEngine.Object.Destroy(keyHandler);
                }

                UnityEngine.Object.Destroy(MainMenu);
                UnityEngine.Object.Destroy(MainMenuButton);
                MainMenu       = null;
                MainMenuButton = null;
#if DEBUG
                UnityEngine.Object.Destroy(DebugMenu);
                DebugMenu = null;
#endif
            }

            CreateMainMenuButtonAndWindow();
#if DEBUG
            UIView uiView = UIView.GetAView();
            DebugMenu = (DebugMenuPanel)uiView.AddUIComponent(typeof(DebugMenuPanel));
#endif
        }