diff --git a/DangerousD/GameCore/GUI/HUD.cs b/DangerousD/GameCore/GUI/HUD.cs new file mode 100644 index 0000000..0571a1d --- /dev/null +++ b/DangerousD/GameCore/GUI/HUD.cs @@ -0,0 +1,38 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using MonogameLibrary.UI.Elements; + +namespace DangerousD.GameCore.GUI +{ + public class HUD : IDrawableObject + { + + + public HUD() + { + } + + public void Draw(SpriteBatch spriteBatch) + { + ; + } + + public void Initialize(GraphicsDevice graphicsDevice) + { + throw new NotImplementedException(); + } + + public void LoadContent() + { + var content = AppManager.Instance.Content; + + } + + public void Update(GameTime gameTime) + { + throw new NotImplementedException(); + } + } +} + diff --git a/DangerousD/GameCore/GUI/MenuGUI.cs b/DangerousD/GameCore/GUI/MenuGUI.cs index 3aff1be..868591c 100644 --- a/DangerousD/GameCore/GUI/MenuGUI.cs +++ b/DangerousD/GameCore/GUI/MenuGUI.cs @@ -16,6 +16,7 @@ internal class MenuGUI : AbstractGui { AppManager.Instance.ChangeGameState(GameState.Game); }; + var butMulti = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 190, 300, 50), text = "Multiplayer", fontName = "File" }; Elements.Add(butMulti); butMulti.LeftButtonPressed += () => @@ -27,6 +28,7 @@ internal class MenuGUI : AbstractGui butOption.LeftButtonPressed += () => { // открытие настроек + AppManager.Instance.ChangeGameState(GameState.Options); }; var butExit = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 310, 300, 50), text = "Exit", fontName = "File" }; Elements.Add(butExit); diff --git a/DangerousD/GameCore/GUI/OptionsGUI.cs b/DangerousD/GameCore/GUI/OptionsGUI.cs new file mode 100644 index 0000000..2dcbe6a --- /dev/null +++ b/DangerousD/GameCore/GUI/OptionsGUI.cs @@ -0,0 +1,44 @@ +using System; +using Microsoft.Xna.Framework; +using MonogameLibrary.UI.Base; +using MonogameLibrary.UI.Elements; +using System.Xml.Linq; + +namespace DangerousD.GameCore.GUI +{ + public class OptionsGUI : AbstractGui + { + protected override void CreateUI() + { + int wigth = AppManager.Instance.Window.ClientBounds.Width; + int height = AppManager.Instance.Window.ClientBounds.Height; + var butSingle = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 130, 300, 50), text = "Singleplayer", fontName = "File" }; + Elements.Add(butSingle); + butSingle.LeftButtonPressed += () => + { + AppManager.Instance.ChangeGameState(GameState.Game); + }; + + var butMulti = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 190, 300, 50), text = "Multiplayer", fontName = "File" }; + Elements.Add(butMulti); + butMulti.LeftButtonPressed += () => + { + AppManager.Instance.ChangeGameState(GameState.Login); + }; + var butOption = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 250, 300, 50), text = "Option", fontName = "File" }; + Elements.Add(butOption); + butOption.LeftButtonPressed += () => + { + // открытие настроек + }; + var butExit = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 310, 300, 50), text = "Exit", fontName = "File" }; + Elements.Add(butExit); + butExit.LeftButtonPressed += () => + { + AppManager.Instance.Exit(); + }; + + var slider = new Slider(Manager) { }; + } + } +} \ No newline at end of file diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Player.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Player.cs index 865c044..8caadd3 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Player.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player.cs @@ -1,4 +1,5 @@ using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using System.Linq; @@ -9,6 +10,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities { public class Player : LivingEntity { + public Player(Vector2 position) : base(position) + { + } + protected override GraphicsComponent GraphicsComponent => throw new NotImplementedException(); public void Kill() diff --git a/DangerousD/GameCore/Levels/Level1.cs b/DangerousD/GameCore/Levels/Level1.cs index 5ab7a66..0604144 100644 --- a/DangerousD/GameCore/Levels/Level1.cs +++ b/DangerousD/GameCore/Levels/Level1.cs @@ -8,7 +8,6 @@ namespace DangerousD.GameCore.Levels { public void InitLevel() { - new Player(); var Трава = new GrassBlock(new Vector2(0, 128)); var Death = new TestAnimationDeath(new Vector2(128, 128)); diff --git a/DangerousD/GameCore/Managers/AppManager.cs b/DangerousD/GameCore/Managers/AppManager.cs index e45a378..479fd2d 100644 --- a/DangerousD/GameCore/Managers/AppManager.cs +++ b/DangerousD/GameCore/Managers/AppManager.cs @@ -10,7 +10,7 @@ using DangerousD.GameCore.Graphics; namespace DangerousD.GameCore { - public enum GameState { Menu, Options, Lobby, Game, Login } + public enum GameState { Menu, Options, Lobby, Game, Login, } public class AppManager : Game { public static AppManager Instance { get; private set; } @@ -38,6 +38,7 @@ namespace DangerousD.GameCore gameState = GameState.Menu; MenuGUI = new MenuGUI(); LoginGUI = new LoginGUI(); + OptionsGUI = new OptionsGUI(); } protected override void Initialize() @@ -45,6 +46,7 @@ namespace DangerousD.GameCore AnimationBuilder.LoadAnimations(); MenuGUI.Initialize(GraphicsDevice); LoginGUI.Initialize(GraphicsDevice); + OptionsGUI.Initialize(GraphicsDevice); base.Initialize(); } @@ -53,6 +55,7 @@ namespace DangerousD.GameCore _spriteBatch = new SpriteBatch(GraphicsDevice); MenuGUI.LoadContent(); LoginGUI.LoadContent(); + OptionsGUI.LoadContent(); } protected override void Update(GameTime gameTime)