Exemplo n.º 1
0
        public Credits(Game game)
            : base(game)
        {
            TextArea = new TextArea(game);
            TextArea.Text = "Desenvolvedores:\n"
                + "    Arthur Figueiredo\n"
                + "    Arthur Werneck\n"
                + "    Clewerton Coelho\n"
                + "    Diogo Honorato\n"
                + "    Humberto Anjos\n"
                + "\n\n"
                + "Professor:\n"
                + "    Cléber Tavares";
            TextArea.Background = Color.Gray;
            TextArea.Alpha = 128;
            Elements.Add(TextArea);

            Back = new Button(Game);
            Back.Text = "Back to MENU";
            Back.Size = new Vector2(ButtonWidth, ButtonHeight);
            Back.OnClick += (sender, args) => GetService<ISceneManagerService<MainGame.Scenes>>().GoTo(MainGame.Scenes.Menu);
            Elements.Add(Back);

            BackgroundImage = Game.Content.Load<Texture2D>("Textures/credits-background");
        }
Exemplo n.º 2
0
        protected override void LoadContent()
        {
            // configurando o fundo
            BackgroundImage = Game.Content.Load<Texture2D>("Textures/menu-background");

            // configurando os botões da tela
            var clientBounds = Game.Window.ClientBounds;

            ToIntro = new Button(Game);
            ToIntro.OnClick += (sender, args) => GetService<ISceneManagerService<MainGame.Scenes>>().GoTo(MainGame.Scenes.Intro);
            ToIntro.Location = new Point((clientBounds.Width - ButtonWidth) / 2, (clientBounds.Height - ButtonHeight) / 2 - 2 * ButtonHeight - 2 * Padding);
            ToIntro.Size = new Vector2(ButtonWidth, ButtonHeight);
            ToIntro.Text = "To INTRO";
            Elements.Add(ToIntro);

            ToFase = new Button(Game);
            ToFase.OnClick += (sender, args) => GetService<ISceneManagerService<MainGame.Scenes>>().GoTo(MainGame.Scenes.Fase);
            ToFase.Location = new Point((clientBounds.Width - ButtonWidth) / 2, (clientBounds.Height - ButtonHeight) / 2 - ButtonHeight - Padding);
            ToFase.Size = new Vector2(ButtonWidth, ButtonHeight);
            ToFase.Text = "To FASE";
            ToFase.Texture = Game.Content.Load<Texture2D>("Widgets/Button");
            ToFase.Background = Color.White;
            Elements.Add(ToFase);

            ToEnd = new Button(Game);
            ToEnd.OnClick += (sender, args) => GetService<ISceneManagerService<MainGame.Scenes>>().GoTo(MainGame.Scenes.End);
            ToEnd.Location = new Point((clientBounds.Width - ButtonWidth) / 2, (clientBounds.Height - ButtonHeight) / 2);
            ToEnd.Size = new Vector2(ButtonWidth, ButtonHeight);
            ToEnd.Text = "To END";
            Elements.Add(ToEnd);

            ToCredits = new Button(Game);
            ToCredits.OnClick += (sender, args) => GetService<ISceneManagerService<MainGame.Scenes>>().GoTo(MainGame.Scenes.Credits);
            ToCredits.Location = new Point((clientBounds.Width - ButtonWidth) / 2, (clientBounds.Height - ButtonHeight) / 2 + ButtonHeight + Padding);
            ToCredits.Size = new Vector2(ButtonWidth, ButtonHeight);
            ToCredits.Text = "To CREDITS";
            Elements.Add(ToCredits);

            ToExit = new Button(Game);
            ToExit.OnClick += (sender, args) => Game.Exit();
            ToExit.Location = new Point((clientBounds.Width - ButtonWidth) / 2, (clientBounds.Height - ButtonHeight) / 2 + 2 * ButtonHeight + 2 * Padding);
            ToExit.Size = new Vector2(ButtonWidth, ButtonHeight);
            ToExit.Text = "EXIT";
            Elements.Add(ToExit);
        }
