예제 #1
0
        public void RebuildMainAndTitle()
        {
            Overworld oui = Overworld;

            oui.UIs.Remove(oui.GetUI <OuiTitleScreen>());
            Oui title = new OuiTitleScreen()
            {
                Visible = false
            };

            title.IsStart(oui, Overworld.StartMode.MainMenu);
            oui.Add(title);
            oui.UIs.Add(title);

            MenuButton selected = null;

            foreach (MenuButton button in buttons)
            {
                if (!button.Selected)
                {
                    continue;
                }
                selected = button;
                break;
            }

            CreateButtons();

            if (selected is MainMenuClimb)
            {
                foreach (MenuButton button in buttons)
                {
                    button.SetSelected(button is MainMenuClimb);
                }
            }
            else
            {
                string selectedLabel = (selected as MainMenuSmallButton)?.GetLabelName();
                foreach (MenuButton button in buttons)
                {
                    button.SetSelected((button as MainMenuSmallButton)?.GetLabelName() == selectedLabel);
                }
            }
        }