protected override void LoadContent() { ContentManager Content = GameRef.Content; backgroundImage = Content.Load<Texture2D>(@"Backgrounds/SpaceWizard"); base.LoadContent(); LinkLabel startLabel = new LinkLabel(); startLabel.Position = new Vector2(500, 500); startLabel.Text = "Press ENTER to begin"; startLabel.Color = Color.White; startLabel.TabStop = true; startLabel.HasFocus = true; startLabel.Selected += new EventHandler(startLabel_Selected); LinkLabel quitLabel = new LinkLabel(); quitLabel.Position = new Vector2(0, 25); quitLabel.Text = "Press ESC to quit"; quitLabel.Color = Color.White; quitLabel.TabStop = false; quitLabel.HasFocus = false; quitLabel.Selected += new EventHandler(quitLabel_Selected); ControlManager.Add(startLabel); }
protected override void LoadContent() { base.LoadContent(); ContentManager content = Game.Content; Background = new PictureBox(GameRef.Content.Load<Texture2D>(@"Backgrounds\MenuBackground"), GameRef.ScreenRectangle); ControlManager.Add(Background); gold = new Label(); gold.Text = "Gold: " + player.Money; gold.Position = new Vector2(400, 0); title = new Label(); title.Text = " BulkShop"; item1 = new LinkLabel(); item2 = new LinkLabel(); ControlManager.Add(title); ControlManager.Add(gold); Vector2 pos = new Vector2(10, 120); populateLabels(pos); ControlManager.NextControl(); }
protected override void LoadContent() { base.LoadContent(); ContentManager Content = Game.Content; Background = new PictureBox( Content.Load<Texture2D>(@"Backgrounds\spacewizardstitle"), GameRef.ScreenRectangle); ControlManager.Add(Background); Texture2D arrowTexture = Content.Load<Texture2D>(@"GUI\leftarrowUp"); arrow = new PictureBox( arrowTexture, new Rectangle(0, 0, arrowTexture.Width, arrowTexture.Height)); ControlManager.Add(arrow); start = new LinkLabel(); start.Text = "Start Game"; start.Size = start.SpriteFont.MeasureString(start.Text); start.Selected += new EventHandler(menu_Selected); ControlManager.Add(start); load = new LinkLabel(); load.Text = "Load Game"; load.Size = load.SpriteFont.MeasureString(load.Text); load.Selected += menu_Selected; exit = new LinkLabel(); exit.Text = "Quit Game"; exit.Size = exit.SpriteFont.MeasureString(exit.Text); exit.Selected += menu_Selected; ControlManager.Add(exit); ControlManager.NextControl(); ControlManager.FocusedChanged += new EventHandler(ControlManager_FocusedChanged); Vector2 position = new Vector2(375, 500); foreach (Control c in ControlManager) { if (c is LinkLabel) { if (c.Size.X > maxItemWidth) maxItemWidth = c.Size.X; c.Position = position; position.Y += c.Size.Y + 5f; } } ControlManager_FocusedChanged(start, null); }
private void PlayerTurn() { if (Player.CurrentStatus != null) Player.CurrentStatus.apply(); Attack = new LinkLabel(); Attack.Text = "Attack"; Attack.Size = Attack.SpriteFont.MeasureString(Attack.Text); Attack.Selected += attackLabel_Selected; Special = new LinkLabel(); Special.Text = new AttackMove().GetName(Player); Special.Size = Special.SpriteFont.MeasureString(Special.Text); Special.Selected += new EventHandler(attackLabel_Selected); Items = new LinkLabel(); Items.Text = "Items"; Items.Size = Items.SpriteFont.MeasureString(Items.Text); Items.Selected += new EventHandler(Items_Selected); Run = new LinkLabel(); Run.Text = "Run"; Run.Size = Run.SpriteFont.MeasureString(Run.Text); Run.Selected += new EventHandler(Run_Selected); ControlManager.Add(Attack); ControlManager.Add(Special); ControlManager.Add(Items); ControlManager.Add(Run); ControlManager.NextControl(); ControlManager.FocusedChanged += new EventHandler(ControlManager_FocusedChanged); Vector2 position = new Vector2(600, 750); int i = 0; foreach (Control c in ControlManager) { if (c is LinkLabel) { if (c.Size.X > MaxItemWidth) maxItemWidth = c.Size.X; if (i == 0) { c.Position = position; position.Y += c.Size.Y + 5f; } if (i % 2 != 0) { c.Position = position; position.X += Special.Size.X + 50f; position.Y -= c.Size.Y + 5f; } else { c.Position = position; position.Y += c.Size.Y + 5f; } i++; } } ControlManager_FocusedChanged(Attack, null); }
private void attackLabel_Selected(object sender, EventArgs e) { if (!textBox) { LinkLabel temp = sender as LinkLabel; isSpecialAttack = (temp.Text == "Attack") ? false : true; if (isSpecialAttack) { Special.HasFocus = false; } else { Attack.HasFocus = false; } if (isSpecialAttack && (int.Parse(PlayerMana.Text) <= 0)) { showDialog(OutOfMana); RemoveCombatMenu(); PlayerTurn(); } if (!textBox) { sb = new StringBuilder("You gained the following items:" + "\n"); firstEnemy = new LinkLabel(); firstEnemy.Selected += Enemy_Selected; firstEnemy.Text = EnemyName.Text; firstEnemy.Size = firstEnemy.SpriteFont.MeasureString(firstEnemy.Text); firstEnemy.Position = EnemyName.Position; ControlManager.Add(firstEnemy); if (Enemies.Count > 1) { SecondEnemy = new LinkLabel(); SecondEnemy.Text = SecondEnemyName.Text; SecondEnemy.Position = SecondEnemyName.Position; SecondEnemy.Size = SecondEnemy.SpriteFont.MeasureString(SecondEnemy.Text); SecondEnemy.Selected += Enemy_Selected; ControlManager.Add(SecondEnemy); RemoveCombatMenu(); firstEnemy.HasFocus = true; ControlManager_FocusedChanged(firstEnemy, null); } else { DamageEnemy(Enemies[0]); RemoveCombatMenu(); EnemyTurn(); } } } }
protected override void LoadContent() { base.LoadContent(); ContentManager Content = Game.Content; Background = new PictureBox(Content.Load<Texture2D>(@"Backgrounds\MenuBackground"), GameRef.ScreenRectangle); ControlManager.Add(Background); Texture2D arrow = Content.Load<Texture2D>(@"GUI\leftarrowUp"); ArrowTexture = new PictureBox( arrow, new Rectangle(0, 0, arrow.Width, arrow.Height)); ControlManager.Add(ArrowTexture); Label NameLabel = new Label(); NameLabel.Text = "Name: "; NameLabel.Position = new Vector2(200, 200); NameLabel.Size = NameLabel.SpriteFont.MeasureString(NameLabel.Text); ControlManager.Add(NameLabel); CharacterName = new Label(); CharacterName.Text = Player.name; CharacterName.Position = new Vector2(200 + NameLabel.Size.X, 200); ControlManager.Add(CharacterName); Label HealthLabel = new Label(); HealthLabel.Text = "Health: "; HealthLabel.Size = HealthLabel.SpriteFont.MeasureString(HealthLabel.Text); HealthLabel.Position = new Vector2(200, 250); ControlManager.Add(HealthLabel); PlayerHealth = new Label(); PlayerHealth.Text = Player.CurrentHP.ToString(); PlayerHealth.Size = PlayerHealth.SpriteFont.MeasureString(PlayerHealth.Text); PlayerHealth.Position = new Vector2(200 + HealthLabel.Size.X, 250); ControlManager.Add(PlayerHealth); Label TotalHealth = new Label(); TotalHealth.Text = " / " + Player.HP.ToString(); TotalHealth.Position = new Vector2(PlayerHealth.Position.X + PlayerHealth.Size.X, 250); ControlManager.Add(TotalHealth); Label ManaLabel = new Label(); ManaLabel.Text = "Mana: "; ManaLabel.Position = new Vector2(200, 300); ManaLabel.Size = ManaLabel.SpriteFont.MeasureString(ManaLabel.Text); ControlManager.Add(ManaLabel); Label PlayerMana = new Label(); PlayerMana.Text = Player.CurrentMana.ToString(); PlayerMana.Size = PlayerMana.SpriteFont.MeasureString(PlayerMana.Text); PlayerMana.Position = new Vector2(200 + ManaLabel.Size.X, 300); ControlManager.Add(PlayerMana); Label TotalMana = new Label(); TotalMana.Text = " / " + Player.mana.ToString(); TotalMana.Position = new Vector2(PlayerMana.Position.X + PlayerMana.Size.X, 300); ControlManager.Add(TotalMana); Label AttackLabel = new Label(); AttackLabel.Text = "Attack: "; AttackLabel.Position = new Vector2(200, 350); AttackLabel.Size = AttackLabel.SpriteFont.MeasureString(AttackLabel.Text); ControlManager.Add(AttackLabel); PlayerAttack = new Label(); PlayerAttack.Text = Player.Atk.ToString(); PlayerAttack.Position = new Vector2(200 + AttackLabel.Size.X, 350); ControlManager.Add(PlayerAttack); Label DefenseLabel = new Label(); DefenseLabel.Text = "Defense: "; DefenseLabel.Position = new Vector2(200, 400); DefenseLabel.Size = DefenseLabel.SpriteFont.MeasureString(DefenseLabel.Text); ControlManager.Add(DefenseLabel); PlayerDefense = new Label(); PlayerDefense.Text = Player.Defense.ToString(); PlayerDefense.Position = new Vector2(200 + DefenseLabel.Size.X, 400); ControlManager.Add(PlayerDefense); Label SpecialAtkLabel = new Label(); SpecialAtkLabel.Text = "Special Attack: "; SpecialAtkLabel.Position = new Vector2(200, 450); SpecialAtkLabel.Size = SpecialAtkLabel.SpriteFont.MeasureString(SpecialAtkLabel.Text); ControlManager.Add(SpecialAtkLabel); PlayerSpecialAtk = new Label(); PlayerSpecialAtk.Text = Player.SpecAttack.ToString(); PlayerSpecialAtk.Position = new Vector2(200 + SpecialAtkLabel.Size.X, 450); ControlManager.Add(PlayerSpecialAtk); Label SpecialDefLabel = new Label(); SpecialDefLabel.Text = "Special Defense: "; SpecialDefLabel.Position = new Vector2(200, 500); SpecialDefLabel.Size = SpecialDefLabel.SpriteFont.MeasureString(SpecialDefLabel.Text); ControlManager.Add(SpecialDefLabel); PlayerSpecialDef = new Label(); PlayerSpecialDef.Text = Player.SpecDefense.ToString(); PlayerSpecialDef.Position = new Vector2(200 + SpecialDefLabel.Size.X, 500); ControlManager.Add(PlayerSpecialDef); ContinueGame = new LinkLabel(); ContinueGame.Text = "Continue Game"; ContinueGame.Size = ContinueGame.SpriteFont.MeasureString(ContinueGame.Text); ContinueGame.Selected += new EventHandler(ContinueGame_Selected); ControlManager.Add(ContinueGame); QuitGame = new LinkLabel(); QuitGame.Text = "Quit Game"; QuitGame.Size = QuitGame.SpriteFont.MeasureString(QuitGame.Text); QuitGame.Selected += new EventHandler(QuitGame_Selected); ControlManager.Add(QuitGame); ControlManager.NextControl(); ControlManager.FocusedChanged += new EventHandler(ControlManager_FocusedChanged); Vector2 position = new Vector2(200, 600); foreach (Control c in ControlManager) { if (c is LinkLabel) { if (c.Size.X > MaxItemWidth) maxItemWidth = c.Size.X; c.Position = position; position.Y += c.Size.Y + 5f; } } ControlManager_FocusedChanged(ContinueGame, null); }
protected override void LoadContent() { base.LoadContent(); ContentManager Content = Game.Content; Background = new PictureBox( Content.Load<Texture2D>(@"Backgrounds\GameOverScreen"), GameRef.ScreenRectangle); ControlManager.Add(Background); Texture2D arrow = Content.Load<Texture2D>(@"GUI\leftarrowUp"); ArrowTexture = new PictureBox( arrow, new Rectangle(0, 0, arrow.Width, arrow.Height)); ControlManager.Add(ArrowTexture); StartOver = new LinkLabel(); StartOver.Text = "Start the game Over"; StartOver.Size = StartOver.SpriteFont.MeasureString(StartOver.Text); StartOver.Selected += new EventHandler(StartOver_Selected); ControlManager.Add(StartOver); Quit = new LinkLabel(); Quit.Text = "Quit the game"; Quit.Size = Quit.SpriteFont.MeasureString(Quit.Text); Quit.Selected += new EventHandler(Quit_Selected); ControlManager.Add(Quit); ControlManager.NextControl(); ControlManager.FocusedChanged += new EventHandler(ControlManager_FocusedChanged); Vector2 position = new Vector2(((GameRef.ScreenRectangle.Width / 2) - StartOver.Size.X), GameRef.ScreenRectangle.Height / 2); foreach (Control c in ControlManager) { if (c is LinkLabel) { c.Position = position; position.Y += c.Size.Y + 5f; } } ControlManager_FocusedChanged(StartOver, null); }