diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index ddc4c36..44c7f84 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -13,3 +13,22 @@ #---------------------------------- Content ---------------------------------# +#begin Font/Font.spritefont +/importer:FontDescriptionImporter +/processor:FontDescriptionProcessor +/processorParam:PremultiplyAlpha=True +/processorParam:TextureFormat=Compressed +/build:Font/Font.spritefont + +#begin Texture/GUI/MenuBackground.jpg +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Texture/GUI/MenuBackground.jpg + diff --git a/ZoFo/Content/Font/Debrosee-ALPnL.ttf b/ZoFo/Content/Font/Debrosee-ALPnL.ttf new file mode 100644 index 0000000..311dd61 Binary files /dev/null and b/ZoFo/Content/Font/Debrosee-ALPnL.ttf differ diff --git a/ZoFo/Content/Font/Font.spritefont b/ZoFo/Content/Font/Font.spritefont new file mode 100644 index 0000000..e6b9115 --- /dev/null +++ b/ZoFo/Content/Font/Font.spritefont @@ -0,0 +1,60 @@ + + + + + + + Debrosee-ALPnL.ttf + + + 12 + + + 0 + + + true + + + + + + + + + + + + ~ + + + + diff --git a/ZoFo/Content/Texture/GUI/MenuBackground.jpg b/ZoFo/Content/Texture/GUI/MenuBackground.jpg new file mode 100644 index 0000000..79b0abe Binary files /dev/null and b/ZoFo/Content/Texture/GUI/MenuBackground.jpg differ diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs index d765f10..ab3d960 100644 --- a/ZoFo/GameCore/Client.cs +++ b/ZoFo/GameCore/Client.cs @@ -4,6 +4,10 @@ using System.Text.Json; using ZoFo.GameCore.GameManagers.NetworkManager; using ZoFo.GameCore.GameManagers.NetworkManager.Updates; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; + namespace ZoFo.GameCore { public class Client @@ -18,7 +22,7 @@ namespace ZoFo.GameCore public void OnDataSend(string data) { List updateDatas = JsonSerializer.Deserialize>(data); - // Тут будет switch + // ��� ����� switch } public void GameEndedUnexpectedly(){ } @@ -26,5 +30,13 @@ namespace ZoFo.GameCore public void JoinRoom(){ } public void JoinYourself(){ } + + internal void Update(GameTime gameTime) + { + } + + internal void Draw(SpriteBatch spriteBatch) + { + } } } \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/AbstractGUI.cs b/ZoFo/GameCore/GUI/AbstractGUI.cs index d2b69ce..95ec020 100644 --- a/ZoFo/GameCore/GUI/AbstractGUI.cs +++ b/ZoFo/GameCore/GUI/AbstractGUI.cs @@ -9,6 +9,7 @@ using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using MonogameLibrary.UI.Base; using MonogameLibrary.UI.Elements; +using ZoFo.GameCore.GameManagers; namespace ZoFo.GameCore.GUI; @@ -29,13 +30,13 @@ public abstract class AbstractGUI private GraphicsDevice graphicsDevice; public virtual void Initialize() { - // Manager.Initialize(AppManager.Instance.GraphicsDevice); + Manager.Initialize(AppManager.Instance.GraphicsDevice); CreateUI(); } public virtual void LoadContent() { - + Manager.LoadContent(AppManager.Instance.Content, "Font"); } public virtual void Update(GameTime gameTime) @@ -47,4 +48,9 @@ public abstract class AbstractGUI { Manager.Draw(spriteBatch); } + + public virtual void ResolutioChenges() + { + + } } \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/DebugHUD.cs b/ZoFo/GameCore/GUI/DebugHUD.cs new file mode 100644 index 0000000..f735f7e --- /dev/null +++ b/ZoFo/GameCore/GUI/DebugHUD.cs @@ -0,0 +1,6 @@ +namespace ZoFo.GameCore.GUI; + +public class DebugHUD +{ + +} \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/MainMenuGUI.cs b/ZoFo/GameCore/GUI/MainMenuGUI.cs index 850181d..98b0640 100644 --- a/ZoFo/GameCore/GUI/MainMenuGUI.cs +++ b/ZoFo/GameCore/GUI/MainMenuGUI.cs @@ -9,15 +9,21 @@ using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using MonogameLibrary.UI.Base; using MonogameLibrary.UI.Elements; +using ZoFo.GameCore.GameManagers; namespace ZoFo.GameCore.GUI; public class MainMenuGUI : AbstractGUI { + DrawableUIElement menuBackground; protected override void CreateUI() { - // int width = AppManager.Instance.inGameHUDHelperResolution.X; - // int height = AppManager.Instance.inGameHUDHelperResolution.Y; + int width = AppManager.Instance.CurentScreenResolution.X; + int height = AppManager.Instance.CurentScreenResolution.Y; + + menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), textureName = "Texture\\GUI\\MenuBackground" }; + Elements.Add(menuBackground); + menuBackground.LoadTexture(AppManager.Instance.Content); } public override void Update(GameTime gameTime) diff --git a/ZoFo/GameCore/GameManagers/AppManager.cs b/ZoFo/GameCore/GameManagers/AppManager.cs index 495a618..a6184d8 100644 --- a/ZoFo/GameCore/GameManagers/AppManager.cs +++ b/ZoFo/GameCore/GameManagers/AppManager.cs @@ -8,6 +8,7 @@ using DangerousD.GameCore.Graphics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; +using ZoFo.GameCore.GameManagers.ItemManager; using ZoFo.GameCore.GUI; using static System.Collections.Specialized.BitVector32; @@ -23,13 +24,15 @@ namespace ZoFo.GameCore.GameManagers public static AppManager Instance { get; private set; } public GameState gamestate; public AbstractGUI currentGUI; - //public Client client; - //public Server server; + public Point CurentScreenResolution = new Point(1920, 1080); + public Client client; + public Server server; #region Managers public InputManager InputManager; + public ItemManager.ItemManager ItemManager; public AnimationBuilder animationBuilder{get;set; } @@ -44,14 +47,14 @@ namespace ZoFo.GameCore.GameManagers Instance = this; InputManager = new InputManager(); - - + currentGUI = new MainMenuGUI(); } protected override void Initialize() { - + currentGUI.Initialize(); + base.Initialize(); @@ -73,17 +76,17 @@ namespace ZoFo.GameCore.GameManagers Exit(); InputManager.Update(); - //currentGUI.Update(); + currentGUI.Update(gameTime); switch (gamestate) { case GameState.NotPlaying: break; case GameState.HostPlaying: - //server.Update(GameTime gameTime); - //client.Update(GameTime gameTime); + server.Update(gameTime); + client.Update(gameTime); break; case GameState.ClientPlaying: - //server.Update(GameTime gameTime); + server.Update(gameTime); break; default: break; @@ -97,12 +100,12 @@ namespace ZoFo.GameCore.GameManagers GraphicsDevice.Clear(Color.CornflowerBlue); - //currentGUI.Draw(_spriteBatch); + currentGUI.Draw(_spriteBatch); switch (gamestate) { case GameState.ClientPlaying: case GameState.HostPlaying: - //client.Draw(_spriteBatch); + client.Draw(_spriteBatch); break; case GameState.NotPlaying: default: @@ -118,8 +121,6 @@ namespace ZoFo.GameCore.GameManagers public void SetGUI(AbstractGUI gui) { currentGUI = gui; - - //TODO } public void GameEnded(Dictionary lootIGot) diff --git a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionComponent.cs b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionComponent.cs new file mode 100644 index 0000000..7556e1c --- /dev/null +++ b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionComponent.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Reflection.Metadata; +using System.Text; +using System.Threading.Tasks; + +namespace ZoFo.GameCore.GameManagers.CollisionManager +{ + public class CollisionComponent + { + //остановлен ли перс + bool doesStop; + Rectangle stopRectangle; + + // triggers for rectangle + bool isTrigger; + Rectangle triggerRectangle; + + //delegate + public delegate void EventHandler(object sender, EventArgs e); + + + //events + public event EventHandler OnTriggerEnter; + public event EventHandler OnTriggerZone; + public event EventHandler OnTriggerExit; + + // methods-event + public void TriggerEnter(object component, ///, + EventArgs e) + { + + } + public void TriggerZone(object component,///, + EventArgs e) + { + + } + public void TriggerExit(object component,///, + EventArgs e) + { + + } + + + } +} diff --git a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs new file mode 100644 index 0000000..1c0ab2b --- /dev/null +++ b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs @@ -0,0 +1,33 @@ +using Microsoft.VisualBasic; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ZoFo.GameCore.GameManagers.CollisionManager +{ + public class CollisionManager + { + public List CollisionComponent; + public List TriggerComponent; + + public void UpdatePositions() + { + + } + + public void GetObjectInArea(Rectangle area) + { + + } + + public void Register(Rectangle rectangle) + { + + } + + + } +} diff --git a/ZoFo/GameCore/GameManagers/ItemManager/ItemInfo.cs b/ZoFo/GameCore/GameManagers/ItemManager/ItemInfo.cs index 68873e4..375d745 100644 --- a/ZoFo/GameCore/GameManagers/ItemManager/ItemInfo.cs +++ b/ZoFo/GameCore/GameManagers/ItemManager/ItemInfo.cs @@ -15,10 +15,23 @@ namespace ZoFo.GameCore.GameManagers.ItemManager Texture2D itemTexture; bool isCraftable; Dictionary resourcesNeededToCraft; + public ItemInfo (string tag) + { + this.tag = tag; + } + public ItemInfo(string tag,string textureName,bool isCraftable, Dictionary resourcesNeededToCraft) + { + this.tag = tag; + this.textureName = textureName; + + this.isCraftable = isCraftable; + this.resourcesNeededToCraft = resourcesNeededToCraft; + } //методы - private void LoadTexture() + public void LoadTexture() { //я что-то хз как это + itemTexture=AppManager.Instance.Content.Load(textureName); } } } diff --git a/ZoFo/GameCore/GameManagers/ItemManager/ItemManager.cs b/ZoFo/GameCore/GameManagers/ItemManager/ItemManager.cs index 3585ec4..6d00e0c 100644 --- a/ZoFo/GameCore/GameManagers/ItemManager/ItemManager.cs +++ b/ZoFo/GameCore/GameManagers/ItemManager/ItemManager.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace ZoFo.GameCore.GameManagers.ItemManager { - class ItemManager + public class ItemManager { //поля Dictionary tagItemPairs; @@ -15,9 +15,18 @@ namespace ZoFo.GameCore.GameManagers.ItemManager { return tagItemPairs.GetValueOrDefault(tag); } - void LoadItemTexture() + void LoadItemTextures() { - + foreach (var item in tagItemPairs) + { + item.Value.LoadTexture(); + } + } + void Initialize() + { + tagItemPairs.Add("wood", new ItemInfo("wood","wood",false,null)); + tagItemPairs.Add("rock", new ItemInfo("rock", "rock", false, null)); + tagItemPairs.Add("steel", new ItemInfo("steel", "steel", false, null)); } } diff --git a/ZoFo/GameCore/GameManagers/ItemManager/PlayerData.cs b/ZoFo/GameCore/GameManagers/ItemManager/PlayerData.cs new file mode 100644 index 0000000..1dfc351 --- /dev/null +++ b/ZoFo/GameCore/GameManagers/ItemManager/PlayerData.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ZoFo.GameCore.GameManagers.ItemManager +{ + /// + /// Класс хранит информацю о количестве ресурсов у игрока + /// + internal class PlayerData + { + Dictionary items; + /// + /// Принимает тэг и крафтит этот объект + /// + /// + public void CraftItem(string itemTag) + { + //TODO + } + } +} diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs index 91cd151..7bf421a 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -1,4 +1,5 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -36,6 +37,8 @@ namespace ZoFo.GameCore networkManager.AddData(gameEnded); } - + internal void Update(GameTime gameTime) + { + } } } diff --git a/ZoFo/ZoFo.csproj b/ZoFo/ZoFo.csproj index e29984f..70c8cbc 100644 --- a/ZoFo/ZoFo.csproj +++ b/ZoFo/ZoFo.csproj @@ -26,6 +26,9 @@ + + +