Exemplo n.º 3
0
 protected AbstractButtonState(Button button)
 {
     Button = button;
 }
Exemplo n.º 4
0
 public Pressed(Button button)
     : base(button)
 {
     Background = Color.YellowGreen;
     Foreground = Color.White;
 }
Exemplo n.º 5
0
 public Normal(Button button)
     : base(button)
 {
     Background = Color.Gray;
     Foreground = Color.White;
 }
Exemplo n.º 6
0
 public Hovered(Button button)
     : base(button)
 {
     Background = Color.BlueViolet;
     Foreground = Color.White;
 }
Exemplo n.º 7
0
        protected override void LoadContent()
        {
            // configurando o fundo
            BackgroundImage = Game.Content.Load<Texture2D>("Textures/grass1920");
            font = Game.Content.Load<SpriteFont>("arial");
            playerName = "";

            // configurando os botões da tela
            var clientBounds = Game.Window.ClientBounds;

            int i, j;
            for (i = 0; i < characters.Length; i++)
            {
                for (j = 0; j < characters[i].Length; j++)
                {
                    Button letterButton = new Button(Game);
                    Char currentLetter = characters[i].ElementAt(j);
                    letterButton.OnClick += (sender, args) =>
                    {
                        if (playerName.Length < MAX_CHAR)
                        {
                            playerName += currentLetter;
                        }
                    };
                    letterButton.Bounds = new Rectangle(0, 0, ButtonWidth, ButtonWidth);
                    letterButton.Location = new Point(startX + 50 * j + Padding, startY + 50 * i + Padding);
                    letterButton.Size = new Vector2(ButtonWidth, ButtonHeight);
                    letterButton.Text = "[" + currentLetter + "]";
                    Elements.Add(letterButton);
                }
            }

            // Tecla de espaço
            Button spaceButton = new Button(Game);
            Char space = ' ';
            spaceButton.OnClick += (sender, args) =>
            {
                if (playerName.Length < MAX_CHAR)
                {
                    playerName += space;
                }
            };
            spaceButton.Bounds = new Rectangle(0, 0, ButtonWidth, ButtonWidth);
            spaceButton.Location = new Point(startX + 50 * 8 + Padding, startY + 50 * 4 + Padding);
            spaceButton.Size = new Vector2(ButtonWidth, ButtonHeight);
            spaceButton.Text = "[" + space + "]";
            Elements.Add(spaceButton);

            // Tecla de Backspace
            Button bckButton = new Button(Game);
            Char back = '<';
            bckButton.OnClick += (sender, args) =>
            {
                if (playerName.Length > 0)
                {
                    playerName = playerName.Remove(playerName.Length - 1);
                }
            };
            bckButton.Bounds = new Rectangle(0, 0, ButtonWidth, ButtonWidth);
            bckButton.Location = new Point(startX + 50 * 9 + Padding, startY + 50 * 4 + Padding);
            bckButton.Size = new Vector2(ButtonWidth, ButtonHeight);
            bckButton.Text = "[" + back + "]";
            Elements.Add(bckButton);

            Button ToFase = new Button(Game);
            ToFase.OnClick += (sender, args) =>
            {
                if (playerName.Length > 0)
                {
                    highScores[newIndex] = new HighscoreLine(playerName, ((MainGame)Game).HighScore);
                    GetService<ISceneManagerService<MainGame.Scenes>>().GoTo(MainGame.Scenes.Fase);
                }
            };
            ToFase.Location = new Point((clientBounds.Width - ButtonWidth) / 2, 500 + (clientBounds.Height - ButtonHeight) / 2 - ButtonHeight - Padding);
            ToFase.Size = new Vector2(ButtonWidth, ButtonHeight);
            ToFase.Text = "Salvar recorde";
            ToFase.Texture = Game.Content.Load<Texture2D>("Widgets/Button");
            ToFase.Background = Color.White;
            Elements.Add(ToFase);
        }