private void btn_salvar_Click(object sender, EventArgs e) { int forca = Convert.ToInt32(nud_forca.Value); int def = Convert.ToInt32(nud_defesa.Value); int agili = Convert.ToInt32(nud_agilidade.Value); int sorte = Convert.ToInt32(nud_sorte.Value); int vida = Convert.ToInt32(nud_vida.Value); int mana = Convert.ToInt32(nud_mana.Value); int ValorPontosTotais = forca + def + agili + sorte + vida + mana; if (ValorPontosTotais > 300) { MessageBox.Show("O valor distribuído passou de 300 pontos"); } else if (ValorPontosTotais < 300) { MessageBox.Show("Falta " + (300 - ValorPontosTotais) + " para os 300 pontos"); } else { Playerativo.ReceberStatus(forca, def, agili, sorte, vida, mana); this.Hide(); TelaJogo form = new TelaJogo(Playerativo); form.Show(); } }
/// <summary> /// É responsável pelo carregamento do conteúdo do jogo, chamada apenas uma vez. /// </summary> protected override void LoadContent() { // Create o SpriteBatch para desenhar as texturas spriteBatch = new SpriteBatch(GraphicsDevice); //carregando os sons Sons.LoadContent(Content); //Definindo as fontes Fontes.Menu = Content.Load <SpriteFont>("Fonts\\bitstreamMenu"); Fontes.MenuSelecionado = Fontes.Menu; Fontes.Score = Content.Load <SpriteFont>("Fonts\\Score_Miramonte"); Fontes.Creditos = Content.Load <SpriteFont>("Fonts\\bitstreamCreditos"); Fontes.TituloCreditos = Fontes.Score; //Tela do logo telaLogo = new TelaLogo(this); telaLogo.Initialize(); Components.Add(telaLogo); //Tela Inicial fundoInicial = Content.Load <Texture2D>("Telas\\tela_inicio"); telaInicial = new TelaInicio(this, fundoInicial); telaInicial.Initialize(); Components.Add(telaInicial); //Tela Controles fundoControles = Content.Load <Texture2D>("Telas\\tela_inicio"); controles = Content.Load <Texture2D>("Telas\\telas_controles"); telaControles = new TelaControles(this, fundoControles, controles); telaControles.Initialize(); Components.Add(telaControles); //Tela Jogo telaJogo = new TelaJogo(this); telaJogo.Initialize(); Components.Add(telaJogo); //Tela Abertura telaAbertura = new TelaAbertura(this); telaAbertura.Initialize(); Components.Add(telaAbertura); //Tela Creditos telaCreditos = new TelaCreditos(this); telaCreditos.Initialize(); Components.Add(telaCreditos); ((TelaInicio)telaInicial).CriarMenu(); //Iniciar a primeira tela telaLogo.Mostrar(); telaAtual = telaLogo; base.LoadContent(); }
public void CarregaComponentes() //percorre todos os componentes, setando as telas caso encontre { foreach (GameComponent gc in Game.Components) { if (gc is TelaInicial) { telaInicial = (TelaInicial)gc; } else if (gc is TelaJogo) { telaJogo = (TelaJogo)gc; } else if (gc is TelaEnredo) { telaEnredo = (TelaEnredo)gc; } else if (gc is TelaPause) { telaPause = (TelaPause)gc; } } }