コード例 #1
0
        public MainMenuScreen() : base()
        {
            var mainList = new Ui.ComponentList(new Vector2(200, 100), 20, Ui.Orientation.Vertical);
            mainList.AddComponent(new Ui.Label("Main Menu", Vector2.Zero, Ui.FontManager.HeadlineFont, Color.Blue));
            var menuList = new Ui.MenuList(Vector2.Zero, 20, Ui.Orientation.Vertical);
            mainList.AddComponent(menuList);
            components.Add(mainList);

            var newButton = new Ui.Button("New game", Vector2.Zero, Ui.FontManager.MenuFont, new Ui.Button.ButtonColors(Color.Blue, Color.Gray, Color.White));
            newButton.Selected += NewButton_Selected;
            menuList.AddComponent(newButton);
            var continueButton = new Ui.Button("Continue", Vector2.Zero, Ui.FontManager.MenuFont, new Ui.Button.ButtonColors(Color.Blue, Color.Gray, Color.White));
            continueButton.Selected += ContinueButton_Selected;
            menuList.AddComponent(continueButton);
            var settingsButton = new Ui.Button("Settings", Vector2.Zero, Ui.FontManager.MenuFont, new Ui.Button.ButtonColors(Color.Blue, Color.Gray, Color.White));
            settingsButton.Selected += SettingsButton_Selected;
            menuList.AddComponent(settingsButton);
            var creditsButton = new Ui.Button("Credits", Vector2.Zero, Ui.FontManager.MenuFont, new Ui.Button.ButtonColors(Color.Blue, Color.Gray, Color.White));
            creditsButton.Selected += CreditsButton_Selected;
            menuList.AddComponent(creditsButton);
            var quitButton = new Ui.Button("Quit", Vector2.Zero, Ui.FontManager.MenuFont, new Ui.Button.ButtonColors(Color.Blue, Color.Gray, Color.White));
            quitButton.Selected += QuitButton_Selected;
            menuList.AddComponent(quitButton);

            availableSavegames = GameProgress.GetAvailableSavegames();
        }
コード例 #2
0
        public SettingsMenuScreen() : base()
        {
            var mainList = new Ui.ComponentList(new Vector2(200, 100), 20, Ui.Orientation.Vertical);
            mainList.AddComponent(new Ui.Label("Settings", Vector2.Zero, Ui.FontManager.HeadlineFont, Color.Blue));
            var menuList = new Ui.MenuList(Vector2.Zero, 20, Ui.Orientation.Vertical);
            mainList.AddComponent(menuList);
            components.Add(mainList);

            // TODO: Add separators for lists?
            menuList.AddComponent(new Ui.Button("Setting 1", Vector2.Zero, Ui.FontManager.MenuFont, new Ui.Button.ButtonColors(Color.Blue, Color.Gray, Color.White)));
            menuList.AddComponent(new Ui.Button("Setting 2", Vector2.Zero, Ui.FontManager.MenuFont, new Ui.Button.ButtonColors(Color.Blue, Color.Gray, Color.White)));
            menuList.AddComponent(new Ui.Button("Setting 3", Vector2.Zero, Ui.FontManager.MenuFont, new Ui.Button.ButtonColors(Color.Blue, Color.Gray, Color.White)));
            var returnButton = new Ui.Button("Return to main menu", Vector2.Zero, Ui.FontManager.MenuFont, new Ui.Button.ButtonColors(Color.Blue, Color.Gray, Color.White));
            returnButton.Selected += ReturnButton_Selected;
            menuList.AddComponent(returnButton);
        }