Beispiel #1
0
        public MainMenu(Engine engine)
            : base(engine)
        {
            this.button1 = new MenuButton(this.Engine);
            this.button2 = new MenuButton(this.Engine);

            this.button1.Position = new Vector2(0, -40);
            this.button2.Position = new Vector2(0, 40);

            this.button1.Text = "new game";
            this.button2.Text = "high scores";

            this.button1.Color = new Color(0.3f, 0.3f, 0.3f);
            this.button2.Color = new Color(0.3f, 0.3f, 0.3f);

            button1.Action = () =>
                                 {
                                     this.Dispose();
                                     new NewGameMenu(this.Engine).Initialize().Attach();
                                 };

            button2.Action = () =>
                                 {
                                     this.Dispose();
                                     new HighScoreMenu(this.Engine).Initialize().Attach();
                                 };

            this.buttons.Add(button1);
            this.buttons.Add(button2);

            this.oldButton = new BehaviorSubject<MenuButton>(null);
            this.currentButton = new BehaviorSubject<MenuButton>(this.button1);
        }
Beispiel #2
0
 private void OnButtonSelected(MenuButton button)
 {
     button.Color = Color.Red;
 }
Beispiel #3
0
 private void OnButtonDeselected(MenuButton button)
 {
     button.Color = Color.Black;
 }