diff --git a/.gitignore b/.gitignore index f926450..f702560 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ SolarFusion/SolarFusion/SolarFusionContent/obj/ SolarFusion/SolarFusion/SolarFusion/bin/ SolarFusion/GameData/obj/ SolarFusion/DataPipeline/obj/ +SolarFusion/DataPipeline/bin/ +SolarFusion/GameData/bin/x86/Debug/GameData.dll diff --git a/SolarFusion/GameData/LevelData/LevelTilemapData.cs b/SolarFusion/GameData/LevelData/LevelTilemapData.cs index 7d7aeab..d2e8741 100644 --- a/SolarFusion/GameData/LevelData/LevelTilemapData.cs +++ b/SolarFusion/GameData/LevelData/LevelTilemapData.cs @@ -18,7 +18,5 @@ public struct LevelTilemapData public float ScrollSpeed; public float LayerDepth; public LevelTileData[] TileData; - - } } diff --git a/SolarFusion/GameData/bin/Xbox 360/Debug/GameData.dll b/SolarFusion/GameData/bin/Xbox 360/Debug/GameData.dll new file mode 100644 index 0000000..2a56936 Binary files /dev/null and b/SolarFusion/GameData/bin/Xbox 360/Debug/GameData.dll differ diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Config/ConfigManager.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Config/ConfigManager.cs index d2edb5f..6ae6687 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Config/ConfigManager.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Config/ConfigManager.cs @@ -66,7 +66,7 @@ private void WIN32_ReadFile() } } } - catch (InvalidOperationException ex01) // Error reading and deserializing the file, so creates a new one. + catch (InvalidOperationException ex) // Error reading and deserializing the file, so creates a new one. { if (_stream != null) _stream.Close(); // Closes the stream if it exists. diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Entities/AI/AI.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Entities/AI/AI.cs index fb005fd..47b5a0f 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Entities/AI/AI.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Entities/AI/AI.cs @@ -39,7 +39,7 @@ public override void Update(GameTime gameTime) public override void Draw(SpriteBatch spriteBatch) { - animation.Draw(spriteBatch); + animation.Draw(spriteBatch, 1f); } public void moveLeft() diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Entities/AI/Enemy_MercBot.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Entities/AI/Enemy_MercBot.cs index 51b140f..511b2de 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Entities/AI/Enemy_MercBot.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Entities/AI/Enemy_MercBot.cs @@ -26,7 +26,7 @@ public Enemy_MercBot(uint id, ContentManager virtualContent, Vector2 position) this.animation.Scale = 1.5f; this.animation.CurrentAnimation = "idle"; this.animation.Loop = true; - //MERCBOT + this.Health = 100; this.Speed = 1f; } diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Entities/EntityManager.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Entities/EntityManager.cs index 2804b17..326d223 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Entities/EntityManager.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Entities/EntityManager.cs @@ -337,7 +337,7 @@ private void RemoveGameObject(GameObjects gameObject) { box = boundingBoxes[id]; } - catch (KeyNotFoundException e) + catch (KeyNotFoundException ex) { return; } diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Entities/General/Player.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Entities/General/Player.cs index 40463b4..e06482f 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Entities/General/Player.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Entities/General/Player.cs @@ -194,7 +194,7 @@ public override void Draw(SpriteBatch spriteBatch) { if (isHidden == false) { - playerAnimation.Draw(spriteBatch); + playerAnimation.Draw(spriteBatch, 1f); } } } diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Entities/PowerUps/PowerUp.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Entities/PowerUps/PowerUp.cs index 2e4cdf7..144d5e1 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Entities/PowerUps/PowerUp.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Entities/PowerUps/PowerUp.cs @@ -38,7 +38,7 @@ public override void Update(GameTime gameTime) } public override void Draw(SpriteBatch spriteBatch) { - animation.Draw(spriteBatch); + animation.Draw(spriteBatch, 1f); } } } diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Game.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Game.cs index f624b8c..962e537 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Game.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Game.cs @@ -26,13 +26,20 @@ public class Game : Microsoft.Xna.Framework.Game public Game() { this._obj_config = new ConfigManager(); - this.Window.Title = SysConfig.CONFIG_GAME_NAME; this.Content.RootDirectory = SysConfig.CONFIG_CONTENT_ROOT; try { this._obj_graphics = new GraphicsDeviceManager(this); + } + catch (Exception ex) + { + Environment.Exit(0); + } + + try + { this._obj_graphics.PreferredBackBufferWidth = this._obj_config.Settings.VIDEO_RES_WIDTH; this._obj_graphics.PreferredBackBufferHeight = this._obj_config.Settings.VIDEO_RES_HEIGHT; this._obj_graphics.IsFullScreen = this._obj_config.Settings.VIDEO_FULLSCREEN; @@ -54,7 +61,6 @@ public Game() this._obj_config.Settings.VIDEO_VSYNC = true; this._obj_config.Settings.VIDEO_DEPTH_STENCIL_BUFFER = (int)DepthFormat.Depth24Stencil8; #endif - this._obj_graphics = new GraphicsDeviceManager(this); this._obj_graphics.PreferredBackBufferWidth = this._obj_config.Settings.VIDEO_RES_WIDTH; this._obj_graphics.PreferredBackBufferHeight = this._obj_config.Settings.VIDEO_RES_HEIGHT; this._obj_graphics.IsFullScreen = this._obj_config.Settings.VIDEO_FULLSCREEN; diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Input/InputManager.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Input/InputManager.cs index f410e55..dcc7880 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Input/InputManager.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Input/InputManager.cs @@ -31,6 +31,7 @@ public InputManager() this.AddGamePadInput("NAV_CANCEL", SysConfig.INPUT_GAMEPAD_CANCEL, true); this.AddGamePadInput("GLOBAL_START", SysConfig.INPUT_GAMEPAD_START, false); + this.AddGamePadInput("GAME_PAUSE", SysConfig.INPUT_GAMEPAD_START, false); this.AddGamePadInput("PLAY_MOVE_LEFT", SysConfig.INPUT_GAMEPAD_LEFT_DPAD, false); this.AddGamePadInput("PLAY_MOVE_LEFT", SysConfig.INPUT_GAMEPAD_LEFT_STICK, false); @@ -48,6 +49,7 @@ public InputManager() this.AddKeyboardInput("NAV_CANCEL", SysConfig.INPUT_KEYBOARD_CANCEL, true); this.AddKeyboardInput("GLOBAL_START", SysConfig.INPUT_KEYBOARD_START, false); + this.AddKeyboardInput("GAME_PAUSE", SysConfig.INPUT_KEYBOARD_CANCEL, false); this.AddKeyboardInput("PLAY_MOVE_LEFT", SysConfig.INPUT_KEYBOARD_LEFT, false); this.AddKeyboardInput("PLAY_MOVE_RIGHT", SysConfig.INPUT_KEYBOARD_RIGHT, false); diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/DefaultScreens/ScreenMsgBox.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/DefaultScreens/ScreenMsgBox.cs index bfc3e33..0b0efbc 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/DefaultScreens/ScreenMsgBox.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/DefaultScreens/ScreenMsgBox.cs @@ -77,7 +77,7 @@ public ScreenMsgBox(string ptexture, string pmessage) /// public override void loadContent() { - this._message_bg = this.GlobalContentManager.Load(this._message_bg_file); + this._message_bg = this.GlobalContentManager.Load("Sprites/Misc/UI/Buttons/misc/blue_panel"); } /// diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/DefaultScreens/ScreenPause.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/DefaultScreens/ScreenPause.cs index 4b88e23..5d9d50f 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/DefaultScreens/ScreenPause.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/DefaultScreens/ScreenPause.cs @@ -2,22 +2,39 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace SolarFusion.Core.Screen { class ScreenPause : BaseGUIScreen { + //----------------CLASS CONSTANTS--------------------------------------------------------- + public const float DEFAULT_ALPHA = 2.0f / 3.0f; + public const int DEFAULT_PADDING_H = 32; + public const int DEFAULT_PADDING_V = 16; + public static readonly Color DEFAULT_COLOUR = Color.White; + + //----------------CLASS MEMBERS----------------------------------------------------------- + protected float _message_alpha; + //-----------------CONSTRUCTOR---------------------------------------------------------------- /// /// Constructor. /// public ScreenPause() - : base("- PAUSED -", false, null) + : base("- PAUSED -", false, null, false, 1f) + { + this._message_alpha = DEFAULT_ALPHA; + } + + public override void loadContent() { // Create our menu entries. - MenuItemBasic tentryresume = new MenuItemBasic("Resume"); - MenuItemBasic tentryquit = new MenuItemBasic("Exit"); + MenuItemBasic tentryresume = new MenuItemBasic("RESUME", this.GlobalContentManager); + MenuItemBasic tentryquit = new MenuItemBasic("EXIT", this.GlobalContentManager); // Hook up menu event handlers. tentryresume.OnSelected += DefaultTriggerMenuBack; @@ -26,6 +43,15 @@ public ScreenPause() // Add entries to the menu. this._list_menuitems.Add(tentryresume); this._list_menuitems.Add(tentryquit); + + this.BGColour = Color.Black; + base.loadContent(); + } + + public override void render() + { + this.ScreenManager.fadeBackBuffer(this.CurrentTransitionAlpha * this._message_alpha); + base.render(); } //-----------------EVENT HANDLER DELEGATES--------------------------------------------------- diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GUIScreens/ScreenCredits.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GUIScreens/ScreenCredits.cs index bac3707..879c03c 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GUIScreens/ScreenCredits.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GUIScreens/ScreenCredits.cs @@ -2,17 +2,25 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace SolarFusion.Core.Screen { class ScreenCredits : BaseGUIScreen { public ScreenCredits() - : base("CREDITS", false, null) + : base("CREDITS", Color.White, true, "System/UI/Logos/static_dimensionalwave", true, 1f) { } + public override void loadContent() + { + base.loadContent(); + //load credits + } + public override void update() { if(this.GlobalInput.IsPressed("NAV_CANCEL", this.ControllingPlayer)) //If player presses cancel button (Escape/B) diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GUIScreens/ScreenMenuRoot.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GUIScreens/ScreenMenuRoot.cs index 472d9c4..dcc610a 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GUIScreens/ScreenMenuRoot.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GUIScreens/ScreenMenuRoot.cs @@ -12,19 +12,17 @@ namespace SolarFusion.Core.Screen { class ScreenMenuRoot : BaseGUIScreen { - List mAnimatedBGObjects = null; - ContentManager _content = null; - Random _obj_random = null; - public ScreenMenuRoot() - : base("Root_Menu", true, "System/UI/Logos/static_jumpista") + : base("Root_Menu", true, "System/UI/Logos/static_jumpista", true, 0.5f) { - _obj_random = new Random(); + } - MenuItemBasic mi_play = new MenuItemBasic("Play"); - MenuItemBasic mi_options = new MenuItemBasic("Options"); - MenuItemBasic mi_credits = new MenuItemBasic("Credits"); - MenuItemBasic mi_exit = new MenuItemBasic("Exit"); + public override void loadContent() + { + MenuItemBasic mi_play = new MenuItemBasic("PLAY", this.GlobalContentManager); + MenuItemBasic mi_options = new MenuItemBasic("OPTIONS", this.GlobalContentManager); + MenuItemBasic mi_credits = new MenuItemBasic("CREDITS", this.GlobalContentManager); + MenuItemBasic mi_exit = new MenuItemBasic("EXIT", this.GlobalContentManager); mi_play.OnSelected += EventTriggerGoToCharSelect; mi_options.OnSelected += EventTriggerGoToOptions; @@ -35,131 +33,17 @@ public ScreenMenuRoot() this._list_menuitems.Add(mi_options); this._list_menuitems.Add(mi_credits); this._list_menuitems.Add(mi_exit); - } - - public override void loadContent() - { - if (this._content == null) - this._content = new ContentManager(ScreenManager.Game.Services, SysConfig.CONFIG_CONTENT_ROOT); - - this.mAnimatedBGObjects = new List(); - - bool IsSelectedUnique = false; - - for (int i = 0; i < 20; i++) - { - int randItem = this._obj_random.Next(0, 2); - - int randDirX = this._obj_random.Next(0, 2); // 0 = Left to Right, 1 = Right to Left - float randPosX = 0f; - float randPosY = 0f; - int randRotDir = this._obj_random.Next(0, 2); // 0 = Left to Right, 1 = Right to Left - float randRotSpeed = (float)((this._obj_random.NextDouble() * Math.Abs(0.04 - 0.01)) + 0.01); // Generate random rotation speed between 0.01 and 0.06 every frame. - - if(randDirX == 0) - randPosX = (float)(this._obj_random.Next(-300, ScreenManager.GraphicsDevice.Viewport.Width) - ScreenManager.GraphicsDevice.Viewport.Width); - else - randPosX = (float)(this._obj_random.Next(0, ScreenManager.GraphicsDevice.Viewport.Width) + ScreenManager.GraphicsDevice.Viewport.Width); - - randPosY = (float)this._obj_random.Next(0, ScreenManager.GraphicsDevice.Viewport.Height); - - switch (randItem) - { - case 0: //Grandfather clock - this.mAnimatedBGObjects.Add(new AnimatedBGEntity(this._content.Load("Sprites/Misc/Animated/anim_grandfather_clock"), 4, 1, (float)((this._obj_random.NextDouble() * 10) - 5), new Vector2(randPosX, randPosY), this._obj_random.Next(0, 4), 4, 1f, 1f, randDirX, 0, randRotDir, randRotSpeed)); - break; - case 1: //Other items - this.mAnimatedBGObjects.Add(new AnimatedBGEntity(this._content.Load("Sprites/Misc/Animated/anim_coin"), 9, 1, (float)((this._obj_random.NextDouble() * 10) - 5), new Vector2(randPosX, randPosY), this._obj_random.Next(0, 10), 20, 1f, 1f, randDirX, 0, randRotDir, randRotSpeed)); - break; - } - - if (IsSelectedUnique == false) - { - IsSelectedUnique = true; - - int randItemUnique = this._obj_random.Next(0, 1); - int randDirXUnique = this._obj_random.Next(0, 2); // 0 = Left to Right, 1 = Right to Left - float randPosXUnique = 0f; - float randPosYUnique = 0f; - int randRotDirUnique = this._obj_random.Next(0, 2); // 0 = Left to Right, 1 = Right to Left - float randRotSpeedUnique = (float)((this._obj_random.NextDouble() * Math.Abs(0.04 - 0.01)) + 0.01); // Generate random rotation speed between 0.01 and 0.06 every frame. - - if (randPosXUnique == 0) - randPosXUnique = (float)(this._obj_random.Next(-300, ScreenManager.GraphicsDevice.Viewport.Width) - ScreenManager.GraphicsDevice.Viewport.Width); - else - randPosXUnique = (float)(this._obj_random.Next(0, ScreenManager.GraphicsDevice.Viewport.Width) + ScreenManager.GraphicsDevice.Viewport.Width); - - randPosYUnique = (float)this._obj_random.Next(0, ScreenManager.GraphicsDevice.Viewport.Height); - - switch (randItemUnique) - { - case 0: //Megaman - this.mAnimatedBGObjects.Add(new AnimatedBGEntity(this._content.Load("Sprites/Misc/Unique/anim_megaman"), 8, 1, (float)((_obj_random.NextDouble() * 10) - 5), new Vector2(randPosXUnique, randPosYUnique), _obj_random.Next(0, 9), 24, 1f, 1f, randDirXUnique, 0, randRotDirUnique, randRotSpeedUnique)); - break; - } - } - } base.loadContent(); } public override void update() { - if (this.mAnimatedBGObjects != null) - { - foreach (AnimatedBGEntity entity in this.mAnimatedBGObjects) - { - entity.Update(GlobalGameTimer); - - if (entity.RotationDirection == 0) - entity.Animation.Rotation += entity.RotationSpeed; //Rotate Left to Right - else - entity.Animation.Rotation -= entity.RotationSpeed; //Rotate Right to Left - - if (entity.DirectionX == 0) //Left to Right - { - if (entity.Animation.Position.X > ScreenManager.GraphicsDevice.Viewport.Width + (entity.Animation.AnimationWidth + entity.Animation.AnimationHeight)) - { - entity.Animation.Position = new Vector2(entity.Animation.Position.X - (ScreenManager.GraphicsDevice.Viewport.Width + entity.Animation.AnimationWidth + entity.Animation.AnimationHeight + 100), entity.Animation.Position.Y); - } - else - { - entity.Animation.Position = new Vector2(entity.Animation.Position.X + entity.GetSpeedX, entity.Animation.Position.Y); - } - } - else //Right to Left - { - if (entity.Animation.Position.X < 0 - (entity.Animation.AnimationWidth + entity.Animation.AnimationHeight)) - { - entity.Animation.Position = new Vector2(entity.Animation.Position.X + (ScreenManager.GraphicsDevice.Viewport.Width + entity.Animation.AnimationWidth + entity.Animation.AnimationHeight + 100), entity.Animation.Position.Y); - } - else - { - entity.Animation.Position = new Vector2(entity.Animation.Position.X - entity.GetSpeedX, entity.Animation.Position.Y); - } - } - } - } - base.update(); } public override void render() { - GraphicsDevice tgd = ScreenManager.GraphicsDevice; - SpriteBatch tsb = ScreenManager.SpriteBatch; - tsb.Begin(); - - if (mAnimatedBGObjects != null) - { - foreach (AnimatedBGEntity entity in mAnimatedBGObjects) - { - entity.Draw(tsb); - } - } - - tsb.End(); - base.render(); } diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GUIScreens/ScreenOptions.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GUIScreens/ScreenOptions.cs index 110aed3..4976176 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GUIScreens/ScreenOptions.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GUIScreens/ScreenOptions.cs @@ -2,13 +2,15 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace SolarFusion.Core.Screen { class ScreenOptions : BaseGUIScreen { public ScreenOptions() - : base("Options", false, null) + : base("OPTIONS", Color.White, false, null, true, 1f) { } diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GameScreens/ScreenCharSelect.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GameScreens/ScreenCharSelect.cs index 20f6672..16b95dd 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GameScreens/ScreenCharSelect.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/GameScreens/ScreenCharSelect.cs @@ -2,37 +2,68 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace SolarFusion.Core.Screen { class ScreenCharSelect : BaseGUIScreen { + MenuItemCharacterSelect _obj_selector; + public ScreenCharSelect() - : base("Character Select", false, null) + : base("Character Select", Color.White, false, null, false, 1f) { + } + public override void loadContent() + { + this._obj_selector = new MenuItemCharacterSelect(this.ScreenManager.ContentManager, this.ScreenManager.GameViewport); + this._obj_selector.OnIncrement += EventTriggerNextCharacter; + this._obj_selector.OnDecrement += EventTriggerPreviousCharacter; + base.loadContent(); } public override void update() { + this._obj_selector.update(this); + + if (this.GlobalInput.IsPressed("NAV_RIGHT", this.ControllingPlayer)) + this._obj_selector.OnIncrementEntry(this.ControllingPlayer); + else if (this.GlobalInput.IsPressed("NAV_LEFT", this.ControllingPlayer)) + this._obj_selector.OnDecrementEntry(this.ControllingPlayer); + if (this.GlobalInput.IsPressed("NAV_SELECT", this.ControllingPlayer)) //If player presses cancel button (Escape/B) - { ScreenLoading.Load(this.ScreenManager, "-LOADING-", true, this.ControllingPlayer, new ScreenGame()); //Load Game - } if (this.GlobalInput.IsPressed("NAV_CANCEL", this.ControllingPlayer)) //If player presses cancel button (Escape/B) - { this.exitScreen(); //Exit the screen. - } base.update(); } public override void render() { - + this._obj_selector.render(this); base.render(); } + + + /// + /// Event Handler to show next character. + /// + void EventTriggerNextCharacter(object sender, EventPlayer e) + { + + } + + /// + /// Event Handler to show previous character. + /// + void EventTriggerPreviousCharacter(object sender, EventPlayer e) + { + + } } } diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/BaseGUIScreen.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/BaseGUIScreen.cs index ece34a6..7638e62 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/BaseGUIScreen.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/BaseGUIScreen.cs @@ -29,10 +29,20 @@ public abstract class BaseGUIScreen : BaseScreen protected Color _menu_title_clr = Color.White; protected int _menu_title_start; protected int _menu_item_start; + protected float _menu_item_logo_scale = 1f; protected string _menu_item_logo_location = ""; protected Texture2D _menu_item_logo = null; protected ContentManager _content = null; - + List mAnimatedBGObjects = null; + Random _obj_random = null; + bool _is_animated_bg; + + //Load Support Buttons + protected Dictionary _menu_supportIcons; + protected Dictionary _menu_supportPos; + protected Dictionary _menu_supportMsg; + protected Dictionary _menu_supportMsgOrigin; + protected Dictionary _menu_supportMsgPos; //----------------CONSTRUCTORS--------------------------------------------------------- @@ -44,7 +54,7 @@ public abstract class BaseGUIScreen : BaseScreen /// The Title vertical start position /// The Transition on time /// - public BaseGUIScreen(string pmenutitle, Color ptitleclr, bool IsLogo, string logoLocation) + public BaseGUIScreen(string pmenutitle, Color ptitleclr, bool IsLogo, string logoLocation, bool animBG, float logoScale) { this._menu_title_txt = pmenutitle; this._trans_on_time = TimeSpan.FromSeconds(DEFAULT_TRANS_TIME); @@ -52,6 +62,9 @@ public BaseGUIScreen(string pmenutitle, Color ptitleclr, bool IsLogo, string log this._menu_title_start = DEFAULT_TITLE_START; this._menu_item_start = DEFAULT_MENU_START; this._menu_title_clr = ptitleclr; + this._obj_random = new Random(); + this._menu_item_logo_scale = logoScale; + this._is_animated_bg = animBG; if(IsLogo) this._menu_item_logo_location = logoLocation; @@ -80,8 +93,8 @@ public float TransitionTime /// Partial Constructor which sets the title text. /// The Menu Title Text /// - public BaseGUIScreen(string pmenutitle, bool IsLogo, string logoLocation) - : this(pmenutitle, DEFAULT_MENU_COLOUR, IsLogo, logoLocation) + public BaseGUIScreen(string pmenutitle, bool IsLogo, string logoLocation, bool animBG, float logoScale) + : this(pmenutitle, DEFAULT_MENU_COLOUR, IsLogo, logoLocation, animBG, logoScale) {} //----------------METHOD OVERRIDES---------------------------------------------------- @@ -96,6 +109,93 @@ public override void loadContent() if (this._menu_item_logo_location != "") this._menu_item_logo = this._content.Load(_menu_item_logo_location); + + this._menu_supportIcons = new Dictionary(); + this._menu_supportPos = new Dictionary(); + this._menu_supportMsg = new Dictionary(); + this._menu_supportMsgOrigin = new Dictionary(); + this._menu_supportMsgPos = new Dictionary(); + + this._menu_supportMsg.Add("GO", "OK"); + this._menu_supportMsg.Add("BACK", "CANCEL"); + + this._menu_supportMsgOrigin.Add("GO", ScreenManager.DefaultGUIFont.MeasureString(this._menu_supportMsg["GO"])); + this._menu_supportMsgOrigin.Add("BACK", ScreenManager.DefaultGUIFont.MeasureString(this._menu_supportMsg["BACK"])); + +#if WINDOWS + this._menu_supportIcons.Add("GO", this._content.Load("Sprites/Misc/UI/ControlButtons/Keyboard/enter")); + this._menu_supportIcons.Add("BACK", this._content.Load("Sprites/Misc/UI/ControlButtons/Keyboard/esc")); +#else + this._menu_supportIcons.Add("GO", this._content.Load("Sprites/Misc/UI/ControlButtons/Gamepad/xboxControllerButtonA")); + this._menu_supportIcons.Add("BACK", this._content.Load("Sprites/Misc/UI/ControlButtons/Gamepad/xboxControllerButtonB")); +#endif + + this._menu_supportPos.Add("GO", new Vector2(((this._menu_supportIcons["GO"].Width / 2f) + 5), this.ScreenManager.GameViewport.Height - ((this._menu_supportIcons["GO"].Height / 2) + 5))); + this._menu_supportPos.Add("BACK", new Vector2(this.ScreenManager.GameViewport.Width - ((this._menu_supportIcons["BACK"].Width / 2f) + 5), this.ScreenManager.GameViewport.Height - ((this._menu_supportIcons["BACK"].Height / 2) + 5))); + + this._menu_supportMsgPos.Add("GO", new Vector2((this._menu_supportPos["GO"].X + (this._menu_supportIcons["GO"].Width /2f)), this._menu_supportPos["GO"].Y)); + this._menu_supportMsgPos.Add("BACK", new Vector2((this._menu_supportPos["BACK"].X - (this._menu_supportIcons["BACK"].Width /2f)), this._menu_supportPos["BACK"].Y)); + + if (this.mAnimatedBGObjects == null && this._is_animated_bg) + { + //Animated BG + this.mAnimatedBGObjects = new List(); + bool IsSelectedUnique = false; + for (int i = 0; i < 20; i++) + { + int randItem = this._obj_random.Next(0, 2); + + int randDirX = this._obj_random.Next(0, 2); // 0 = Left to Right, 1 = Right to Left + float randPosX = 0f; + float randPosY = 0f; + int randRotDir = this._obj_random.Next(0, 2); // 0 = Left to Right, 1 = Right to Left + float randRotSpeed = (float)((this._obj_random.NextDouble() * Math.Abs(0.04 - 0.01)) + 0.01); // Generate random rotation speed between 0.01 and 0.06 every frame. + + if (randDirX == 0) + randPosX = (float)(this._obj_random.Next(-300, ScreenManager.GraphicsDevice.Viewport.Width) - ScreenManager.GraphicsDevice.Viewport.Width); + else + randPosX = (float)(this._obj_random.Next(0, ScreenManager.GraphicsDevice.Viewport.Width) + ScreenManager.GraphicsDevice.Viewport.Width); + + randPosY = (float)this._obj_random.Next(0, ScreenManager.GraphicsDevice.Viewport.Height); + + switch (randItem) + { + case 0: //Grandfather clock + this.mAnimatedBGObjects.Add(new AnimatedBGEntity(this._content.Load("Sprites/Misc/Animated/anim_grandfather_clock"), 4, 1, (float)((this._obj_random.NextDouble() * 10) - 5), new Vector2(randPosX, randPosY), this._obj_random.Next(0, 4), 4, 1f, 1f, randDirX, 0, randRotDir, randRotSpeed)); + break; + case 1: //Other items + this.mAnimatedBGObjects.Add(new AnimatedBGEntity(this._content.Load("Sprites/Misc/Animated/anim_coin"), 9, 1, (float)((this._obj_random.NextDouble() * 10) - 5), new Vector2(randPosX, randPosY), this._obj_random.Next(0, 10), 20, 1f, 1f, randDirX, 0, randRotDir, randRotSpeed)); + break; + } + + if (IsSelectedUnique == false) + { + IsSelectedUnique = true; + + int randItemUnique = this._obj_random.Next(0, 1); + int randDirXUnique = this._obj_random.Next(0, 2); // 0 = Left to Right, 1 = Right to Left + float randPosXUnique = 0f; + float randPosYUnique = 0f; + int randRotDirUnique = this._obj_random.Next(0, 2); // 0 = Left to Right, 1 = Right to Left + float randRotSpeedUnique = (float)((this._obj_random.NextDouble() * Math.Abs(0.04 - 0.01)) + 0.01); // Generate random rotation speed between 0.01 and 0.06 every frame. + + if (randPosXUnique == 0) + randPosXUnique = (float)(this._obj_random.Next(-300, ScreenManager.GraphicsDevice.Viewport.Width) - ScreenManager.GraphicsDevice.Viewport.Width); + else + randPosXUnique = (float)(this._obj_random.Next(0, ScreenManager.GraphicsDevice.Viewport.Width) + ScreenManager.GraphicsDevice.Viewport.Width); + + randPosYUnique = (float)this._obj_random.Next(0, ScreenManager.GraphicsDevice.Viewport.Height); + + switch (randItemUnique) + { + case 0: //Megaman + this.mAnimatedBGObjects.Add(new AnimatedBGEntity(this._content.Load("Sprites/Misc/Unique/anim_megaman"), 8, 1, (float)((_obj_random.NextDouble() * 10) - 5), new Vector2(randPosXUnique, randPosYUnique), _obj_random.Next(0, 9), 24, 1f, 1f, randDirXUnique, 0, randRotDirUnique, randRotSpeedUnique)); + break; + } + } + } + //Animated BG + } } /// @@ -118,7 +218,6 @@ public override void bgUpdate(bool potherfocused, bool poverlaid) /// public override void update() { - // Move to the previous menu entry? if (this.GlobalInput.IsPressed("NAV_UP", this.ControllingPlayer)) { @@ -155,6 +254,42 @@ public override void update() { this.OnCancel(ControllingPlayer); } + + if (this.mAnimatedBGObjects != null) + { + foreach (AnimatedBGEntity entity in this.mAnimatedBGObjects) + { + entity.Update(GlobalGameTimer); + + if (entity.RotationDirection == 0) + entity.Animation.Rotation += entity.RotationSpeed; //Rotate Left to Right + else + entity.Animation.Rotation -= entity.RotationSpeed; //Rotate Right to Left + + if (entity.DirectionX == 0) //Left to Right + { + if (entity.Animation.Position.X > ScreenManager.GraphicsDevice.Viewport.Width + (entity.Animation.AnimationWidth + entity.Animation.AnimationHeight)) + { + entity.Animation.Position = new Vector2(entity.Animation.Position.X - (ScreenManager.GraphicsDevice.Viewport.Width + entity.Animation.AnimationWidth + entity.Animation.AnimationHeight + 100), entity.Animation.Position.Y); + } + else + { + entity.Animation.Position = new Vector2(entity.Animation.Position.X + entity.GetSpeedX, entity.Animation.Position.Y); + } + } + else //Right to Left + { + if (entity.Animation.Position.X < 0 - (entity.Animation.AnimationWidth + entity.Animation.AnimationHeight)) + { + entity.Animation.Position = new Vector2(entity.Animation.Position.X + (ScreenManager.GraphicsDevice.Viewport.Width + entity.Animation.AnimationWidth + entity.Animation.AnimationHeight + 100), entity.Animation.Position.Y); + } + else + { + entity.Animation.Position = new Vector2(entity.Animation.Position.X - entity.GetSpeedX, entity.Animation.Position.Y); + } + } + } + } } @@ -169,8 +304,18 @@ public override void render() GraphicsDevice tgd = ScreenManager.GraphicsDevice; SpriteBatch tsb = ScreenManager.SpriteBatch; SpriteFont tfont = ScreenManager.DefaultGUIFont; + Color _alphaMixer = Color.White; + _alphaMixer *= this.CurrentTransitionAlpha; tsb.Begin(); + if (mAnimatedBGObjects != null) + { + foreach (AnimatedBGEntity entity in mAnimatedBGObjects) + { + entity.Draw(tsb, this.CurrentTransitionAlpha); + } + } + for (int i = 0; i < this._list_menuitems.Count; i++) { MenuItemBasic tmenuitem = this._list_menuitems[i]; @@ -182,12 +327,10 @@ public override void render() Vector2 ttitlepos = Vector2.Zero; Vector2 ttitleorigin = Vector2.Zero; - float ttitlescale = 1f; Color ttitlecolour = Color.Black; ttitleorigin = tfont.MeasureString(this._menu_title_txt) / 2; ttitlecolour = this._menu_title_clr * this.CurrentTransitionAlpha; - ttitlescale = 1.25f; ttitlepos.Y -= ttransoffset * 100; if (_menu_item_logo == null) @@ -195,18 +338,23 @@ public override void render() else { ttitlepos = new Vector2(tgd.Viewport.Width / 2, this._menu_title_start); - ttitlescale = 0.5f; ttitleorigin = new Vector2(this._menu_item_logo.Width / 2, this._menu_item_logo.Height / 2); } if (_menu_item_logo == null) - tsb.DrawString(tfont, this._menu_title_txt, ttitlepos, ttitlecolour, 0, ttitleorigin, ttitlescale, SpriteEffects.None, 0); + tsb.DrawString(tfont, this._menu_title_txt, ttitlepos, ttitlecolour, 0, ttitleorigin, this._menu_item_logo_scale, SpriteEffects.None, 0); else { Rectangle tlogorec = new Rectangle(tgd.Viewport.Width / 2, this._menu_title_start, _menu_item_logo.Width, _menu_item_logo.Height); - tsb.Draw(this._menu_item_logo, ttitlepos, null, ttitlecolour, 0f, ttitleorigin, ttitlescale, SpriteEffects.None, 0); + tsb.Draw(this._menu_item_logo, ttitlepos, null, ttitlecolour, 0f, ttitleorigin, this._menu_item_logo_scale, SpriteEffects.None, 0); } + tsb.Draw(this._menu_supportIcons["BACK"], this._menu_supportPos["BACK"], null, _alphaMixer, 0f, new Vector2(this._menu_supportIcons["BACK"].Width / 2f, this._menu_supportIcons["BACK"].Height / 2f), 0.5f, SpriteEffects.None, 0); + tsb.DrawString(tfont, this._menu_supportMsg["BACK"], this._menu_supportMsgPos["BACK"], _alphaMixer, 0, new Vector2(this._menu_supportMsgOrigin["BACK"].X, this._menu_supportMsgOrigin["BACK"].Y / 2f), 0.5f, SpriteEffects.None, 0); + + tsb.Draw(this._menu_supportIcons["GO"], this._menu_supportPos["GO"], null, _alphaMixer, 0f, new Vector2(this._menu_supportIcons["GO"].Width / 2f, this._menu_supportIcons["GO"].Height / 2f), 0.5f, SpriteEffects.None, 0); + tsb.DrawString(tfont, this._menu_supportMsg["GO"], this._menu_supportMsgPos["GO"], _alphaMixer, 0, new Vector2(0, this._menu_supportMsgOrigin["GO"].Y / 2f), 0.5f, SpriteEffects.None, 0); + tsb.End(); } @@ -249,7 +397,8 @@ protected virtual void OnDecrementEntry(int pitemindex, PlayerIndex? pplyrindex) /// The Index of the Controlling Player protected virtual void OnIncrementEntry(int pitemindex, PlayerIndex? pplyrindex) { - this._list_menuitems[pitemindex].OnIncrementEntry(pplyrindex); + if (this._list_menuitems.Count > 0) + this._list_menuitems[pitemindex].OnIncrementEntry(pplyrindex); } diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/BaseScreen.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/BaseScreen.cs index 7fef672..ee1e22d 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/BaseScreen.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/BaseScreen.cs @@ -349,7 +349,7 @@ protected virtual void updateScreenFade(bool poverlaid) /// protected virtual void checkForPauseAction() { - if (this.GlobalInput.IsPressed("GAME_START", this.ControllingPlayer)) + if (this.GlobalInput.IsPressed("GAME_PAUSE", this.ControllingPlayer)) ScreenManager.addScreen(new ScreenPause(), this.ControllingPlayer); } diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/AnimatedBGEntity.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/AnimatedBGEntity.cs index 3bb7370..a4430e5 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/AnimatedBGEntity.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/AnimatedBGEntity.cs @@ -81,9 +81,9 @@ public void Update(GameTime gt) baseAnimation.Update(gt); } - public void Draw(SpriteBatch sb) + public void Draw(SpriteBatch sb, float alpha) { - baseAnimation.Draw(sb); + baseAnimation.Draw(sb, alpha); } } } diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/MenuItemBasic.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/MenuItemBasic.cs index 09d0d09..c2f2840 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/MenuItemBasic.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/MenuItemBasic.cs @@ -1,6 +1,7 @@ using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Content; namespace SolarFusion.Core.Screen { @@ -8,7 +9,7 @@ public class MenuItemBasic { //--------------CLASS CONSTANTS------------------------------------------------------- public static readonly Color DEF_COLOUR_NORMAL = Color.White; - public static readonly Color DEF_COLOUR_SELECTED = Color.Turquoise; + public static readonly Color DEF_COLOUR_SELECTED = new Color(46, 46, 46); //--------------CLASS MEMBERS--------------------------------------------------------- protected string _item_text; @@ -17,7 +18,12 @@ public class MenuItemBasic protected Color _item_colour_def; protected Color _item_colour_selected; protected float _item_pulse_rate; - + protected Texture2D _item_background; + protected Texture2D _item_background_pressed; + protected Texture2D _item_background_selected; + protected float _item_press_time; + protected float _item_press_time_passed; + protected bool _item_pressed; //--------------CLASS EVENTS---------------------------------------------------------- public event EventHandler OnSelected; @@ -34,11 +40,16 @@ public class MenuItemBasic /// The selected colour of the menu /// The pulse rate of the menu /// - public MenuItemBasic(string pitemtext,Color pnormal,Color pselected) + public MenuItemBasic(string pitemtext, Color pnormal, Color pselected, ContentManager _content) { this._item_text = pitemtext; this._item_colour_def = pnormal; this._item_colour_selected = pselected; + this._item_background = _content.Load("Sprites/Misc/UI/Buttons/rectangle/blue_01_btn"); + this._item_background_pressed = _content.Load("Sprites/Misc/UI/Buttons/rectangle/blue_01_btn_press"); + this._item_background_selected = _content.Load("Sprites/Misc/UI/Buttons/rectangle/yellow_01_btn"); + this._item_press_time = 120; //Time in Miliseconds + } /// @@ -47,7 +58,7 @@ public MenuItemBasic(string pitemtext,Color pnormal,Color pselected) /// and the pulse rate. /// The text of the menu item. /// - public MenuItemBasic(string pitemtext) : this(pitemtext,DEF_COLOUR_NORMAL,DEF_COLOUR_SELECTED) + public MenuItemBasic(string pitemtext, ContentManager _content) : this(pitemtext,DEF_COLOUR_NORMAL,DEF_COLOUR_SELECTED, _content) { } @@ -101,6 +112,16 @@ public virtual void update(BaseGUIScreen pscreen, bool pselected) { float tfadespeed = (float)pscreen.GlobalGameTimer.ElapsedGameTime.TotalSeconds * this._item_pulse_rate; + if (this._item_pressed) + { + this._item_press_time_passed += (float)pscreen.GlobalGameTimer.ElapsedGameTime.TotalMilliseconds; + if (this._item_press_time_passed > this._item_press_time) + { + this._item_pressed = false; + this._item_press_time_passed = 0; + } + } + if (pselected) this._item_fade = Math.Min(this._item_fade + tfadespeed, 1); else @@ -117,12 +138,34 @@ public virtual void render(BaseGUIScreen pscreen, bool pselected) { // Draw the selected entry in yellow, otherwise white. Color tmenuitemclr = pselected ? this._item_colour_selected : this._item_colour_def; + Color tmenuimgclr = this._item_colour_def; + Vector2 tmenuposaddition = Vector2.Zero; // Modify the alpha to fade text out during transitions. tmenuitemclr *= pscreen.CurrentTransitionAlpha; + tmenuimgclr *= pscreen.CurrentTransitionAlpha; + + if (this._item_pressed) + { + pscreen.ScreenManager.SpriteBatch.Draw(this._item_background_pressed, this._item_pos, null, tmenuimgclr, 0f, new Vector2(this._item_background_pressed.Width / 2, (this._item_background_pressed.Height / 2) - 3), 0.8f, SpriteEffects.None, 0); + tmenuposaddition = new Vector2(0, 2); + } + else + { + if (pselected) + { + pscreen.ScreenManager.SpriteBatch.Draw(this._item_background_selected, this._item_pos, null, tmenuimgclr, 0f, new Vector2(this._item_background_selected.Width / 2, (this._item_background_selected.Height / 2) - 3), 0.8f, SpriteEffects.None, 0); + } + else + { + pscreen.ScreenManager.SpriteBatch.Draw(this._item_background, this._item_pos, null, tmenuimgclr, 0f, new Vector2(this._item_background.Width / 2, (this._item_background.Height / 2) - 3), 0.8f, SpriteEffects.None, 0); + } + } + + Vector2 textSize = pscreen.ScreenManager.DefaultGUIFont.MeasureString(this._item_text); Vector2 torigin = new Vector2(textSize.X / 2f, pscreen.ScreenManager.DefaultGUIFont.LineSpacing / 2); - pscreen.ScreenManager.SpriteBatch.DrawString(pscreen.ScreenManager.DefaultGUIFont, this._item_text, this._item_pos, tmenuitemclr, 0, torigin, 0.7f, SpriteEffects.None, 0); + pscreen.ScreenManager.SpriteBatch.DrawString(pscreen.ScreenManager.DefaultGUIFont, this._item_text, this._item_pos + tmenuposaddition, tmenuitemclr, 0, torigin, 0.7f, SpriteEffects.None, 0); } //------------------PUBLIC METHODS----------------------------------------------------------------------- @@ -154,7 +197,10 @@ public virtual int getMenuItemWidth(BaseGUIScreen pscreen) protected internal virtual void OnSelectEntry(PlayerIndex? pplayerindex) { if (this.OnSelected != null) + { this.OnSelected(this, new EventPlayer(pplayerindex)); + this._item_pressed = true; + } } /// diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/MenuItemCharacterSelect.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/MenuItemCharacterSelect.cs new file mode 100644 index 0000000..238a2d0 --- /dev/null +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/MenuItemCharacterSelect.cs @@ -0,0 +1,181 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Content; + +namespace SolarFusion.Core.Screen +{ + public class MenuItemCharacterSelect + { + //--------------CLASS CONSTANTS------------------------------------------------------- + public static readonly Color DEF_COLOUR_NORMAL = Color.White; + + //--------------CLASS MEMBERS--------------------------------------------------------- + protected float _item_fade; + protected Color _item_colour_def; + + protected Vector2 _item_text_pos; + protected string _item_text; + + protected Vector2 _item_box_pos; + protected Texture2D _item_box_tex; + + protected Vector2 _item_selector_left_pos; + protected Texture2D _item_selector_left_tex; + protected Texture2D _item_selector_left_tex_press; + protected Vector2 _item_selector_right_pos; + protected Texture2D _item_selector_right_tex; + protected Texture2D _item_selector_right_tex_press; + + protected float _item_press_time; + protected float _item_press_time_passed; + protected bool _item_pressed_left; + protected bool _item_pressed_right; + + //--------------CLASS EVENTS---------------------------------------------------------- + public event EventHandler OnSelected; + public event EventHandler OnIncrement; + public event EventHandler OnDecrement; + + //--------------CONSTRUCTORS---------------------------------------------------------- + + /// + /// Get/Set the Menu Text + /// + public string Text + { + get { return _item_text; } + set { _item_text = value; } + } + + /// + /// Constructs a new menu entry with the specified text, + /// this is the full constructor, allowing each property to be set. + /// The menu item text + /// The normal colour of the menu + /// The selected colour of the menu + /// The pulse rate of the menu + /// + public MenuItemCharacterSelect(Color pnormal, ContentManager _content, Viewport _vp) + { + this._item_colour_def = pnormal; + this._item_box_tex = _content.Load("Sprites/Misc/UI/Buttons/misc/blank_panel"); + this._item_selector_left_tex = _content.Load("Sprites/Misc/UI/Buttons/elements/blue_sliderLeft"); + this._item_selector_right_tex = _content.Load("Sprites/Misc/UI/Buttons/elements/blue_sliderRight"); + this._item_selector_left_tex_press = _content.Load("Sprites/Misc/UI/Buttons/elements/yellow_sliderLeft"); + this._item_selector_right_tex_press = _content.Load("Sprites/Misc/UI/Buttons/elements/yellow_sliderRight"); + this._item_press_time = 80; //Time in Miliseconds + + Vector2 tmp_vp_center = new Vector2(_vp.Width / 2f, _vp.Height / 2f); + float tmp_offset_center_x = 160f; + float tmp_offset_center_y = 160f; + + this._item_box_pos = tmp_vp_center; + this._item_selector_left_pos = new Vector2(tmp_vp_center.X - tmp_offset_center_x, tmp_vp_center.Y); + this._item_selector_right_pos = new Vector2(tmp_vp_center.X + tmp_offset_center_x, tmp_vp_center.Y); + this._item_text = "CHARACTER"; + this._item_text_pos = new Vector2(tmp_vp_center.X, tmp_vp_center.Y + tmp_offset_center_y); + } + + /// + /// Constructs a new menu entry with the specified text. + /// Using the Default Constants for selected and non-selected colour + /// and the pulse rate. + /// The text of the menu item. + /// + public MenuItemCharacterSelect(ContentManager _content, Viewport _vp) + : this(DEF_COLOUR_NORMAL, _content, _vp) + { + + } + + //------------------PUBLIC OVERRIDABLE METHODS-------------------------------------------------------------- + + /// + /// Update the state of the menu item + /// + /// The Screen this menu item belongs to. + /// True if this is the currently selected item. + public virtual void update(BaseGUIScreen pscreen) + { + if (this._item_pressed_right || this._item_pressed_left) + { + this._item_press_time_passed += (float)pscreen.GlobalGameTimer.ElapsedGameTime.TotalMilliseconds; + if (this._item_press_time_passed > this._item_press_time) + { + this._item_pressed_right = false; + this._item_pressed_left = false; + this._item_press_time_passed = 0; + } + } + } + + /// + /// Draws the menu entry. This can be overridden to customize the appearance. + /// The Screen this menu item belongs to. + /// True if this is the currently selected item. + /// + public virtual void render(BaseGUIScreen pscreen) + { + // Draw the selected entry in yellow, otherwise white. + Color tmenuimgclr = this._item_colour_def; + + // Modify the alpha to fade text out during transitions. + tmenuimgclr *= pscreen.CurrentTransitionAlpha; + + pscreen.ScreenManager.SpriteBatch.Begin(); + pscreen.ScreenManager.SpriteBatch.Draw(this._item_box_tex, this._item_box_pos, null, tmenuimgclr, 0f, new Vector2(this._item_box_tex.Width / 2f, this._item_box_tex.Height / 2f), 1f, SpriteEffects.None, 0f); + if (this._item_pressed_left) + pscreen.ScreenManager.SpriteBatch.Draw(this._item_selector_left_tex_press, this._item_selector_left_pos, null, tmenuimgclr, 0f, new Vector2(this._item_selector_left_tex_press.Width / 2f, this._item_selector_left_tex_press.Height / 2f), 0.8f, SpriteEffects.None, 0f); + else + pscreen.ScreenManager.SpriteBatch.Draw(this._item_selector_left_tex, this._item_selector_left_pos, null, tmenuimgclr, 0f, new Vector2(this._item_selector_left_tex.Width / 2f, this._item_selector_left_tex.Height / 2f), 0.8f, SpriteEffects.None, 0f); + + if (this._item_pressed_right) + pscreen.ScreenManager.SpriteBatch.Draw(this._item_selector_right_tex_press, this._item_selector_right_pos, null, tmenuimgclr, 0f, new Vector2(this._item_selector_right_tex_press.Width / 2f, this._item_selector_right_tex_press.Height / 2f), 0.8f, SpriteEffects.None, 0f); + else + pscreen.ScreenManager.SpriteBatch.Draw(this._item_selector_right_tex, this._item_selector_right_pos, null, tmenuimgclr, 0f, new Vector2(this._item_selector_right_tex.Width / 2f, this._item_selector_right_tex.Height / 2f), 0.8f, SpriteEffects.None, 0f); + + Vector2 tmp_txt_origin = pscreen.ScreenManager.DefaultGUIFont.MeasureString(this._item_text); + pscreen.ScreenManager.SpriteBatch.DrawString(pscreen.ScreenManager.DefaultGUIFont, this._item_text, this._item_text_pos, tmenuimgclr, 0f, new Vector2(tmp_txt_origin.X / 2f, tmp_txt_origin.Y / 2f), 0.6f, SpriteEffects.None, 0); + pscreen.ScreenManager.SpriteBatch.End(); + } + + //-----------------PRIVATE / PROTECTED METHODS----------------------------------------------------------- + + /// + /// Method for raising the Selected event. + /// The active player's index + /// + protected internal virtual void OnSelectEntry(PlayerIndex? pplayerindex) + { + if (this.OnSelected != null) + this.OnSelected(this, new EventPlayer(pplayerindex)); + } + + /// + /// Method for raising the Increment event. + /// The active player's index + /// + protected internal virtual void OnIncrementEntry(PlayerIndex? pplayerindex) + { + if (this.OnIncrement != null) + { + this.OnIncrement(this, new EventPlayer(pplayerindex)); + this._item_pressed_right = true; + } + } + + /// + /// Method for raising the Decrement event. + /// The active player's index + /// + protected internal virtual void OnDecrementEntry(PlayerIndex? pplayerindex) + { + if (this.OnDecrement != null) + { + this.OnDecrement(this, new EventPlayer(pplayerindex)); + this._item_pressed_left = true; + } + } + } +} diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/MenuItemSlider.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/MenuItemSlider.cs new file mode 100644 index 0000000..390c38e --- /dev/null +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Screen/System/Components/MenuItemSlider.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SolarFusion.Core.Screen +{ + class MenuItemSlider + { + } +} diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/Sprites/Sprite.cs b/SolarFusion/SolarFusion/SolarFusion/Core/Sprites/Sprite.cs index c69e90f..4e45524 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/Sprites/Sprite.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/Sprites/Sprite.cs @@ -125,17 +125,20 @@ public void AddAnimation(string animName, int animRow, int frameCount, int sprit mSpriteFPS.Add(animName, spriteFPS); } - public void Draw(SpriteBatch spriteBatch) + public void Draw(SpriteBatch spriteBatch, float alpha) { + Color _alphaMixer = mSpriteColor; + _alphaMixer *= alpha; + if (mFrameIndex > (mSpriteAnimations[mCurrentAnimation].Length - 1)) { if (mSpriteTexture != null) - spriteBatch.Draw(mSpriteTexture, mSpritePosition, mSpriteAnimations[mCurrentAnimation][0], mSpriteColor, mSpriteRotation, mSpriteOrigin, mSpriteScale, mSpriteEffects, 0f); + spriteBatch.Draw(mSpriteTexture, mSpritePosition, mSpriteAnimations[mCurrentAnimation][0], _alphaMixer, mSpriteRotation, mSpriteOrigin, mSpriteScale, mSpriteEffects, 0f); } else { if (mSpriteTexture != null) - spriteBatch.Draw(mSpriteTexture, mSpritePosition, mSpriteAnimations[mCurrentAnimation][mFrameIndex], mSpriteColor, mSpriteRotation, mSpriteOrigin, mSpriteScale, mSpriteEffects, 0f); + spriteBatch.Draw(mSpriteTexture, mSpritePosition, mSpriteAnimations[mCurrentAnimation][mFrameIndex], _alphaMixer, mSpriteRotation, mSpriteOrigin, mSpriteScale, mSpriteEffects, 0f); } } //!FUNCTIONS diff --git a/SolarFusion/SolarFusion/SolarFusion/Core/SysConfig.cs b/SolarFusion/SolarFusion/SolarFusion/Core/SysConfig.cs index 826ef60..71ea302 100644 --- a/SolarFusion/SolarFusion/SolarFusion/Core/SysConfig.cs +++ b/SolarFusion/SolarFusion/SolarFusion/Core/SysConfig.cs @@ -11,12 +11,15 @@ namespace SolarFusion.Core public class SysConfig { //General Configuration - public const string CONFIG_GAME_BUILD = "0.1.1dev-branch"; + public const string CONFIG_GAME_BUILD = "0.1dev-branch"; public const string CONFIG_GAME_BUILD_TYPE = "Development"; - public const string CONFIG_GAME_NAME = "SolarFusion - " + CONFIG_GAME_BUILD_TYPE + " Build (" + CONFIG_GAME_BUILD + ")"; public const string CONFIG_GAME_NAME_CLEAN = "SolarFusion"; + public const string CONFIG_GAME_NAME = CONFIG_GAME_NAME_CLEAN + " - " + CONFIG_GAME_BUILD_TYPE + " Build (" + CONFIG_GAME_BUILD + ")"; //Debug Settings + public const string CONFIG_DEBUG_TEAMCITY_BUILD_CONFIG = "xna_4-[Win32|X360]"; + public const string CONFIG_DEBUG_TEAMCITY_BUILD_AGENT_SERVER = "glokon-s03"; + public const string CONFIG_DEBUG_TEAMCITY_KEY = "HwF0r58n8VmVPWoR8G3c9S9qWWB117NL"; public const string CONFIG_DEBUG_JIRA = "jira.blackholedev.net"; public const string CONFIG_DEBUG_JIRA_METHOD = "POST"; public const string CONFIG_DEBUG_JIRA_KEY = "pAG7zeZ16AY1Ht3924QsC1rup8T3x8pC"; diff --git a/SolarFusion/SolarFusion/SolarFusion/SolarFusion (Xbox 360).csproj b/SolarFusion/SolarFusion/SolarFusion/SolarFusion (Xbox 360).csproj index 4f8cff2..2cb04c4 100644 --- a/SolarFusion/SolarFusion/SolarFusion/SolarFusion (Xbox 360).csproj +++ b/SolarFusion/SolarFusion/SolarFusion/SolarFusion (Xbox 360).csproj @@ -99,6 +99,8 @@ + + diff --git a/SolarFusion/SolarFusion/SolarFusion/SolarFusion.csproj b/SolarFusion/SolarFusion/SolarFusion/SolarFusion.csproj index 623410b..27e6a28 100644 --- a/SolarFusion/SolarFusion/SolarFusion/SolarFusion.csproj +++ b/SolarFusion/SolarFusion/SolarFusion/SolarFusion.csproj @@ -135,6 +135,8 @@ + + diff --git a/SolarFusion/SolarFusion/SolarFusionContent/SolarFusionContent.contentproj b/SolarFusion/SolarFusion/SolarFusionContent/SolarFusionContent.contentproj index 33c7c45..dd83327 100644 --- a/SolarFusion/SolarFusion/SolarFusionContent/SolarFusionContent.contentproj +++ b/SolarFusion/SolarFusion/SolarFusionContent/SolarFusionContent.contentproj @@ -171,319 +171,247 @@ - - xboxControllerBack - TextureImporter - TextureProcessor - - - xboxControllerButtonA - TextureImporter - TextureProcessor - - - xboxControllerButtonB - TextureImporter - TextureProcessor - - - xboxControllerButtonGuide - TextureImporter - TextureProcessor - - - xboxControllerButtonX - TextureImporter - TextureProcessor - - - xboxControllerButtonY - TextureImporter - TextureProcessor - - - xboxControllerDPad - TextureImporter - TextureProcessor - - - xboxControllerLeftShoulder - TextureImporter - TextureProcessor - - - xboxControllerLeftThumbstick - TextureImporter - TextureProcessor - - - xboxControllerLeftTrigger - TextureImporter - TextureProcessor - - - xboxControllerRightShoulder - TextureImporter - TextureProcessor - - - xboxControllerRightThumbstick - TextureImporter - TextureProcessor - - - xboxControllerRightTrigger - TextureImporter - TextureProcessor - - - xboxControllerStart - TextureImporter - TextureProcessor - - - - + 0 TextureImporter TextureProcessor - + 1 TextureImporter TextureProcessor - + 2 TextureImporter TextureProcessor - + 3 TextureImporter TextureProcessor - + 4 TextureImporter TextureProcessor - + 5 TextureImporter TextureProcessor - + 6 TextureImporter TextureProcessor - + 7 TextureImporter TextureProcessor - + 8 TextureImporter TextureProcessor - + 9 TextureImporter TextureProcessor - + a TextureImporter TextureProcessor - + alt TextureImporter TextureProcessor - + b TextureImporter TextureProcessor - + c TextureImporter TextureProcessor - + ctrl TextureImporter TextureProcessor - + d TextureImporter TextureProcessor - + del TextureImporter TextureProcessor - + down TextureImporter TextureProcessor - + e TextureImporter TextureProcessor - + enter TextureImporter TextureProcessor - + esc TextureImporter TextureProcessor - + f TextureImporter TextureProcessor - + g TextureImporter TextureProcessor - + h TextureImporter TextureProcessor - + i TextureImporter TextureProcessor - + j TextureImporter TextureProcessor - + k TextureImporter TextureProcessor - + l TextureImporter TextureProcessor - + left TextureImporter TextureProcessor - + m TextureImporter TextureProcessor - + meta TextureImporter TextureProcessor - + n TextureImporter TextureProcessor - + o TextureImporter TextureProcessor - + p TextureImporter TextureProcessor - + q TextureImporter TextureProcessor - + r TextureImporter TextureProcessor - + right TextureImporter TextureProcessor - + s TextureImporter TextureProcessor - + shift TextureImporter TextureProcessor - + space TextureImporter TextureProcessor - + t TextureImporter TextureProcessor - + tab TextureImporter TextureProcessor - + u TextureImporter TextureProcessor - + up TextureImporter TextureProcessor - + v TextureImporter TextureProcessor - + w TextureImporter TextureProcessor - + x TextureImporter TextureProcessor - + y TextureImporter TextureProcessor - + z TextureImporter TextureProcessor @@ -539,6 +467,577 @@ TextureProcessor + + + blue_01_btn + TextureImporter + TextureProcessor + + + blue_01_btn_press + TextureImporter + TextureProcessor + + + blue_02_btn + TextureImporter + TextureProcessor + + + blue_02_btn_press + TextureImporter + TextureProcessor + + + blue_03_btn + TextureImporter + TextureProcessor + + + blue_03_btn_press + TextureImporter + TextureProcessor + + + blue_btn_disabled + TextureImporter + TextureProcessor + + + + + blue_01_btn + TextureImporter + TextureProcessor + + + blue_01_btn_press + TextureImporter + TextureProcessor + + + blue_02_btn + TextureImporter + TextureProcessor + + + blue_02_btn_press + TextureImporter + TextureProcessor + + + blue_03_btn + TextureImporter + TextureProcessor + + + blue_03_btn_press + TextureImporter + TextureProcessor + + + blue_btn_disabled + TextureImporter + TextureProcessor + + + + + blue_circle + TextureImporter + TextureProcessor + + + blue_panel + TextureImporter + TextureProcessor + + + green_circle + TextureImporter + TextureProcessor + + + green_panel + TextureImporter + TextureProcessor + + + grey_circle + TextureImporter + TextureProcessor + + + grey_panel + TextureImporter + TextureProcessor + + + red_circle + TextureImporter + TextureProcessor + + + red_panel + TextureImporter + TextureProcessor + + + yellow_circle + TextureImporter + TextureProcessor + + + yellow_panel + TextureImporter + TextureProcessor + + + + + blue_boxCheckmark + TextureImporter + TextureProcessor + + + blue_boxCross + TextureImporter + TextureProcessor + + + blue_boxTick + TextureImporter + TextureProcessor + + + blue_checkmark + TextureImporter + TextureProcessor + + + blue_cross + TextureImporter + TextureProcessor + + + blue_sliderDown + TextureImporter + TextureProcessor + + + blue_sliderLeft + TextureImporter + TextureProcessor + + + blue_sliderRight + TextureImporter + TextureProcessor + + + blue_sliderUp + TextureImporter + TextureProcessor + + + blue_tick + TextureImporter + TextureProcessor + + + dropdownBottom + TextureImporter + TextureProcessor + + + dropdownMid + TextureImporter + TextureProcessor + + + dropdownTop + TextureImporter + TextureProcessor + + + green_boxCheckmark + TextureImporter + TextureProcessor + + + green_boxCross + TextureImporter + TextureProcessor + + + green_boxTick + TextureImporter + TextureProcessor + + + green_checkmark + TextureImporter + TextureProcessor + + + green_cross + TextureImporter + TextureProcessor + + + green_sliderDown + TextureImporter + TextureProcessor + + + green_sliderLeft + TextureImporter + TextureProcessor + + + green_sliderRight + TextureImporter + TextureProcessor + + + green_sliderUp + TextureImporter + TextureProcessor + + + green_tick + TextureImporter + TextureProcessor + + + grey_arrowDownGrey + TextureImporter + TextureProcessor + + + grey_arrowDownWhite + TextureImporter + TextureProcessor + + + grey_arrowUpGrey + TextureImporter + TextureProcessor + + + grey_arrowUpWhite + TextureImporter + TextureProcessor + + + grey_box + TextureImporter + TextureProcessor + + + grey_boxCheckmark + TextureImporter + TextureProcessor + + + grey_boxCross + TextureImporter + TextureProcessor + + + grey_boxTick + TextureImporter + TextureProcessor + + + grey_checkmarkGrey + TextureImporter + TextureProcessor + + + grey_checkmarkWhite + TextureImporter + TextureProcessor + + + grey_crossGrey + TextureImporter + TextureProcessor + + + grey_crossWhite + TextureImporter + TextureProcessor + + + grey_sliderDown + TextureImporter + TextureProcessor + + + grey_sliderEnd + TextureImporter + TextureProcessor + + + grey_sliderHorizontal + TextureImporter + TextureProcessor + + + grey_sliderLeft + TextureImporter + TextureProcessor + + + grey_sliderRight + TextureImporter + TextureProcessor + + + grey_sliderUp + TextureImporter + TextureProcessor + + + grey_sliderVertical + TextureImporter + TextureProcessor + + + grey_tickGrey + TextureImporter + TextureProcessor + + + grey_tickWhite + TextureImporter + TextureProcessor + + + red_boxCheckmark + TextureImporter + TextureProcessor + + + red_boxCross + TextureImporter + TextureProcessor + + + red_boxTick + TextureImporter + TextureProcessor + + + red_checkmark + TextureImporter + TextureProcessor + + + red_cross + TextureImporter + TextureProcessor + + + red_sliderDown + TextureImporter + TextureProcessor + + + red_sliderLeft + TextureImporter + TextureProcessor + + + red_sliderRight + TextureImporter + TextureProcessor + + + red_sliderUp + TextureImporter + TextureProcessor + + + red_tick + TextureImporter + TextureProcessor + + + yellow_boxCheckmark + TextureImporter + TextureProcessor + + + yellow_boxCross + TextureImporter + TextureProcessor + + + yellow_boxTick + TextureImporter + TextureProcessor + + + yellow_checkmark + TextureImporter + TextureProcessor + + + yellow_cross + TextureImporter + TextureProcessor + + + yellow_sliderDown + TextureImporter + TextureProcessor + + + yellow_sliderLeft + TextureImporter + TextureProcessor + + + yellow_sliderRight + TextureImporter + TextureProcessor + + + yellow_sliderUp + TextureImporter + TextureProcessor + + + yellow_tick + TextureImporter + TextureProcessor + + + + + xboxControllerBack + TextureImporter + TextureProcessor + + + xboxControllerButtonA + TextureImporter + TextureProcessor + + + xboxControllerButtonB + TextureImporter + TextureProcessor + + + xboxControllerButtonGuide + TextureImporter + TextureProcessor + + + xboxControllerButtonX + TextureImporter + TextureProcessor + + + xboxControllerButtonY + TextureImporter + TextureProcessor + + + xboxControllerDPad + TextureImporter + TextureProcessor + + + xboxControllerLeftShoulder + TextureImporter + TextureProcessor + + + xboxControllerLeftThumbstick + TextureImporter + TextureProcessor + + + xboxControllerLeftTrigger + TextureImporter + TextureProcessor + + + xboxControllerRightShoulder + TextureImporter + TextureProcessor + + + xboxControllerRightThumbstick + TextureImporter + TextureProcessor + + + xboxControllerRightTrigger + TextureImporter + TextureProcessor + + + xboxControllerStart + TextureImporter + TextureProcessor + + + + + yellow_01_btn + TextureImporter + TextureProcessor + + + yellow_01_btn_press + TextureImporter + TextureProcessor + + + yellow_02_btn + TextureImporter + TextureProcessor + + + yellow_02_btn_press + TextureImporter + TextureProcessor + + + yellow_03_btn + TextureImporter + TextureProcessor + + + yellow_03_btn_press + TextureImporter + TextureProcessor + + + yellow_btn_disabled + TextureImporter + TextureProcessor + + + + + blank_panel + TextureImporter + TextureProcessor + + + + + static_dimensionalwave + TextureImporter + TextureProcessor + +