From 1b19433645a06448190eafa791e02a7f91b89e90 Mon Sep 17 00:00:00 2001 From: SergoDobro Date: Mon, 14 Aug 2023 11:25:16 +0300 Subject: [PATCH] reordering and etc. --- DangerousD/GameCore/GameObjects/GameObject.cs | 1 + DangerousD/GameCore/GraphicsComponent.cs | 3 ++ .../GameCore/{ => Managers}/AppManager.cs | 0 .../GameCore/{ => Managers}/GameManager.cs | 0 .../GameCore/{ => Managers}/NetworkManager.cs | 4 +- DangerousD/GameCore/Managers/SoundManager.cs | 13 ++++++ .../GameCore/Managers/TextureManager.cs | 42 +++++++++++++++++++ DangerousD/GameCore/SoundManager.cs | 10 ----- DangerousD/GameCore/TextureManager.cs | 14 ------- 9 files changed, 62 insertions(+), 25 deletions(-) rename DangerousD/GameCore/{ => Managers}/AppManager.cs (100%) rename DangerousD/GameCore/{ => Managers}/GameManager.cs (100%) rename DangerousD/GameCore/{ => Managers}/NetworkManager.cs (51%) create mode 100644 DangerousD/GameCore/Managers/SoundManager.cs create mode 100644 DangerousD/GameCore/Managers/TextureManager.cs delete mode 100644 DangerousD/GameCore/SoundManager.cs delete mode 100644 DangerousD/GameCore/TextureManager.cs diff --git a/DangerousD/GameCore/GameObjects/GameObject.cs b/DangerousD/GameCore/GameObjects/GameObject.cs index 3e5dfa4..3d73a45 100644 --- a/DangerousD/GameCore/GameObjects/GameObject.cs +++ b/DangerousD/GameCore/GameObjects/GameObject.cs @@ -6,6 +6,7 @@ namespace DangerousD.GameCore { class GameObject { + GraphicsComponent graphicsComponent; public GameObject() { GameManager.Register(this); diff --git a/DangerousD/GameCore/GraphicsComponent.cs b/DangerousD/GameCore/GraphicsComponent.cs index ecff3d8..8fffc08 100644 --- a/DangerousD/GameCore/GraphicsComponent.cs +++ b/DangerousD/GameCore/GraphicsComponent.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using System.Text; @@ -7,5 +8,7 @@ namespace DangerousD.GameCore { class GraphicsComponent { + public void Draw(SpriteBatch s + ) { } } } diff --git a/DangerousD/GameCore/AppManager.cs b/DangerousD/GameCore/Managers/AppManager.cs similarity index 100% rename from DangerousD/GameCore/AppManager.cs rename to DangerousD/GameCore/Managers/AppManager.cs diff --git a/DangerousD/GameCore/GameManager.cs b/DangerousD/GameCore/Managers/GameManager.cs similarity index 100% rename from DangerousD/GameCore/GameManager.cs rename to DangerousD/GameCore/Managers/GameManager.cs diff --git a/DangerousD/GameCore/NetworkManager.cs b/DangerousD/GameCore/Managers/NetworkManager.cs similarity index 51% rename from DangerousD/GameCore/NetworkManager.cs rename to DangerousD/GameCore/Managers/NetworkManager.cs index d9941f2..ff7a47a 100644 --- a/DangerousD/GameCore/NetworkManager.cs +++ b/DangerousD/GameCore/Managers/NetworkManager.cs @@ -1,4 +1,5 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using System.Text; @@ -6,5 +7,6 @@ namespace DangerousD.GameCore { class NetworkManager { + public void SendSOund(string sound, Vector2 soundPosition) { } } } diff --git a/DangerousD/GameCore/Managers/SoundManager.cs b/DangerousD/GameCore/Managers/SoundManager.cs new file mode 100644 index 0000000..5997394 --- /dev/null +++ b/DangerousD/GameCore/Managers/SoundManager.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace DangerousD.GameCore +{ + class SoundManager + { + public void LoadSounds() { } + public void StartSound(string soundName) { }//GameManager.SendSound + public void StopAllSounds() { } + } +} diff --git a/DangerousD/GameCore/Managers/TextureManager.cs b/DangerousD/GameCore/Managers/TextureManager.cs new file mode 100644 index 0000000..7e3f1fc --- /dev/null +++ b/DangerousD/GameCore/Managers/TextureManager.cs @@ -0,0 +1,42 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Text; + +namespace DangerousD.GameCore +{ + static class TextureManager + { + public static ContentManager contentManager; + public static GraphicsDevice graphicsDevice; + public static SpriteBatch spriteBatch; + private static Dictionary textures = new Dictionary(); + public static Texture2D nullTexture; + public static void Init(GraphicsDevice _graphicsDevice, ContentManager _contentManager, SpriteBatch _spriteBatch) + { + graphicsDevice = _graphicsDevice; + contentManager = _contentManager; + spriteBatch = _spriteBatch; + nullTexture = new Texture2D(graphicsDevice, 1, 1); + nullTexture.SetData(new Color[] { Color.Purple , Color.Black, Color.Purple, Color.Black }); + } + public static Texture2D GetTexture(string textureName) + { + if (textures.ContainsKey(textureName)) + return textures[textureName]; + try + { + Texture2D loadedTexture = contentManager.Load(textureName); + textures.Add(textureName, loadedTexture); + } + catch + { + } + return nullTexture; + + } + + } +} diff --git a/DangerousD/GameCore/SoundManager.cs b/DangerousD/GameCore/SoundManager.cs deleted file mode 100644 index 668b67c..0000000 --- a/DangerousD/GameCore/SoundManager.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace DangerousD.GameCore -{ - class SoundManager - { - } -} diff --git a/DangerousD/GameCore/TextureManager.cs b/DangerousD/GameCore/TextureManager.cs deleted file mode 100644 index 708507a..0000000 --- a/DangerousD/GameCore/TextureManager.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.Text; - -namespace DangerousD.GameCore -{ - static class TextureManager - { - public static ContentManager contentManager; - public static GraphicsDevice graphicsDevice; - } -}