From aea83e543f75217ea28bc4771b4f19a4fbca0174 Mon Sep 17 00:00:00 2001 From: dvaer Date: Thu, 15 Aug 2024 00:45:19 +0300 Subject: [PATCH 1/4] init --- ZoFo/GameCore/GUI/AbstractGUI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZoFo/GameCore/GUI/AbstractGUI.cs b/ZoFo/GameCore/GUI/AbstractGUI.cs index 5208c96..9c966f1 100644 --- a/ZoFo/GameCore/GUI/AbstractGUI.cs +++ b/ZoFo/GameCore/GUI/AbstractGUI.cs @@ -1,6 +1,6 @@ namespace ZoFo.GameCore.GUI; -public class AbstractGUI +public abstract class AbstractGUI { } \ No newline at end of file From 7e71d2f93821d09f3968e8d93646931cd1fb3341 Mon Sep 17 00:00:00 2001 From: dvaer Date: Thu, 15 Aug 2024 01:15:21 +0300 Subject: [PATCH 2/4] add --- ZoFo/GameCore/GUI/AbstractGUI.cs | 58 ++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/ZoFo/GameCore/GUI/AbstractGUI.cs b/ZoFo/GameCore/GUI/AbstractGUI.cs index 9c966f1..1fdbee6 100644 --- a/ZoFo/GameCore/GUI/AbstractGUI.cs +++ b/ZoFo/GameCore/GUI/AbstractGUI.cs @@ -1,6 +1,60 @@ -namespace ZoFo.GameCore.GUI; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Xml; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using MonogameLibrary.UI.Base; +using MonogameLibrary.UI.Elements; + +namespace ZoFo.GameCore.GUI; public abstract class AbstractGUI { - + protected UIManager Manager = new(); + protected List Elements = new(); + private List ActiveElements; + protected DrawableUIElement SelectedElement; + private bool isStartedPrint = false; + private bool isPressed = false; + + public AbstractGui() + { + } + + protected abstract void CreateUI(); + private GraphicsDevice graphicsDevice; + public virtual void Initialize() + { + Manager.Initialize(AppManager.Instance.GraphicsDevice); + CreateUI(); + ActiveElements = new List(); + foreach (var element in Elements) + { + if (CheckOnBadElements(element)) + { + ActiveElements.Add(element); + } + } + if (ActiveElements.Count > 0) { SelectedElement = ActiveElements.First(); } + + } + + public virtual void LoadContent() + { + + } + + public virtual void Update(GameTime gameTime) + { + + } + + public virtual void Draw(SpriteBatch spriteBatch) + { + Manager.Draw(spriteBatch); + } } \ No newline at end of file From 03b5a5917c0fa534f4e7cacc6863bd723c832982 Mon Sep 17 00:00:00 2001 From: dvaer Date: Thu, 15 Aug 2024 01:32:31 +0300 Subject: [PATCH 3/4] add --- ZoFo/GameCore/GUI/AbstractGUI.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/ZoFo/GameCore/GUI/AbstractGUI.cs b/ZoFo/GameCore/GUI/AbstractGUI.cs index e02cbea..2c1e549 100644 --- a/ZoFo/GameCore/GUI/AbstractGUI.cs +++ b/ZoFo/GameCore/GUI/AbstractGUI.cs @@ -23,7 +23,6 @@ public abstract class AbstractGUI public AbstractGUI() { - } protected abstract void CreateUI(); From 0018fbb894b47eda31f5291391511612584285dd Mon Sep 17 00:00:00 2001 From: dvaer Date: Thu, 15 Aug 2024 02:04:45 +0300 Subject: [PATCH 4/4] add_class --- ZoFo/GameCore/GUI/AbstractGUI.cs | 3 +- ZoFo/GameCore/GUI/BaseGUI.cs | 28 +++++++++++++++ ZoFo/GameCore/GUI/GameEndedGUI.cs | 27 ++++++++++++++ ZoFo/GameCore/GUI/HUD.cs | 44 +++++++++++++++++++++++ ZoFo/GameCore/GUI/InventoryGUI.cs | 27 ++++++++++++++ ZoFo/GameCore/GUI/MainMenuGUI.cs | 27 ++++++++++++++ ZoFo/GameCore/GUI/OptionsGUI.cs | 27 ++++++++++++++ ZoFo/GameCore/GUI/SelectModeMenu.cs | 27 ++++++++++++++ ZoFo/GameCore/GUI/SelectingServerGUI.cs | 27 ++++++++++++++ ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs | 27 ++++++++++++++ 10 files changed, 263 insertions(+), 1 deletion(-) create mode 100644 ZoFo/GameCore/GUI/BaseGUI.cs create mode 100644 ZoFo/GameCore/GUI/GameEndedGUI.cs create mode 100644 ZoFo/GameCore/GUI/HUD.cs create mode 100644 ZoFo/GameCore/GUI/InventoryGUI.cs create mode 100644 ZoFo/GameCore/GUI/MainMenuGUI.cs create mode 100644 ZoFo/GameCore/GUI/OptionsGUI.cs create mode 100644 ZoFo/GameCore/GUI/SelectModeMenu.cs create mode 100644 ZoFo/GameCore/GUI/SelectingServerGUI.cs create mode 100644 ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs diff --git a/ZoFo/GameCore/GUI/AbstractGUI.cs b/ZoFo/GameCore/GUI/AbstractGUI.cs index 2c1e549..d2b69ce 100644 --- a/ZoFo/GameCore/GUI/AbstractGUI.cs +++ b/ZoFo/GameCore/GUI/AbstractGUI.cs @@ -29,7 +29,8 @@ public abstract class AbstractGUI private GraphicsDevice graphicsDevice; public virtual void Initialize() { - + // Manager.Initialize(AppManager.Instance.GraphicsDevice); + CreateUI(); } public virtual void LoadContent() diff --git a/ZoFo/GameCore/GUI/BaseGUI.cs b/ZoFo/GameCore/GUI/BaseGUI.cs new file mode 100644 index 0000000..cb159db --- /dev/null +++ b/ZoFo/GameCore/GUI/BaseGUI.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Xml; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using MonogameLibrary.UI.Base; +using MonogameLibrary.UI.Elements; + + +namespace ZoFo.GameCore.GUI; + +public class BaseGUI : AbstractGUI +{ + protected override void CreateUI() + { + // int width = AppManager.Instance.inGameHUDHelperResolution.X; + // int height = AppManager.Instance.inGameHUDHelperResolution.Y; + } + + public override void Update(GameTime gameTime) + { + + } +} \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/GameEndedGUI.cs b/ZoFo/GameCore/GUI/GameEndedGUI.cs new file mode 100644 index 0000000..03897ea --- /dev/null +++ b/ZoFo/GameCore/GUI/GameEndedGUI.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Xml; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using MonogameLibrary.UI.Base; +using MonogameLibrary.UI.Elements; + +namespace ZoFo.GameCore.GUI; + +public class GameEndedGUI : AbstractGUI +{ + protected override void CreateUI() + { + // int width = AppManager.Instance.inGameHUDHelperResolution.X; + // int height = AppManager.Instance.inGameHUDHelperResolution.Y; + } + + public override void Update(GameTime gameTime) + { + + } +} \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/HUD.cs b/ZoFo/GameCore/GUI/HUD.cs new file mode 100644 index 0000000..c20ead1 --- /dev/null +++ b/ZoFo/GameCore/GUI/HUD.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Xml; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using MonogameLibrary.UI.Base; +using MonogameLibrary.UI.Elements; + +namespace ZoFo.GameCore.GUI; + +public class HUD +{ + protected UIManager Manager = new(); + protected List Elements = new(); + private List ActiveElements; + protected DrawableUIElement SelectedElement; + private bool isStartedPrint = false; + private bool isPressed = false; + + private GraphicsDevice graphicsDevice; + public virtual void Initialize() + { + + } + + public virtual void LoadContent() + { + + } + + public virtual void Update(GameTime gameTime) + { + + } + + public virtual void Draw(SpriteBatch spriteBatch) + { + Manager.Draw(spriteBatch); + } +} \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/InventoryGUI.cs b/ZoFo/GameCore/GUI/InventoryGUI.cs new file mode 100644 index 0000000..c085803 --- /dev/null +++ b/ZoFo/GameCore/GUI/InventoryGUI.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Xml; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using MonogameLibrary.UI.Base; +using MonogameLibrary.UI.Elements; + +namespace ZoFo.GameCore.GUI; + +public class InventoryGUI : AbstractGUI +{ + protected override void CreateUI() + { + // int width = AppManager.Instance.inGameHUDHelperResolution.X; + // int height = AppManager.Instance.inGameHUDHelperResolution.Y; + } + + public override void Update(GameTime gameTime) + { + + } +} \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/MainMenuGUI.cs b/ZoFo/GameCore/GUI/MainMenuGUI.cs new file mode 100644 index 0000000..850181d --- /dev/null +++ b/ZoFo/GameCore/GUI/MainMenuGUI.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Xml; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using MonogameLibrary.UI.Base; +using MonogameLibrary.UI.Elements; + +namespace ZoFo.GameCore.GUI; + +public class MainMenuGUI : AbstractGUI +{ + protected override void CreateUI() + { + // int width = AppManager.Instance.inGameHUDHelperResolution.X; + // int height = AppManager.Instance.inGameHUDHelperResolution.Y; + } + + public override void Update(GameTime gameTime) + { + + } +} \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/OptionsGUI.cs b/ZoFo/GameCore/GUI/OptionsGUI.cs new file mode 100644 index 0000000..7282f70 --- /dev/null +++ b/ZoFo/GameCore/GUI/OptionsGUI.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Xml; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using MonogameLibrary.UI.Base; +using MonogameLibrary.UI.Elements; + +namespace ZoFo.GameCore.GUI; + +public class OptionsGUI : AbstractGUI +{ + protected override void CreateUI() + { + // int width = AppManager.Instance.inGameHUDHelperResolution.X; + // int height = AppManager.Instance.inGameHUDHelperResolution.Y; + } + + public override void Update(GameTime gameTime) + { + + } +} \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/SelectModeMenu.cs b/ZoFo/GameCore/GUI/SelectModeMenu.cs new file mode 100644 index 0000000..b08e782 --- /dev/null +++ b/ZoFo/GameCore/GUI/SelectModeMenu.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Xml; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using MonogameLibrary.UI.Base; +using MonogameLibrary.UI.Elements; + +namespace ZoFo.GameCore.GUI; + +public class SelectModeMenu : AbstractGUI +{ + protected override void CreateUI() + { + // int width = AppManager.Instance.inGameHUDHelperResolution.X; + // int height = AppManager.Instance.inGameHUDHelperResolution.Y; + } + + public override void Update(GameTime gameTime) + { + + } +} \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/SelectingServerGUI.cs b/ZoFo/GameCore/GUI/SelectingServerGUI.cs new file mode 100644 index 0000000..0a7f049 --- /dev/null +++ b/ZoFo/GameCore/GUI/SelectingServerGUI.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Xml; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using MonogameLibrary.UI.Base; +using MonogameLibrary.UI.Elements; + +namespace ZoFo.GameCore.GUI; + +public class SelectingServerGUI : AbstractGUI +{ + protected override void CreateUI() + { + // int width = AppManager.Instance.inGameHUDHelperResolution.X; + // int height = AppManager.Instance.inGameHUDHelperResolution.Y; + } + + public override void Update(GameTime gameTime) + { + + } +} \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs b/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs new file mode 100644 index 0000000..893efc6 --- /dev/null +++ b/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Xml; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using MonogameLibrary.UI.Base; +using MonogameLibrary.UI.Elements; + +namespace ZoFo.GameCore.GUI; + +public class WaitingForPlayersGUI : AbstractGUI +{ + protected override void CreateUI() + { + // int width = AppManager.Instance.inGameHUDHelperResolution.X; + // int height = AppManager.Instance.inGameHUDHelperResolution.Y; + } + + public override void Update(GameTime gameTime) + { + + } +} \ No newline at end of file