コード例 #1
0
        protected override void AddItems()
        {
            // Load one of the four different types of multiplayer
            MenuItemSpec mp1 = new MenuItemSpec("Type 1", () => { ChooseType1(); }, Color.White);
            MenuItemSpec mp2 = new MenuItemSpec("Type 2", () => { ChooseType2(); }, Color.White);
            MenuItemSpec mp3 = new MenuItemSpec("Type 3", () => { ChooseType3(); }, Color.White);
            MenuItemSpec mp4 = new MenuItemSpec("Type 4", () => { ChooseType4(); }, Color.White);

            MultiplayerSelectMenuItem typeOne = new MultiplayerSelectMenuItem(this, mp1);
            MultiplayerSelectMenuItem typeTwo = new MultiplayerSelectMenuItem(this, mp1);
            MultiplayerSelectMenuItem typeThree = new MultiplayerSelectMenuItem(this, mp1);
            MultiplayerSelectMenuItem typeFour = new MultiplayerSelectMenuItem(this, mp1);

            title = Content.LoadImage("Select");

            Rectangle tsa = game.FacetManager.Game.GraphicsDevice.Viewport.TitleSafeArea;
            int x = tsa.Center.X - typeOne.SelSprite.Width / 2;
            typeOne.Location = new Rectangle(x, tsa.Center.Y - typeOne.SelSprite.Height, typeOne.SelSprite.Width, typeOne.SelSprite.Height);
            x = tsa.Center.X - typeTwo.SelSprite.Width / 2;
            typeTwo.Location = new Rectangle(x, tsa.Center.Y - typeTwo.SelSprite.Height, typeTwo.SelSprite.Width, typeTwo.SelSprite.Height);
            x = tsa.Center.X - typeThree.SelSprite.Width / 2;
            typeThree.Location = new Rectangle(x, tsa.Center.Y - typeThree.SelSprite.Height, typeThree.SelSprite.Width, typeThree.SelSprite.Height);
            x = tsa.Center.X - typeFour.SelSprite.Width / 2;
            typeFour.Location = new Rectangle(x, tsa.Center.Y - typeFour.SelSprite.Height, typeFour.SelSprite.Width, typeFour.SelSprite.Height);

            MenuItemSpec back = new MenuItemSpec("Back", () => Exit(), Color.Magenta);
            AddItem(new MenuItem(this, mp1));
            AddItem(new MenuItem(this, mp2));
            AddItem(new MenuItem(this, mp3));
            AddItem(new MenuItem(this, mp4));
            AddItem(new MenuItem(this, back));
        }
コード例 #2
0
        protected override void AddItems()
        {
            MenuItemSpec resume = new MenuItemSpec("Resume", () => Exit(), Color.White) { hovercolor = Color.Cyan };
            MenuItemSpec exit = new MenuItemSpec("Main Menu", exitToMainMenu, Color.White) { hovercolor = Color.Red };

            AddItem(new MenuItem(this, resume));
            AddItem(new MenuItem(this, exit));
            selectedItem = items[0];
        }
コード例 #3
0
ファイル: MainMenu.cs プロジェクト: Cheezmeister/Chromathud
        protected override void AddItems()
        {
            //TODO clean this up, read from file or something
            MenuItemSpec play = new MenuItemSpec(
                Strings.Play,
                () => StartSinglePlayer(),
                Color.Violet) { normalcolor = Color.White };
            AddItem(new MenuItem(this, play));

            if (Util.UseXboxUI())
            {
                MenuItemSpec network = new MenuItemSpec(
                    Strings.MultiPlay,
                    () => FacetManager.AddFacet(new MultiplayScreen(FacetManager), new FadeTransition(200)),
                    Color.Orange) { normalcolor = Color.White };
                MenuItemSpec splitscreen = new MenuItemSpec(
                    "Splitscreen",
                    () => FacetManager.AddFacet(new GameplayFacet(FacetManager) { SinglePlayer = false }, new FadeTransition(200)),
                    Color.DarkOrange) { normalcolor = Color.White };
            #if XBOX
                //AddItem(multiplay = new MenuItem(this, network) { Enabled = !Guide.IsTrialMode } );
            #endif
                AddItem(new MenuItem(this, splitscreen));
            }

            MenuItemSpec options = new MenuItemSpec(
                Strings.Options,
                () => FacetManager.AddFacet(new OptionsMenu(FacetManager), new FadeTransition(200)),
                Color.Yellow) { normalcolor = Color.White };
            MenuItemSpec how = new MenuItemSpec(
                Strings.HowToPlay,
                () => FacetManager.AddFacet(new Gameplay.Instructions(FacetManager), new FadeTransition(200)),
                Color.Cyan) { normalcolor = Color.White };
            MenuItemSpec quit = new MenuItemSpec(
                Strings.Quit,
                () => InputManager.PostEvent(UserCommand.ExitProgram, PlayerIndex.One),
                Color.Red) { normalcolor = Color.White };
            MenuItemSpec credits = new MenuItemSpec(
                Strings.Credits,
                () => FacetManager.AddFacet(new Credits(FacetManager), new FadeTransition(200)),
                Color.Blue) { normalcolor = Color.White };

            AddItem(new MenuItem(this, options));
            AddItem(new MenuItem(this, how));
            AddItem(new MenuItem(this, credits));
            AddItem(new MenuItem(this, quit));
            selectedItem = items[0];
        }
