diff --git a/.run/ZoFo.run.xml b/.run/ZoFo.run.xml new file mode 100644 index 0000000..315a66b --- /dev/null +++ b/.run/ZoFo.run.xml @@ -0,0 +1,20 @@ + + + + \ No newline at end of file diff --git a/AnimationsFileCreator/Program.cs b/AnimationsFileCreator/Program.cs index 45c6a06..4203494 100644 --- a/AnimationsFileCreator/Program.cs +++ b/AnimationsFileCreator/Program.cs @@ -1,13 +1,11 @@ -using DangerousD.GameCore.Graphics; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Newtonsoft.Json; using System; using NativeFileDialogSharp; using System.IO; using System.Linq; using System.Reflection.Metadata; -using Zofo.GameCore.ZoFo_grafics; - +using ZoFo.GameCore.Graphics; namespace AnimationsFileCreator { class Program diff --git a/MonogameLibrary/UI/Elements/ItemDisplayLabel.cs b/MonogameLibrary/UI/Elements/ItemDisplayLabel.cs new file mode 100644 index 0000000..1e637fb --- /dev/null +++ b/MonogameLibrary/UI/Elements/ItemDisplayLabel.cs @@ -0,0 +1,79 @@ +using Microsoft.Xna.Framework.Graphics; +using MonogameLibrary.UI.Base; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using MonogameLibrary.UI.Enums; +using System; +using System.Collections.Generic; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading; +using Microsoft.Xna.Framework.Content; + +namespace MonogameLibrary.UI.Elements; + +public class ItemDisplayLabel : DrawableUIElement +{ + public int count; + public string itemTextureName; + private Texture2D itemTexture; + public Color fontColor1; + protected UIManager Manager; + public string fontName1; + public string text1; + public float scale1; + private DrawableUIElement icon; + + + public ItemDisplayLabel(UIManager manager) : base(manager) + { + Manager = manager; + } + + public void Initialize() + { + icon = new DrawableUIElement(Manager) + { + rectangle = new Rectangle(rectangle.X + rectangle.Height / 3 / 2, rectangle.Y + rectangle.Height / 3 / 2, rectangle.Height / 3 * 2, rectangle.Height / 3 * 2), + mainColor = Color.White, textureName = itemTextureName + }; + Label itemName = new Label(Manager) + { + rectangle = new Rectangle(rectangle.X + rectangle.Height / 3 / 2 + rectangle.Height / 3 * 2, rectangle.Y + rectangle.Height / 3 / 2, rectangle.Width / 3, rectangle.Height / 3 * 2), + fontColor = fontColor1, text = text1, scale = scale1, fontName = fontName1, mainColor = Color.Transparent + }; + Label itemCount = new Label(Manager) + { + rectangle = new Rectangle(rectangle.X + rectangle.Width - (int)(rectangle.Height / 3 * 2.5), rectangle.Y + rectangle.Height / 3 / 2, rectangle.Height / 3 * 2, rectangle.Height / 3 * 2), + fontColor = fontColor1, text = count.ToString(), scale = scale1, fontName = fontName1, mainColor = Color.Transparent + }; + } + + public override void LoadTexture(ContentManager content) + { + icon.LoadTexture(content); + base.LoadTexture(content); + if (itemTextureName == "") + { + itemTexture = new Texture2D(Manager.GraphicsDevice, 1, 1); + itemTexture.SetData(new Color[] { mainColor }); + } + else + { + try + { + itemTexture = content.Load(itemTextureName); + } + catch + { + itemTexture = new Texture2D(Manager.GraphicsDevice, 1, 1); + itemTexture.SetData(new Color[] { mainColor }); + } + } + } + + public override void Draw(SpriteBatch _spriteBatch) + { + base.Draw(_spriteBatch); + } +} \ No newline at end of file diff --git a/MonogameLibrary/UI/Elements/itemDisplayButton.cs b/MonogameLibrary/UI/Elements/itemDisplayButton.cs new file mode 100644 index 0000000..0a29c4f --- /dev/null +++ b/MonogameLibrary/UI/Elements/itemDisplayButton.cs @@ -0,0 +1,79 @@ +using Microsoft.Xna.Framework.Graphics; +using MonogameLibrary.UI.Base; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using MonogameLibrary.UI.Enums; +using System; +using System.Collections.Generic; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading; +using Microsoft.Xna.Framework.Content; + +namespace MonogameLibrary.UI.Elements; + +public class ItemDisplayButton : DrawableUIElement +{ + public int count; + public string itemTextureName; + private Texture2D itemTexture; + public Color fontColor1; + protected UIManager Manager; + public string fontName1; + public string text1; + public float scale1; + private DrawableUIElement icon; + + + public ItemDisplayButton(UIManager manager) : base(manager) + { + Manager = manager; + } + + public void Initialize() + { + icon = new DrawableUIElement(Manager) + { + rectangle = new Rectangle(rectangle.X + rectangle.Height / 3 / 2, rectangle.Y + rectangle.Height / 3 / 2, rectangle.Height / 3 * 2, rectangle.Height / 3 * 2), + mainColor = Color.White, textureName = itemTextureName + }; + Label itemName = new Label(Manager) + { + rectangle = new Rectangle(rectangle.X + rectangle.Height / 3 / 2 + rectangle.Height / 3 * 2, rectangle.Y + rectangle.Height / 3 / 2, rectangle.Width / 3, rectangle.Height / 3 * 2), + fontColor = fontColor1, text = text1, scale = scale1, fontName = fontName1, mainColor = Color.Transparent + }; + Label itemCount = new Label(Manager) + { + rectangle = new Rectangle(rectangle.X + rectangle.Width - (int)(rectangle.Height / 3 * 2.5), rectangle.Y + rectangle.Height / 3 / 2, rectangle.Height / 3 * 2, rectangle.Height / 3 * 2), + fontColor = fontColor1, text = count.ToString(), scale = scale1, fontName = fontName1, mainColor = Color.Transparent + }; + } + + public override void LoadTexture(ContentManager content) + { + icon.LoadTexture(content); + base.LoadTexture(content); + if (itemTextureName == "") + { + itemTexture = new Texture2D(Manager.GraphicsDevice, 1, 1); + itemTexture.SetData(new Color[] { mainColor }); + } + else + { + try + { + itemTexture = content.Load(itemTextureName); + } + catch + { + itemTexture = new Texture2D(Manager.GraphicsDevice, 1, 1); + itemTexture.SetData(new Color[] { mainColor }); + } + } + } + + public override void Draw(SpriteBatch _spriteBatch) + { + base.Draw(_spriteBatch); + } +} \ No newline at end of file diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index c4dedca..09e9f35 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -85,21 +85,111 @@ /processorParam:Quality=Best /build:sounds/Zombi stoit.wav -#begin Textures/Animations/player_idle_rotate_weapon.animation -/copy:Textures/Animations/player_idle_rotate_weapon.animation +#begin Textures/Animations/player_down_idle.animation +/copy:Textures/Animations/player_down_idle.animation + +#begin Textures/Animations/player_down-left_idle.animation +/copy:Textures/Animations/player_down-left_idle.animation + +#begin Textures/Animations/player_down-right_idle.animation +/copy:Textures/Animations/player_down-right_idle.animation + +#begin Textures/Animations/player_idle_down_mining.animation +/copy:Textures/Animations/player_idle_down_mining.animation + +#begin Textures/Animations/player_idle_down-left_mining.animation +/copy:Textures/Animations/player_idle_down-left_mining.animation + +#begin Textures/Animations/player_idle_left_mining.animation +/copy:Textures/Animations/player_idle_left_mining.animation + +#begin Textures/Animations/player_idle_rights_mining.animation +/copy:Textures/Animations/player_idle_rights_mining.animation #begin Textures/Animations/player_idle_top_noweapon.animation /copy:Textures/Animations/player_idle_top_noweapon.animation +#begin Textures/Animations/player_idle_top-left_mining.animation +/copy:Textures/Animations/player_idle_top-left_mining.animation + #begin Textures/Animations/player_idle_top-right_noweapon.animation /copy:Textures/Animations/player_idle_top-right_noweapon.animation +#begin Textures/Animations/player_idle_top-rights_mining.animation +/copy:Textures/Animations/player_idle_top-rights_mining.animation + +#begin Textures/Animations/player_left_idle.animation +/copy:Textures/Animations/player_left_idle.animation + +#begin Textures/Animations/player_look_down_weapon.animation +/copy:Textures/Animations/player_look_down_weapon.animation + +#begin Textures/Animations/player_look_down.animation +/copy:Textures/Animations/player_look_down.animation + +#begin Textures/Animations/player_look_left_down_weapon.animation +/copy:Textures/Animations/player_look_left_down_weapon.animation + +#begin Textures/Animations/player_look_left_down.animation +/copy:Textures/Animations/player_look_left_down.animation + +#begin Textures/Animations/player_look_left_up_weapon.animation +/copy:Textures/Animations/player_look_left_up_weapon.animation + +#begin Textures/Animations/player_look_left_up.animation +/copy:Textures/Animations/player_look_left_up.animation + +#begin Textures/Animations/player_look_left_weapon.animation +/copy:Textures/Animations/player_look_left_weapon.animation + +#begin Textures/Animations/player_look_left.animation +/copy:Textures/Animations/player_look_left.animation + +#begin Textures/Animations/player_look_right_down_weapon.animation +/copy:Textures/Animations/player_look_right_down_weapon.animation + +#begin Textures/Animations/player_look_right_down.animation +/copy:Textures/Animations/player_look_right_down.animation + +#begin Textures/Animations/player_look_right_up_weapon.animation +/copy:Textures/Animations/player_look_right_up_weapon.animation + +#begin Textures/Animations/player_look_right_up.animation +/copy:Textures/Animations/player_look_right_up.animation + +#begin Textures/Animations/player_look_right_weapon.animation +/copy:Textures/Animations/player_look_right_weapon.animation + +#begin Textures/Animations/player_look_right.animation +/copy:Textures/Animations/player_look_right.animation + +#begin Textures/Animations/player_look_up_weapon.animation +/copy:Textures/Animations/player_look_up_weapon.animation + +#begin Textures/Animations/player_look_up.animation +/copy:Textures/Animations/player_look_up.animation + +#begin Textures/Animations/player_right_idle.animation +/copy:Textures/Animations/player_right_idle.animation + #begin Textures/Animations/player_running_top_rotate.animation /copy:Textures/Animations/player_running_top_rotate.animation +#begin Textures/Animations/player_top_mining.animation +/copy:Textures/Animations/player_top_mining.animation + +#begin Textures/Animations/player_top-left_idle.animation +/copy:Textures/Animations/player_top-left_idle.animation + +#begin Textures/Animations/player_top-right_idle.animation +/copy:Textures/Animations/player_top-right_idle.animation + #begin Textures/Animations/running_top.animation /copy:Textures/Animations/running_top.animation +#begin Textures/Animations/testAnimation.animation +/copy:Textures/Animations/testAnimation.animation + #begin Textures/Animations/testAnimationExample.animation /copy:Textures/Animations/testAnimationExample.animation @@ -355,7 +445,7 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/switch.png -#begin Textures/TileSetImages/TilesetFloor.png +#begin Textures/icons/12.png /importer:TextureImporter /processor:TextureProcessor /processorParam:ColorKeyColor=255,0,255,255 @@ -365,5 +455,221 @@ /processorParam:ResizeToPowerOfTwo=False /processorParam:MakeSquare=False /processorParam:TextureFormat=Color -/build:Textures/TileSetImages/TilesetFloor.png +/build:Textures/icons/12.png + +#begin Textures/icons/13.png +/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:Textures/icons/13.png + +#begin Textures/icons/14.png +/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:Textures/icons/14.png + +#begin Textures/icons/21.png +/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:Textures/icons/21.png + +#begin Textures/icons/22.png +/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:Textures/icons/22.png + +#begin Textures/icons/5.png +/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:Textures/icons/5.png + +#begin Textures/icons/6.png +/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:Textures/icons/6.png + +#begin Textures/icons/7.png +/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:Textures/icons/7.png + +#begin Textures/icons/8.png +/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:Textures/icons/8.png + +#begin Textures/icons/9.png +/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:Textures/icons/9.png + +#begin Textures/Test/pickaxe.webp +/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:Textures/Test/pickaxe.webp + +#begin Textures/Test/rock.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:Textures/Test/rock.jpg + +#begin Textures/Test/steel.png +/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:Textures/Test/steel.png + +#begin Textures/Test/wood.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:Textures/Test/wood.jpg + +#begin Textures/TileSets/Tilelist1.png +/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:Textures/TileSets/Tilelist1.png + +#begin Textures/TileSets/Tilelist2.png +/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:Textures/TileSets/Tilelist2.png + +#begin Textures/TileSets/Tilelist3.png +/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:Textures/TileSets/Tilelist3.png + +#begin Textures/TileSets/Tilelist4.png +/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:Textures/TileSets/Tilelist4.png + +#begin Textures/TileSets/TilesetFloor.png +/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:Textures/TileSets/TilesetFloor.png diff --git a/ZoFo/Content/MapData/MapSession.tiled-session b/ZoFo/Content/MapData/MapSession.tiled-session index 2b7d661..257833b 100644 --- a/ZoFo/Content/MapData/MapSession.tiled-session +++ b/ZoFo/Content/MapData/MapSession.tiled-session @@ -3,24 +3,28 @@ "height": 4300, "width": 2 }, - "activeFile": "TileSets/TileSet 1.tsj", + "activeFile": "TileMaps/main.tmj", "expandedProjectPaths": [ ".", - "TileMaps", - "TileSets" + "TileSets", + "TileMaps" ], "fileStates": { "TileMaps/TileSets/TileSet 1.tsj": { "scaleInDock": 1 }, "TileMaps/main.tmj": { - "scale": 0.25, + "scale": 0.75, "selectedLayer": 0, "viewCenter": { - "x": 3078, - "y": 2164 + "x": 578, + "y": 482.66666666666674 } }, + "TileSets/CollisionTileSet.tsj": { + "scaleInDock": 0.75, + "scaleInEditor": 1 + }, "TileSets/TileSet 1.tsj": { "scaleInDock": 1, "scaleInEditor": 1.5 @@ -33,14 +37,15 @@ "last.imagePath": "D:/C#/Я смотрел ваши ХАКАТОНЫ/ZoFo/ZoFo/Content/Textures/TileSetImages", "openFiles": [ "TileSets/TileSet 1.tsj", - "TileSets/WallSet.tsj", - "TileMaps/main.tmj" + "TileMaps/main.tmj", + "TileSets/CollisionTileSet.tsj" ], "project": "MapSession.tiled-project", "recentFiles": [ - "TileSets/WallSet.tsj", "TileMaps/main.tmj", - "TileSets/TileSet 1.tsj" + "TileSets/TileSet 1.tsj", + "TileSets/CollisionTileSet.tsj", + "TileSets/WallSet.tsj" ], "tileset.lastUsedFormat": "json", "tileset.margin": 2, diff --git a/ZoFo/Content/MapData/TileMaps/main.tmj b/ZoFo/Content/MapData/TileMaps/main.tmj index 4b1d785..521ea7b 100644 --- a/ZoFo/Content/MapData/TileMaps/main.tmj +++ b/ZoFo/Content/MapData/TileMaps/main.tmj @@ -5,44 +5,44 @@ { "chunks":[ { - "data":[24, 50, 51, 24, 24, 24, 28, 29, 24, 24, 28, 46, 29, 24, 24, 50, - 24, 28, 46, 46, 29, 24, 50, 51, 24, 90, 25, 111, 23, 28, 29, 89, - 29, 50, 2, 2, 51, 24, 24, 28, 29, 28, 10, 3, 23, 25, 23, 89, - 23, 90, 24, 24, 24, 24, 24, 25, 23, 50, 32, 10, 32, 47, 23, 89, - 51, 24, 24, 24, 28, 29, 24, 50, 51, 24, 50, 51, 50, 2, 51, 24, - 28, 46, 29, 24, 50, 51, 24, 24, 24, 24, 28, 46, 46, 46, 29, 89, - 50, 2, 51, 24, 24, 24, 24, 28, 29, 24, 50, 2, 2, 2, 51, 89, - 24, 24, 28, 29, 24, 89, 24, 50, 32, 29, 24, 90, 24, 24, 24, 24, - 24, 89, 25, 23, 24, 90, 24, 24, 50, 51, 24, 24, 24, 24, 24, 24, - 89, 24, 25, 23, 24, 24, 24, 24, 24, 24, 24, 24, 28, 46, 29, 24, - 24, 24, 25, 23, 24, 28, 46, 29, 24, 89, 28, 29, 25, 111, 45, 29, - 24, 24, 50, 51, 89, 50, 3, 45, 29, 24, 50, 51, 50, 2, 3, 45, - 24, 90, 24, 24, 24, 24, 50, 2, 32, 29, 24, 24, 24, 24, 25, 1, - 24, 89, 24, 24, 24, 24, 89, 24, 50, 51, 24, 24, 24, 24, 50, 32, - 29, 90, 90, 24, 24, 89, 24, 24, 24, 24, 24, 24, 28, 29, 24, 50, - 32, 29, 24, 24, 90, 24, 24, 24, 24, 24, 24, 24, 25, 45, 29, 24], + "data":[28, 46, 29, 24, 24, 28, 46, 29, 24, 90, 24, 24, 50, 51, 24, 24, + 50, 2, 32, 46, 29, 50, 2, 32, 29, 24, 90, 24, 89, 24, 24, 24, + 89, 28, 10, 3, 23, 24, 24, 25, 23, 24, 24, 24, 28, 29, 89, 24, + 24, 25, 23, 50, 32, 29, 24, 25, 23, 28, 29, 24, 50, 51, 28, 29, + 24, 25, 23, 24, 50, 51, 24, 50, 51, 50, 51, 24, 24, 24, 50, 32, + 24, 25, 23, 24, 24, 89, 24, 24, 24, 24, 24, 24, 24, 24, 28, 47, + 24, 50, 32, 46, 29, 90, 24, 579, 29, 24, 89, 89, 24, 24, 25, 579, + 29, 24, 25, 114, 45, 29, 24, 25, 23, 90, 24, 24, 24, 89, 50, 51, + 51, 89, 50, 3, 115, 23, 24, 25, 23, 89, 28, 29, 24, 24, 24, 89, + 24, 24, 24, 25, 111, 23, 90, 50, 51, 24, 50, 32, 46, 29, 24, 24, + 24, 90, 24, 50, 2, 51, 28, 46, 46, 29, 24, 50, 2, 51, 24, 24, + 24, 89, 24, 24, 28, 29, 50, 2, 2, 51, 24, 90, 24, 24, 89, 24, + 46, 29, 28, 46, 10, 32, 29, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 2, 51, 50, 2, 51, 50, 51, 24, 89, 24, 24, 90, 24, 24, 89, 90, + 24, 28, 46, 29, 24, 24, 24, 24, 89, 24, 24, 24, 24, 24, 89, 24, + 29, 50, 3, 23, 24, 90, 28, 29, 24, 24, 24, 24, 24, 90, 28, 46], "height":16, "width":16, "x":0, "y":0 }, { - "data":[51, 28, 46, 29, 24, 24, 24, 24, 24, 50, 2, 51, 24, 24, 24, 24, - 24, 50, 2, 51, 28, 29, 24, 24, 24, 28, 29, 89, 24, 28, 46, 29, - 89, 24, 90, 24, 50, 32, 29, 24, 28, 10, 51, 24, 24, 25, 1, 51, - 90, 24, 24, 24, 28, 10, 51, 90, 25, 45, 46, 29, 24, 25, 23, 89, - 24, 28, 29, 28, 10, 32, 29, 28, 10, 2, 2, 51, 24, 50, 51, 24, - 24, 50, 32, 10, 51, 50, 51, 25, 45, 46, 29, 24, 24, 90, 24, 24, - 24, 24, 50, 32, 46, 29, 24, 50, 2, 2, 32, 29, 24, 24, 24, 24, - 24, 24, 24, 50, 2, 32, 29, 24, 24, 24, 50, 51, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 25, 23, 90, 24, 89, 24, 28, 29, 24, 24, 28, - 28, 46, 29, 24, 24, 50, 51, 24, 24, 24, 24, 50, 32, 29, 24, 25, - 50, 2, 51, 28, 29, 28, 46, 29, 24, 24, 89, 24, 25, 45, 46, 10, - 29, 24, 24, 50, 32, 10, 2, 51, 24, 24, 24, 24, 50, 2, 2, 51, - 51, 24, 28, 29, 50, 51, 28, 46, 29, 24, 24, 24, 24, 24, 90, 28, - 29, 24, 25, 23, 24, 24, 50, 2, 32, 29, 24, 24, 89, 24, 89, 50, - 51, 24, 50, 51, 24, 24, 24, 24, 50, 32, 29, 89, 90, 24, 24, 24, - 24, 24, 24, 24, 24, 28, 29, 24, 24, 25, 23, 24, 24, 28, 46, 29], + "data":[90, 24, 24, 24, 24, 24, 24, 24, 24, 90, 24, 89, 24, 24, 24, 24, + 28, 29, 24, 24, 24, 24, 24, 24, 90, 24, 89, 24, 24, 24, 24, 24, + 50, 51, 24, 24, 89, 24, 24, 24, 24, 24, 24, 24, 24, 28, 29, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 23, 28, + 46, 29, 24, 24, 24, 24, 24, 28, 29, 24, 24, 24, 90, 50, 32, 47, + 115, 23, 24, 24, 24, 24, 24, 25, 23, 28, 29, 24, 24, 89, 50, 3, + 3, 45, 46, 29, 24, 24, 24, 50, 51, 50, 51, 89, 24, 24, 28, 47, + 50, 2, 2, 32, 29, 24, 24, 24, 90, 24, 24, 24, 24, 24, 25, 1, + 24, 24, 24, 25, 23, 24, 24, 24, 89, 24, 24, 90, 24, 24, 50, 51, + 89, 24, 24, 25, 23, 24, 24, 24, 24, 24, 28, 29, 24, 24, 24, 90, + 24, 24, 24, 50, 32, 29, 24, 24, 28, 46, 47, 23, 24, 24, 24, 24, + 24, 24, 24, 90, 50, 51, 90, 24, 50, 3, 1, 51, 28, 29, 28, 46, + 24, 89, 28, 46, 46, 29, 24, 24, 24, 50, 51, 28, 10, 51, 50, 2, + 24, 90, 25, 1, 2, 51, 28, 46, 46, 46, 46, 10, 51, 24, 24, 24, + 24, 24, 50, 32, 29, 28, 10, 2, 2, 3, 1, 32, 29, 24, 24, 24, + 29, 24, 24, 25, 45, 47, 23, 24, 24, 50, 51, 25, 45, 29, 24, 24], "height":16, "width":16, "x":16, @@ -52,19 +52,19 @@ "data":[24, 24, 50, 51, 24, 50, 2, 51, 24, 28, 47, 1, 51, 25, 111, 45, 24, 24, 28, 29, 24, 24, 24, 28, 29, 25, 111, 23, 24, 50, 2, 2, 28, 46, 10, 51, 28, 29, 24, 25, 23, 50, 2, 51, 24, 24, 28, 29, - 50, 2, 51, 90, 50, 32, 29, 50, 32, 46, 29, 24, 24, 24, 25, 23, - 89, 24, 24, 24, 90, 50, 51, 24, 25, 114, 23, 24, 90, 24, 25, 23, - 24, 28, 29, 24, 24, 28, 29, 89, 50, 2, 51, 24, 24, 24, 25, 23, - 24, 50, 51, 28, 46, 10, 51, 24, 24, 24, 90, 24, 24, 24, 50, 32, - 24, 24, 90, 50, 2, 32, 29, 28, 46, 29, 28, 46, 29, 24, 90, 50, - 46, 29, 24, 90, 24, 25, 45, 47, 1, 51, 50, 2, 32, 46, 29, 89, - 115, 45, 29, 24, 24, 50, 2, 2, 32, 29, 24, 24, 50, 3, 23, 24, - 2, 2, 51, 24, 24, 24, 24, 24, 50, 32, 46, 29, 24, 50, 51, 24, - 89, 24, 28, 29, 89, 24, 24, 24, 24, 25, 111, 23, 24, 28, 29, 24, - 46, 29, 25, 23, 89, 28, 46, 29, 24, 25, 115, 23, 24, 25, 23, 24, - 2, 32, 47, 45, 46, 10, 2, 32, 46, 10, 2, 51, 24, 25, 23, 89, + 10, 2, 51, 90, 50, 32, 29, 50, 32, 46, 29, 24, 24, 24, 25, 23, + 23, 24, 24, 24, 90, 50, 51, 24, 25, 114, 23, 24, 90, 24, 25, 23, + 23, 28, 29, 24, 24, 28, 29, 89, 50, 2, 51, 24, 24, 24, 25, 23, + 23, 50, 51, 28, 46, 10, 51, 24, 24, 24, 90, 24, 24, 24, 50, 32, + 51, 24, 90, 50, 2, 32, 29, 28, 46, 29, 28, 46, 29, 24, 90, 50, + 28, 29, 24, 90, 24, 25, 45, 47, 1, 51, 50, 2, 32, 46, 29, 89, + 25, 45, 29, 24, 24, 50, 2, 2, 32, 29, 24, 24, 50, 3, 23, 24, + 50, 2, 51, 24, 24, 24, 24, 24, 50, 32, 46, 29, 24, 50, 51, 24, + 29, 24, 28, 29, 89, 24, 24, 24, 24, 25, 111, 23, 24, 28, 29, 24, + 32, 29, 25, 23, 89, 28, 46, 29, 24, 25, 115, 23, 24, 25, 23, 24, + 50, 32, 47, 45, 46, 10, 2, 32, 46, 10, 2, 51, 24, 25, 23, 89, 24, 50, 2, 3, 1, 32, 46, 10, 2, 51, 89, 24, 89, 50, 51, 24, - 90, 28, 46, 47, 23, 50, 3, 23, 24, 24, 90, 24, 28, 46, 46, 29], + 24, 28, 46, 47, 23, 50, 3, 23, 24, 24, 90, 24, 28, 46, 46, 29], "height":16, "width":16, "x":32, @@ -181,7 +181,7 @@ "y":0 }, { - "data":[50, 51, 24, 24, 24, 24, 28, 46, 29, 24, 89, 28, 10, 2, 51, 28, + "data":[51, 24, 50, 51, 24, 24, 25, 45, 29, 24, 24, 28, 29, 24, 50, 3, 24, 24, 28, 29, 28, 29, 25, 111, 23, 90, 24, 25, 23, 24, 24, 25, 46, 46, 10, 51, 25, 23, 25, 115, 23, 90, 89, 50, 51, 24, 28, 47, 2, 2, 51, 24, 25, 23, 25, 111, 23, 24, 24, 24, 24, 24, 50, 2, @@ -203,7 +203,7 @@ "y":16 }, { - "data":[29, 24, 24, 24, 24, 50, 51, 24, 24, 25, 45, 29, 24, 50, 2, 32, + "data":[23, 24, 24, 50, 2, 2, 51, 89, 24, 28, 46, 10, 2, 51, 24, 28, 23, 24, 28, 46, 46, 46, 46, 29, 28, 47, 1, 51, 90, 24, 24, 50, 23, 89, 50, 2, 3, 115, 1, 51, 50, 2, 51, 89, 24, 24, 24, 28, 51, 28, 29, 24, 50, 2, 51, 24, 28, 29, 90, 24, 28, 29, 28, 47, @@ -1087,137 +1087,49 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 578, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 579, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 578, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":16, + "width":16, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 583, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 578, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 583, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 578, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "height":16, "width":16, - "x":16, - "y":32 - }, - { - "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 582, 582, 582, 582, 582, 582, 582, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 580, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - "height":16, - "width":16, - "x":32, - "y":32 - }, - { - "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 582, 582, 582, 582, 582, 582, 582, 0, 0, 0, 583, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 585, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0], - "height":16, - "width":16, - "x":48, - "y":32 - }, - { - "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 579, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 579, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 579, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 580, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - "height":16, - "width":16, - "x":16, - "y":48 - }, - { - "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 580, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - "height":16, - "width":16, - "x":32, - "y":48 - }, - { - "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 585, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 581, 581, 581, 581, 581, 581, 581, 0, 0, 0, 585, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - "height":16, - "width":16, - "x":48, - "y":48 + "x":0, + "y":16 }], - "height":48, + "height":64, "id":2, "name":"Collidable ", "opacity":1, - "startx":16, - "starty":16, + "startx":0, + "starty":0, "type":"tilelayer", "visible":true, - "width":80, + "width":64, "x":0, "y":0 }], diff --git a/ZoFo/Content/MapData/TileSets/CollisionTileSet.tsj b/ZoFo/Content/MapData/TileSets/CollisionTileSet.tsj index f54327b..e748c72 100644 --- a/ZoFo/Content/MapData/TileSets/CollisionTileSet.tsj +++ b/ZoFo/Content/MapData/TileSets/CollisionTileSet.tsj @@ -9,16 +9,31 @@ "tiledversion":"1.10.2", "tileheight":128, "tiles":[ + { + "id":0, + "type":"Tiles" + }, + { + "id":1, + "type":"Tiles" + }, + { + "id":2, + "type":"Tiles" + }, + { + "id":3, + "type":"Tiles" + }, { "id":4, - "type":"Tile" + "type":"Tiles" }, { "id":5, "objectgroup": { "draworder":"index", - "id":2, "name":"", "objects":[ { @@ -48,14 +63,14 @@ "visible":true, "x":0, "y":0 - } + }, + "type":"StopObject" }, { "id":6, "objectgroup": { "draworder":"index", - "id":4, "name":"", "objects":[ { @@ -74,14 +89,51 @@ "visible":true, "x":0, "y":0 - } + }, + "type":"StopObject" + }, + { + "id":7, + "objectgroup": + { + "draworder":"index", + "name":"", + "objects":[ + { + "height":128, + "id":1, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":36, + "x":0, + "y":0 + }, + { + "height":36.6666666666667, + "id":2, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":128.666666666667, + "x":0, + "y":91.3333333333333 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "x":0, + "y":0 + }, + "type":"StopObject" }, { "id":8, "objectgroup": { "draworder":"index", - "id":2, "name":"", "objects":[ { @@ -100,14 +152,14 @@ "visible":true, "x":0, "y":0 - } + }, + "type":"StopObject" }, { "id":9, "objectgroup": { "draworder":"index", - "id":2, "name":"", "objects":[ { @@ -126,14 +178,14 @@ "visible":true, "x":0, "y":0 - } + }, + "type":"StopObject" }, { "id":10, "objectgroup": { "draworder":"index", - "id":2, "name":"", "objects":[ { @@ -163,14 +215,14 @@ "visible":true, "x":0, "y":0 - } + }, + "type":"StopObject" }, { "id":11, "objectgroup": { "draworder":"index", - "id":2, "name":"", "objects":[ { @@ -189,14 +241,14 @@ "visible":true, "x":0, "y":0 - } + }, + "type":"StopObject" }, { "id":12, "objectgroup": { "draworder":"index", - "id":2, "name":"", "objects":[ { @@ -226,7 +278,156 @@ "visible":true, "x":0, "y":0 - } + }, + "type":"StopObject" + }, + { + "id":13, + "type":"StopObject" + }, + { + "id":14, + "type":"StopObject" + }, + { + "id":15, + "type":"StopObject" + }, + { + "id":16, + "type":"StopObject" + }, + { + "id":17, + "type":"StopObject" + }, + { + "id":18, + "type":"StopObject" + }, + { + "id":19, + "type":"StopObject" + }, + { + "id":20, + "type":"StopObject" + }, + { + "id":21, + "type":"StopObject" + }, + { + "id":22, + "type":"StopObject" + }, + { + "id":23, + "type":"StopObject" + }, + { + "id":24, + "type":"StopObject" + }, + { + "id":25, + "type":"StopObject" + }, + { + "id":26, + "type":"StopObject" + }, + { + "id":27, + "type":"StopObject" + }, + { + "id":28, + "type":"StopObject" + }, + { + "id":29, + "type":"StopObject" + }, + { + "id":30, + "type":"StopObject" + }, + { + "id":31, + "type":"StopObject" + }, + { + "id":32, + "type":"StopObject" + }, + { + "id":33, + "type":"StopObject" + }, + { + "id":34, + "type":"StopObject" + }, + { + "id":35, + "type":"StopObject" + }, + { + "id":36, + "type":"StopObject" + }, + { + "id":37, + "type":"StopObject" + }, + { + "id":38, + "type":"StopObject" + }, + { + "id":39, + "type":"StopObject" + }, + { + "id":40, + "type":"StopObject" + }, + { + "id":41, + "type":"StopObject" + }, + { + "id":42, + "type":"StopObject" + }, + { + "id":43, + "type":"StopObject" + }, + { + "id":44, + "type":"StopObject" + }, + { + "id":45, + "type":"StopObject" + }, + { + "id":46, + "type":"StopObject" + }, + { + "id":47, + "type":"StopObject" + }, + { + "id":48, + "type":"StopObject" + }, + { + "id":49, + "type":"StopObject" }], "tilewidth":128, "type":"tileset", diff --git a/ZoFo/Content/MapData/TileSets/TileSet 1.tsj b/ZoFo/Content/MapData/TileSets/TileSet 1.tsj index bde6188..452c896 100644 --- a/ZoFo/Content/MapData/TileSets/TileSet 1.tsj +++ b/ZoFo/Content/MapData/TileSets/TileSet 1.tsj @@ -1082,6 +1082,1238 @@ { "id":263, "type":"Tile" + }, + { + "id":264, + "type":"Tile" + }, + { + "id":265, + "type":"Tile" + }, + { + "id":266, + "type":"Tile" + }, + { + "id":267, + "type":"Tile" + }, + { + "id":268, + "type":"Tile" + }, + { + "id":269, + "type":"Tile" + }, + { + "id":270, + "type":"Tile" + }, + { + "id":271, + "type":"Tile" + }, + { + "id":272, + "type":"Tile" + }, + { + "id":273, + "type":"Tile" + }, + { + "id":274, + "type":"Tile" + }, + { + "id":275, + "type":"Tile" + }, + { + "id":276, + "type":"Tile" + }, + { + "id":277, + "type":"Tile" + }, + { + "id":278, + "type":"Tile" + }, + { + "id":279, + "type":"Tile" + }, + { + "id":280, + "type":"Tile" + }, + { + "id":281, + "type":"Tile" + }, + { + "id":282, + "type":"Tile" + }, + { + "id":283, + "type":"Tile" + }, + { + "id":284, + "type":"Tile" + }, + { + "id":285, + "type":"Tile" + }, + { + "id":286, + "type":"Tile" + }, + { + "id":287, + "type":"Tile" + }, + { + "id":288, + "type":"Tile" + }, + { + "id":289, + "type":"Tile" + }, + { + "id":290, + "type":"Tile" + }, + { + "id":291, + "type":"Tile" + }, + { + "id":292, + "type":"Tile" + }, + { + "id":293, + "type":"Tile" + }, + { + "id":294, + "type":"Tile" + }, + { + "id":295, + "type":"Tile" + }, + { + "id":296, + "type":"Tile" + }, + { + "id":297, + "type":"Tile" + }, + { + "id":298, + "type":"Tile" + }, + { + "id":299, + "type":"Tile" + }, + { + "id":300, + "type":"Tile" + }, + { + "id":301, + "type":"Tile" + }, + { + "id":302, + "type":"Tile" + }, + { + "id":303, + "type":"Tile" + }, + { + "id":304, + "type":"Tile" + }, + { + "id":305, + "type":"Tile" + }, + { + "id":306, + "type":"Tile" + }, + { + "id":307, + "type":"Tile" + }, + { + "id":308, + "type":"Tile" + }, + { + "id":309, + "type":"Tile" + }, + { + "id":310, + "type":"Tile" + }, + { + "id":311, + "type":"Tile" + }, + { + "id":312, + "type":"Tile" + }, + { + "id":313, + "type":"Tile" + }, + { + "id":314, + "type":"Tile" + }, + { + "id":315, + "type":"Tile" + }, + { + "id":316, + "type":"Tile" + }, + { + "id":317, + "type":"Tile" + }, + { + "id":318, + "type":"Tile" + }, + { + "id":319, + "type":"Tile" + }, + { + "id":320, + "type":"Tile" + }, + { + "id":321, + "type":"Tile" + }, + { + "id":322, + "type":"Tile" + }, + { + "id":323, + "type":"Tile" + }, + { + "id":324, + "type":"Tile" + }, + { + "id":325, + "type":"Tile" + }, + { + "id":326, + "type":"Tile" + }, + { + "id":327, + "type":"Tile" + }, + { + "id":328, + "type":"Tile" + }, + { + "id":329, + "type":"Tile" + }, + { + "id":330, + "type":"Tile" + }, + { + "id":331, + "type":"Tile" + }, + { + "id":332, + "type":"Tile" + }, + { + "id":333, + "type":"Tile" + }, + { + "id":334, + "type":"Tile" + }, + { + "id":335, + "type":"Tile" + }, + { + "id":336, + "type":"Tile" + }, + { + "id":337, + "type":"Tile" + }, + { + "id":338, + "type":"Tile" + }, + { + "id":339, + "type":"Tile" + }, + { + "id":340, + "type":"Tile" + }, + { + "id":341, + "type":"Tile" + }, + { + "id":342, + "type":"Tile" + }, + { + "id":343, + "type":"Tile" + }, + { + "id":344, + "type":"Tile" + }, + { + "id":345, + "type":"Tile" + }, + { + "id":346, + "type":"Tile" + }, + { + "id":347, + "type":"Tile" + }, + { + "id":348, + "type":"Tile" + }, + { + "id":349, + "type":"Tile" + }, + { + "id":350, + "type":"Tile" + }, + { + "id":351, + "type":"Tile" + }, + { + "id":352, + "type":"Tile" + }, + { + "id":353, + "type":"Tile" + }, + { + "id":354, + "type":"Tile" + }, + { + "id":355, + "type":"Tile" + }, + { + "id":356, + "type":"Tile" + }, + { + "id":357, + "type":"Tile" + }, + { + "id":358, + "type":"Tile" + }, + { + "id":359, + "type":"Tile" + }, + { + "id":360, + "type":"Tile" + }, + { + "id":361, + "type":"Tile" + }, + { + "id":362, + "type":"Tile" + }, + { + "id":363, + "type":"Tile" + }, + { + "id":364, + "type":"Tile" + }, + { + "id":365, + "type":"Tile" + }, + { + "id":366, + "type":"Tile" + }, + { + "id":367, + "type":"Tile" + }, + { + "id":368, + "type":"Tile" + }, + { + "id":369, + "type":"Tile" + }, + { + "id":370, + "type":"Tile" + }, + { + "id":371, + "type":"Tile" + }, + { + "id":372, + "type":"Tile" + }, + { + "id":373, + "type":"Tile" + }, + { + "id":374, + "type":"Tile" + }, + { + "id":375, + "type":"Tile" + }, + { + "id":376, + "type":"Tile" + }, + { + "id":377, + "type":"Tile" + }, + { + "id":378, + "type":"Tile" + }, + { + "id":379, + "type":"Tile" + }, + { + "id":380, + "type":"Tile" + }, + { + "id":381, + "type":"Tile" + }, + { + "id":382, + "type":"Tile" + }, + { + "id":383, + "type":"Tile" + }, + { + "id":384, + "type":"Tile" + }, + { + "id":385, + "type":"Tile" + }, + { + "id":386, + "type":"Tile" + }, + { + "id":387, + "type":"Tile" + }, + { + "id":388, + "type":"Tile" + }, + { + "id":389, + "type":"Tile" + }, + { + "id":390, + "type":"Tile" + }, + { + "id":391, + "type":"Tile" + }, + { + "id":392, + "type":"Tile" + }, + { + "id":393, + "type":"Tile" + }, + { + "id":394, + "type":"Tile" + }, + { + "id":395, + "type":"Tile" + }, + { + "id":396, + "type":"Tile" + }, + { + "id":397, + "type":"Tile" + }, + { + "id":398, + "type":"Tile" + }, + { + "id":399, + "type":"Tile" + }, + { + "id":400, + "type":"Tile" + }, + { + "id":401, + "type":"Tile" + }, + { + "id":402, + "type":"Tile" + }, + { + "id":403, + "type":"Tile" + }, + { + "id":404, + "type":"Tile" + }, + { + "id":405, + "type":"Tile" + }, + { + "id":406, + "type":"Tile" + }, + { + "id":407, + "type":"Tile" + }, + { + "id":408, + "type":"Tile" + }, + { + "id":409, + "type":"Tile" + }, + { + "id":410, + "type":"Tile" + }, + { + "id":411, + "type":"Tile" + }, + { + "id":412, + "type":"Tile" + }, + { + "id":413, + "type":"Tile" + }, + { + "id":414, + "type":"Tile" + }, + { + "id":415, + "type":"Tile" + }, + { + "id":416, + "type":"Tile" + }, + { + "id":417, + "type":"Tile" + }, + { + "id":418, + "type":"Tile" + }, + { + "id":419, + "type":"Tile" + }, + { + "id":420, + "type":"Tile" + }, + { + "id":421, + "type":"Tile" + }, + { + "id":422, + "type":"Tile" + }, + { + "id":423, + "type":"Tile" + }, + { + "id":424, + "type":"Tile" + }, + { + "id":425, + "type":"Tile" + }, + { + "id":426, + "type":"Tile" + }, + { + "id":427, + "type":"Tile" + }, + { + "id":428, + "type":"Tile" + }, + { + "id":429, + "type":"Tile" + }, + { + "id":430, + "type":"Tile" + }, + { + "id":431, + "type":"Tile" + }, + { + "id":432, + "type":"Tile" + }, + { + "id":433, + "type":"Tile" + }, + { + "id":434, + "type":"Tile" + }, + { + "id":435, + "type":"Tile" + }, + { + "id":436, + "type":"Tile" + }, + { + "id":437, + "type":"Tile" + }, + { + "id":438, + "type":"Tile" + }, + { + "id":439, + "type":"Tile" + }, + { + "id":440, + "type":"Tile" + }, + { + "id":441, + "type":"Tile" + }, + { + "id":442, + "type":"Tile" + }, + { + "id":443, + "type":"Tile" + }, + { + "id":444, + "type":"Tile" + }, + { + "id":445, + "type":"Tile" + }, + { + "id":446, + "type":"Tile" + }, + { + "id":447, + "type":"Tile" + }, + { + "id":448, + "type":"Tile" + }, + { + "id":449, + "type":"Tile" + }, + { + "id":450, + "type":"Tile" + }, + { + "id":451, + "type":"Tile" + }, + { + "id":452, + "type":"Tile" + }, + { + "id":453, + "type":"Tile" + }, + { + "id":454, + "type":"Tile" + }, + { + "id":455, + "type":"Tile" + }, + { + "id":456, + "type":"Tile" + }, + { + "id":457, + "type":"Tile" + }, + { + "id":458, + "type":"Tile" + }, + { + "id":459, + "type":"Tile" + }, + { + "id":460, + "type":"Tile" + }, + { + "id":461, + "type":"Tile" + }, + { + "id":462, + "type":"Tile" + }, + { + "id":463, + "type":"Tile" + }, + { + "id":464, + "type":"Tile" + }, + { + "id":465, + "type":"Tile" + }, + { + "id":466, + "type":"Tile" + }, + { + "id":467, + "type":"Tile" + }, + { + "id":468, + "type":"Tile" + }, + { + "id":469, + "type":"Tile" + }, + { + "id":470, + "type":"Tile" + }, + { + "id":471, + "type":"Tile" + }, + { + "id":472, + "type":"Tile" + }, + { + "id":473, + "type":"Tile" + }, + { + "id":474, + "type":"Tile" + }, + { + "id":475, + "type":"Tile" + }, + { + "id":476, + "type":"Tile" + }, + { + "id":477, + "type":"Tile" + }, + { + "id":478, + "type":"Tile" + }, + { + "id":479, + "type":"Tile" + }, + { + "id":480, + "type":"Tile" + }, + { + "id":481, + "type":"Tile" + }, + { + "id":482, + "type":"Tile" + }, + { + "id":483, + "type":"Tile" + }, + { + "id":484, + "type":"Tile" + }, + { + "id":485, + "type":"Tile" + }, + { + "id":486, + "type":"Tile" + }, + { + "id":487, + "type":"Tile" + }, + { + "id":488, + "type":"Tile" + }, + { + "id":489, + "type":"Tile" + }, + { + "id":490, + "type":"Tile" + }, + { + "id":491, + "type":"Tile" + }, + { + "id":492, + "type":"Tile" + }, + { + "id":493, + "type":"Tile" + }, + { + "id":494, + "type":"Tile" + }, + { + "id":495, + "type":"Tile" + }, + { + "id":496, + "type":"Tile" + }, + { + "id":497, + "type":"Tile" + }, + { + "id":498, + "type":"Tile" + }, + { + "id":499, + "type":"Tile" + }, + { + "id":500, + "type":"Tile" + }, + { + "id":501, + "type":"Tile" + }, + { + "id":502, + "type":"Tile" + }, + { + "id":503, + "type":"Tile" + }, + { + "id":504, + "type":"Tile" + }, + { + "id":505, + "type":"Tile" + }, + { + "id":506, + "type":"Tile" + }, + { + "id":507, + "type":"Tile" + }, + { + "id":508, + "type":"Tile" + }, + { + "id":509, + "type":"Tile" + }, + { + "id":510, + "type":"Tile" + }, + { + "id":511, + "type":"Tile" + }, + { + "id":512, + "type":"Tile" + }, + { + "id":513, + "type":"Tile" + }, + { + "id":514, + "type":"Tile" + }, + { + "id":515, + "type":"Tile" + }, + { + "id":516, + "type":"Tile" + }, + { + "id":517, + "type":"Tile" + }, + { + "id":518, + "type":"Tile" + }, + { + "id":519, + "type":"Tile" + }, + { + "id":520, + "type":"Tile" + }, + { + "id":521, + "type":"Tile" + }, + { + "id":522, + "type":"Tile" + }, + { + "id":523, + "type":"Tile" + }, + { + "id":524, + "type":"Tile" + }, + { + "id":525, + "type":"Tile" + }, + { + "id":526, + "type":"Tile" + }, + { + "id":527, + "type":"Tile" + }, + { + "id":528, + "type":"Tile" + }, + { + "id":529, + "type":"Tile" + }, + { + "id":530, + "type":"Tile" + }, + { + "id":531, + "type":"Tile" + }, + { + "id":532, + "type":"Tile" + }, + { + "id":533, + "type":"Tile" + }, + { + "id":534, + "type":"Tile" + }, + { + "id":535, + "type":"Tile" + }, + { + "id":536, + "type":"Tile" + }, + { + "id":537, + "type":"Tile" + }, + { + "id":538, + "type":"Tile" + }, + { + "id":539, + "type":"Tile" + }, + { + "id":540, + "type":"Tile" + }, + { + "id":541, + "type":"Tile" + }, + { + "id":542, + "type":"Tile" + }, + { + "id":543, + "type":"Tile" + }, + { + "id":544, + "type":"Tile" + }, + { + "id":545, + "type":"Tile" + }, + { + "id":546, + "type":"Tile" + }, + { + "id":547, + "type":"Tile" + }, + { + "id":548, + "type":"Tile" + }, + { + "id":549, + "type":"Tile" + }, + { + "id":550, + "type":"Tile" + }, + { + "id":551, + "type":"Tile" + }, + { + "id":552, + "type":"Tile" + }, + { + "id":553, + "type":"Tile" + }, + { + "id":554, + "type":"Tile" + }, + { + "id":555, + "type":"Tile" + }, + { + "id":556, + "type":"Tile" + }, + { + "id":557, + "type":"Tile" + }, + { + "id":558, + "type":"Tile" + }, + { + "id":559, + "type":"Tile" + }, + { + "id":560, + "type":"Tile" + }, + { + "id":561, + "type":"Tile" + }, + { + "id":562, + "type":"Tile" + }, + { + "id":563, + "type":"Tile" + }, + { + "id":564, + "type":"Tile" + }, + { + "id":565, + "type":"Tile" + }, + { + "id":566, + "type":"Tile" + }, + { + "id":567, + "type":"Tile" + }, + { + "id":568, + "type":"Tile" + }, + { + "id":569, + "type":"Tile" + }, + { + "id":570, + "type":"Tile" + }, + { + "id":571, + "type":"Tile" }], "tilewidth":32, "type":"tileset", diff --git a/ZoFo/Content/Textures/Animations/player_down-left_idle.animation b/ZoFo/Content/Textures/Animations/player_down-left_idle.animation new file mode 100644 index 0000000..6c2a6c7 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_down-left_idle.animation @@ -0,0 +1,21 @@ +{ + "id": "player_down-left_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 560, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_down-right_idle.animation b/ZoFo/Content/Textures/Animations/player_down-right_idle.animation new file mode 100644 index 0000000..016a3f2 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_down-right_idle.animation @@ -0,0 +1,20 @@ +{ + "id": "player_down-right_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 358, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/Content/Textures/Animations/player_down_idle.animation b/ZoFo/Content/Textures/Animations/player_down_idle.animation new file mode 100644 index 0000000..243946c --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_down_idle.animation @@ -0,0 +1,20 @@ +{ + "id": "player_down_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 464, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/Content/Textures/Animations/player_idle_down-left_mining.animation b/ZoFo/Content/Textures/Animations/player_idle_down-left_mining.animation new file mode 100644 index 0000000..ba1b3c9 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_idle_down-left_mining.animation @@ -0,0 +1,21 @@ +{ + "id": "player_idle_down-left_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 776, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_idle_down_mining.animation b/ZoFo/Content/Textures/Animations/player_idle_down_mining.animation new file mode 100644 index 0000000..92bda6c --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_idle_down_mining.animation @@ -0,0 +1,21 @@ +{ + "id": "player_idle_down_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 582, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_idle_left_mining.animation b/ZoFo/Content/Textures/Animations/player_idle_left_mining.animation new file mode 100644 index 0000000..81f9629 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_idle_left_mining.animation @@ -0,0 +1,21 @@ +{ + "id": "player_idle_left_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 1358, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_idle_rights_mining.animation b/ZoFo/Content/Textures/Animations/player_idle_rights_mining.animation new file mode 100644 index 0000000..6570cce --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_idle_rights_mining.animation @@ -0,0 +1,21 @@ +{ + "id": "player_idle_rights_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 388, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": false, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_idle_rotate_weapon.animation b/ZoFo/Content/Textures/Animations/player_idle_rotate_weapon.animation deleted file mode 100644 index 3240a26..0000000 --- a/ZoFo/Content/Textures/Animations/player_idle_rotate_weapon.animation +++ /dev/null @@ -1 +0,0 @@ -{"id":"player_idle_rotate_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":116,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_idle_top-left_mining.animation b/ZoFo/Content/Textures/Animations/player_idle_top-left_mining.animation new file mode 100644 index 0000000..3dfef38 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_idle_top-left_mining.animation @@ -0,0 +1,21 @@ +{ + "id": "player_idle_top-left_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 1552, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_idle_top-rights_mining.animation b/ZoFo/Content/Textures/Animations/player_idle_top-rights_mining.animation new file mode 100644 index 0000000..d4a5828 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_idle_top-rights_mining.animation @@ -0,0 +1,20 @@ +{ + "id": "player_idle_top-rights_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 194, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/Content/Textures/Animations/player_left_idle.animation b/ZoFo/Content/Textures/Animations/player_left_idle.animation new file mode 100644 index 0000000..8906cb3 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_left_idle.animation @@ -0,0 +1,21 @@ +{ + "id": "player_left_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 696, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_look_down.animation b/ZoFo/Content/Textures/Animations/player_look_down.animation new file mode 100644 index 0000000..0b4e385 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_down.animation @@ -0,0 +1,20 @@ +{ + "id": "player_look_down", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 464, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/Content/Textures/Animations/player_look_down_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_down_weapon.animation new file mode 100644 index 0000000..76f9b07 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_down_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_down_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":512,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_left.animation b/ZoFo/Content/Textures/Animations/player_look_left.animation new file mode 100644 index 0000000..13e8f0e --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_left.animation @@ -0,0 +1 @@ +{"id":"player_look_left","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":696,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_left_down.animation b/ZoFo/Content/Textures/Animations/player_look_left_down.animation new file mode 100644 index 0000000..78f5150 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_left_down.animation @@ -0,0 +1 @@ +{"id":"player_look_left_down","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":580,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_left_down_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_left_down_weapon.animation new file mode 100644 index 0000000..5d7468b --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_left_down_weapon.animation @@ -0,0 +1,20 @@ +{ + "id": "player_look_left_down_weapon", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle_gun", + "startSpriteRectangle": { + "X": 0, + "Y": 640, + "Width": 110, + "Height": 128 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/Content/Textures/Animations/player_look_left_up.animation b/ZoFo/Content/Textures/Animations/player_look_left_up.animation new file mode 100644 index 0000000..9fc0cf6 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_left_up.animation @@ -0,0 +1 @@ +{"id":"player_look_left_up","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":812,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_left_up_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_left_up_weapon.animation new file mode 100644 index 0000000..68ddc46 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_left_up_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_left_up_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":896,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_left_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_left_weapon.animation new file mode 100644 index 0000000..638f33a --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_left_weapon.animation @@ -0,0 +1,20 @@ +{ + "id": "player_look_left_weapon", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle_gun", + "startSpriteRectangle": { + "X": 0, + "Y": 768, + "Width": 110, + "Height": 128 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/Content/Textures/Animations/player_look_right.animation b/ZoFo/Content/Textures/Animations/player_look_right.animation new file mode 100644 index 0000000..3d1bf63 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_right.animation @@ -0,0 +1 @@ +{"id":"player_look_right","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":232,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_right_down.animation b/ZoFo/Content/Textures/Animations/player_look_right_down.animation new file mode 100644 index 0000000..fbdbeb9 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_right_down.animation @@ -0,0 +1 @@ +{"id":"player_look_right_down","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":348,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_right_down_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_right_down_weapon.animation new file mode 100644 index 0000000..49ca0c6 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_right_down_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_right_down_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":384,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_right_up.animation b/ZoFo/Content/Textures/Animations/player_look_right_up.animation new file mode 100644 index 0000000..0fe59d4 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_right_up.animation @@ -0,0 +1 @@ +{"id":"player_look_right_up","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":116,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_right_up_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_right_up_weapon.animation new file mode 100644 index 0000000..897c4b5 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_right_up_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_right_up_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":128,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_right_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_right_weapon.animation new file mode 100644 index 0000000..e7a753c --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_right_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_right_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":256,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_up.animation b/ZoFo/Content/Textures/Animations/player_look_up.animation new file mode 100644 index 0000000..3b24dca --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_up.animation @@ -0,0 +1 @@ +{"id":"player_look_up","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":0,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_up_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_up_weapon.animation new file mode 100644 index 0000000..4f45286 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_up_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_up_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":0,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_right_idle.animation b/ZoFo/Content/Textures/Animations/player_right_idle.animation new file mode 100644 index 0000000..a3c1538 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_right_idle.animation @@ -0,0 +1,21 @@ +{ + "id": "player_right_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 232, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_top-left_idle.animation b/ZoFo/Content/Textures/Animations/player_top-left_idle.animation new file mode 100644 index 0000000..feb823e --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_top-left_idle.animation @@ -0,0 +1,21 @@ +{ + "id": "player_top-left_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 812, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_top-right_idle.animation b/ZoFo/Content/Textures/Animations/player_top-right_idle.animation new file mode 100644 index 0000000..df132a3 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_top-right_idle.animation @@ -0,0 +1,21 @@ +{ + "id": "player_top-right_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 116, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_top_mining.animation b/ZoFo/Content/Textures/Animations/player_top_mining.animation new file mode 100644 index 0000000..061d43a --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_top_mining.animation @@ -0,0 +1,21 @@ +{ + "id": "player_top_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 0, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/testAnimation.animation b/ZoFo/Content/Textures/Animations/testAnimation.animation new file mode 100644 index 0000000..917113d --- /dev/null +++ b/ZoFo/Content/Textures/Animations/testAnimation.animation @@ -0,0 +1,21 @@ +{ + "id": "testAnimation", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 0, + "Width": 53, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 11, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/testAnimationExample.animation b/ZoFo/Content/Textures/Animations/testAnimationExample.animation index de970c1..88d3740 100644 --- a/ZoFo/Content/Textures/Animations/testAnimationExample.animation +++ b/ZoFo/Content/Textures/Animations/testAnimationExample.animation @@ -1 +1,20 @@ -{"id":"testAnimationExample","textureName":"Textures/AnimationTextures/unicorn","startSpriteRectangle":{"X":0,"Y":0,"Width":400,"Height":400},"frameSecond":[{"Item1":0,"Item2":1}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"} +{ + "id": "testAnimationExample", + "textureName": "Textures/AnimationTextures/unicorn", + "startSpriteRectangle": { + "X": 0, + "Y": 0, + "Width": 400, + "Height": 400 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 1 + } + ], + "textureFrameInterval": 1, + "framesCount": 1, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/Content/Textures/GUI/background/base.png b/ZoFo/Content/Textures/GUI/background/base.png index 11cbac6..49a5fb7 100644 Binary files a/ZoFo/Content/Textures/GUI/background/base.png and b/ZoFo/Content/Textures/GUI/background/base.png differ diff --git a/ZoFo/Content/Textures/GUI/background/join.png b/ZoFo/Content/Textures/GUI/background/join.png index 6d45273..c0bb204 100644 Binary files a/ZoFo/Content/Textures/GUI/background/join.png and b/ZoFo/Content/Textures/GUI/background/join.png differ diff --git a/ZoFo/Content/Textures/GUI/background/mainMenu.png b/ZoFo/Content/Textures/GUI/background/mainMenu.png index a0778fb..7f7665c 100644 Binary files a/ZoFo/Content/Textures/GUI/background/mainMenu.png and b/ZoFo/Content/Textures/GUI/background/mainMenu.png differ diff --git a/ZoFo/Content/Textures/Test/pickaxe.webp b/ZoFo/Content/Textures/Test/pickaxe.webp new file mode 100644 index 0000000..549165d Binary files /dev/null and b/ZoFo/Content/Textures/Test/pickaxe.webp differ diff --git a/ZoFo/Content/Textures/Test/rock.jpg b/ZoFo/Content/Textures/Test/rock.jpg new file mode 100644 index 0000000..e4f78d7 Binary files /dev/null and b/ZoFo/Content/Textures/Test/rock.jpg differ diff --git a/ZoFo/Content/Textures/Test/steel.png b/ZoFo/Content/Textures/Test/steel.png new file mode 100644 index 0000000..ca6d643 Binary files /dev/null and b/ZoFo/Content/Textures/Test/steel.png differ diff --git a/ZoFo/Content/Textures/Test/wood.jpg b/ZoFo/Content/Textures/Test/wood.jpg new file mode 100644 index 0000000..983d6f5 Binary files /dev/null and b/ZoFo/Content/Textures/Test/wood.jpg differ diff --git a/ZoFo/Content/Textures/TileSetImages/Tilelist1.png b/ZoFo/Content/Textures/TileSets/Tilelist1.png similarity index 100% rename from ZoFo/Content/Textures/TileSetImages/Tilelist1.png rename to ZoFo/Content/Textures/TileSets/Tilelist1.png diff --git a/ZoFo/Content/Textures/TileSetImages/Tilelist2.png b/ZoFo/Content/Textures/TileSets/Tilelist2.png similarity index 100% rename from ZoFo/Content/Textures/TileSetImages/Tilelist2.png rename to ZoFo/Content/Textures/TileSets/Tilelist2.png diff --git a/ZoFo/Content/Textures/TileSetImages/Tilelist3.png b/ZoFo/Content/Textures/TileSets/Tilelist3.png similarity index 100% rename from ZoFo/Content/Textures/TileSetImages/Tilelist3.png rename to ZoFo/Content/Textures/TileSets/Tilelist3.png diff --git a/ZoFo/Content/Textures/TileSetImages/Tilelist4.png b/ZoFo/Content/Textures/TileSets/Tilelist4.png similarity index 100% rename from ZoFo/Content/Textures/TileSetImages/Tilelist4.png rename to ZoFo/Content/Textures/TileSets/Tilelist4.png diff --git a/ZoFo/Content/Textures/TileSetImages/TilesetFloor.png b/ZoFo/Content/Textures/TileSets/TilesetFloor.png similarity index 100% rename from ZoFo/Content/Textures/TileSetImages/TilesetFloor.png rename to ZoFo/Content/Textures/TileSets/TilesetFloor.png diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs index 00c2a91..626f732 100644 --- a/ZoFo/GameCore/Client.cs +++ b/ZoFo/GameCore/Client.cs @@ -13,12 +13,17 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; using System.Drawing; using System.Reflection; using ZoFo.GameCore.GameObjects.Entities; +using System.Net.Sockets; +using System.Net; using ZoFo.GameCore.GameManagers; using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer; using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player; using System.Linq; using System.Web; using ZoFo.GameCore.GUI; +using ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables; +using ZoFo.GameCore.GameObjects.MapObjects.StopObjects; +using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies; namespace ZoFo.GameCore { public class Client @@ -28,6 +33,8 @@ namespace ZoFo.GameCore ClientNetworkManager networkManager; public bool IsConnected { get { return networkManager.IsConnected; } } + public IPEndPoint InfoConnect => networkManager.InfoConnect; + public Client() { networkManager = new ClientNetworkManager(); @@ -35,16 +42,21 @@ namespace ZoFo.GameCore // Подписка на действия инпутменеджера. // Отправляются данные апдейтса с обновлением инпута - AppManager.Instance.InputManager.ActionEvent += () => networkManager.AddData(new UpdateInput(){ - InputMovementDirection = AppManager.Instance.InputManager.InputMovementDirection, - InputAttackDirection = AppManager.Instance.InputManager.InputAttackDirection - }); + AppManager.Instance.InputManager.ActionEvent += () => + { + networkManager.AddData(new UpdateInput() + { + InputMovementDirection = AppManager.Instance.InputManager.InputMovementDirection, + InputAttackDirection = AppManager.Instance.InputManager.InputAttackDirection + }); + }; } public void OnDataSend(string data) { List updateDatas = JsonSerializer.Deserialize>(data); // тут будет switch + AppManager.Instance.debugHud.Log(data); foreach (var item in updateDatas) { GotData(item); @@ -62,7 +74,9 @@ namespace ZoFo.GameCore #endregion List mapObjects = new List(); - List gameObjects = new List(); + List gameObjects = new List(); + List players = new List(); + List stopObjects = new List(); /// /// Клиент должен обнговлять игру анимаций /// @@ -71,6 +85,7 @@ namespace ZoFo.GameCore { for (int i = 0; i < gameObjects.Count; i++) { + AppManager.Instance.debugHud.Set("GameTime", gameTime.TotalGameTime.ToString()); gameObjects[i].UpdateAnimations(); } } @@ -80,6 +95,10 @@ namespace ZoFo.GameCore { mapObjects[i].Draw(spriteBatch); } + for (int i = 0; i < stopObjects.Count; i++) + { + stopObjects[i].Draw(spriteBatch); + } for (int i = 0; i < gameObjects.Count; i++) { gameObjects[i].Draw(spriteBatch); @@ -98,12 +117,33 @@ namespace ZoFo.GameCore (update as UpdateTileCreated).tileSetName )); } + else if (update is UpdateStopObjectCreated) + { + stopObjects.Add( + new StopObject( + (update as UpdateStopObjectCreated).Position, + (update as UpdateStopObjectCreated).Size.ToVector2(), + (update as UpdateStopObjectCreated).sourceRectangle, + (update as UpdateStopObjectCreated).tileSetName, + (update as UpdateStopObjectCreated).collisions + )); + } else if (update is UpdateGameObjectCreated) { + GameObject created_gameObject; if ((update as UpdateGameObjectCreated).GameObjectType == "EntittyForAnimationTests") gameObjects.Add(new EntittyForAnimationTests((update as UpdateGameObjectCreated).position)); if ((update as UpdateGameObjectCreated).GameObjectType == "Player") - gameObjects.Add(new Player((update as UpdateGameObjectCreated).position)); + { + created_gameObject = new Player((update as UpdateGameObjectCreated).position); + players.Add(created_gameObject as Player); + gameObjects.Add(created_gameObject); + } + if ((update as UpdateGameObjectCreated).GameObjectType == "Ammo") + gameObjects.Add(new Ammo((update as UpdateGameObjectCreated).position)); + if ((update as UpdateGameObjectCreated).GameObjectType == "Zombie") + gameObjects.Add(new Zombie((update as UpdateGameObjectCreated).position)); + (gameObjects.Last() as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity); //var a = Assembly.GetAssembly(typeof(GameObject)); diff --git a/ZoFo/GameCore/GUI/BaseGUI.cs b/ZoFo/GameCore/GUI/BaseGUI.cs index cb159db..0949412 100644 --- a/ZoFo/GameCore/GUI/BaseGUI.cs +++ b/ZoFo/GameCore/GUI/BaseGUI.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Threading; using System.Xml; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; @@ -9,20 +10,118 @@ using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using MonogameLibrary.UI.Base; using MonogameLibrary.UI.Elements; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.GameManagers.ItemManager; namespace ZoFo.GameCore.GUI; public class BaseGUI : AbstractGUI { + private DrawableUIElement menuBackground; + private List ItemDisplayButtonsList; + private int buttonIndex = 0; + private string textureName; + protected override void CreateUI() { - // int width = AppManager.Instance.inGameHUDHelperResolution.X; - // int height = AppManager.Instance.inGameHUDHelperResolution.Y; + ItemDisplayButtonsList = new List(); + int width = AppManager.Instance.CurentScreenResolution.X; + int height = AppManager.Instance.CurentScreenResolution.Y; + Dictionary playerItems = AppManager.Instance.playerData.items; + Dictionary items = AppManager.Instance.ItemManager.tagItemPairs; + + menuBackground = new DrawableUIElement(Manager) + { + rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, + textureName = "Textures\\GUI\\background\\base" + }; + Elements.Add(menuBackground); + menuBackground.LoadTexture(AppManager.Instance.Content); + + Elements.Add(new Label(Manager) + { + rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 15, (int)(width / 4), (int)(height / 20)), + text = "Base", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, + fontName = "Fonts\\Font" + }); + + DrawableUIElement baseHudBack = new DrawableUIElement(Manager) + { + rectangle = new Rectangle(width / 2 - (int)(width / 1.5) / 2, height / 2 - (int)(height / 1.5) / 2, + (int)(width / 1.5), (int)(height / 1.5)), + mainColor = Color.LightGray + }; + Elements.Add(baseHudBack); + + //player itams + foreach (var item in playerItems) + { + textureName = AppManager.Instance.ItemManager.GetItemInfo(item.Key).textureName; + var temp = new ItemDisplayLabel(Manager) + { + rectangle = new Rectangle(width / 2 - (int)(width / 1.5) / 2 + height / 80, + height / 2 - (int)(height / 1.5) / 2 + height / 80 + (height / 20 + height / 80) * (buttonIndex), + (int)(width / 5), (int)(height / 20)), + text1 = item.Key, + scale1 = 0.4f, + count = item.Value, + itemTextureName = textureName, + fontColor1 = Color.White, + mainColor = Color.Gray, + fontName1 = "Fonts\\Font3" + }; + Elements.Add(temp); + temp.Initialize(); + temp.LoadTexture(AppManager.Instance.Content); + ItemDisplayButtonsList.Add(temp); + + buttonIndex++; + } + + // craftable items + buttonIndex = 0; + foreach (var item in items) + { + ItemInfo itemInfo = AppManager.Instance.ItemManager.GetItemInfo(item.Key); + + if (itemInfo.isCraftable) + { + var temp = new ItemDisplayLabel(Manager) + { + rectangle = new Rectangle(width / 2 - (int)(width / 1.5) / 2 + height / 40 + width / 5, + height / 2 - (int)(height / 1.5) / 2 + height / 80 + + (height / 20 + height / 80) * (buttonIndex), + (int)(width / 5), (int)(height / 20)), + text1 = item.Key, + scale1 = 0.4f, + count = 0, + itemTextureName = itemInfo.textureName, + fontColor1 = Color.White, + mainColor = Color.Gray, + fontName1 = "Fonts\\Font3" + }; + Elements.Add(temp); + temp.Initialize(); + temp.LoadTexture(AppManager.Instance.Content); + ItemDisplayButtonsList.Add(temp); + + buttonIndex++; + } + } + + Button bTExit = new Button(Manager) + { + fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, + mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), + textureName = "Textures\\GUI\\checkboxs_off" + }; + Elements.Add(bTExit); + bTExit.LeftButtonPressed += () => { AppManager.Instance.SetGUI(new MainMenuGUI()); }; } public override void Update(GameTime gameTime) { - + base.Update(gameTime); } } \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/HUD.cs b/ZoFo/GameCore/GUI/HUD.cs index a2b1892..745453a 100644 --- a/ZoFo/GameCore/GUI/HUD.cs +++ b/ZoFo/GameCore/GUI/HUD.cs @@ -9,34 +9,27 @@ 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 HUD : AbstractGUI -{ - - 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); - } - +public class HUD : AbstractGUI +{ protected override void CreateUI() - { + { + int width = AppManager.Instance.CurentScreenResolution.X; + int height = AppManager.Instance.CurentScreenResolution.Y; + + Button pauseButton = new Button(Manager) + { fontName = "Fonts\\Font3", scale = 0.4f, text = "| |", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"}; + Elements.Add(pauseButton); + pauseButton.LeftButtonPressed += () => + { + AppManager.Instance.SetGUI(new PauseGUI()); + }; + } + public override void Update(GameTime gameTime) + { + base.Update(gameTime); } } \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/MainMenuGUI.cs b/ZoFo/GameCore/GUI/MainMenuGUI.cs index 5d258eb..645faf8 100644 --- a/ZoFo/GameCore/GUI/MainMenuGUI.cs +++ b/ZoFo/GameCore/GUI/MainMenuGUI.cs @@ -44,9 +44,23 @@ public class MainMenuGUI : AbstractGUI AppManager.Instance.SetGUI(new SelectModeMenu()); }; Elements.Add(playButton); - Button optionButton = new Button(Manager) + Button baseButton = new Button(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + (height / 20 + height / 40) * 2, (int)(width / 5), (int)(height / 20)), + text = "Base", + scale = 0.2f, + fontColor = Color.White, + mainColor = Color.Gray, + fontName = "Fonts\\Font" + }; + baseButton.LeftButtonPressed += () => + { + AppManager.Instance.SetGUI(new BaseGUI()); + }; + Elements.Add(baseButton); + Button optionButton = new Button(Manager) + { + rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + (height / 20 + height / 40) * 3, (int)(width / 5), (int)(height / 20)), text = "Options", scale = 0.2f, fontColor = Color.White, @@ -61,7 +75,7 @@ public class MainMenuGUI : AbstractGUI Elements.Add(optionButton); Button exitButton = new Button(Manager) { - rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + (height / 20 + height / 40) * 3, (int)(width / 5), (int)(height / 20)), + rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + (height / 20 + height / 40) * 4, (int)(width / 5), (int)(height / 20)), text = "Exit", scale = 0.2f, fontColor = Color.White, diff --git a/ZoFo/GameCore/GUI/OptionsGUI.cs b/ZoFo/GameCore/GUI/OptionsGUI.cs index 464da7d..39db371 100644 --- a/ZoFo/GameCore/GUI/OptionsGUI.cs +++ b/ZoFo/GameCore/GUI/OptionsGUI.cs @@ -40,6 +40,7 @@ public class OptionsGUI : AbstractGUI var slider_OverallVolume = new Slider(Manager) { rectangle = new Rectangle(width / 2, height / 3, width / 10, height / 20), indentation = 7, textureName = "Textures/GUI/Switch_backgrownd", MinValue = 0, MaxValue = 1 }; slider_OverallVolume.SetValue(AppManager.Instance.SettingsManager.MainVolume); + label_OverallVolume_Percent.text = Math.Round(slider_OverallVolume.GetSliderValue * 100) + "%"; slider_OverallVolume.SliderChanged += (newVal) => { label_OverallVolume_Percent.text = Math.Round(slider_OverallVolume.GetSliderValue * 100) + "%"; @@ -60,6 +61,7 @@ public class OptionsGUI : AbstractGUI var slider_MusicVolume = new Slider(Manager) { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 1, width / 10, height / 20), indentation = 7, textureName = "Textures/GUI/Switch_backgrownd", MinValue = 0, MaxValue = 1 }; slider_MusicVolume.SetValue(AppManager.Instance.SettingsManager.MusicVolume); + label_MusicVolume_Percent.text = Math.Round(slider_MusicVolume.GetSliderValue * 100) + "%"; slider_MusicVolume.SliderChanged += (newVal) => { label_MusicVolume_Percent.text = Math.Round(slider_MusicVolume.GetSliderValue * 100) + "%"; @@ -80,6 +82,7 @@ public class OptionsGUI : AbstractGUI var slider_EffectsVolume = new Slider(Manager) { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 2, width / 10, height / 20), indentation = 7, textureName = "Textures/GUI/Switch_backgrownd", MinValue = 0, MaxValue = 1 }; slider_EffectsVolume.SetValue(AppManager.Instance.SettingsManager.SoundEffectsVolume); + label_EffectsVolume_Percent.text = Math.Round(slider_EffectsVolume.GetSliderValue * 100) + "%"; slider_EffectsVolume.SliderChanged += (newVal) => { label_EffectsVolume_Percent.text = Math.Round(slider_EffectsVolume.GetSliderValue * 100) + "%"; diff --git a/ZoFo/GameCore/GUI/PauseGUI.cs b/ZoFo/GameCore/GUI/PauseGUI.cs new file mode 100644 index 0000000..d316fb7 --- /dev/null +++ b/ZoFo/GameCore/GUI/PauseGUI.cs @@ -0,0 +1,57 @@ +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; +using ZoFo.GameCore.GameManagers; + +namespace ZoFo.GameCore.GUI; + +public class PauseGUI : AbstractGUI +{ + protected override void CreateUI() + { + int width = AppManager.Instance.CurentScreenResolution.X; + int height = AppManager.Instance.CurentScreenResolution.Y; + + Button continueButton = new Button(Manager) + { + rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + height / 20 + height / 40, (int)(width / 5), (int)(height / 20)), + text = "Continue", + scale = 0.2f, + fontColor = Color.White, + mainColor = Color.Gray, + fontName = "Fonts\\Font" + }; + continueButton.LeftButtonPressed += () => + { + AppManager.Instance.SetGUI(new HUD()); + }; + Elements.Add(continueButton); + Button exitButton = new Button(Manager) + { + rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + (height / 20 + height / 40) * 2, (int)(width / 5), (int)(height / 20)), + text = "Exit", + scale = 0.2f, + fontColor = Color.White, + mainColor = Color.Gray, + fontName = "Fonts\\Font" + }; + exitButton.LeftButtonPressed += () => + { + AppManager.Instance.SetGUI(new MainMenuGUI()); + }; + Elements.Add(exitButton); + } + + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + } +} \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/SelectingServerGUI.cs b/ZoFo/GameCore/GUI/SelectingServerGUI.cs index fafc259..9460341 100644 --- a/ZoFo/GameCore/GUI/SelectingServerGUI.cs +++ b/ZoFo/GameCore/GUI/SelectingServerGUI.cs @@ -21,30 +21,32 @@ public class SelectingServerGUI : AbstractGUI { int width = AppManager.Instance.CurentScreenResolution.X; int height = AppManager.Instance.CurentScreenResolution.Y; - + menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures/GUI/background/join" }; Elements.Add(menuBackground); menuBackground.LoadTexture(AppManager.Instance.Content); - - Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = "Select server", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font"}); - TextBox ipBox = new TextBox(Manager) + Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = "Select server", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font" }); + + TextBox ipBox = new TextBox(Manager) { rectangle = new Rectangle(width / 4 - (width / 4) / 2, height / 4, (int)(width / 4), (int)(height / 20)), text = "ip", - scale = 0.2f, + scale = 0.5f, fontColor = Color.White, mainColor = Color.Gray, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left, - fontName = "Fonts/Font" + fontName = "Fonts/Font3" }; - ipBox.TextChanged += input => { + ipBox.TextChanged += input => + { if (input == "ip") { ipBox.text = ""; ipBox.fontColor = Color.White; } }; - ipBox.StopChanging += input => { + ipBox.StopChanging += input => + { if (input.Length == 0) { ipBox.fontColor = Color.White; @@ -52,7 +54,7 @@ public class SelectingServerGUI : AbstractGUI } }; Elements.Add(ipBox); - Button joinButton = new Button(Manager) + Button joinButton = new Button(Manager) { rectangle = new Rectangle(width / 4 + (width / 4) / 2, height / 4, (int)(width / 15), (int)(height / 20)), text = "Join", @@ -61,23 +63,32 @@ public class SelectingServerGUI : AbstractGUI mainColor = Color.Gray, fontName = "Fonts/Font" }; - joinButton.LeftButtonPressed += () => + joinButton.LeftButtonPressed += () => { // join Client client = new Client(); - var endpoint = ipBox.text.Split(':'); + var endpoint = ipBox.text.Split(':'); int port; - if (int.TryParse(endpoint[1], out port)) + try { - client.JoinRoom(endpoint[0], port); - AppManager.Instance.SetClient(client); - AppManager.Instance.SetGUI(new WaitingForPlayersGUI(false)); + if (int.TryParse(endpoint[1], out port)) + { + client.JoinRoom(endpoint[0], port); + AppManager.Instance.SetClient(client); + AppManager.Instance.SetGUI(new WaitingForPlayersGUI(false)); + } } + catch (Exception) + { + + // throw; + } + // ваш код здесь }; Elements.Add(joinButton); - Button hostButton = new Button(Manager) + Button hostButton = new Button(Manager) { rectangle = new Rectangle(width / 4 + (width / 4) / 2 + (width / 15), height / 4, (int)(width / 15), (int)(height / 20)), text = "Host", @@ -86,22 +97,25 @@ public class SelectingServerGUI : AbstractGUI mainColor = Color.Gray, fontName = "Fonts/Font" }; - hostButton.LeftButtonPressed += () => + hostButton.LeftButtonPressed += () => { - + // host Server server = new Server(); //Server Logic MultiPlayer - server.CreateRoom(5); + Client client = new Client(); + server.CreateRoom(2); + client.JoinYourself(server.MyIp.Port); AppManager.Instance.SetServer(server); + AppManager.Instance.SetClient(client); string key = server.MyIp.ToString(); AppManager.Instance.debugHud.Set(key, "MultiPlayer"); // ваш код здесь AppManager.Instance.SetGUI(new WaitingForPlayersGUI(true)); }; Elements.Add(hostButton); - + Button bTExit = new Button(Manager) - { fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off"}; + { fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off" }; Elements.Add(bTExit); bTExit.LeftButtonPressed += () => { diff --git a/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs b/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs index 2632e0a..2764fb1 100644 --- a/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs +++ b/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs @@ -30,13 +30,17 @@ public class WaitingForPlayersGUI : AbstractGUI menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures/GUI/background/Waiting" }; Elements.Add(menuBackground); - menuBackground.LoadTexture(AppManager.Instance.Content); + menuBackground.LoadTexture(AppManager.Instance.Content); + // string pcIp = + // string pcIp = ip = new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = AppManager.Instance.server.MyIp.ToString(), fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font3" }; - Elements.Add(ip); + Elements.Add(ip); if (isHost) { - Button startButton = new Button(Manager) + ip = new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = AppManager.Instance.server.MyIp.ToString(), fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font3" }; + Elements.Add(ip); + Button startButton = new Button(Manager) { rectangle = new Rectangle(width / 2 - (width / 15) / 2, height / 2 + height / 4, (int)(width / 15), (int)(height / 20)), text = "Start", @@ -45,14 +49,34 @@ public class WaitingForPlayersGUI : AbstractGUI mainColor = Color.Gray, fontName = "Fonts/Font" }; - startButton.LeftButtonPressed += () => + startButton.LeftButtonPressed += () => { // start - + AppManager.Instance.ChangeState(GameState.HostPlaying); // ваш код здесь }; Elements.Add(startButton); } + else { + ip = new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = AppManager.Instance.client.InfoConnect.ToString(), fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font3" }; + Elements.Add(ip); + Button waitButton = new Button(Manager) + { + rectangle = new Rectangle(width / 2 - (width / 15) / 2, height / 2 + height / 4, (int)(width / 15), (int)(height / 20)), + text = "WAITING", + scale = 0.3f, + fontColor = Color.White, + mainColor = Color.Gray, + fontName = "Fonts/Font" + }; + waitButton.LeftButtonPressed += () => + { + // start + AppManager.Instance.ChangeState(GameState.ClientPlaying); + // ваш код здесь + }; + Elements.Add(waitButton); + } Button bTExit = new Button(Manager) { fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off"}; diff --git a/ZoFo/GameCore/GameManagers/AppManager.cs b/ZoFo/GameCore/GameManagers/AppManager.cs index 42e886a..b129359 100644 --- a/ZoFo/GameCore/GameManagers/AppManager.cs +++ b/ZoFo/GameCore/GameManagers/AppManager.cs @@ -28,9 +28,10 @@ namespace ZoFo.GameCore.GameManagers public GameState gamestate; public AbstractGUI currentGUI; public DebugHUD debugHud; - public Point CurentScreenResolution = new Point(1920, 1080); + public Point CurentScreenResolution; public Client client; public Server server; + public PlayerData playerData; #region Managers @@ -46,14 +47,17 @@ namespace ZoFo.GameCore.GameManagers public AppManager() { - _graphics = new GraphicsDeviceManager(this); + _graphics = new GraphicsDeviceManager(this); + CurentScreenResolution = new Point(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height); SetResolution(CurentScreenResolution.X, CurentScreenResolution.Y); - // FulscrreenSwitch(); + //FulscrreenSwitch(); Content.RootDirectory = "Content"; IsMouseVisible = true; + playerData = new PlayerData(); + ItemManager = new ItemManager.ItemManager(); Instance = this; InputManager = new InputManager(); SettingsManager = new SettingsManager(); @@ -71,7 +75,9 @@ namespace ZoFo.GameCore.GameManagers protected override void Initialize() { currentGUI.Initialize(); - debugHud.Initialize(); + + debugHud.Initialize(); + ItemManager.Initialize(); base.Initialize(); @@ -81,11 +87,15 @@ namespace ZoFo.GameCore.GameManagers { _spriteBatch = new SpriteBatch(GraphicsDevice); debugHud.LoadContent(); - currentGUI.LoadContent(); + currentGUI.LoadContent(); + ItemManager.LoadItemTextures(); + + + animationBuilder = new AnimationBuilder(); animationBuilder.LoadAnimations(); GameObject.debugTexture = new Texture2D(GraphicsDevice, 1, 1); - GameObject.debugTexture.SetData(new Color[] { Color.White }); + GameObject.debugTexture.SetData(new Color[] { Color.White }); } protected override void Update(GameTime gameTime) @@ -94,7 +104,7 @@ namespace ZoFo.GameCore.GameManagers Keyboard.GetState().IsKeyDown(Keys.Escape)) { server.CloseConnection(); Exit(); } - debugHud.Set("key", "value"); + // debugHud.Set("key", "value"); InputManager.Update(); currentGUI.Update(gameTime); @@ -107,7 +117,7 @@ namespace ZoFo.GameCore.GameManagers client.Update(gameTime); break; case GameState.ClientPlaying: - server.Update(gameTime); + client.Update(gameTime); break; default: break; @@ -119,11 +129,10 @@ namespace ZoFo.GameCore.GameManagers protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); - - + // Pointwrap - _spriteBatch.Begin(samplerState: SamplerState.PointWrap); + _spriteBatch.Begin(samplerState: SamplerState.PointWrap); switch (gamestate) { case GameState.ClientPlaying: @@ -135,7 +144,7 @@ namespace ZoFo.GameCore.GameManagers break; } - _spriteBatch.End(); + _spriteBatch.End(); currentGUI.Draw(_spriteBatch); debugHud.Draw(_spriteBatch); diff --git a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionComponent.cs b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionComponent.cs index 3ad2811..fa9f9d6 100644 --- a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionComponent.cs +++ b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionComponent.cs @@ -26,7 +26,7 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager { this.gameObject = gameObject; - hasCollision = hasCollision; + this.hasCollision = hasCollision; this.isTrigger = isTrigger; if (hasCollision) this.stopRectangle = collisionRectangle.Value; diff --git a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs index 7c0b998..25736fe 100644 --- a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs +++ b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs @@ -44,9 +44,12 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager foreach (var item in ObjectsWithCollisions)//фильтрация { - if (Math.Abs(item.stopRectangle.X - entity.collisionComponent.stopRectangle.X) < 550 - && Math.Abs(item.stopRectangle.Y - entity.collisionComponent.stopRectangle.Y) < 550 - && tryingRectX.Intersects(item.stopRectangle)) + if (item == componentOfEntity) continue; + + Rectangle rectChecking = item.stopRectangle.SetOrigin(item.gameObject.position); + if (Math.Abs(item.gameObject.position.X - componentOfEntity.gameObject.position.X) < 550 + && Math.Abs(item.gameObject.position.Y - componentOfEntity.gameObject.position.Y) < 550 + && tryingRectX.Intersects(rectChecking)) { collidedX = true;// меняем значение соприкосновения на true @@ -75,9 +78,11 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager foreach (var item in ObjectsWithCollisions)//фильтрация { - if (Math.Abs(item.stopRectangle.X - entity.collisionComponent.stopRectangle.X) < 550 - && Math.Abs(item.stopRectangle.Y - entity.collisionComponent.stopRectangle.Y) < 550 - && tryingRectY.Intersects(item.stopRectangle)) + if (item == componentOfEntity) continue; + Rectangle rectChecking = item.stopRectangle.SetOrigin(item.gameObject.position); + if (Math.Abs(item.gameObject.position.X - componentOfEntity.gameObject.position.X) < 550 + && Math.Abs(item.gameObject.position.Y - componentOfEntity.gameObject.position.Y) < 550 + && tryingRectY.Intersects(rectChecking)) { collidedY = true;// меняем значение соприкосновения на true @@ -135,4 +140,14 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager } + public static class ExtentionClass + { + public static Rectangle SetOrigin(this Rectangle rectangle, Vector2 origin) + { + rectangle.X = (int)origin.X; + rectangle.Y = (int)origin.Y; + return rectangle; + } + } + } diff --git a/ZoFo/GameCore/GameManagers/ItemManager/ItemInfo.cs b/ZoFo/GameCore/GameManagers/ItemManager/ItemInfo.cs index cfd5a4f..6461dc6 100644 --- a/ZoFo/GameCore/GameManagers/ItemManager/ItemInfo.cs +++ b/ZoFo/GameCore/GameManagers/ItemManager/ItemInfo.cs @@ -11,10 +11,10 @@ namespace ZoFo.GameCore.GameManagers.ItemManager { //поля string tag; - string textureName; + public string textureName; Texture2D itemTexture; - bool isCraftable; - Dictionary resourcesNeededToCraft; + public bool isCraftable; + public Dictionary resourcesNeededToCraft; public ItemInfo (string tag) { this.tag = tag; diff --git a/ZoFo/GameCore/GameManagers/ItemManager/ItemManager.cs b/ZoFo/GameCore/GameManagers/ItemManager/ItemManager.cs index 6d00e0c..3b982e6 100644 --- a/ZoFo/GameCore/GameManagers/ItemManager/ItemManager.cs +++ b/ZoFo/GameCore/GameManagers/ItemManager/ItemManager.cs @@ -9,24 +9,30 @@ namespace ZoFo.GameCore.GameManagers.ItemManager public class ItemManager { //поля - Dictionary tagItemPairs; + public Dictionary tagItemPairs; //методы - ItemInfo GetItemInfo(string tag) + public ItemInfo GetItemInfo(string tag) { - return tagItemPairs.GetValueOrDefault(tag); + return tagItemPairs[tag]; } - void LoadItemTextures() + public 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)); + public void Initialize() + { + tagItemPairs = new Dictionary(); + tagItemPairs.Add("wood", new ItemInfo("wood","Textures\\Test\\wood",false,null)); + tagItemPairs.Add("rock", new ItemInfo("rock", "Textures\\Test\\rock", false, null)); + tagItemPairs.Add("steel", new ItemInfo("steel", "Textures\\Test\\steel", false, null)); + tagItemPairs.Add("pickaxe", new ItemInfo("steel", "Textures\\Test\\pickaxe", true, new Dictionary() + { + {"wood", 2}, + {"Steel", 3} + })); } } diff --git a/ZoFo/GameCore/GameManagers/ItemManager/PlayerData.cs b/ZoFo/GameCore/GameManagers/ItemManager/PlayerData.cs index 1dfc351..5a6c78e 100644 --- a/ZoFo/GameCore/GameManagers/ItemManager/PlayerData.cs +++ b/ZoFo/GameCore/GameManagers/ItemManager/PlayerData.cs @@ -9,16 +9,42 @@ namespace ZoFo.GameCore.GameManagers.ItemManager /// /// Класс хранит информацю о количестве ресурсов у игрока /// - internal class PlayerData + public class PlayerData { - Dictionary items; + public PlayerData() + { + LoadPlayerData(); + } + public Dictionary items; /// /// Принимает тэг и крафтит этот объект /// /// - public void CraftItem(string itemTag) + public bool CraftItem(string itemTag) + { + Dictionary needToCraft = AppManager.Instance.ItemManager.GetItemInfo(itemTag).resourcesNeededToCraft; + foreach (var item in needToCraft) + { + if (items[item.Key] < item.Value) + { + return false; + } + } + + foreach (var item in needToCraft) + { + items[item.Key] -= item.Value; + } + return true; + } + + public void LoadPlayerData() { //TODO + items = new Dictionary(); + items.Add("wood", 2); + items.Add("steel", 110); + items.Add("rock", 6); } } } diff --git a/ZoFo/GameCore/GameManagers/MapManager/MapElements/Object.cs b/ZoFo/GameCore/GameManagers/MapManager/MapElements/Object.cs index 702ffb2..f4c4336 100644 --- a/ZoFo/GameCore/GameManagers/MapManager/MapElements/Object.cs +++ b/ZoFo/GameCore/GameManagers/MapManager/MapElements/Object.cs @@ -8,9 +8,9 @@ namespace ZoFo.GameCore.GameManagers.MapManager.MapElements { public class Object { - public int Height { get; set; } - public int Width { get; set; } - public int X { get; set; } - public int Y { get; set; } + public double Height { get; set; } + public double Width { get; set; } + public double X { get; set; } + public double Y { get; set; } } } diff --git a/ZoFo/GameCore/GameManagers/MapManager/MapElements/Tile.cs b/ZoFo/GameCore/GameManagers/MapManager/MapElements/Tile.cs index 13aa10c..88ce815 100644 --- a/ZoFo/GameCore/GameManagers/MapManager/MapElements/Tile.cs +++ b/ZoFo/GameCore/GameManagers/MapManager/MapElements/Tile.cs @@ -10,6 +10,6 @@ namespace ZoFo.GameCore.GameManagers.MapManager.MapElements { public int Id { get; set; } public string Type { get; set; } - public List Objectgroup { get; set; } + public ObjectGroup Objectgroup { get; set; } } } diff --git a/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs b/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs index 4c93aba..0d6a569 100644 --- a/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs +++ b/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs @@ -16,8 +16,8 @@ namespace ZoFo.GameCore.GameManagers.MapManager { public class MapManager { - private static readonly string _templatePath = "Content/MapData/TileMaps/{0}.tmj"; + //private static readonly float _scale = 1.0f; private List _tileSets = new List(); @@ -32,7 +32,8 @@ namespace ZoFo.GameCore.GameManagers.MapManager { PropertyNameCaseInsensitive = true }; - TileMap tileMap = JsonSerializer.Deserialize(File.ReadAllText(string.Format(_templatePath, mapName)), options); + TileMap tileMap = + JsonSerializer.Deserialize(File.ReadAllText(string.Format(_templatePath, mapName)), options); // Загрузка TileSet-ов по TileSetInfo List tileSets = new List(); @@ -42,6 +43,7 @@ namespace ZoFo.GameCore.GameManagers.MapManager tileSet.FirstGid = tileSetInfo.FirstGid; tileSets.Add(tileSet); } + tileSets.Reverse(); foreach (var layer in tileMap.Layers) { @@ -51,37 +53,45 @@ namespace ZoFo.GameCore.GameManagers.MapManager { foreach (var tileSet in tileSets) { - if (tileSet.FirstGid - chunk.Data[i] <= 0) + if (tileSet.FirstGid <= chunk.Data[i]) { int number = chunk.Data[i] - tileSet.FirstGid; int relativeColumn = number % tileSet.Columns; - int relativeRow = number / tileSet.Columns; // относительно левого угла чанка + int relativeRow = number / tileSet.Columns; // относительно левого угла чанка - Rectangle sourceRectangle = new Rectangle(relativeColumn * tileSet.TileWidth, relativeRow * tileSet.TileHeight, - tileSet.TileWidth, tileSet.TileHeight); + Rectangle sourceRectangle = new Rectangle(relativeColumn * tileSet.TileWidth, + relativeRow * tileSet.TileHeight, + tileSet.TileWidth, tileSet.TileHeight); - Vector2 position = new Vector2((i % chunk.Width) * tileSet.TileWidth + chunk.X * tileSet.TileWidth, + Vector2 position = new Vector2( + (i % chunk.Width) * tileSet.TileWidth + chunk.X * tileSet.TileWidth, (i / chunk.Height) * tileSet.TileHeight + chunk.Y * tileSet.TileHeight); - - Tile tile = tileSet.Tiles[i]; // По факту может быть StopObjectom, но на уровне Tiled это все в первую очередь Tile + + Tile tile = tileSet.Tiles[number]; // По факту может быть StopObjectom, но на уровне Tiled это все в первую очередь Tile switch (tile.Type) { case "Tile": - AppManager.Instance.server.RegisterGameObject(new MapObject(position, new Vector2(tileSet.TileWidth, tileSet.TileHeight), - sourceRectangle, "Textures/TileSetImages/" + Path.GetFileName(tileSet.Image).Replace(".png", ""))); + AppManager.Instance.server.RegisterGameObject(new MapObject(position, + new Vector2(tileSet.TileWidth, tileSet.TileHeight), + sourceRectangle, + "Textures/TileSets/" + + Path.GetFileName(tileSet.Image).Replace(".png", ""))); break; case "StopObject": - var collisionRectangles = LoadRectangles(tile); // Грузит коллизии обьектов - AppManager.Instance.server.RegisterGameObject(new StopObject(position, new Vector2(tileSet.TileWidth, tileSet.TileHeight), - sourceRectangle, "Textures/TileSetImages/" + Path.GetFileName(tileSet.Image).Replace(".png", ""), collisionRectangles.ToArray())); - // TODO: изменить конструктор, засунув коллизии. + var collisionRectangles = LoadRectangles(tile); // Грузит коллизии обьектов + AppManager.Instance.server.RegisterGameObject(new StopObject(position/4,//TODO + new Vector2(tileSet.TileWidth, tileSet.TileHeight), + sourceRectangle, + "Textures/TileSets/" + + Path.GetFileName(tileSet.Image).Replace(".png", ""), + collisionRectangles.ToArray())); break; default: break; } - + break; } } } @@ -112,16 +122,20 @@ namespace ZoFo.GameCore.GameManagers.MapManager /// /// /// - private List LoadRectangles(Tile tile) { - List collisionRectangles = new List(); - foreach (var objectGroup in tile.Objectgroup) + private List LoadRectangles(Tile tile) + { + if (tile.Objectgroup == null) { - foreach (var obj in objectGroup.Objects) - { - collisionRectangles.Add(new Rectangle(obj.X, obj.Y, obj.Width, obj.Height)); - } + return new List(); } + + List collisionRectangles = new List(); + foreach (var obj in tile.Objectgroup.Objects) + { + collisionRectangles.Add(new Rectangle((int)obj.X, (int)obj.Y, (int)obj.Width, (int)obj.Height)); + } + return collisionRectangles; } } -} +} \ No newline at end of file diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs b/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs index 70cfe76..6f58b5e 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Data.SqlTypes; +using System.Linq; using System.Net; using System.Net.Sockets; using System.Security.Cryptography.X509Certificates; @@ -97,9 +98,16 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager public static IPAddress GetIp() { - string hostName = Dns.GetHostName(); // Retrive the Name of HOST - //string myIP = Dns.GetHostByName(hostName).AddressList[1].ToString();// Get the IP - return IPAddress.Parse("127.0.0.1"); + string hostName = Dns.GetHostName(); // Retrive the Name of HOST + var ipList = Dns.GetHostByName(hostName).AddressList; + foreach (var ip in ipList) + { + if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + { + return ip; + } + } + return IPAddress.Loopback; } //поток 2 @@ -108,7 +116,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager while(socket.Connected) { byte[] bytes = new byte[2048]; - var countAnsw = socket.Receive(bytes); + var countAnsw = socket.Receive(bytes); //Вылетает если кто то закрыл string update = Encoding.UTF8.GetString(bytes, 0, countAnsw); // обновление отосланные сервером GetDataSent(update); } diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs index fedcac4..98b93b6 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs @@ -37,8 +37,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager /// private void Init() { - ip = GetIp(); - endPoint = new IPEndPoint(ip, port); + endPoint = new IPEndPoint(GetIp(), port); socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); managerThread = new Dictionary(); clients = new List(); @@ -54,9 +53,15 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager public static IPAddress GetIp() { string hostName = Dns.GetHostName(); // Retrive the Name of HOST - //var ipList =Dns.GetHostByName(hostName).AddressList; - //string myIP = ipList[ipList.Count()-1].ToString();// Get the IP - return IPAddress.Parse("127.0.0.1"); + var ipList = Dns.GetHostByName(hostName).AddressList; + foreach (var ip in ipList) + { + if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + { + return ip; + } + } + return IPAddress.Loopback; } /// @@ -71,7 +76,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager } updates.Clear(); return; //TODO TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK - + //Что это? //по 10 паков за раз TODO FIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXIT List datasToSend = new List(); for (int i = 0; i < 5 && i diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteraction.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteraction.cs index 09b0bc3..6f4711d 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteraction.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteraction.cs @@ -4,12 +4,13 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; /// При попытке взаимодействия с объектом /// public class UpdateInteraction : UpdateData -{ +{ + public UpdateInteraction() { UpdateType = "UpdateInteraction"; } public UpdateInteraction(int id) { IdEntity = id; } public int IdEntity { get; set; } - public string UpdateType { get; set; } + public string UpdateType { get; set; } } \ No newline at end of file diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteractionReady.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteractionReady.cs index db4d01d..591bc1b 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteractionReady.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteractionReady.cs @@ -9,6 +9,6 @@ public class UpdateInteractionReady(int idEntity, bool isReady) : UpdateData { public int IdEntity { get; set; } = idEntity; - public string UpdateType { get; set; } + public string UpdateType { get; set; } = "UpdateInteractionReady"; public bool IsReady { get; set; } = isReady; } \ No newline at end of file diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateLoot.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateLoot.cs index 2337f74..b69a860 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateLoot.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateLoot.cs @@ -11,6 +11,12 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient /// public class UpdateLoot : UpdateData { - public UpdateLoot() { UpdateType = "UpdateLoot"; } + public string lootName; + public UpdateLoot() { UpdateType = "UpdateLoot"; } + public UpdateLoot(string lootName) + { + UpdateType = "UpdateLoot"; + this.lootName = lootName; + } } } diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs index 0799653..2cf477b 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs @@ -23,4 +23,17 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient public Rectangle sourceRectangle { get; set; } public string tileSetName { get; set; } } + /// + /// При создании тайла TODO move to another file + /// + public class UpdateStopObjectCreated : UpdateData + { + public UpdateStopObjectCreated() { UpdateType = "UpdateStopObjectCreated"; } + public Texture2D TextureTile { get; set; } + public Vector2 Position { get; set; } + public Point Size { get; set; } + public Rectangle sourceRectangle { get; set; } + public string tileSetName { get; set; } + public Rectangle[] collisions { get; set; } + } } diff --git a/ZoFo/GameCore/GameManagers/SoundManager.cs b/ZoFo/GameCore/GameManagers/SoundManager.cs index e5c5699..97a5922 100644 --- a/ZoFo/GameCore/GameManagers/SoundManager.cs +++ b/ZoFo/GameCore/GameManagers/SoundManager.cs @@ -8,8 +8,9 @@ using Microsoft.Xna.Framework.Content; using System.Linq; using Newtonsoft.Json; -using Microsoft.Xna.Framework.Media; -using System.Runtime.InteropServices; +using Microsoft.Xna.Framework.Media; +using System.Runtime.InteropServices; +using ZoFo.GameCore.GUI; namespace ZoFo.GameCore.GameManagers { @@ -21,7 +22,7 @@ namespace ZoFo.GameCore.GameManagers public void LoadSounds() // метод для загрузки звуков из папки { - //List sounds = AppManager.Instance.Content.Load>("sounds/"); + //List sounds = AppManager.Instance.Content.Load>("sounds/"); string a = Path.Combine("Content", "sounds"); string[] k; @@ -32,13 +33,13 @@ namespace ZoFo.GameCore.GameManagers else{ k = Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), "Content", "sounds")).Where(x => x.EndsWith("xnb")).ToArray(); } - if (k.Length > 0) + if (k.Length > 0) { string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".xnb", "")).ToArray();// папка со звуками там где exe foreach (var soundFile in soundFiles) { - Sounds.Add(soundFile, AppManager.Instance.Content.Load("sounds//" + soundFile)); + Sounds.Add(soundFile, AppManager.Instance.Content.Load(Path.Combine("sounds", soundFile))); } } diff --git a/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs b/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs index 9336e76..2bad778 100644 --- a/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs +++ b/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs @@ -12,7 +12,10 @@ namespace ZoFo.GameCore.GameObjects.Entities { //public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List { "тут пишите название анимации" }, "сдублируйте " + - public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List { "player_running_top_rotate" }, "player_running_top_rotate"); + + + public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List { "player_idle_rotate_weapon" }, "player_idle_rotate_weapon"); + public EntittyForAnimationTests(Vector2 position) : base(position) { graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0,16*12, 16 * 16); diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Ammo.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Ammo.cs new file mode 100644 index 0000000..ba4f1bc --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Ammo.cs @@ -0,0 +1,28 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.GameManagers.CollisionManager; +using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.Graphics; + +namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +{ + class Ammo:Collectable + { + public override StaticGraphicsComponent graphicsComponent { get; } = new("Textures/icons/8"); + public Ammo(Vector2 position) : base(position) + { + graphicsComponent.ObjectDrawRectangle.Width = 20; + graphicsComponent.ObjectDrawRectangle.Height = 20; + } + public override void OnInteraction(object sender, CollisionComponent e) + { + AppManager.Instance.server.AddData(new UpdateLoot("Ammo")); + AppManager.Instance.server.DeleteObject(this); + } + } +} diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Antiradine.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Antiradine.cs new file mode 100644 index 0000000..01f36a9 --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Antiradine.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.GameManagers.CollisionManager; +using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.Graphics; + +namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +{ + class Antiradine:Collectable + { + public override StaticGraphicsComponent graphicsComponent { get; } = new("Antiradine"); + public Antiradine(Vector2 position) : base(position) + { + + } + public override void OnInteraction(object sender, CollisionComponent e) + { + AppManager.Instance.server.AddData(new UpdateLoot("Antiradine")); + AppManager.Instance.server.DeleteObject(this); + } + } +} diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/BottleOfWater.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/BottleOfWater.cs new file mode 100644 index 0000000..528f614 --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/BottleOfWater.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.Graphics; + +using Microsoft.Xna.Framework; +using ZoFo.GameCore.GameManagers.CollisionManager; +using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; +using ZoFo.GameCore.GameManagers; + +namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +{ + public class BottleOfWater : Collectable + { + public override StaticGraphicsComponent graphicsComponent { get; } = new("BottleOfWater"); + public BottleOfWater(Vector2 position) : base(position) + { + + } + public override void OnInteraction(object sender, CollisionComponent e) + { + AppManager.Instance.server.AddData(new UpdateLoot("BottleOfWater")); + AppManager.Instance.server.DeleteObject(this); + } + } +} diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Peeble.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Peeble.cs new file mode 100644 index 0000000..5525cfd --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Peeble.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.Graphics; +using Microsoft.Xna.Framework; +using ZoFo.GameCore.GameManagers.CollisionManager; +using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; +using ZoFo.GameCore.GameManagers; + + +namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +{ + public class Peeble:Collectable + { + public override StaticGraphicsComponent graphicsComponent { get; } = new("Peeble"); + + public Peeble(Vector2 position) : base(position) + { + + } + public override void OnInteraction(object sender, CollisionComponent e) + { + AppManager.Instance.server.AddData(new UpdateLoot("Peeble")); + AppManager.Instance.server.DeleteObject(this); + } + } +} diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/PureBottleOfWater.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/PureBottleOfWater.cs new file mode 100644 index 0000000..1523f6e --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/PureBottleOfWater.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.GameManagers.CollisionManager; +using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.Graphics; + +namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +{ + class PureBottleOfWater:Collectable + { + public override StaticGraphicsComponent graphicsComponent { get; } = new("PureBottleOfWater"); + + public PureBottleOfWater(Vector2 position) : base(position) + { + } + public override void OnInteraction(object sender, CollisionComponent e) + { + AppManager.Instance.server.AddData(new UpdateLoot("PureBottleOfWater")); + AppManager.Instance.server.DeleteObject(this); + } + } +} diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/RottenFlesh.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/RottenFlesh.cs new file mode 100644 index 0000000..147f30d --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/RottenFlesh.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.GameManagers.CollisionManager; +using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.Graphics; + +namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +{ + class RottenFlesh:Collectable + { + public override StaticGraphicsComponent graphicsComponent { get; } = new("RottenFlesh"); + public RottenFlesh(Vector2 position) : base(position) + { + + } + public override void OnInteraction(object sender, CollisionComponent e) + { + AppManager.Instance.server.AddData(new UpdateLoot("RottenFlesh")); + AppManager.Instance.server.DeleteObject(this); + } + } +} diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Steel.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Steel.cs new file mode 100644 index 0000000..5618236 --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Steel.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.GameManagers.CollisionManager; +using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.Graphics; + +namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +{ + class Steel:Collectable + { + public override StaticGraphicsComponent graphicsComponent { get; } = new("Steel"); + + public Steel(Vector2 position) : base(position) + { + } + public override void OnInteraction(object sender, CollisionComponent e) + { + AppManager.Instance.server.AddData(new UpdateLoot("Steel")); + AppManager.Instance.server.DeleteObject(this); + } + } +} diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Wood.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Wood.cs index 2c6b0b8..85af71b 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Wood.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Wood.cs @@ -1,14 +1,23 @@ using System.Collections.Generic; using Microsoft.Xna.Framework; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.GameManagers.CollisionManager; +using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; using ZoFo.GameCore.Graphics; namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables; public class Wood : Collectable { - public override GraphicsComponent graphicsComponent { get; } = new(new List { "Wood" }, "Wood"); + public override StaticGraphicsComponent graphicsComponent { get; } = new("Wood"); public Wood(Vector2 position) : base(position) { + + } + public override void OnInteraction(object sender, CollisionComponent e) + { + AppManager.Instance.server.AddData(new UpdateLoot("Wood")); + AppManager.Instance.server.DeleteObject(this); } } \ No newline at end of file diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs index 640c9c1..23ce44f 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs @@ -9,16 +9,16 @@ public class Door : Interactable { public bool isOpened; - public override GraphicsComponent graphicsComponent { get; } = new(new List { "DoorInteraction" }, "DoorInteraction"); + public override StaticGraphicsComponent graphicsComponent { get; } = new("DoorInteraction"); public Door(Vector2 position) : base(position) { - graphicsComponent.OnAnimationEnd += _ => { isOpened = !isOpened; }; + //graphicsComponent.OnAnimationEnd += _ => { isOpened = !isOpened; };//���������, ��� ����� ������ ������������� - SD } public override void OnInteraction(object sender, CollisionComponent e) { - graphicsComponent.AnimationSelect("DoorInteraction", isOpened); - graphicsComponent.AnimationStep(); + //graphicsComponent.AnimationSelect("DoorInteraction", isOpened); + //graphicsComponent.AnimationStep(); } } \ No newline at end of file diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Interactable.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Interactable.cs index 2701d49..270b986 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Interactable.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Interactable.cs @@ -9,7 +9,7 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables; public class Interactable : Entity { - public override GraphicsComponent graphicsComponent => throw new System.NotImplementedException(); + public override StaticGraphicsComponent graphicsComponent => throw new System.NotImplementedException(); public Interactable(Vector2 position) : base(position) { diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Enemy.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Enemy.cs index f948689..61762ae 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Enemy.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Enemy.cs @@ -8,7 +8,14 @@ using Microsoft.Xna.Framework.Content; namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies; public class Enemy : LivingEntity { + protected float speed; + protected int health; public Enemy(Vector2 position) : base(position) { + } + public override void Update() + { + + } } \ No newline at end of file diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs new file mode 100644 index 0000000..bc504f9 --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs @@ -0,0 +1,37 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.Graphics; + +namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies +{ + class Zombie : Enemy + { + public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent("Textures/icons/8"); + public Zombie(Vector2 position) : base(position) + { + health = 5; + speed =2; + collisionComponent.stopRectangle = new Rectangle(0, 0, 100, 100); + graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 100, 100); + } + + public override void Update() + { + Vector2 duration = Vector2.Normalize( + AppManager.Instance.server.players[0].position - position + ); + velocity=new Vector2(duration.X * speed, duration.Y*speed); + if(position.X>595 && 605>position.X && position.Y>495 && 505>position.Y) + { + velocity = Vector2.Zero; + } + //position.X += velocity.X*t; + //position.Y += velocity.Y * t; + } + } +} diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/LootData.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/LootData.cs index 5336e7b..2d86531 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/LootData.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/LootData.cs @@ -6,12 +6,13 @@ using System.Threading.Tasks; namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player { - internal class LootData + class LootData { public Dictionary loots; - public void AddLoot(object lootObject, int quantity) - { + public void AddLoot(string lootName, int quantity) + { + loots.Add(lootName, quantity); } } } diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs index d2fb023..42d89c2 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs @@ -1,8 +1,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; using System; using System.Collections.Generic; +using Microsoft.Xna.Framework.Input; using ZoFo.GameCore.GameManagers; using ZoFo.GameCore.GameManagers.CollisionManager; using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer; @@ -21,14 +21,14 @@ public class Player : LivingEntity public bool IsTryingToShoot { get; set; } private float speed; private int health; - public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List { "player_running_top_rotate" }, "player_running_top_rotate"); + public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List { "player_look_down" }, "player_look_down"); + private LootData lootData; public Player(Vector2 position) : base(position) { //InputWeaponRotation = new Vector2(0, 0); //InputPlayerRotation = new Vector2(0, 0); - + graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 100, 100); collisionComponent.stopRectangle = new Rectangle(0, 0, 100, 100); - graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0,100,100); } diff --git a/ZoFo/GameCore/GameObjects/GameObject.cs b/ZoFo/GameCore/GameObjects/GameObject.cs index 7a4eb43..85189ea 100644 --- a/ZoFo/GameCore/GameObjects/GameObject.cs +++ b/ZoFo/GameCore/GameObjects/GameObject.cs @@ -13,7 +13,7 @@ public abstract class GameObject public Vector2 position; public Vector2 rotation; //вектор направления объекта - public abstract GraphicsComponent graphicsComponent { get; } + public virtual GraphicsComponent graphicsComponent { get; } #region ServerSide public GameObject(Vector2 position) @@ -81,7 +81,7 @@ public abstract class GameObject /// public virtual void Draw(SpriteBatch spriteBatch) { - graphicsComponent.DrawAnimation(graphicsComponent.ObjectDrawRectangle, spriteBatch); + graphicsComponent.Draw(graphicsComponent.ObjectDrawRectangle, spriteBatch); //debug DrawDebugRectangle(spriteBatch, graphicsComponent.ObjectDrawRectangle); diff --git a/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs b/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs index 15ac53c..e55976d 100644 --- a/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs +++ b/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs @@ -16,7 +16,8 @@ namespace ZoFo.GameCore.GameObjects.MapObjects { public virtual bool IsColliderOn { get; protected set; } = true;//Who added that? public Rectangle sourceRectangle; - public override GraphicsComponent graphicsComponent { get; } = new(); + public override GraphicsComponent graphicsComponent { get; } + = new StaticGraphicsComponent(); /// /// Создается простой объект на карте - no animations, только где, насколько крупно рисовать, по какой сорс ректанглу рисовать и из какой текстуры @@ -27,15 +28,16 @@ namespace ZoFo.GameCore.GameObjects.MapObjects /// public MapObject(Vector2 position, Vector2 size, Rectangle sourceRectangle, string textureName) : base(position) { + (graphicsComponent as StaticGraphicsComponent)._textureName = textureName; + (graphicsComponent as StaticGraphicsComponent).BuildComponent(textureName); + (graphicsComponent as StaticGraphicsComponent).ObjectDrawRectangle = new Rectangle((int)position.X, (int)position.Y, (int)size.X, (int)size.Y); + (graphicsComponent as StaticGraphicsComponent).LoadContent(); this.sourceRectangle = sourceRectangle; - graphicsComponent.ObjectDrawRectangle = new Rectangle((int)position.X, (int)position.Y, (int)size.X, (int)size.Y); - graphicsComponent.BuildComponent(textureName); - graphicsComponent.LoadContent(); } public override void Draw(SpriteBatch spriteBatch) { - graphicsComponent.DrawAnimation(graphicsComponent.ObjectDrawRectangle, spriteBatch, sourceRectangle); + graphicsComponent.Draw(graphicsComponent.ObjectDrawRectangle, spriteBatch, sourceRectangle); } } diff --git a/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs b/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs index 87e44c0..5ef0c2d 100644 --- a/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs +++ b/ZoFo/GameCore/GameObjects/MapObjects/StopObjects/StopObject.cs @@ -1,23 +1,32 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using System.Diagnostics; +using System.Security.Cryptography.X509Certificates; using ZoFo.GameCore.GameManagers.CollisionManager; namespace ZoFo.GameCore.GameObjects.MapObjects.StopObjects; public class StopObject : MapObject { - CollisionComponent[] collisionComponent; + public CollisionComponent[] collisionComponents; public StopObject(Vector2 position, Vector2 size, Rectangle sourceRectangle, string textureName, Rectangle[] collisions) : base(position, size, sourceRectangle, textureName) { - collisionComponent = new CollisionComponent[collisions.Length]; - for (int i = 0; i < collisionComponent.Length; i++) + + collisionComponents = new CollisionComponent[collisions.Length]; + for (int i = 0; i < collisionComponents.Length; i++) { - collisionComponent[i] = new CollisionComponent(this, true, collisions[i]); + collisionComponents[i] = new CollisionComponent(this, true, new Rectangle(0,0, (int)size.X, (int)size.Y)/*collisions[i]*/); } + //REDO // TODO: Написать коллизию, пусть тразмер будет чисто таким же как и текстурка. // Поменяйте уровень защиты конструктора, после снимите в MapManager комментарий в методе LoadMap с создания StopObject-а } + public override void Draw(SpriteBatch spriteBatch) + { + base.Draw(spriteBatch); + DrawDebugRectangle(spriteBatch, new Rectangle((int)position.X, (int)position.Y, collisionComponents[0].stopRectangle.Width, collisionComponents[0].stopRectangle.Height)); + } } diff --git a/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs b/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs new file mode 100644 index 0000000..d590462 --- /dev/null +++ b/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs @@ -0,0 +1,247 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.GUI; + +namespace ZoFo.GameCore.Graphics +{ + + public class AnimatedGraphicsComponent : GraphicsComponent + { + + public event Action actionOfAnimationEnd; + public List animations; + private List textures; + private List texturesNames; + private AnimationContainer currentAnimation; + static public int Camera_XW=800; + static public int Camera_YH = 400; + static public Vector2 CameraSize = new Vector2(1800, 960); + public int parentId; + public AnimationContainer CurrentAnimation + { + get + { + return currentAnimation; + } + } + public string LastAnimation { get; set; } + public string GetCurrentAnimation + { + get { return currentAnimation.Id; } + } + + private AnimationContainer neitralAnimation; + //private SpriteBatch _spriteBatch; + + private int currentFrame; + public int CurrentFrame + { + get + { + return currentFrame; + } + } + + // Needed to ckeck whether the frame has changed since last update call + private int lastUpdateCallFrame; + public int LastUpdateCallFrame + { + get + { + return lastUpdateCallFrame; + } + } + public int CurrentFrameInterval { get => interval; } + public void Force_Set_CurrentFrameInterval(int newFrameInterval) { } + private int interval; + private int lastInterval; + private Rectangle sourceRectangle; + public AnimatedGraphicsComponent(List animationsId, string neitralAnimationId) + { + //this._spriteBatch = _spriteBatch; + currentFrame = 0; + lastInterval = 1; + LoadAnimations(animationsId, neitralAnimationId); + currentAnimation = neitralAnimation; + SetInterval(); + buildSourceRectangle(); + } + + public AnimatedGraphicsComponent(string textureName) + { + animations = new List(); + textures = new List(); + var texture = AppManager.Instance.Content.Load(textureName); + textures.Add(texture); + AnimationContainer animationContainer = new AnimationContainer(); + animationContainer.StartSpriteRectangle = new Rectangle(0, 0, texture.Width, texture.Height); + animationContainer.TextureFrameInterval = 0; + animationContainer.TextureName = texture.Name; + animationContainer.IsCycle = true; + animationContainer.FramesCount = 1; + animationContainer.FrameTime = new List>() { new Tuple(0, 10) }; + animationContainer.Id = texture.Name; + currentAnimation = animationContainer; + neitralAnimation = animationContainer; + animations.Add(animationContainer); + } + + private void LoadAnimations(List animationsId, string neitralAnimationId) + { + animations = new List(); + foreach (var id in animationsId) + { + animations.Add(AppManager.Instance.animationBuilder.Animations.Find(x => x.Id == id)); + if (id == neitralAnimationId) + { + neitralAnimation = animations.Last(); + } + } + } + + public override void LoadContent() + { + textures = new List(); + texturesNames = new List(); + + foreach (var animation in animations) + { + if (!texturesNames.Contains(animation.TextureName)) + { + texturesNames.Add(animation.TextureName); + textures.Add(AppManager.Instance.Content.Load(animation.TextureName)); + } + } + } + + public void StartAnimation(string startedanimationId) + { + currentFrame = 0; + currentAnimation = animations.Find(x => x.Id == startedanimationId); + + buildSourceRectangle(); + SetInterval(); + } + + public void StopAnimation() + { + currentFrame = 0; + interval = 0; + currentAnimation = neitralAnimation; + buildSourceRectangle(); + SetInterval(); + } + + public override void Update() + { + lastUpdateCallFrame = currentFrame; + if (interval == 0) + { + currentFrame++; + if (currentAnimation.FramesCount <= currentFrame) + { + if (!currentAnimation.IsCycle) + { + if (actionOfAnimationEnd != null) + { + actionOfAnimationEnd(currentAnimation.Id); + } + currentAnimation = neitralAnimation; + + } + + currentFrame = 0; + + } + + buildSourceRectangle(); + SetInterval(); + } + + interval--; + } + + public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch) + { + Texture2D texture = textures[texturesNames.FindIndex(x => x == currentAnimation.TextureName)]; + float scale; + if (currentAnimation.Offset.X != 0) + { + destinationRectangle.X -= (int)currentAnimation.Offset.X; + scale = destinationRectangle.Height / sourceRectangle.Height; + destinationRectangle.Width = (int)(sourceRectangle.Width * scale); + + } + else if (currentAnimation.Offset.Y != 0) + { + destinationRectangle.Y -= (int)currentAnimation.Offset.Y; + scale = destinationRectangle.Width / sourceRectangle.Width; + destinationRectangle.Height = (int)(sourceRectangle.Height * scale); + } + + destinationRectangle.X -= CameraPosition.X; + destinationRectangle.Y -= CameraPosition.Y; + + destinationRectangle = Scaling(destinationRectangle); + _spriteBatch.Draw(texture, + destinationRectangle, sourceRectangle, Color.White); + } + public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle) + { + Texture2D texture = textures[texturesNames.FindIndex(x => x == currentAnimation.TextureName)]; + float scale; + if (currentAnimation.Offset.X != 0) + { + destinationRectangle.X -= (int)currentAnimation.Offset.X; + scale = destinationRectangle.Height / sourceRectangle.Height; + destinationRectangle.Width = (int)(sourceRectangle.Width * scale); + + } + else if (currentAnimation.Offset.Y != 0) + { + destinationRectangle.Y -= (int)currentAnimation.Offset.Y; + scale = destinationRectangle.Width / sourceRectangle.Width; + destinationRectangle.Height = (int)(sourceRectangle.Height * scale); + } + + destinationRectangle.X -= CameraPosition.X; + destinationRectangle.Y -= CameraPosition.Y; + + destinationRectangle = Scaling(destinationRectangle); + _spriteBatch.Draw(texture, + destinationRectangle, sourceRectangle, Color.White); + } + private void buildSourceRectangle() + { + sourceRectangle = new Rectangle(); + if (currentAnimation == null) + { + currentAnimation = neitralAnimation; + } + sourceRectangle.X = currentAnimation.StartSpriteRectangle.X + currentFrame * + (currentAnimation.StartSpriteRectangle.Width + currentAnimation.TextureFrameInterval); + sourceRectangle.Y = currentAnimation.StartSpriteRectangle.Y; + sourceRectangle.Height = currentAnimation.StartSpriteRectangle.Height; + sourceRectangle.Width = currentAnimation.StartSpriteRectangle.Width; + } + + private void SetInterval() + { + Tuple i = currentAnimation.FrameTime.Find(x => x.Item1 == currentFrame); + if (i != null) + { + interval = i.Item2; + lastInterval = interval; + } + else + { + interval = lastInterval; + } + } + + } +} diff --git a/ZoFo/GameCore/Graphics/AnimationBuilder.cs b/ZoFo/GameCore/Graphics/AnimationBuilder.cs index 2ff7ac4..e85ec28 100644 --- a/ZoFo/GameCore/Graphics/AnimationBuilder.cs +++ b/ZoFo/GameCore/Graphics/AnimationBuilder.cs @@ -17,12 +17,20 @@ namespace ZoFo.GameCore.Graphics StreamReader reader; foreach (var fileName in animationFilesNames) { - if (!fileName.EndsWith(".animation")) continue; - reader = new StreamReader(fileName); - string json = reader.ReadToEnd(); - AnimationContainer animation = JsonConvert.DeserializeObject(json); - Animations.Add(animation); - reader.Close(); + try + { + if (!fileName.EndsWith(".animation")) continue; + reader = new StreamReader(fileName); + string json = reader.ReadToEnd(); + AnimationContainer animation = JsonConvert.DeserializeObject(json); + Animations.Add(animation); + reader.Close(); + } + catch + { + + + } } } diff --git a/ZoFo/GameCore/Graphics/GraphicsComponent.cs b/ZoFo/GameCore/Graphics/GraphicsComponent.cs index e8f9f17..c71b0c3 100644 --- a/ZoFo/GameCore/Graphics/GraphicsComponent.cs +++ b/ZoFo/GameCore/Graphics/GraphicsComponent.cs @@ -1,318 +1,56 @@ -using System; -using System.Collections.Generic; -using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using ZoFo.GameCore.GameManagers; -namespace ZoFo.GameCore.Graphics +namespace ZoFo.GameCore.Graphics; + +public abstract class GraphicsComponent { + public Rectangle ObjectDrawRectangle; + public static int scaling = 1; + public string mainTextureName;//TODO костыль - пофиксить - public class GraphicsComponent + public abstract void LoadContent(); + public abstract void Update(); + public abstract void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch); + public abstract void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle); + + protected Rectangle Scaling(Rectangle destinationRectangle) { - public Rectangle ObjectDrawRectangle; - - - - public event Action OnAnimationEnd; - private List animations; - private List textures; - public List texturesNames; //rethink public and following that errors - private AnimationContainer currentAnimation; - public static int scaling = 1; - - public bool animating = true; - private int step = 1; - - public AnimationContainer CurrentAnimation - { - get - { - return currentAnimation; - } - } - public string LastAnimation { get; set; } - public string GetCurrentAnimation - { - get { return currentAnimation.Id; } - } - - private AnimationContainer idleAnimation; - //private SpriteBatch _spriteBatch; - - private int currentFrame; - public int CurrentFrame - { - get - { - return currentFrame; - } - } - private int interval; - private int lastInterval; - private Rectangle sourceRectangle; - public GraphicsComponent(List animationsId, string neitralAnimationId) - { - //this._spriteBatch = _spriteBatch; - currentFrame = 0; - lastInterval = 1; - LoadAnimations(animationsId, neitralAnimationId); - currentAnimation = idleAnimation; - SetInterval(); - buildSourceRectangle(); - } - - public string mainTextureName;//TODO костыль - пофиксить - public GraphicsComponent(string textureName) - { - BuildComponent(textureName); - } - public GraphicsComponent() - { - } - public void BuildComponent(string textureName) - { - mainTextureName = textureName; - //texturesNames.Add(textureName);//Added by SD - animations = new List(); - textures = new List(); - var texture = AppManager.Instance.Content.Load(textureName); - textures.Add(texture); - AnimationContainer animationContainer = new AnimationContainer(); - animationContainer.StartSpriteRectangle = new Rectangle(0, 0, texture.Width, texture.Height); - animationContainer.TextureFrameInterval = 0; - animationContainer.TextureName = texture.Name; - animationContainer.IsCycle = true; - animationContainer.FramesCount = 1; - animationContainer.FrameTime = new List>() { new Tuple(0, 10) }; - animationContainer.Id = texture.Name; - currentAnimation = animationContainer; - idleAnimation = animationContainer; - animations.Add(animationContainer); - } - - private void LoadAnimations(List animationsId, string neitralAnimationId) - { - animations = new List(); - foreach (var id in animationsId) - { - animations.Add(AppManager.Instance.animationBuilder.Animations.Find(x => x.Id == id)); - if (id == neitralAnimationId) - { - idleAnimation = animations.Last(); - } - } - } - - public void LoadContent() - { - textures = new List(); - texturesNames = new List(); - - if (animations is null) - { - return; - } - - foreach (var animation in animations) - { - if (!texturesNames.Contains(animation.TextureName)) - { - texturesNames.Add(animation.TextureName); - textures.Add(AppManager.Instance.Content.Load(animation.TextureName)); - } - } - } - - public void AnimationSelect(string animationId, bool reverse = false) - { - currentAnimation = animations.Find(x => x.Id == animationId); - if (reverse) - { - currentFrame = currentAnimation.FramesCount; - step = -1; - } - else - { - step = 1; - currentFrame = 1; - } - buildSourceRectangle(); - SetInterval(); - } - - public void StartAnimation() - { - animating = true; - } - - public void AnimationStep() - { - currentFrame += step; - } - - public void SetFrame(int frame) - { - currentFrame = frame; - } - - public void StopAnimation() - { - currentFrame = 0; - interval = 0; - currentAnimation = idleAnimation; - buildSourceRectangle(); - SetInterval(); - } - - private void AnimationEnd() - { - if (!currentAnimation.IsCycle) - { - if (OnAnimationEnd != null) - { - OnAnimationEnd(currentAnimation.Id); - } - currentAnimation = idleAnimation; - animating = false; - } - currentFrame = 0; - } - - public void Update() - { - if (currentAnimation.FramesCount <= currentFrame || currentFrame < 0) - { - AnimationEnd(); - } - - if (!animating) - return; - - if (interval == 0) - { - currentFrame += step; - buildSourceRectangle(); - SetInterval(); - } - - interval--; - } - - public void DrawAnimation(Rectangle destinationRectangle, SpriteBatch _spriteBatch) - { - Texture2D texture = textures[texturesNames.FindIndex(x => x == currentAnimation.TextureName)]; - float scale; - if (currentAnimation.Offset.X != 0) - { - destinationRectangle.X -= (int)currentAnimation.Offset.X; - scale = destinationRectangle.Height / sourceRectangle.Height; - destinationRectangle.Width = (int)(sourceRectangle.Width * scale); - - } - else if (currentAnimation.Offset.Y != 0) - { - destinationRectangle.Y -= (int)currentAnimation.Offset.Y; - scale = destinationRectangle.Width / sourceRectangle.Width; - destinationRectangle.Height = (int)(sourceRectangle.Height * scale); - } - - destinationRectangle.X -= CameraPosition.X; - destinationRectangle.Y -= CameraPosition.Y; - - destinationRectangle = Scaling(destinationRectangle); - _spriteBatch.Draw(texture, - destinationRectangle, sourceRectangle, Color.White); - } - public void DrawAnimation(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle) - { - Texture2D texture = textures[texturesNames.FindIndex(x => x == currentAnimation.TextureName)]; - float scale; - if (currentAnimation.Offset.X != 0) - { - destinationRectangle.X -= (int)currentAnimation.Offset.X; - scale = destinationRectangle.Height / sourceRectangle.Height; - destinationRectangle.Width = (int)(sourceRectangle.Width * scale); - - } - else if (currentAnimation.Offset.Y != 0) - { - destinationRectangle.Y -= (int)currentAnimation.Offset.Y; - scale = destinationRectangle.Width / sourceRectangle.Width; - destinationRectangle.Height = (int)(sourceRectangle.Height * scale); - } - - destinationRectangle.X -= CameraPosition.X; - destinationRectangle.Y -= CameraPosition.Y; - - destinationRectangle = Scaling(destinationRectangle); - _spriteBatch.Draw(texture, - destinationRectangle, sourceRectangle, Color.White); - } - private Rectangle Scaling(Rectangle destinationRectangle) - { - destinationRectangle.X *= scaling; - destinationRectangle.Y *= scaling; - destinationRectangle.Width *= scaling; - destinationRectangle.Height *= scaling; - return destinationRectangle; - } - private void buildSourceRectangle() - { - sourceRectangle = new Rectangle(); - if (currentAnimation == null) - { - currentAnimation = idleAnimation; - } - sourceRectangle.X = currentAnimation.StartSpriteRectangle.X + currentFrame * - (currentAnimation.StartSpriteRectangle.Width + currentAnimation.TextureFrameInterval); - sourceRectangle.Y = currentAnimation.StartSpriteRectangle.Y; - sourceRectangle.Height = currentAnimation.StartSpriteRectangle.Height; - sourceRectangle.Width = currentAnimation.StartSpriteRectangle.Width; - } - - private void SetInterval() - { - Tuple i = currentAnimation.FrameTime.Find(x => x.Item1 == currentFrame); - if (i != null) - { - interval = i.Item2; - lastInterval = interval; - } - else - { - interval = lastInterval; - } - } - public static void SetCameraPosition(Vector2 playerPosition) - { - CameraPosition = (playerPosition).ToPoint(); - CameraPosition.X -= 200; - CameraPosition.Y -= 120; - - // TODO - /* - if (CameraPosition.X > AppManager.Instance.GameManager.CameraBorder.Y - 460) - { - CameraPosition.X = (int)AppManager.Instance.GameManager.CameraBorder.Y - 460; - } - - if (CameraPosition.Y < AppManager.Instance.GameManager.CameraBorder.Z) - { - CameraPosition.Y = (int)AppManager.Instance.GameManager.CameraBorder.Z; - } - if (CameraPosition.X < AppManager.Instance.GameManager.CameraBorder.X) - { - CameraPosition.X = (int)AppManager.Instance.GameManager.CameraBorder.X; - } - if (CameraPosition.Y > AppManager.Instance.GameManager.CameraBorder.W - 240) - { - CameraPosition.Y = (int)AppManager.Instance.GameManager.CameraBorder.W - 240; - } - - AppManager.Instance.DebugHUD.Set("CameraPosition", $"{CameraPosition.X}, {CameraPosition.Y}"); - */ - } - public static Point CameraPosition = new Point(0, 0); + destinationRectangle.X *= scaling; + destinationRectangle.Y *= scaling; + destinationRectangle.Width *= scaling; + destinationRectangle.Height *= scaling; + return destinationRectangle; } -} + + public static void SetCameraPosition(Vector2 playerPosition) + { + CameraPosition = (playerPosition).ToPoint(); + CameraPosition.X -= 200; + CameraPosition.Y -= 120; + + // TODO + /* + if (CameraPosition.X > AppManager.Instance.GameManager.CameraBorder.Y - 460) + { + CameraPosition.X = (int)AppManager.Instance.GameManager.CameraBorder.Y - 460; + } + + if (CameraPosition.Y < AppManager.Instance.GameManager.CameraBorder.Z) + { + CameraPosition.Y = (int)AppManager.Instance.GameManager.CameraBorder.Z; + } + if (CameraPosition.X < AppManager.Instance.GameManager.CameraBorder.X) + { + CameraPosition.X = (int)AppManager.Instance.GameManager.CameraBorder.X; + } + if (CameraPosition.Y > AppManager.Instance.GameManager.CameraBorder.W - 240) + { + CameraPosition.Y = (int)AppManager.Instance.GameManager.CameraBorder.W - 240; + } + + AppManager.Instance.DebugHUD.Set("CameraPosition", $"{CameraPosition.X}, {CameraPosition.Y}"); + */ + } + public static Point CameraPosition = new Point(0, 0); +} \ No newline at end of file diff --git a/ZoFo/GameCore/Graphics/IGraphicsComponent.cs b/ZoFo/GameCore/Graphics/IGraphicsComponent.cs new file mode 100644 index 0000000..50e2424 --- /dev/null +++ b/ZoFo/GameCore/Graphics/IGraphicsComponent.cs @@ -0,0 +1,16 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace ZoFo.GameCore.Graphics; + +public interface IGraphicsComponent +{ + public Rectangle ObjectDrawRectangle { get; set; } + public static int scaling = 1; + public string mainTextureName { get; set; }//TODO костыль - пофиксить + + public abstract void LoadContent(); + public abstract void Update(); + public abstract void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch); + public abstract void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle); +} \ No newline at end of file diff --git a/ZoFo/GameCore/Graphics/StaticGraphicsComponent.cs b/ZoFo/GameCore/Graphics/StaticGraphicsComponent.cs new file mode 100644 index 0000000..3e2fd6c --- /dev/null +++ b/ZoFo/GameCore/Graphics/StaticGraphicsComponent.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.GUI; + +namespace ZoFo.GameCore.Graphics +{ + + public class StaticGraphicsComponent : GraphicsComponent + { + private Texture2D texture; + public string _textureName; + + public StaticGraphicsComponent() + { + LoadContent(); + } + + public StaticGraphicsComponent(string textureName) + { + BuildComponent(textureName); + LoadContent(); + } + + public void BuildComponent(string textureName) + { + _textureName = textureName; + } + + + public override void LoadContent() + { + if (_textureName is null) + { + return; + } + + texture = AppManager.Instance.Content.Load(_textureName); + } + + public override void Update() + { + + } + + public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch) + { + DebugHUD.Instance.Log("draw "); + + destinationRectangle.X -= CameraPosition.X; + destinationRectangle.Y -= CameraPosition.Y; + destinationRectangle = Scaling(destinationRectangle); + _spriteBatch.Draw(texture, destinationRectangle, Color.White); + } + + public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle) + { + DebugHUD.Instance.Log("draw "); + + destinationRectangle.X -= CameraPosition.X; + destinationRectangle.Y -= CameraPosition.Y; + + destinationRectangle = Scaling(destinationRectangle); + _spriteBatch.Draw(texture, + destinationRectangle, sourceRectangle, Color.White); + } + } +} diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs index 17502b9..329763c 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -15,9 +15,12 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates; using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; using ZoFo.GameCore.GameObjects; using ZoFo.GameCore.GameObjects.Entities; +using ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables; using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies; using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player; using ZoFo.GameCore.GameObjects.MapObjects; +using ZoFo.GameCore.GameObjects.MapObjects.StopObjects; +using ZoFo.GameCore.Graphics; namespace ZoFo.GameCore { @@ -25,8 +28,7 @@ namespace ZoFo.GameCore { private ServerNetworkManager networkManager; private int ticks = 0; - public IPEndPoint MyIp { get { return networkManager.InfoConnect; } } - + public IPEndPoint MyIp { get { return networkManager.InfoConnect; } } public Server() { networkManager = new ServerNetworkManager(); @@ -41,6 +43,7 @@ namespace ZoFo.GameCore public void OnDataSend(string data) { List updateDatas = JsonSerializer.Deserialize>(data); + AppManager.Instance.debugHud.Log(data); for (int i = 0; i < updateDatas.Count; i++) { ProcessIUpdateData(updateDatas[i]); @@ -54,6 +57,32 @@ namespace ZoFo.GameCore { //ТУТ Switch case будет честное слово + switch (updateData.UpdateType) + { + case "UpdateAnimation": + break; + case "UpdateEntityHealth": + break; + case "UpdateGameEnded": + break; + case "UpdateGameObjectCreated": + break; + case "UpdateGameObjectDeleted": + break; + case "UpdateInteraction": + break; + case "UpdateInteractionReady": + break; + case "UpdateLoot": + break; + case "UpdatePlayerParametrs": + break; + case "UpdatePosition": + break; + case "UpdateTileCreated": + break; + + } } public void CloseConnection() @@ -95,11 +124,14 @@ namespace ZoFo.GameCore collisionManager = new CollisionManager(); gameObjects = new List(); entities = new List(); - //new MapManager().LoadMap(); + players = new List(); + new MapManager().LoadMap(); - AppManager.Instance.server.RegisterGameObject(new EntittyForAnimationTests(new Vector2(40, 40))); - AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(140, 140))); - AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(140, 140))); + AppManager.Instance.server.RegisterGameObject(new EntittyForAnimationTests(new Vector2(0, 0))); + AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(740, 140))); + AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1000, 1000))); + AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(140, 440))); + AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(240, 440))); } /// @@ -112,8 +144,9 @@ namespace ZoFo.GameCore networkManager.CloseConnection(); } - private List gameObjects = new List(); - private List entities; //entity + public List gameObjects; + public List entities; //entity + public List players; public void Update(GameTime gameTime) { if (ticks == 3) //ОБРАБАТЫВАЕТСЯ 20 РАЗ В СЕКУНДУ @@ -139,6 +172,23 @@ namespace ZoFo.GameCore { gameObjects.Add(gameObject); + if (gameObject is StopObject) + { + AddData(new UpdateStopObjectCreated() + { + Position = (gameObject as StopObject).position, + sourceRectangle = (gameObject as StopObject).sourceRectangle, + Size = (gameObject as StopObject).graphicsComponent.ObjectDrawRectangle.Size, + collisions = (gameObject as StopObject).collisionComponents.Select(x=>x.stopRectangle).ToArray(), + tileSetName = ((gameObject as StopObject).graphicsComponent as StaticGraphicsComponent)._textureName + });//TODO + foreach (var item in (gameObject as StopObject).collisionComponents) + { + collisionManager.Register(item); + + } + return; + } if (gameObject is MapObject) { AddData(new UpdateTileCreated() @@ -146,25 +196,32 @@ namespace ZoFo.GameCore Position = (gameObject as MapObject).position, sourceRectangle = (gameObject as MapObject).sourceRectangle, Size = (gameObject as MapObject).graphicsComponent.ObjectDrawRectangle.Size, - tileSetName = (gameObject as MapObject).graphicsComponent.mainTextureName + tileSetName = ((gameObject as MapObject).graphicsComponent as StaticGraphicsComponent)._textureName });//TODO return; } - if (gameObject is Entity) + if (gameObject is Entity entity) { - AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, IdEntity = (gameObject as Entity).Id }); - collisionManager.Register((gameObject as Entity).collisionComponent); + AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, IdEntity = entity.Id, + position = gameObject.position}); + collisionManager.Register(entity.collisionComponent); } else - AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name }); + AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, + position = gameObject.position + }); + if (gameObject is Player) + { + players.Add(gameObject as Player); + } ////var elems = gameObject.GetType().GetProperties(System.Reflection.BindingFlags.Public); ////if (elems.Count()>0) TODO ////{ //// AppManager.Instance.server.collisionManager.Register((elems.First().GetValue(gameObject) as CollisionComponent)); ////} - + } /// diff --git a/ZoFo/ZoFo.csproj b/ZoFo/ZoFo.csproj index b4a9088..1fd87e3 100644 --- a/ZoFo/ZoFo.csproj +++ b/ZoFo/ZoFo.csproj @@ -35,6 +35,8 @@ + +