diff --git a/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj b/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj index a0f5c32dd6c77d7704f7b10c17c5f94576d5e24d..9f23c1425bb8d7da25a83f9574a81f2e46ab5b12 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj +++ b/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj @@ -126,6 +126,7 @@ <Content Include="GameThumbnail.png"> <XnaPlatformSpecific>true</XnaPlatformSpecific> </Content> + <None Include="Resources\End_Button.jpg" /> <None Include="Resources\Inventory_Button.jpg" /> <None Include="Resources\exit_game.png" /> <None Include="Resources\main_menu_button.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 2b05cc6736239656867eb1cb08474a3f661a85d6..1b6e574da25ff1b674c6480f8c3c408070a1b1c7 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj.Debug.cachefile +++ b/src/Blaze-Brigade/Blaze_Brigade/Blaze_Brigade.csproj.Debug.cachefile @@ -34,3 +34,4 @@ Content\confirm_attack.xnb Content\PixelFontLargest.xnb Content\exit_game.xnb Content\Inventory_Button.xnb +Content\End_Button.xnb diff --git a/src/Blaze-Brigade/Blaze_Brigade/Game.cs b/src/Blaze-Brigade/Blaze_Brigade/Game.cs index c8a15e889d52220030059adb35fb36c25a6861d0..8259d7adbf0f395dbf465ffc71794b340e840cc6 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Game.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Game.cs @@ -49,7 +49,7 @@ namespace Controller Camera camera; GraphicsDeviceManager graphics; SpriteBatch spriteBatch; - Texture2D backGround, moveableNode, attackableNode, gameOver; + Texture2D backGround, moveableNode, attackableNode, gameOver, endTurnButton; private SpriteFont font; // custom font private SpriteFont largeFont; // custom font 2 private SpriteFont largestFont; // custom font 3 @@ -96,6 +96,7 @@ namespace Controller moveableNode = Content.Load<Texture2D>("moveableNode"); attackableNode = Content.Load<Texture2D>("attackableNode"); gameOver = Content.Load<Texture2D>("exit_game"); + endTurnButton = Content.Load<Texture2D>("End_Button"); font = Content.Load<SpriteFont>("PixelFont"); //loads font PixelFont largeFont = Content.Load<SpriteFont>("PixelFontLarge"); //loads font PixelFont @@ -555,6 +556,11 @@ namespace Controller } #endregion + if (GameState.endTurnButton) + { + spriteBatch.Draw(endTurnButton, GameState.endTurnButtonLocation, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + spriteBatch.Draw(backGround, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 1); diff --git a/src/Blaze-Brigade/Blaze_Brigade/GameState.cs b/src/Blaze-Brigade/Blaze_Brigade/GameState.cs index 7f940be122f035d7595e2203820cf2a4ba76a357..068a9def0cfadd2c45d4a83afee0e9ca1e420f66 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/GameState.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/GameState.cs @@ -1,4 +1,5 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -45,6 +46,10 @@ namespace Model */ public static bool inventoryOpen { get; set; } /** + Sets and gets whether end turn button is active + **/ + public static bool endTurnButton { 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; } @@ -61,6 +66,10 @@ namespace Model */ public static bool exitGameClicked { get; set; } /* + Sets and gets current mouse click position + */ + public static Vector2 endTurnButtonLocation { get; set; } + /* Sets and gets movable nodes that can be retrieved without calling path finding */ public static LinkedList<Node> moveableNodes { get; set; } diff --git a/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs b/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs index 12e37a16ff33aab119d5e10bd943dd8acb65d58d..0431db581816f10fc076027073f922a04c842dd1 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs @@ -83,10 +83,16 @@ namespace Controller GameState.unitToAttack = null; GameState.attackConfirmOpen = false; GameState.dropDownMenuOpen = false; + }else if(lastMouseState.RightButton == ButtonState.Released + && currentMouseState.RightButton == ButtonState.Pressed + && validX && validY) + { + GameState.endTurnButton = true; + GameState.endTurnButtonLocation = new Vector2(currentMouseState.X, currentMouseState.Y); } - // checks for single mouse left click inside the game window - if (lastMouseState.LeftButton == ButtonState.Released + // checks for single mouse left click inside the game window + if (lastMouseState.LeftButton == ButtonState.Released && currentMouseState.LeftButton == ButtonState.Pressed && validX && validY) { @@ -99,6 +105,25 @@ namespace Controller Vector2 mouseClickCoordinates = new Vector2(currentMouseState.X, currentMouseState.Y); // mouse click coordinates Node nodeClickedOn = graph.getNode(mouseClickCoordinates); + //if end turn is clicked + if (GameState.endTurnButton) + { + if(mouseClickCoordinates.X>GameState.endTurnButtonLocation.X && mouseClickCoordinates.X < GameState.endTurnButtonLocation.X + 128 + && mouseClickCoordinates.Y>GameState.endTurnButtonLocation.Y && mouseClickCoordinates.Y<GameState.endTurnButtonLocation.Y+32) + { + Player tempPlayer = GameState.currentPlayer; + GameState.currentPlayer = (GameState.enemyPlayer); + GameState.enemyPlayer = (tempPlayer); + GameFunction.startTurn(GameState.currentPlayer); + GameState.endTurnButton = false; + }else + { + GameState.endTurnButton = false; + } + } + + + if (GameState.gameOver) { if ((mouseClickCoordinates.X > 370 & mouseClickCoordinates.X < 556) & (mouseClickCoordinates.Y>300&mouseClickCoordinates.Y<396)){ @@ -106,7 +131,7 @@ namespace Controller } } - #region Check if a unit is clicked + #region Options when unit is clicked // if player clicks after unit is already selected ... if (GameState.playableUnitSelected) @@ -115,7 +140,6 @@ namespace Controller if (getMenuButtonClicked(mouseClickCoordinates) != null) { Button menuButton = getMenuButtonClicked(mouseClickCoordinates); - Debug.WriteLine(getMenuButtonClicked(mouseClickCoordinates).getButtonType()); buttonAction(menuButton, graph); return; } diff --git a/src/Blaze-Brigade/Blaze_Brigade/Resource1.Designer.cs b/src/Blaze-Brigade/Blaze_Brigade/Resource1.Designer.cs index 2010e1734fe67e99707a271d9a4ed8bc92cbb5dc..6750cdada7c233fe6f247b73a699bbd991793661 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Resource1.Designer.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Resource1.Designer.cs @@ -220,6 +220,16 @@ namespace Blaze_Brigade { } } + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap End_Button { + get { + object obj = ResourceManager.GetObject("End_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 2b55810c137234ac37ef6bc838e36a2a432c681a..7009ee5cd28422e7781d1c3c7bf90b3f1b7765ac 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Resource1.resx +++ b/src/Blaze-Brigade/Blaze_Brigade/Resource1.resx @@ -217,4 +217,7 @@ <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> + <data name="End_Button" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>Resources\End_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/End_Button.jpg b/src/Blaze-Brigade/Blaze_Brigade/Resources/End_Button.jpg new file mode 100644 index 0000000000000000000000000000000000000000..30469c73e5c1fb80ef291a718e09af7d9c4fcc1d Binary files /dev/null and b/src/Blaze-Brigade/Blaze_Brigade/Resources/End_Button.jpg differ diff --git a/src/Blaze-Brigade/Blaze_BrigadeContent/Blaze_BrigadeContent.contentproj b/src/Blaze-Brigade/Blaze_BrigadeContent/Blaze_BrigadeContent.contentproj index b11568f973c4460724f1369fd68769496f88c262..d720ad88fb38eda66db94b4b77bf7e18339a9d8f 100644 --- a/src/Blaze-Brigade/Blaze_BrigadeContent/Blaze_BrigadeContent.contentproj +++ b/src/Blaze-Brigade/Blaze_BrigadeContent/Blaze_BrigadeContent.contentproj @@ -282,6 +282,13 @@ <Processor>TextureProcessor</Processor> </Compile> </ItemGroup> + <ItemGroup> + <Compile Include="End_Button.jpg"> + <Name>End_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/End_Button.jpg b/src/Blaze-Brigade/Blaze_BrigadeContent/End_Button.jpg new file mode 100644 index 0000000000000000000000000000000000000000..30469c73e5c1fb80ef291a718e09af7d9c4fcc1d Binary files /dev/null and b/src/Blaze-Brigade/Blaze_BrigadeContent/End_Button.jpg differ diff --git a/src/Blaze-Brigade/Blaze_BrigadeContent/buttons/End_Button.jpg b/src/Blaze-Brigade/Blaze_BrigadeContent/buttons/End_Button.jpg new file mode 100644 index 0000000000000000000000000000000000000000..30469c73e5c1fb80ef291a718e09af7d9c4fcc1d Binary files /dev/null and b/src/Blaze-Brigade/Blaze_BrigadeContent/buttons/End_Button.jpg differ