コード例 #4
0
        protected override void AddItems()
        {
            MenuItemSpec mode = new MenuItemSpec(Strings.TimedMode, () => { ChooseTime(); }, Color.Orange) { normalcolor = Color.White };
            MenuItemSpec mode2 = new MenuItemSpec(Strings.EndlessMode, () => { ChooseLevel(); }, Color.Purple) { normalcolor = Color.White };
            MenuItemSpec tut = new MenuItemSpec(Strings.Tutorial, () => { StartTutorial(); }, Color.Green) { normalcolor = Color.White };

            MenuItem one = new MenuItem(this, mode);
            MenuItem two = new MenuItem(this, mode2);
            MenuItem three = new MenuItem(this, tut);

            title = Content.LoadImage("mnu/Select");

            AddItem(two);
            AddItem(one);
            AddItem(three);
        }
コード例 #5
0
ファイル: MenuItem.cs プロジェクト: Cheezmeister/Chromathud
 public MenuItem(GameMenu gm, MenuItemSpec spec)
     : base(gm)
 {
     this.gm = gm;
     this.fm = gm.FacetManager;
     text = spec.text;
     command = spec.command;
     textcolor = spec.normalcolor;
     hovercolor = spec.hovercolor;
     scale = 1.0f;
     location = Rectangle.Empty;
     selSprite = Menu.Game.Content.LoadImage("mnu/TitleButtonSelected");
     deselSprite = Menu.Game.Content.LoadImage("mnu/TitleButtonDeselected");
     location.Width = selSprite.Width;
     location.Height = selSprite.Height;
     Enabled = true;
 }
コード例 #6
0
        protected override void AddItems()
        {
            Color[] dasList = {
                                Color.Orange,
                                Color.Purple,
                                Color.GreenYellow,
                                Color.Crimson,
                                Color.Salmon
                            };
            int i = 0;
            foreach (string s in Preferences.List(null))
            {

                MenuItemSpec spec = new MenuItemSpec(s, () => { }, dasList[i++ % dasList.Length]) { normalcolor = Color.White };
                OptionMenuItem item = new OptionMenuItem(this, spec);
                AddItem(item);
            }

            MenuItemSpec back = new MenuItemSpec("Back", () => Exit(), Color.Red) { normalcolor = Color.White };
            AddItem(new MenuItem(this, back));
        }
コード例 #7
0
 private void ChooseType1()
 {
     ClearItems();
     game.GameplayMode = ChromathudWin.Gameplay.GameplayMode.Timed;
     Spinner spin = new Spinner(this) { Label = "Minutes", Min = 1, Number = 1, Max = 10 };
     AddItem(spin);
     MenuItemSpec go = new MenuItemSpec(Strings.Play, () => { game.MinuteLimit = spin.Number; startGame(); }, Color.White);
     AddItem(new MenuItem(this, go));
     selectedItem = items.Last();
     selectedItem.Selected = true;
     base.SortItems();
 }
コード例 #8
0
 private void ChooseLevel()
 {
     ClearItems();
     game.GameplayMode = ChromathudWin.Gameplay.GameplayMode.Endless;
     Spinner spin = new Spinner(this) { Label = "Level", Min = 1, Number = 1, Max = 7 };
     AddItem(spin);
     MenuItemSpec go = new MenuItemSpec(Strings.Play, () => { game.Level = spin.Number; startGame(); }, Color.White);
     AddItem(new MenuItem(this, go));
     Select(items.Last());
     base.SortItems();
 }
コード例 #9
0
 public OptionMenuItem(OptionsMenu menu, MenuItemSpec spec)
     : base(menu, spec)
 {
     prefType = Preferences.GetType(text);
 }