From 638e82899b4cb7d8784649ab5eed24e13b735a0a Mon Sep 17 00:00:00 2001 From: trandit <trandit@mcmaster.ca> Date: Mon, 14 Nov 2016 18:59:46 -0500 Subject: [PATCH] Added inventory buttons --- src/Blaze-Brigade/Blaze_Brigade/Archer.cs | 72 ++-- .../Blaze_Brigade/Blaze_Brigade.csproj | 1 + .../Blaze_Brigade.csproj.Debug.cachefile | 19 +- src/Blaze-Brigade/Blaze_Brigade/Button.cs | 40 +- src/Blaze-Brigade/Blaze_Brigade/Game.cs | 343 +++++++++--------- src/Blaze-Brigade/Blaze_Brigade/GameState.cs | 4 + src/Blaze-Brigade/Blaze_Brigade/Mage.cs | 72 ++-- .../Blaze_Brigade/Resource1.Designer.cs | 10 + .../Blaze_Brigade/Resource1.resx | 3 + .../Resources/Inventory_Button.jpg | Bin 0 -> 2002 bytes src/Blaze-Brigade/Blaze_Brigade/Warrior.cs | 67 +++- .../Blaze_BrigadeContent.contentproj | 7 + .../Blaze_BrigadeContent/Inventory_Button.jpg | Bin 0 -> 2002 bytes .../buttons/Inventory_Button.jpg | Bin 0 -> 2002 bytes 14 files changed, 391 insertions(+), 247 deletions(-) create mode 100644 src/Blaze-Brigade/Blaze_Brigade/Resources/Inventory_Button.jpg create mode 100644 src/Blaze-Brigade/Blaze_BrigadeContent/Inventory_Button.jpg create mode 100644 src/Blaze-Brigade/Blaze_BrigadeContent/buttons/Inventory_Button.jpg diff --git a/src/Blaze-Brigade/Blaze_Brigade/Archer.cs b/src/Blaze-Brigade/Blaze_Brigade/Archer.cs index 34620c2..58e2e1e 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Archer.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Archer.cs @@ -51,7 +51,7 @@ namespace Model private Texture2D spriteImage; // the char sprite private Vector2 pixelCoordinates; // the pixel coordinate of the unit private Tuple<int, int> position; // the tile location of the unit - private Button[] buttons = new Button[5]; // the buttons associated with the unit + private Button[] buttons = new Button[9]; // the buttons associated with the unit private Texture2D charInfo, charAttackInfo; // The character and attack info textures private int currentFrame; // the current frame the sprite is on @@ -68,16 +68,19 @@ namespace Model * @param coordinates The unit's current coordinate on screen * @param player The player of which the unit belongs to */ - public Archer(Texture2D spriteImage, Button attackButton, Button moveButton, - Button itemButton, Button waitButton, Button confirmButton, Texture2D charInfo, + public Archer(Texture2D spriteImage, Button[] unitButtons, Texture2D charInfo, Texture2D charAttackInfo, Vector2 coordinates) { this.spriteImage = spriteImage; - buttons[0] = attackButton; - buttons[1] = moveButton; - buttons[2] = itemButton; - buttons[3] = waitButton; - buttons[4] = confirmButton; + buttons[0] = unitButtons[0]; + buttons[1] = unitButtons[1]; + buttons[2] = unitButtons[2]; + buttons[3] = unitButtons[3]; + buttons[4] = unitButtons[4]; + buttons[5] = unitButtons[5]; + buttons[6] = unitButtons[6]; + buttons[7] = unitButtons[7]; + buttons[8] = unitButtons[8]; this.charInfo = charInfo; this.charAttackInfo = charAttackInfo; pixelCoordinates = coordinates; @@ -232,8 +235,16 @@ namespace Model return buttons[2].getImage(); case ButtonType.Wait: // if wait is clicked return buttons[3].getImage(); - case ButtonType.AttackConfirm: + case ButtonType.AttackConfirm: // if attack confirm is clicked return buttons[4].getImage(); + case ButtonType.Inventory1: // if item1 clicked + return buttons[5].getImage(); + case ButtonType.Inventory2: // if item2 is clicked + return buttons[6].getImage(); + case ButtonType.Inventory3: // if item3 is clicked + return buttons[7].getImage(); + case ButtonType.Inventory4: // if item4 is clicked + return buttons[8].getImage(); default: return null; } @@ -256,6 +267,14 @@ namespace Model return buttons[3].Active; case ButtonType.AttackConfirm: return buttons[4].Active; + case ButtonType.Inventory1: + return buttons[5].Active; + case ButtonType.Inventory2: + return buttons[6].Active; + case ButtonType.Inventory3: + return buttons[7].Active; + case ButtonType.Inventory4: + return buttons[8].Active; default: return false; @@ -339,6 +358,14 @@ namespace Model return buttons[3]; case ButtonType.AttackConfirm: return buttons[4]; + case ButtonType.Inventory1: + return buttons[5]; + case ButtonType.Inventory2: + return buttons[6]; + case ButtonType.Inventory3: + return buttons[7]; + case ButtonType.Inventory4: + return buttons[8]; default: return null; @@ -351,21 +378,20 @@ namespace Model */ public void setButtonCoordinates(Vector2 pixelCoordinates) { - int increment = 0; - foreach (Button button in buttons) + int offsetInactive = 0; + for (int i = 0; i < 4; i++) { - if (button.Active) + if (!buttons[i].Active) { - if (button.getButtonType() != ButtonType.AttackConfirm) - { - button.setPixelCoordinates((int)(pixelCoordinates.X + 32), (int)(pixelCoordinates.Y + (increment * 32))); - increment++; - } - else if (GameState.attackConfirmOpen) - { - button.setPixelCoordinates((int)(pixelCoordinates.X + 32), (int)(pixelCoordinates.Y)); - } + offsetInactive -= 32; } + buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 32), (int)(pixelCoordinates.Y + (i * 32) + offsetInactive)); + + } + buttons[4].setPixelCoordinates(330, 120); + for (int i = 5; i < 9; i++) + { + buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 150), (int)(pixelCoordinates.Y + (i - 1 * 32))); } } @@ -441,7 +467,7 @@ namespace Model { if ((currentFrame < 6) || (currentFrame > 8)) // if unit isnt already going right, set the sprite to default facing right { - currentFrame = 7;//increment walk cycle + currentFrame = 7; } else { @@ -451,7 +477,7 @@ namespace Model } else { - currentFrame++; + currentFrame++; //increment walk cycle } } } diff --git a/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj b/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj index 1a25284..2eb821d 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj +++ b/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj @@ -122,6 +122,7 @@ <Content Include="GameThumbnail.png"> <XnaPlatformSpecific>true</XnaPlatformSpecific> </Content> + <None Include="Resources\Inventory_Button.jpg" /> <None Include="Resources\exit_game.png" /> <None Include="Resources\main_menu_button.png" /> <None Include="Resources\warrior_stats.png" /> diff --git a/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj.Debug.cachefile b/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj.Debug.cachefile index 7da2584..022bec4 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj.Debug.cachefile +++ b/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj.Debug.cachefile @@ -6,30 +6,31 @@ Content\attack.xnb Content\items.xnb Content\move.xnb Content\wait.xnb -Content\PixelFont.xnb -Content\warrior_stats.xnb -Content\PixelFontLarge.xnb Content\warrior.xnb Content\instructions1.xnb Content\instructions2.xnb Content\instructions3.xnb -Content\mage_stats.xnb -Content\archer_stats.xnb Content\archer.xnb Content\mage.xnb Content\2archer.xnb Content\2archer_attack.xnb -Content\2archer_stats.xnb Content\2mage.xnb Content\2mage_attack.xnb -Content\2mage_stats.xnb Content\2warrior.xnb Content\2warrior_attack.xnb -Content\2warrior_stats.xnb Content\archer_attack.xnb Content\mage_attack.xnb Content\warrior_attack.xnb Content\attack_confirm.xnb Content\confirm_attack.xnb -Content\PixelFontLargest.xnb +Content\archer_stats.xnb +Content\2archer_stats.xnb +Content\2mage_stats.xnb +Content\2warrior_stats.xnb +Content\mage_stats.xnb +Content\warrior_stats.xnb Content\exit_game.xnb +Content\PixelFont.xnb +Content\PixelFontLarge.xnb +Content\PixelFontLargest.xnb +Content\Inventory_Button.xnb diff --git a/src/Blaze-Brigade/Blaze_Brigade/Button.cs b/src/Blaze-Brigade/Blaze_Brigade/Button.cs index 1c7bcb5..24a5d6c 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Button.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Button.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Model; namespace View { @@ -15,7 +16,33 @@ namespace View private ButtonType buttonType; // holds the button type private Vector2 pixelCoordinates; // holds the coordinates of the menu button in question private Texture2D buttonImage; // stores the texture for the button - public bool Active { get; set; } // sets and gets whether button is active + public bool Active { get; set; } // sets and gets whether button is active + public String item { get; set; } // sets and gets string name for item name + private Weapon weapons; + public bool hasItem { get; set; } // returns whether an item is currently bounded to button + + /** + Sets and gets weapon associated with button + */ + public Weapon weapon + { + get + { + return weapons; + } + set + { + weapons = value; + if(value== null) + { + hasItem = false;// set item to false if null + } + else + { + hasItem = true;// set item to true if weapon is added + } + } + } /** Constructor for button @@ -31,6 +58,11 @@ namespace View Active = true; } + public void addItem(Weapon weapon) + { + + } + /** Returns the pixel coordinate of the button */ @@ -76,6 +108,10 @@ namespace View AttackConfirm, Move, Items, - Wait + Wait, + Inventory1, + Inventory2, + Inventory3, + Inventory4 } } diff --git a/src/Blaze-Brigade/Blaze_Brigade/Game.cs b/src/Blaze-Brigade/Blaze_Brigade/Game.cs index 1454fdc..00102b8 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Game.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Game.cs @@ -125,7 +125,6 @@ namespace Controller player2.addUnit(getNewUnit(UnitType.Warrior, new Vector2(8 * 32f, 8 * 32f), player2)); player2.addUnit(getNewUnit(UnitType.Mage, new Vector2(8 * 32f, 6 * 32f), player2)); player2.addUnit(getNewUnit(UnitType.Archer, new Vector2(8 * 32f, 10 * 32f), player2)); - setObstacles(graph); } @@ -239,7 +238,7 @@ namespace Controller } // removes deceased units in Player 1 - foreach (Unit unit in player1.getUnits()) + foreach(Unit unit in player1.getUnits()) { if (!unit.Alive) { @@ -316,7 +315,7 @@ namespace Controller if (GameState.playableUnitSelected) { Unit unit = GameState.selectedUnit; - + if (!GameState.isAnimating) { #region Highlight nodes @@ -333,7 +332,7 @@ namespace Controller foreach (Node attack in attackableNodes) { - if ((!GameState.moveableNodes.Contains(attack)) && (attack.unitOnNode != unit) && (!attack.isObstacle)) + if ((!GameState.moveableNodes.Contains(attack))&&(attack.unitOnNode!=unit)&&(!attack.isObstacle)) { spriteBatch.Draw(attackableNode, attack.getPosition(), null, Color.White * 0.2f, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.9f); } @@ -354,13 +353,16 @@ namespace Controller if (GameState.dropDownMenuOpen) // if dropDowMenu should be opened, draw dropDownMenu { unit.setButtonCoordinates(unit.PixelCoordinates); - foreach (Button button in unit.getButtons()) + + Button[] unitButtons = unit.getButtons(); + for(int i=0; i<4; i++) { - if (button.Active && button.getButtonType() != ButtonType.AttackConfirm) + if (unitButtons[i].Active) { - spriteBatch.Draw(button.getImage(), button.getPixelCoordinates(), null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(unitButtons[i].getImage(), unitButtons[i].getPixelCoordinates(), null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0f); } } + } #region Attack menu Button confirmButton = unit.getButtonOfType(ButtonType.AttackConfirm); @@ -384,12 +386,12 @@ namespace Controller if (GameState.currentPlayer == player1) { - + spriteBatch.Draw(unit.getCharAttackInfo(), Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw charAttackInfoBackground texture for current character spriteBatch.DrawString(largeFont, damageDealt.ToString(), new Vector2(180, 458), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws damage dealt - spriteBatch.DrawString(font, " x " + hitCount.ToString(), new Vector2(195, 459), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws hit count - spriteBatch.DrawString(largeFont, hitRate.ToString() + " %", new Vector2(170, 488), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws hit rate - spriteBatch.DrawString(largeFont, critRate.ToString() + " %", new Vector2(170, 518), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws crit rate + spriteBatch.DrawString(font, " x " +hitCount.ToString(), new Vector2(195, 459), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws hit count + spriteBatch.DrawString(largeFont, hitRate.ToString()+" %", new Vector2(170, 488), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws hit rate + spriteBatch.DrawString(largeFont, critRate.ToString()+" %", new Vector2(170, 518), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws crit rate spriteBatch.DrawString(largestFont, unit.Hp.ToString(), new Vector2(342, 475), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws unit health spriteBatch.Draw(attackedUnit.getCharAttackInfo(), attackInfoLocation2, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw charAttackInfoBackground for unit being attacked @@ -408,9 +410,9 @@ namespace Controller { spriteBatch.Draw(attackedUnit.getCharAttackInfo(), Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw charAttackInfoBackground texture for current character spriteBatch.DrawString(largeFont, damageDealt.ToString(), new Vector2(180, 458), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack damage - spriteBatch.DrawString(font, " x " + hitCount.ToString(), new Vector2(195, 459), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack hit count - spriteBatch.DrawString(largeFont, hitRate.ToString() + " %", new Vector2(170, 488), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack hit rate - spriteBatch.DrawString(largeFont, critRate.ToString() + " %", new Vector2(170, 518), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack crit rate + spriteBatch.DrawString(font, " x " +hitCount.ToString(), new Vector2(195, 459), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack hit count + spriteBatch.DrawString(largeFont, hitRate.ToString()+" %", new Vector2(170, 488), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack hit rate + spriteBatch.DrawString(largeFont, critRate.ToString()+" %", new Vector2(170, 518), Color.DarkBlue, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws counterattack crit rate spriteBatch.DrawString(largestFont, attackedUnit.Hp.ToString(), new Vector2(342, 475), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); //draws enemy unit health spriteBatch.Draw(unit.getCharAttackInfo(), attackInfoLocation2, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.7f); //draw charAttackInfoBackground for current character @@ -433,7 +435,7 @@ namespace Controller #region Character Info Screen player1 //if player 1, prints info screen for player 1 - if ((GameState.currentPlayer == player1) && (!GameState.attackConfirmOpen)) + if ((GameState.currentPlayer == player1)&&(!GameState.attackConfirmOpen)) { Vector2 statLocation = new Vector2(170, 535); //starting location for first stat Vector2 statLocation2 = new Vector2(235, 535); //starting location for first stat @@ -443,12 +445,12 @@ namespace Controller for (int k = 0; k < 4; k++) //for stats - level, str, int, skill, { - spriteBatch.DrawString(font, stats[k].ToString(), statLocation, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); + spriteBatch.DrawString(font, stats[k].ToString(), statLocation, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); statLocation = statLocation + increment; //increment downwards } for (int t = 4; t < 7; t++) //for stats - speed, defense, resistance { - spriteBatch.DrawString(font, stats[t].ToString(), statLocation2, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); + spriteBatch.DrawString(font, stats[t].ToString(), statLocation2, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); statLocation2 = statLocation2 + increment; //increment downwards } @@ -460,20 +462,20 @@ namespace Controller { if (!GameState.attackConfirmOpen) { - Vector2 statLocation = new Vector2(795, 533); //starting location for first stat - Vector2 statLocation2 = new Vector2(860, 533); //starting location for first stat - Vector2 increment = new Vector2(0, 20); //increment downwards for each stat - Vector2 infoLocation = new Vector2(635, 513); - int[] stats = unit.getStats(); + Vector2 statLocation = new Vector2(795, 533); //starting location for first stat + Vector2 statLocation2 = new Vector2(860, 533); //starting location for first stat + Vector2 increment = new Vector2(0, 20); //increment downwards for each stat + Vector2 infoLocation = new Vector2(635, 513); + int[] stats = unit.getStats(); for (int k = 0; k < 4; k++) //for stats - level, str, int, skill, { - spriteBatch.DrawString(font, stats[k].ToString(), statLocation, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); + spriteBatch.DrawString(font, stats[k].ToString(), statLocation, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); statLocation = statLocation + increment; //increment downwards } for (int t = 4; t < 7; t++) //for stats - speed, defense, resistance { - spriteBatch.DrawString(font, stats[t].ToString(), statLocation2, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); + spriteBatch.DrawString(font, stats[t].ToString(), statLocation2, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.6f); statLocation2 = statLocation2 + increment; //increment downwards } @@ -490,7 +492,7 @@ namespace Controller if (GameState.gameOver) { Vector2 gameOverLocation = new Vector2(-370, -300); - spriteBatch.DrawString(largestFont, "Game Over", new Vector2(350, 200), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0f); //draws Game Over Text + spriteBatch.DrawString(largestFont,"Game Over", new Vector2(350, 200), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0f); //draws Game Over Text spriteBatch.Draw(gameOver, Vector2.Zero, null, Color.White, 0, gameOverLocation, 1f, SpriteEffects.None, 0f); spriteBatch.Draw(backGround, Vector2.Zero, null, Color.Black * 0.5f, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.9f); @@ -502,7 +504,7 @@ namespace Controller if (unit.Alive) { spriteBatch.Draw(unit.getSpriteImage(), unit.PixelCoordinates, - unit.getCurrentFrame(), Color.Black * 0.5f, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.8f); + unit.getCurrentFrame(), Color.Black*0.5f, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.8f); } } #endregion @@ -515,7 +517,7 @@ namespace Controller if (unit.Alive) { spriteBatch.Draw(unit.getSpriteImage(), unit.PixelCoordinates, - unit.getCurrentFrame(), Color.Black * 0.5f, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.8f); + unit.getCurrentFrame(), Color.Black*0.5f, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.8f); } } #endregion @@ -524,7 +526,7 @@ namespace Controller spriteBatch.Draw(backGround, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 1); - + break; } @@ -535,7 +537,7 @@ namespace Controller private static bool findAttackType(Unit unit1) { - if ((unit1.getClass() == UnitType.Warrior) || (unit1.getClass() == UnitType.Archer)) + if ((unit1.getClass() == UnitType.Warrior)|| (unit1.getClass() == UnitType.Archer)) { return false; } @@ -548,19 +550,23 @@ namespace Controller //method to return a unit: takes in unit type (warrior/mage/ranger), unit position, and which player's unit (since different model/colors) private Unit getNewUnit(UnitType unitType, Vector2 unitPosition, Player player) { - Button attackButton = new Button(ButtonType.Attack, unitPosition, Content.Load<Texture2D>("attack")); - Button moveButton = new Button(ButtonType.Move, unitPosition, Content.Load<Texture2D>("move")); - Button itemButton = new Button(ButtonType.Items, unitPosition, Content.Load<Texture2D>("items")); ; - Button waitButton = new Button(ButtonType.Wait, unitPosition, Content.Load<Texture2D>("wait")); ; - Button attackConfirmButton = new Button(ButtonType.AttackConfirm, new Vector2(328, 130), Content.Load<Texture2D>("confirm_attack")); + Button[] unitButtons = new Button[9]; + unitButtons[0] = new Button(ButtonType.Attack, unitPosition, Content.Load<Texture2D>("attack")); + unitButtons[1] = new Button(ButtonType.Move, unitPosition, Content.Load<Texture2D>("move")); + unitButtons[2] = new Button(ButtonType.Items, unitPosition, Content.Load<Texture2D>("items")); ; + unitButtons[3] = new Button(ButtonType.Wait, unitPosition, Content.Load<Texture2D>("wait")); ; + unitButtons[4] = new Button(ButtonType.AttackConfirm, new Vector2(328, 130), Content.Load<Texture2D>("confirm_attack")); + unitButtons[5] = new Button(ButtonType.Inventory1, unitPosition, Content.Load<Texture2D>("Inventory_Button")); + unitButtons[6] = new Button(ButtonType.Inventory2, unitPosition, Content.Load<Texture2D>("Inventory_Button")); + unitButtons[7] = new Button(ButtonType.Inventory3, unitPosition, Content.Load<Texture2D>("Inventory_Button")); + unitButtons[8] = new Button(ButtonType.Inventory4, unitPosition, Content.Load<Texture2D>("Inventory_Button")); // creates human-like characters for current player if (player == GameState.currentPlayer) { if (unitType == UnitType.Warrior) { - Unit unit = new Warrior(Content.Load<Texture2D>("warrior"), attackButton, moveButton, - itemButton, waitButton, attackConfirmButton, Content.Load<Texture2D>("warrior_stats"), Content.Load<Texture2D>("warrior_attack"), unitPosition); + Unit unit = new Warrior(Content.Load<Texture2D>("warrior"),unitButtons, Content.Load<Texture2D>("warrior_stats"), Content.Load<Texture2D>("warrior_attack"), unitPosition); Weapon startingWeap = new BronzeSword(); unit.equippedWeapon = startingWeap; graph.getNode(unitPosition).unitOnNode = (unit); @@ -569,8 +575,7 @@ namespace Controller if (unitType == UnitType.Mage) { - Unit unit = new Mage(Content.Load<Texture2D>("mage"), attackButton, moveButton, - itemButton, waitButton, attackConfirmButton, Content.Load<Texture2D>("mage_stats"), Content.Load<Texture2D>("mage_attack"), unitPosition); + Unit unit = new Mage(Content.Load<Texture2D>("mage"),unitButtons, Content.Load<Texture2D>("mage_stats"), Content.Load<Texture2D>("mage_attack"), unitPosition); Weapon startingWeap = new Fireball(); unit.equippedWeapon = startingWeap; graph.getNode(unitPosition).unitOnNode = (unit); @@ -579,8 +584,7 @@ namespace Controller if (unitType == UnitType.Archer) { - Unit unit = new Archer(Content.Load<Texture2D>("archer"), attackButton, moveButton, - itemButton, waitButton, attackConfirmButton, Content.Load<Texture2D>("archer_stats"), Content.Load<Texture2D>("archer_attack"), unitPosition); + Unit unit = new Archer(Content.Load<Texture2D>("archer"), unitButtons, Content.Load<Texture2D>("archer_stats"), Content.Load<Texture2D>("archer_attack"), unitPosition); Weapon startingWeap = new BronzeBow(); unit.equippedWeapon = startingWeap; graph.getNode(unitPosition).unitOnNode = (unit); @@ -593,8 +597,7 @@ namespace Controller { if (unitType == UnitType.Warrior) { - Unit unit = new Warrior(Content.Load<Texture2D>("2warrior"), attackButton, moveButton, - itemButton, waitButton, attackConfirmButton, Content.Load<Texture2D>("2warrior_stats"), Content.Load<Texture2D>("2warrior_attack"), unitPosition); + Unit unit = new Warrior(Content.Load<Texture2D>("2warrior"), unitButtons, Content.Load<Texture2D>("2warrior_stats"), Content.Load<Texture2D>("2warrior_attack"), unitPosition); Weapon startingWeap = new BronzeSword(); unit.equippedWeapon = startingWeap; graph.getNode(unitPosition).unitOnNode = (unit); @@ -603,8 +606,7 @@ namespace Controller if (unitType == UnitType.Mage) { - Unit unit = new Mage(Content.Load<Texture2D>("2mage"), attackButton, moveButton, - itemButton, waitButton, attackConfirmButton, Content.Load<Texture2D>("2mage_stats"), Content.Load<Texture2D>("2mage_attack"), unitPosition); + Unit unit = new Mage(Content.Load<Texture2D>("2mage"), unitButtons, Content.Load<Texture2D>("2mage_stats"), Content.Load<Texture2D>("2mage_attack"), unitPosition); Weapon startingWeap = new Fireball(); unit.equippedWeapon = startingWeap; graph.getNode(unitPosition).unitOnNode = (unit); @@ -613,8 +615,7 @@ namespace Controller if (unitType == UnitType.Archer) { - Unit unit = new Archer(Content.Load<Texture2D>("2archer"), attackButton, moveButton, - itemButton, waitButton, attackConfirmButton, Content.Load<Texture2D>("2archer_stats"), Content.Load<Texture2D>("2archer_attack"), unitPosition); + Unit unit = new Archer(Content.Load<Texture2D>("2archer"),unitButtons, Content.Load<Texture2D>("2archer_stats"), Content.Load<Texture2D>("2archer_attack"), unitPosition); Weapon startingWeap = new BronzeBow(); unit.equippedWeapon = startingWeap; graph.getNode(unitPosition).unitOnNode = (unit); @@ -630,156 +631,156 @@ namespace Controller { for (int y = 5; y <= 14; y++) { - graph.getNode(2, y).isObstacle = (true); + graph.getNode(2, y).isObstacle=(true); } - graph.getNode(3, 5).isObstacle = (true); - graph.getNode(3, 13).isObstacle = (true); - graph.getNode(4, 3).isObstacle = (true); - graph.getNode(4, 4).isObstacle = (true); - graph.getNode(4, 13).isObstacle = (true); - graph.getNode(4, 14).isObstacle = (true); - graph.getNode(5, 2).isObstacle = (true); - graph.getNode(5, 15).isObstacle = (true); - graph.getNode(6, 2).isObstacle = (true); - graph.getNode(6, 14).isObstacle = (true); - graph.getNode(7, 2).isObstacle = (true); - graph.getNode(7, 3).isObstacle = (true); - graph.getNode(7, 4).isObstacle = (true); - graph.getNode(7, 14).isObstacle = (true); - graph.getNode(8, 4).isObstacle = (true); + graph.getNode(3, 5).isObstacle=(true); + graph.getNode(3, 13).isObstacle=(true); + graph.getNode(4, 3).isObstacle=(true); + graph.getNode(4, 4).isObstacle=(true); + graph.getNode(4, 13).isObstacle=(true); + graph.getNode(4, 14).isObstacle=(true); + graph.getNode(5, 2).isObstacle=(true); + graph.getNode(5, 15).isObstacle=(true); + graph.getNode(6, 2).isObstacle=(true); + graph.getNode(6, 14).isObstacle=(true); + graph.getNode(7, 2).isObstacle=(true); + graph.getNode(7, 3).isObstacle=(true); + graph.getNode(7, 4).isObstacle=(true); + graph.getNode(7, 14).isObstacle=(true); + graph.getNode(8, 4).isObstacle=(true); for (int y = 14; y <= 17; y++) { - graph.getNode(8, y).isObstacle = (true); + graph.getNode(8, y).isObstacle=(true); } - graph.getNode(9, 4).isObstacle = (true); + graph.getNode(9, 4).isObstacle=(true); for (int y = 17; y <= 20; y++) { - graph.getNode(9, y).isObstacle = (true); + graph.getNode(9, y).isObstacle=(true); } - graph.getNode(10, 4).isObstacle = (true); - graph.getNode(10, 20).isObstacle = (true); - graph.getNode(10, 21).isObstacle = (true); - graph.getNode(10, 22).isObstacle = (true); - graph.getNode(11, 4).isObstacle = (true); - graph.getNode(11, 14).isObstacle = (true); - graph.getNode(11, 22).isObstacle = (true); - graph.getNode(12, 3).isObstacle = (true); + graph.getNode(10, 4).isObstacle=(true); + graph.getNode(10, 20).isObstacle=(true); + graph.getNode(10, 21).isObstacle=(true); + graph.getNode(10, 22).isObstacle=(true); + graph.getNode(11, 4).isObstacle=(true); + graph.getNode(11, 14).isObstacle=(true); + graph.getNode(11, 22).isObstacle=(true); + graph.getNode(12, 3).isObstacle=(true); for (int y = 22; y <= 25; y++) { - graph.getNode(12, y).isObstacle = (true); + graph.getNode(12, y).isObstacle=(true); } - graph.getNode(13, 4).isObstacle = (true); - graph.getNode(12, 25).isObstacle = (true); - graph.getNode(14, 4).isObstacle = (true); - graph.getNode(14, 25).isObstacle = (true); - graph.getNode(15, 4).isObstacle = (true); - graph.getNode(15, 25).isObstacle = (true); - graph.getNode(15, 26).isObstacle = (true); - graph.getNode(15, 27).isObstacle = (true); - graph.getNode(16, 3).isObstacle = (true); - graph.getNode(16, 27).isObstacle = (true); - graph.getNode(17, 2).isObstacle = (true); - graph.getNode(17, 3).isObstacle = (true); - graph.getNode(17, 27).isObstacle = (true); - graph.getNode(18, 1).isObstacle = (true); - graph.getNode(18, 27).isObstacle = (true); - graph.getNode(19, 1).isObstacle = (true); - graph.getNode(19, 27).isObstacle = (true); - graph.getNode(20, 2).isObstacle = (true); + graph.getNode(13, 4).isObstacle=(true); + graph.getNode(12, 25).isObstacle=(true); + graph.getNode(14, 4).isObstacle=(true); + graph.getNode(14, 25).isObstacle=(true); + graph.getNode(15, 4).isObstacle=(true); + graph.getNode(15, 25).isObstacle=(true); + graph.getNode(15, 26).isObstacle=(true); + graph.getNode(15, 27).isObstacle=(true); + graph.getNode(16, 3).isObstacle=(true); + graph.getNode(16, 27).isObstacle=(true); + graph.getNode(17, 2).isObstacle=(true); + graph.getNode(17, 3).isObstacle=(true); + graph.getNode(17, 27).isObstacle=(true); + graph.getNode(18, 1).isObstacle=(true); + graph.getNode(18, 27).isObstacle=(true); + graph.getNode(19, 1).isObstacle=(true); + graph.getNode(19, 27).isObstacle=(true); + graph.getNode(20, 2).isObstacle=(true); for (int y = 24; y <= 27; y++) { - graph.getNode(20, y).isObstacle = (true); + graph.getNode(20, y).isObstacle=(true); } - graph.getNode(21, 2).isObstacle = (true); - graph.getNode(21, 21).isObstacle = (true); - graph.getNode(21, 22).isObstacle = (true); - graph.getNode(21, 23).isObstacle = (true); - graph.getNode(22, 1).isObstacle = (true); - graph.getNode(22, 2).isObstacle = (true); - graph.getNode(22, 20).isObstacle = (true); - graph.getNode(23, 0).isObstacle = (true); - graph.getNode(23, 20).isObstacle = (true); - graph.getNode(24, 0).isObstacle = (true); - graph.getNode(24, 20).isObstacle = (true); - graph.getNode(25, 1).isObstacle = (true); - graph.getNode(25, 20).isObstacle = (true); - graph.getNode(26, 1).isObstacle = (true); - graph.getNode(26, 21).isObstacle = (true); - graph.getNode(27, 1).isObstacle = (true); - graph.getNode(27, 22).isObstacle = (true); - graph.getNode(28, 0).isObstacle = (true); + graph.getNode(21, 2).isObstacle=(true); + graph.getNode(21, 21).isObstacle=(true); + graph.getNode(21, 22).isObstacle=(true); + graph.getNode(21, 23).isObstacle=(true); + graph.getNode(22, 1).isObstacle=(true); + graph.getNode(22, 2).isObstacle=(true); + graph.getNode(22, 20).isObstacle=(true); + graph.getNode(23, 0).isObstacle=(true); + graph.getNode(23, 20).isObstacle=(true); + graph.getNode(24, 0).isObstacle=(true); + graph.getNode(24, 20).isObstacle=(true); + graph.getNode(25, 1).isObstacle=(true); + graph.getNode(25, 20).isObstacle=(true); + graph.getNode(26, 1).isObstacle=(true); + graph.getNode(26, 21).isObstacle=(true); + graph.getNode(27, 1).isObstacle=(true); + graph.getNode(27, 22).isObstacle=(true); + graph.getNode(28, 0).isObstacle=(true); for (int y = 22; y <= 27; y++) { - graph.getNode(28, y).isObstacle = (true); + graph.getNode(28, y).isObstacle=(true); } - graph.getNode(29, 1).isObstacle = (true); - graph.getNode(29, 2).isObstacle = (true); - graph.getNode(29, 3).isObstacle = (true); - graph.getNode(29, 27).isObstacle = (true); - graph.getNode(30, 3).isObstacle = (true); - graph.getNode(30, 27).isObstacle = (true); - graph.getNode(31, 2).isObstacle = (true); - graph.getNode(31, 3).isObstacle = (true); - graph.getNode(31, 27).isObstacle = (true); - graph.getNode(32, 27).isObstacle = (true); - graph.getNode(33, 2).isObstacle = (true); - graph.getNode(33, 3).isObstacle = (true); - graph.getNode(33, 26).isObstacle = (true); - graph.getNode(34, 3).isObstacle = (true); - graph.getNode(34, 25).isObstacle = (true); - graph.getNode(35, 3).isObstacle = (true); - graph.getNode(35, 25).isObstacle = (true); - graph.getNode(36, 2).isObstacle = (true); - graph.getNode(36, 25).isObstacle = (true); - graph.getNode(37, 2).isObstacle = (true); - graph.getNode(37, 25).isObstacle = (true); - graph.getNode(38, 2).isObstacle = (true); + graph.getNode(29, 1).isObstacle=(true); + graph.getNode(29, 2).isObstacle=(true); + graph.getNode(29, 3).isObstacle=(true); + graph.getNode(29, 27).isObstacle=(true); + graph.getNode(30, 3).isObstacle=(true); + graph.getNode(30, 27).isObstacle=(true); + graph.getNode(31, 2).isObstacle=(true); + graph.getNode(31, 3).isObstacle=(true); + graph.getNode(31, 27).isObstacle=(true); + graph.getNode(32, 27).isObstacle=(true); + graph.getNode(33, 2).isObstacle=(true); + graph.getNode(33, 3).isObstacle=(true); + graph.getNode(33, 26).isObstacle=(true); + graph.getNode(34, 3).isObstacle=(true); + graph.getNode(34, 25).isObstacle=(true); + graph.getNode(35, 3).isObstacle=(true); + graph.getNode(35, 25).isObstacle=(true); + graph.getNode(36, 2).isObstacle=(true); + graph.getNode(36, 25).isObstacle=(true); + graph.getNode(37, 2).isObstacle=(true); + graph.getNode(37, 25).isObstacle=(true); + graph.getNode(38, 2).isObstacle=(true); for (int y = 9; y <= 14; y++) { - graph.getNode(38, y).isObstacle = (true); + graph.getNode(38, y).isObstacle=(true); } - graph.getNode(38, 26).isObstacle = (true); - graph.getNode(39, 2).isObstacle = (true); - graph.getNode(39, 8).isObstacle = (true); - graph.getNode(39, 14).isObstacle = (true); - graph.getNode(40, 3).isObstacle = (true); - graph.getNode(40, 7).isObstacle = (true); - graph.getNode(40, 14).isObstacle = (true); - graph.getNode(40, 26).isObstacle = (true); - graph.getNode(41, 3).isObstacle = (true); - graph.getNode(41, 7).isObstacle = (true); + graph.getNode(38, 26).isObstacle=(true); + graph.getNode(39, 2).isObstacle=(true); + graph.getNode(39, 8).isObstacle=(true); + graph.getNode(39, 14).isObstacle=(true); + graph.getNode(40, 3).isObstacle=(true); + graph.getNode(40, 7).isObstacle=(true); + graph.getNode(40, 14).isObstacle=(true); + graph.getNode(40, 26).isObstacle=(true); + graph.getNode(41, 3).isObstacle=(true); + graph.getNode(41, 7).isObstacle=(true); for (int y = 14; y <= 17; y++) { - graph.getNode(41, y).isObstacle = (true); + graph.getNode(41, y).isObstacle=(true); } - graph.getNode(41, 27).isObstacle = (true); - graph.getNode(42, 4).isObstacle = (true); - graph.getNode(42, 7).isObstacle = (true); - graph.getNode(42, 17).isObstacle = (true); - graph.getNode(42, 27).isObstacle = (true); - graph.getNode(43, 4).isObstacle = (true); - graph.getNode(43, 7).isObstacle = (true); - graph.getNode(43, 17).isObstacle = (true); - graph.getNode(43, 27).isObstacle = (true); - graph.getNode(44, 4).isObstacle = (true); - graph.getNode(44, 7).isObstacle = (true); + graph.getNode(41, 27).isObstacle=(true); + graph.getNode(42, 4).isObstacle=(true); + graph.getNode(42, 7).isObstacle=(true); + graph.getNode(42, 17).isObstacle=(true); + graph.getNode(42, 27).isObstacle=(true); + graph.getNode(43, 4).isObstacle=(true); + graph.getNode(43, 7).isObstacle=(true); + graph.getNode(43, 17).isObstacle=(true); + graph.getNode(43, 27).isObstacle=(true); + graph.getNode(44, 4).isObstacle=(true); + graph.getNode(44, 7).isObstacle=(true); for (int y = 17; y <= 23; y++) { - graph.getNode(44, y).isObstacle = (true); + graph.getNode(44, y).isObstacle=(true); } - graph.getNode(44, 27).isObstacle = (true); - graph.getNode(45, 4).isObstacle = (true); - graph.getNode(45, 5).isObstacle = (true); - graph.getNode(45, 24).isObstacle = (true); - graph.getNode(45, 25).isObstacle = (true); - graph.getNode(45, 27).isObstacle = (true); - graph.getNode(46, 5).isObstacle = (true); - graph.getNode(46, 7).isObstacle = (true); - graph.getNode(46, 25).isObstacle = (true); - graph.getNode(46, 26).isObstacle = (true); - graph.getNode(47, 5).isObstacle = (true); - graph.getNode(47, 6).isObstacle = (true); - graph.getNode(47, 7).isObstacle = (true); + graph.getNode(44, 27).isObstacle=(true); + graph.getNode(45, 4).isObstacle=(true); + graph.getNode(45, 5).isObstacle=(true); + graph.getNode(45, 24).isObstacle=(true); + graph.getNode(45, 25).isObstacle=(true); + graph.getNode(45, 27).isObstacle=(true); + graph.getNode(46, 5).isObstacle=(true); + graph.getNode(46, 7).isObstacle=(true); + graph.getNode(46, 25).isObstacle=(true); + graph.getNode(46, 26).isObstacle=(true); + graph.getNode(47, 5).isObstacle=(true); + graph.getNode(47, 6).isObstacle=(true); + graph.getNode(47, 7).isObstacle=(true); } } } \ No newline at end of file diff --git a/src/Blaze-Brigade/Blaze_Brigade/GameState.cs b/src/Blaze-Brigade/Blaze_Brigade/GameState.cs index a8a69ec..7f940be 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/GameState.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/GameState.cs @@ -41,6 +41,10 @@ namespace Model */ public static bool attackConfirmOpen { get; set; } /** + Sets and gets whether inventory menu should be open + */ + public static bool inventoryOpen { get; set; } + /** Sets and gets if a unit has moved yet or not. beforeMOve is true before unit moves, false after it moves. Used to determine what tiles are highlighted */ public static bool beforeMove { get; set; } diff --git a/src/Blaze-Brigade/Blaze_Brigade/Mage.cs b/src/Blaze-Brigade/Blaze_Brigade/Mage.cs index b89bb74..59d28c5 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Mage.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Mage.cs @@ -51,7 +51,7 @@ namespace Model private Texture2D spriteImage; // the char sprite private Vector2 pixelCoordinates; // the pixel coordinate of the unit private Tuple<int, int> position; // the tile location of the unit - private Button[] buttons = new Button[5]; // the buttons associated with the unit + private Button[] buttons = new Button[9]; // the buttons associated with the unit private Texture2D charInfo, charAttackInfo; // The character and attack info textures private int currentFrame; // the current frame the sprite is on @@ -68,16 +68,19 @@ namespace Model * @param coordinates The unit's current coordinate on screen * @param player The player of which the unit belongs to */ - public Mage(Texture2D spriteImage, Button attackButton, Button moveButton, - Button itemButton, Button waitButton, Button confirmButton, Texture2D charInfo, + public Mage(Texture2D spriteImage, Button[] unitButtons, Texture2D charInfo, Texture2D charAttackInfo, Vector2 coordinates) { this.spriteImage = spriteImage; - buttons[0] = attackButton; - buttons[1] = moveButton; - buttons[2] = itemButton; - buttons[3] = waitButton; - buttons[4] = confirmButton; + buttons[0] = unitButtons[0]; + buttons[1] = unitButtons[1]; + buttons[2] = unitButtons[2]; + buttons[3] = unitButtons[3]; + buttons[4] = unitButtons[4]; + buttons[5] = unitButtons[5]; + buttons[6] = unitButtons[6]; + buttons[7] = unitButtons[7]; + buttons[8] = unitButtons[8]; this.charInfo = charInfo; this.charAttackInfo = charAttackInfo; pixelCoordinates = coordinates; @@ -232,8 +235,16 @@ namespace Model return buttons[2].getImage(); case ButtonType.Wait: // if wait is clicked return buttons[3].getImage(); - case ButtonType.AttackConfirm: + case ButtonType.AttackConfirm: // if attack confirm is clicked return buttons[4].getImage(); + case ButtonType.Inventory1: // if item1 clicked + return buttons[5].getImage(); + case ButtonType.Inventory2: // if item2 is clicked + return buttons[6].getImage(); + case ButtonType.Inventory3: // if item3 is clicked + return buttons[7].getImage(); + case ButtonType.Inventory4: // if item4 is clicked + return buttons[8].getImage(); default: return null; } @@ -256,6 +267,14 @@ namespace Model return buttons[3].Active; case ButtonType.AttackConfirm: return buttons[4].Active; + case ButtonType.Inventory1: + return buttons[5].Active; + case ButtonType.Inventory2: + return buttons[6].Active; + case ButtonType.Inventory3: + return buttons[7].Active; + case ButtonType.Inventory4: + return buttons[8].Active; default: return false; @@ -339,6 +358,14 @@ namespace Model return buttons[3]; case ButtonType.AttackConfirm: return buttons[4]; + case ButtonType.Inventory1: + return buttons[5]; + case ButtonType.Inventory2: + return buttons[6]; + case ButtonType.Inventory3: + return buttons[7]; + case ButtonType.Inventory4: + return buttons[8]; default: return null; @@ -351,21 +378,20 @@ namespace Model */ public void setButtonCoordinates(Vector2 pixelCoordinates) { - int increment = 0; - foreach (Button button in buttons) + int offsetInactive = 0; + for (int i = 0; i < 4; i++) { - if (button.Active) + if (!buttons[i].Active) { - if (button.getButtonType() != ButtonType.AttackConfirm) - { - button.setPixelCoordinates((int)(pixelCoordinates.X + 32), (int)(pixelCoordinates.Y + (increment * 32))); - increment++; - } - else if (GameState.attackConfirmOpen) - { - button.setPixelCoordinates((int)(pixelCoordinates.X + 32), (int)(pixelCoordinates.Y)); - } + offsetInactive -= 32; } + buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 32), (int)(pixelCoordinates.Y + (i * 32) + offsetInactive)); + + } + buttons[4].setPixelCoordinates(330, 120); + for (int i = 5; i < 9; i++) + { + buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 150), (int)(pixelCoordinates.Y + (i - 1 * 32))); } } @@ -441,7 +467,7 @@ namespace Model { if ((currentFrame < 6) || (currentFrame > 8)) // if unit isnt already going right, set the sprite to default facing right { - currentFrame = 7;//increment walk cycle + currentFrame = 7; } else { @@ -451,7 +477,7 @@ namespace Model } else { - currentFrame++; + currentFrame++; //increment walk cycle } } } diff --git a/src/Blaze-Brigade/Blaze_Brigade/Resource1.Designer.cs b/src/Blaze-Brigade/Blaze_Brigade/Resource1.Designer.cs index e815729..2010e17 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Resource1.Designer.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Resource1.Designer.cs @@ -270,6 +270,16 @@ namespace Blaze_Brigade { } } + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap Inventory_Button { + get { + object obj = ResourceManager.GetObject("Inventory_Button", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> diff --git a/src/Blaze-Brigade/Blaze_Brigade/Resource1.resx b/src/Blaze-Brigade/Blaze_Brigade/Resource1.resx index 77996a8..2b55810 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Resource1.resx +++ b/src/Blaze-Brigade/Blaze_Brigade/Resource1.resx @@ -214,4 +214,7 @@ <data name="exit_game" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>Resources\exit_game.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> + <data name="Inventory_Button" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>Resources\Inventory_Button.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> </root> \ No newline at end of file diff --git a/src/Blaze-Brigade/Blaze_Brigade/Resources/Inventory_Button.jpg b/src/Blaze-Brigade/Blaze_Brigade/Resources/Inventory_Button.jpg new file mode 100644 index 0000000000000000000000000000000000000000..75c5feff05f432b4565184015d6120bdb39c9183 GIT binary patch literal 2002 zcmbW1c~DbV6vl7z$Ob5~h>BuV5U~tUH?)GJiVCP5MyW+$h6uQzT~HwqKzIlgM5m^J z2<TKsQBhnXOH4(CvIuH*7#5XX0tm7vEa5?tcY6ccQp+E0@0)igZ{9gK-|su;JXi-? z!JHl2owoxDg#z}Y3&2L;0I2AZLQ(Hj_0qu9J556a)1cGn^vRpSV$vBb2A$5-VzM;V z3;oj8($rQzs1KP+rP45rrpcf)CPV(y27d#(Ot1t*Vw7cos!PFiDX<K%0ie((<x#+g zMWJFEG&%#x&_V&CIY>T+A<;CX7)6Jp_dr9Jrnhv}X1e}vZ^p9Y2CGjcTw$7Q$u6F| zr%GzN#^*#7OVe=P`~^nK%~qJN{A}$yoAn#M*yylz+jd7M=N+zJ@BPMYpSy?efrEz* z`yDwN5XcJ(=7)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;=! zRq!K9d`bUC)QgLYP>T&6v?Ui-$n_z}7*qQdcN>*nndTm5#~s=^aHyb;JwDD>vhcJ) ztjw}u2kI9~2sRlN7(}#i@1tJ3L=d_kvo7sK!_%c;K~SYU$wZZVC4qq4mDwlbKC^y! z_7VmG$7D=6ylIfsGlbxB`dzm4=k)PzFD;bUtzh9OO<nM*v<z}#ja(1uBBtqb%zc8J z7Is>Fr=wH~S_GjG#Kb^Qxq~BF${DUMm^WjNa(!msatIt{>gm>TLxV8B`rIxz#D{k* zngo2jcoYp15`OtSUa|%6y3V(rDM>*1yVUI@1?_70gp=+qN)>jbG?ji}%V;T@6e1v; zT$Ce18miQYDyHZ?X^+??JyHlDFhest18sd<Q6e{B_NQP&)`YoD&JXAtlFrVf6+-Y> z$}YzzydU4O{->Cbl>Uc`V-aNygMFK2MWy*V{g0%cuC+Xus1~d2n!uM9ZJqHvUKr0N yKE&X22W_{nOmpncoxYjno)!s`JiWWyBC@rL2lDMZH^lEJh4${{@^Cj_SpNs6y}q;n literal 0 HcmV?d00001 diff --git a/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs b/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs index 8ccaf3e..97c8d7f 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Warrior.cs @@ -52,7 +52,7 @@ namespace Model private Texture2D spriteImage; // the char sprite private Vector2 pixelCoordinates; // the pixel coordinate of the unit private Tuple<int, int> position; // the tile location of the unit - private Button[] buttons = new Button[5]; // the buttons associated with the unit + private Button[] buttons = new Button[9]; // the buttons associated with the unit private Texture2D charInfo, charAttackInfo; // The character and attack info textures private int currentFrame; // the current frame the sprite is on @@ -69,16 +69,19 @@ namespace Model * @param coordinates The unit's current coordinate on screen * @param player The player of which the unit belongs to */ - public Warrior(Texture2D spriteImage, Button attackButton, Button moveButton, - Button itemButton, Button waitButton, Button confirmButton, Texture2D charInfo, + public Warrior(Texture2D spriteImage, Button[] unitButtons, Texture2D charInfo, Texture2D charAttackInfo, Vector2 coordinates) { this.spriteImage = spriteImage; - buttons[0] = attackButton; - buttons[1] = moveButton; - buttons[2] = itemButton; - buttons[3] = waitButton; - buttons[4] = confirmButton; + buttons[0] = unitButtons[0]; + buttons[1] = unitButtons[1]; + buttons[2] = unitButtons[2]; + buttons[3] = unitButtons[3]; + buttons[4] = unitButtons[4]; + buttons[5] = unitButtons[5]; + buttons[6] = unitButtons[6]; + buttons[7] = unitButtons[7]; + buttons[8] = unitButtons[8]; this.charInfo = charInfo; this.charAttackInfo = charAttackInfo; pixelCoordinates = coordinates; @@ -233,8 +236,16 @@ namespace Model return buttons[2].getImage(); case ButtonType.Wait: // if wait is clicked return buttons[3].getImage(); - case ButtonType.AttackConfirm: + case ButtonType.AttackConfirm: // if attack confirm is clicked return buttons[4].getImage(); + case ButtonType.Inventory1: // if item1 clicked + return buttons[5].getImage(); + case ButtonType.Inventory2: // if item2 is clicked + return buttons[6].getImage(); + case ButtonType.Inventory3: // if item3 is clicked + return buttons[7].getImage(); + case ButtonType.Inventory4: // if item4 is clicked + return buttons[8].getImage(); default: return null; } @@ -257,6 +268,14 @@ namespace Model return buttons[3].Active; case ButtonType.AttackConfirm: return buttons[4].Active; + case ButtonType.Inventory1: + return buttons[5].Active; + case ButtonType.Inventory2: + return buttons[6].Active; + case ButtonType.Inventory3: + return buttons[7].Active; + case ButtonType.Inventory4: + return buttons[8].Active; default: return false; @@ -340,6 +359,14 @@ namespace Model return buttons[3]; case ButtonType.AttackConfirm: return buttons[4]; + case ButtonType.Inventory1: + return buttons[5]; + case ButtonType.Inventory2: + return buttons[6]; + case ButtonType.Inventory3: + return buttons[7]; + case ButtonType.Inventory4: + return buttons[8]; default: return null; @@ -352,21 +379,23 @@ namespace Model */ public void setButtonCoordinates(Vector2 pixelCoordinates) { - int increment = 0; - foreach (Button button in buttons) + int offsetInactive = 0; + for(int i=0; i<4; i++) { - if (button.Active) + if (GameState.dropDownMenuOpen) { - if (button.getButtonType() != ButtonType.AttackConfirm) - { - button.setPixelCoordinates((int)(pixelCoordinates.X + 32), (int)(pixelCoordinates.Y + (increment * 32))); - increment++; - } - else if (GameState.attackConfirmOpen) + if (buttons[i].Active) { - button.setPixelCoordinates((int)(pixelCoordinates.X + 32), (int)(pixelCoordinates.Y)); + offsetInactive -= 32; } + buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 32), (int)(pixelCoordinates.Y + (i * 32))); } + + } + buttons[4].setPixelCoordinates(330, 120); + for (int i = 5; i < 9; i++) + { + buttons[i].setPixelCoordinates((int)(pixelCoordinates.X + 150), (int)(pixelCoordinates.Y + (i-1 * 32))); } } diff --git a/src/Blaze-Brigade/Blaze_BrigadeContent/Blaze_BrigadeContent.contentproj b/src/Blaze-Brigade/Blaze_BrigadeContent/Blaze_BrigadeContent.contentproj index 6aeb954..b11568f 100644 --- a/src/Blaze-Brigade/Blaze_BrigadeContent/Blaze_BrigadeContent.contentproj +++ b/src/Blaze-Brigade/Blaze_BrigadeContent/Blaze_BrigadeContent.contentproj @@ -275,6 +275,13 @@ <Processor>TextureProcessor</Processor> </Compile> </ItemGroup> + <ItemGroup> + <Compile Include="Inventory_Button.jpg"> + <Name>Inventory_Button</Name> + <Importer>TextureImporter</Importer> + <Processor>TextureProcessor</Processor> + </Compile> + </ItemGroup> <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. diff --git a/src/Blaze-Brigade/Blaze_BrigadeContent/Inventory_Button.jpg b/src/Blaze-Brigade/Blaze_BrigadeContent/Inventory_Button.jpg new file mode 100644 index 0000000000000000000000000000000000000000..75c5feff05f432b4565184015d6120bdb39c9183 GIT binary patch literal 2002 zcmbW1c~DbV6vl7z$Ob5~h>BuV5U~tUH?)GJiVCP5MyW+$h6uQzT~HwqKzIlg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$2*VPEyq3{+VMp<wFCcbRxGe1XtSX zOj-DTnuW4-!n{kVpGmUbv=$L7QYwTC_$G2K!Xl&BgH!B3mwUwML9$frB+k#yk8{dT zTq(I=dranZF6()ZgN6B$D2rZhe+MZO8X#YidwK(qmo2KROJ<D~Vg%~GUBStLz0S2~ z9yRmK_65%u`<_)r@?u3O7(WRj*^i{`VtitMw$PJ1$DSWbKp<bC5_5ch(wCbMCK6S! zyos>Ban$H=u|Kn}$K%i~S-@6Ner|sB*4#6GX0e{4#Fctm0}t@D?_8V16z)QeF{p}B zkS%Yi9O)<@hakz~Wtr=faG#*)=8^EqtEDcCQ9rNak5l&6FCMV_vN^aW?zATv8X;=! zRq!K9d`bUC)QgLYP>T&6v?Ui-$n_z}7*qQdcN>*nndTm5#~s=^aHyb;JwDD>vhcJ) ztjw}u2kI9~2sRlN7(}#i@1tJ3L=d_kvo7sK!_%c;K~SYU$wZZVC4qq4mDwlbKC^y! z_7VmG$7D=6ylIfsGlbxB`dzm4=k)PzFD;bUtzh9OO<nM*v<z}#ja(1uBBtqb%zc8J z7Is>Fr=wH~S_GjG#Kb^Qxq~BF${DUMm^WjNa(!msatIt{>gm>TLxV8B`rIxz#D{k* zngo2jcoYp15`OtSUa|%6y3V(rDM>*1yVUI@1?_70gp=+qN)>jbG?ji}%V;T@6e1v; zT$Ce18miQYDyHZ?X^+??JyHlDFhest18sd<Q6e{B_NQP&)`YoD&JXAtlFrVf6+-Y> z$}YzzydU4O{->Cbl>Uc`V-aNygMFK2MWy*V{g0%cuC+Xus1~d2n!uM9ZJqHvUKr0N yKE&X22W_{nOmpncoxYjno)!s`JiWWyBC@rL2lDMZH^lEJh4${{@^Cj_SpNs6y}q;n literal 0 HcmV?d00001 diff --git a/src/Blaze-Brigade/Blaze_BrigadeContent/buttons/Inventory_Button.jpg b/src/Blaze-Brigade/Blaze_BrigadeContent/buttons/Inventory_Button.jpg new file mode 100644 index 0000000000000000000000000000000000000000..75c5feff05f432b4565184015d6120bdb39c9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