From 4188745eedfd4da264093420ca5dacf3431b57e1 Mon Sep 17 00:00:00 2001 From: Ivan Filipenkov Date: Mon, 14 Aug 2023 18:13:48 +0300 Subject: [PATCH] IGameObject --- DangerousD/GameCore/GUI/AbstractGui.cs | 5 +++-- .../{GUI/IGui.cs => GameObjects/IGameObject.cs} | 7 ++++--- DangerousD/GameCore/Managers/AppManager.cs | 12 ++++++------ 3 files changed, 13 insertions(+), 11 deletions(-) rename DangerousD/GameCore/{GUI/IGui.cs => GameObjects/IGameObject.cs} (63%) diff --git a/DangerousD/GameCore/GUI/AbstractGui.cs b/DangerousD/GameCore/GUI/AbstractGui.cs index b16a654..91926cb 100644 --- a/DangerousD/GameCore/GUI/AbstractGui.cs +++ b/DangerousD/GameCore/GUI/AbstractGui.cs @@ -1,11 +1,12 @@ using System.Collections.Generic; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using MonogameLibrary.UI.Base; namespace DangerousD.GameCore.GUI; -public abstract class AbstractGui : IGui +public abstract class AbstractGui : IGameObject { protected UIManager Manager = new(); protected List Elements = new(); @@ -27,7 +28,7 @@ public abstract class AbstractGui : IGui Manager.LoadContent(content); } - public virtual void Update() + public virtual void Update(GameTime gameTime) { Manager.Update(); } diff --git a/DangerousD/GameCore/GUI/IGui.cs b/DangerousD/GameCore/GameObjects/IGameObject.cs similarity index 63% rename from DangerousD/GameCore/GUI/IGui.cs rename to DangerousD/GameCore/GameObjects/IGameObject.cs index 86af141..9037a10 100644 --- a/DangerousD/GameCore/GUI/IGui.cs +++ b/DangerousD/GameCore/GameObjects/IGameObject.cs @@ -1,13 +1,14 @@ -using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; namespace DangerousD.GameCore.GUI { - interface IGui + interface IGameObject { void Initialize(GraphicsDevice graphicsDevice); void LoadContent(ContentManager content); - void Update(); + void Update(GameTime gameTime); void Draw(SpriteBatch spriteBatch); } } diff --git a/DangerousD/GameCore/Managers/AppManager.cs b/DangerousD/GameCore/Managers/AppManager.cs index 23b8dee..d0c3284 100644 --- a/DangerousD/GameCore/Managers/AppManager.cs +++ b/DangerousD/GameCore/Managers/AppManager.cs @@ -16,9 +16,9 @@ namespace DangerousD.GameCore private SpriteBatch _spriteBatch; GameState gameState; - IGui MenuGUI; - IGui OptionsGUI; - IGui LobbyGUI; + IGameObject MenuGUI; + IGameObject OptionsGUI; + IGameObject LobbyGUI; public AppManager() { _graphics = new GraphicsDeviceManager(this); @@ -50,13 +50,13 @@ namespace DangerousD.GameCore switch (gameState) { case GameState.Menu: - MenuGUI.Update(); + MenuGUI.Update(gameTime); break; case GameState.Options: - OptionsGUI.Update(); + OptionsGUI.Update(gameTime); break; case GameState.Lobby: - LobbyGUI.Update(); + LobbyGUI.Update(gameTime); break; case GameState.Game: GameManager.Update(gameTime);