Exemplo n.º 1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.DarkBlue);

            // TODO: Add your drawing code here
            if (CurrentGameState == GameState.MainMenu)
            {
                spriteBatch.Begin();
                spriteBatch.Draw(mainMenu, mainMenuRec, Color.White);

                //spriteBatch.Draw(Content.Load<Texture2D>bntWIII)
                btnPlay.Draw(spriteBatch);
                add.Draw(spriteBatch);
                sub.Draw(spriteBatch);

                spriteBatch.DrawString(gametxt, "Jogadores:", new Vector2(1100, 250), Color.White);
                spriteBatch.DrawString(gametxt, Número_Inicial_de_Jogadores.ToString(), new Vector2(1100, 275), Color.White);

                spriteBatch.End();
            }
            if (CurrentGameState == GameState.Setup)
            {
                GraphicsDevice.Clear(Color.White);
                spriteBatch.Begin();
                //Desenhar o mapa
                spriteBatch.Draw(Content.Load <Texture2D>("Mapa"), new Vector2(0, 0));

                //Desenhar os botões dos países
                for (int i = 0; i < tabuleiro.Territorios.Length; i++)
                {
                    tabuleiro.Territorios[i].botão.Draw_Botão_Território(spriteBatch);
                    spriteBatch.DrawString(button_text, tabuleiro.Territorios[i].Infantaria_Presente.ToString(), tabuleiro.Territorios[i].botão.Posição, tabuleiro.Territorios[i].botão.Cor_Texto);
                }
                spriteBatch.DrawString(gametxt, "Posicionar Unidades", new Vector2(600, 0), Color.Black);
                spriteBatch.DrawString(gametxt, "Jogador actual " + (jogador_actual + 1).ToString(), new Vector2(0, 0), Jogadores[jogador_actual].Cor);
                spriteBatch.DrawString(gametxt, "Infantaria Restante " + Jogadores[jogador_actual].Número_de_Infantaria_Guardada.ToString(), new Vector2(0, 15), Jogadores[jogador_actual].Cor);
                spriteBatch.End();
            }
            if (CurrentGameState == GameState.Drafting)
            {
                GraphicsDevice.Clear(Color.White);
                spriteBatch.Begin();
                //Desenhar o mapa
                spriteBatch.Draw(Content.Load <Texture2D>("Mapa"), new Vector2(0, 0));

                //Desenhar os botões dos países
                for (int i = 0; i < tabuleiro.Territorios.Length; i++)
                {
                    tabuleiro.Territorios[i].botão.Draw_Botão_Território(spriteBatch);
                    spriteBatch.DrawString(button_text, tabuleiro.Territorios[i].Infantaria_Presente.ToString(), tabuleiro.Territorios[i].botão.Posição, tabuleiro.Territorios[i].botão.Cor_Texto);
                }

                spriteBatch.DrawString(gametxt, "Posicionar Novas Unidades", new Vector2(600, 0), Color.Black);
                spriteBatch.DrawString(gametxt, "Jogador actual " + (jogador_actual + 1).ToString(), new Vector2(0, 0), Jogadores[jogador_actual].Cor);
                spriteBatch.DrawString(gametxt, "Infantaria Restante " + Jogadores[jogador_actual].Número_de_Infantaria_Guardada.ToString(), new Vector2(0, 15), Jogadores[jogador_actual].Cor);

                spriteBatch.End();
            }
            if (CurrentGameState == GameState.Attacking)
            {
                GraphicsDevice.Clear(Color.White);
                spriteBatch.Begin();
                //Desenhar o mapa
                spriteBatch.Draw(Content.Load <Texture2D>("Mapa"), new Vector2(0, 0));

                //Desenhar os botões dos países
                for (int i = 0; i < tabuleiro.Territorios.Length; i++)
                {
                    tabuleiro.Territorios[i].botão.Draw_Botão_Território(spriteBatch);
                    spriteBatch.DrawString(button_text, tabuleiro.Territorios[i].Infantaria_Presente.ToString(), tabuleiro.Territorios[i].botão.Posição, tabuleiro.Territorios[i].botão.Cor_Texto);
                }

                spriteBatch.DrawString(gametxt, "Atacar", new Vector2(600, 0), Color.Black);
                spriteBatch.DrawString(gametxt, "Jogador actual " + (jogador_actual + 1).ToString(), new Vector2(0, 0), Jogadores[jogador_actual].Cor);

                if (escolheu_atacante == true)
                {
                    spriteBatch.DrawString(gametxt, "Territorio a atacar " + território_atacante.Nome, new Vector2(0, 16), Jogadores[jogador_actual].Cor);
                }
                if (escolheu_defensor == true)
                {
                    spriteBatch.DrawString(gametxt, "Territorio defensor " + território_defensor.Nome, new Vector2(0, 32), Jogadores[território_defensor.Identificação_do_Jogador_que_o_possui].Cor);
                }

                if (atacante_ganhou && !escolheu_numero_de_infantaria_a_deslocar)
                {
                    spriteBatch.DrawString(gametxt, "Quantas unidades serao destacadas", new Vector2(25, 500), Color.Black);
                    spriteBatch.DrawString(gametxt, infantaria_a_ser_deslocada.ToString(), new Vector2(25, 516), Color.Black);
                    add.Posição = new Vector2(25, 540);
                    sub.Posição = new Vector2(25, 590);
                    add.Draw(spriteBatch);
                    sub.Draw(spriteBatch);
                    confirmar.Draw(spriteBatch);
                }

                confirmar.Posição = new Vector2(75, 557);
                proximo.Posição   = new Vector2(1300, 700);
                proximo.Draw(spriteBatch);

                spriteBatch.End();
            }
            if (CurrentGameState == GameState.Reinforcing)
            {
                GraphicsDevice.Clear(Color.White);
                spriteBatch.Begin();
                //Desenhar o mapa
                spriteBatch.Draw(Content.Load <Texture2D>("Mapa"), new Vector2(0, 0));

                //Desenhar os botões dos países
                for (int i = 0; i < tabuleiro.Territorios.Length; i++)
                {
                    tabuleiro.Territorios[i].botão.Draw_Botão_Território(spriteBatch);
                    spriteBatch.DrawString(button_text, tabuleiro.Territorios[i].Infantaria_Presente.ToString(), tabuleiro.Territorios[i].botão.Posição, tabuleiro.Territorios[i].botão.Cor_Texto);
                }
                spriteBatch.DrawString(gametxt, "Reforcar", new Vector2(600, 0), Color.Black);
                spriteBatch.DrawString(gametxt, "Jogador actual " + (jogador_actual + 1).ToString(), new Vector2(0, 0), Jogadores[jogador_actual].Cor);

                if (escolheu_início == true)
                {
                    spriteBatch.DrawString(gametxt, "Territorio de onde partem  " + tInicial.Nome, new Vector2(0, 16), Jogadores[jogador_actual].Cor);
                }
                if (escolheu_destino == true)
                {
                    spriteBatch.DrawString(gametxt, "Territorio para onde vao " + tDestino.Nome, new Vector2(0, 32), Jogadores[jogador_actual].Cor);
                }

                if (escolheu_início && escolheu_destino)
                {
                    spriteBatch.DrawString(gametxt, "Quantas unidades serao movidas", new Vector2(25, 500), Color.Black);
                    spriteBatch.DrawString(gametxt, infantaria_a_mover.ToString(), new Vector2(25, 516), Color.Black);
                    add.Posição = new Vector2(25, 540);
                    sub.Posição = new Vector2(25, 590);
                    add.Draw(spriteBatch);
                    sub.Draw(spriteBatch);
                    confirmar.Draw(spriteBatch);
                }
                spriteBatch.End();
            }
            if (CurrentGameState == GameState.GameOver)
            {
                Get_Vencedor();
                spriteBatch.Begin();
                spriteBatch.DrawString(button_text, "Ganha o Jogador " + vencedor.ToString(), new Vector2(600, 300), Color.White);
                spriteBatch.End();
            }

            base.Draw(gameTime);
        }