From 28487fdee666ac0266b5da838c4939385277b971 Mon Sep 17 00:00:00 2001 From: polten0 Date: Tue, 20 Aug 2024 05:06:57 +0300 Subject: [PATCH] fixed map --- ZoFo/Content/Content.mgcb | 15 + ZoFo/Content/MapData/MapSession.tiled-session | 26 ++ ZoFo/Content/MapData/TileSets/TileSet 1.tsj | 264 ++++++++++++++++++ ZoFo/Content/MapData/TileSets/bonfire.tsj | 12 +- ZoFo/GameCore/Client.cs | 11 +- .../GameManagers/MapManager/MapManager.cs | 4 +- .../Collectables/BottleOfWater.cs | 5 +- .../Interactables/Collectables/Peeble.cs | 5 +- .../Collectables/PureBottleOfWater.cs | 4 +- .../Interactables/Collectables/RottenFlesh.cs | 5 +- .../Interactables/Collectables/Steel.cs | 4 +- .../Interactables/Collectables/Wood.cs | 5 +- 12 files changed, 339 insertions(+), 21 deletions(-) diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index b3a43e3..3460cd8 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -44,6 +44,9 @@ #begin MapData/TileMaps/main.tmj /copy:MapData/TileMaps/main.tmj +#begin MapData/TileSets/bonfire.tsj +/copy:MapData/TileSets/bonfire.tsj + #begin MapData/TileSets/IconSet.tsj /copy:MapData/TileSets/IconSet.tsj @@ -1469,6 +1472,18 @@ /processorParam:TextureFormat=Color /build:Textures/Test/wood.jpg +#begin Textures/TileSetImages/Campfire.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/TileSetImages/Campfire.png + #begin Textures/TileSetImages/Pipes.png /importer:TextureImporter /processor:TextureProcessor diff --git a/ZoFo/Content/MapData/MapSession.tiled-session b/ZoFo/Content/MapData/MapSession.tiled-session index e69de29..66a3ad6 100644 --- a/ZoFo/Content/MapData/MapSession.tiled-session +++ b/ZoFo/Content/MapData/MapSession.tiled-session @@ -0,0 +1,26 @@ +{ + "fileStates": { + "TileMaps/main.tmj": { + "scale": 0.33, + "selectedLayer": 0, + "viewCenter": { + "x": -463.63636363636374, + "y": 300 + } + }, + "TileSets/IconSet.tsj": { + "dynamicWrapping": true + }, + "TileSets/TileSet 1.tsj": { + "dynamicWrapping": false, + "scaleInDock": 1 + }, + "TileSets/TilesetNature.tsj": { + "scaleInDock": 1.5 + }, + "TileSets/tileset 1 collision.tsj": { + "dynamicWrapping": false, + "scaleInDock": 1 + } + } +} diff --git a/ZoFo/Content/MapData/TileSets/TileSet 1.tsj b/ZoFo/Content/MapData/TileSets/TileSet 1.tsj index 8259460..30268ce 100644 --- a/ZoFo/Content/MapData/TileSets/TileSet 1.tsj +++ b/ZoFo/Content/MapData/TileSets/TileSet 1.tsj @@ -2314,6 +2314,270 @@ { "id":571, "type":"Tile" + }, + { + "id":572, + "type":"Tile" + }, + { + "id":573, + "type":"Tile" + }, + { + "id":574, + "type":"Tile" + }, + { + "id":575, + "type":"Tile" + }, + { + "id":576, + "type":"Tile" + }, + { + "id":577, + "type":"Tile" + }, + { + "id":578, + "type":"Tile" + }, + { + "id":579, + "type":"Tile" + }, + { + "id":580, + "type":"Tile" + }, + { + "id":581, + "type":"Tile" + }, + { + "id":582, + "type":"Tile" + }, + { + "id":583, + "type":"Tile" + }, + { + "id":584, + "type":"Tile" + }, + { + "id":585, + "type":"Tile" + }, + { + "id":586, + "type":"Tile" + }, + { + "id":587, + "type":"Tile" + }, + { + "id":588, + "type":"Tile" + }, + { + "id":589, + "type":"Tile" + }, + { + "id":590, + "type":"Tile" + }, + { + "id":591, + "type":"Tile" + }, + { + "id":592, + "type":"Tile" + }, + { + "id":593, + "type":"Tile" + }, + { + "id":594, + "type":"Tile" + }, + { + "id":595, + "type":"Tile" + }, + { + "id":596, + "type":"Tile" + }, + { + "id":597, + "type":"Tile" + }, + { + "id":598, + "type":"Tile" + }, + { + "id":599, + "type":"Tile" + }, + { + "id":600, + "type":"Tile" + }, + { + "id":601, + "type":"Tile" + }, + { + "id":602, + "type":"Tile" + }, + { + "id":603, + "type":"Tile" + }, + { + "id":604, + "type":"Tile" + }, + { + "id":605, + "type":"Tile" + }, + { + "id":606, + "type":"Tile" + }, + { + "id":607, + "type":"Tile" + }, + { + "id":608, + "type":"Tile" + }, + { + "id":609, + "type":"Tile" + }, + { + "id":610, + "type":"Tile" + }, + { + "id":611, + "type":"Tile" + }, + { + "id":612, + "type":"Tile" + }, + { + "id":613, + "type":"Tile" + }, + { + "id":614, + "type":"Tile" + }, + { + "id":615, + "type":"Tile" + }, + { + "id":616, + "type":"Tile" + }, + { + "id":617, + "type":"Tile" + }, + { + "id":618, + "type":"Tile" + }, + { + "id":619, + "type":"Tile" + }, + { + "id":620, + "type":"Tile" + }, + { + "id":621, + "type":"Tile" + }, + { + "id":622, + "type":"Tile" + }, + { + "id":623, + "type":"Tile" + }, + { + "id":624, + "type":"Tile" + }, + { + "id":625, + "type":"Tile" + }, + { + "id":626, + "type":"Tile" + }, + { + "id":627, + "type":"Tile" + }, + { + "id":628, + "type":"Tile" + }, + { + "id":629, + "type":"Tile" + }, + { + "id":630, + "type":"Tile" + }, + { + "id":631, + "type":"Tile" + }, + { + "id":632, + "type":"Tile" + }, + { + "id":633, + "type":"Tile" + }, + { + "id":634, + "type":"Tile" + }, + { + "id":635, + "type":"Tile" + }, + { + "id":636, + "type":"Tile" + }, + { + "id":637, + "type":"Tile" }], "tilewidth":16, "type":"tileset", diff --git a/ZoFo/Content/MapData/TileSets/bonfire.tsj b/ZoFo/Content/MapData/TileSets/bonfire.tsj index e45de50..69111cb 100644 --- a/ZoFo/Content/MapData/TileSets/bonfire.tsj +++ b/ZoFo/Content/MapData/TileSets/bonfire.tsj @@ -27,16 +27,20 @@ "duration":250, "tileid":3 }], - "id":0 + "id":0, + "type":"StopObject" }, { - "id":1 + "id":1, + "type":"StopObject" }, { - "id":2 + "id":2, + "type":"StopObject" }, { - "id":3 + "id":3, + "type":"StopObject" }, { "id":4 diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs index 58257fd..9f7e17b 100644 --- a/ZoFo/GameCore/Client.cs +++ b/ZoFo/GameCore/Client.cs @@ -166,12 +166,13 @@ namespace ZoFo.GameCore created_gameObject = new Player((update as UpdateGameObjectCreated).position); players.Add(created_gameObject as Player); myPlayer = players[0]; - gameObjects.Add(created_gameObject); + gameObjects.Add(created_gameObject); + (created_gameObject as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity); } - else if((update as UpdateGameObjectCreated).GameObjectType == "Ammo") + else if ((update as UpdateGameObjectCreated).GameObjectType == "Ammo") gameObjects.Add(new Ammo((update as UpdateGameObjectCreated).position)); - else if((update as UpdateGameObjectCreated).GameObjectType == "Zombie") - gameObjects.Add(new Zombie((update as UpdateGameObjectCreated).position)); + else if ((update as UpdateGameObjectCreated).GameObjectType == "BottleOfWater") + gameObjects.Add(new BottleOfWater((update as UpdateGameObjectCreated).position)); else { Type t = Type.GetType("ZoFo.GameCore.GameObjects." + (update as UpdateGameObjectCreated).GameObjectType); @@ -180,7 +181,7 @@ namespace ZoFo.GameCore (gameObject as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity); gameObjects.Add(gameObject); } - (gameObjects.Last() as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity); + } else if (update is UpdatePosition) diff --git a/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs b/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs index cb26b8d..49d2b2d 100644 --- a/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs +++ b/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs @@ -20,8 +20,8 @@ namespace ZoFo.GameCore.GameManagers.MapManager private static readonly string _templatePath = "Content/MapData/TileMaps/{0}.tmj"; private static readonly JsonSerializerOptions _options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true }; // Задача настроек для JsonSerialize private static readonly Dictionary _classPath = new Dictionary() { - { "Collectables", "ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables." }, - { "Enemies", "ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies." } + { "Collectables", "ZoFo.GameCore.GameObjects." }, + { "Enemies", "ZoFo.GameCore.GameObjects." } }; //private static readonly float _scale = 1.0f; diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/BottleOfWater.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/BottleOfWater.cs index 2a4e542..2e48992 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/BottleOfWater.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/BottleOfWater.cs @@ -10,14 +10,15 @@ using ZoFo.GameCore.GameManagers.CollisionManager; using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; using ZoFo.GameCore.GameManagers; -namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +namespace ZoFo.GameCore.GameObjects { public class BottleOfWater : Collectable { public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "BottleOfWater"); public BottleOfWater(Vector2 position) : base(position) { - + graphicsComponent.ObjectDrawRectangle.Width = 20; + graphicsComponent.ObjectDrawRectangle.Height = 20; } public override void OnInteraction(GameObject sender) { diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Peeble.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Peeble.cs index 9b6ad47..b031bdd 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Peeble.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Peeble.cs @@ -10,7 +10,7 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; using ZoFo.GameCore.GameManagers; -namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +namespace ZoFo.GameCore.GameObjects { public class Peeble:Collectable { @@ -18,7 +18,8 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables public Peeble(Vector2 position) : base(position) { - + graphicsComponent.ObjectDrawRectangle.Width = 20; + graphicsComponent.ObjectDrawRectangle.Height = 20; } public override void OnInteraction(GameObject sender) { diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/PureBottleOfWater.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/PureBottleOfWater.cs index d318bf6..f32d070 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/PureBottleOfWater.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/PureBottleOfWater.cs @@ -9,7 +9,7 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; using ZoFo.GameCore.GameManagers; using ZoFo.GameCore.Graphics; -namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +namespace ZoFo.GameCore.GameObjects { class PureBottleOfWater:Collectable { @@ -17,6 +17,8 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables public PureBottleOfWater(Vector2 position) : base(position) { + graphicsComponent.ObjectDrawRectangle.Width = 20; + graphicsComponent.ObjectDrawRectangle.Height = 20; } public override void OnInteraction(GameObject sender) { diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/RottenFlesh.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/RottenFlesh.cs index a1ce270..68a7a0a 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/RottenFlesh.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/RottenFlesh.cs @@ -9,14 +9,15 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; using ZoFo.GameCore.GameManagers; using ZoFo.GameCore.Graphics; -namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +namespace ZoFo.GameCore.GameObjects { class RottenFlesh:Collectable { public override StaticGraphicsComponent graphicsComponent { get; } = new(_path + "RottenFlesh"); public RottenFlesh(Vector2 position) : base(position) { - + graphicsComponent.ObjectDrawRectangle.Width = 20; + graphicsComponent.ObjectDrawRectangle.Height = 20; } public override void OnInteraction(GameObject sender) { diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Steel.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Steel.cs index a8bbe9d..21f5311 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Steel.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Steel.cs @@ -9,7 +9,7 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; using ZoFo.GameCore.GameManagers; using ZoFo.GameCore.Graphics; -namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +namespace ZoFo.GameCore.GameObjects { class Steel:Collectable { @@ -17,6 +17,8 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables public Steel(Vector2 position) : base(position) { + graphicsComponent.ObjectDrawRectangle.Width = 20; + graphicsComponent.ObjectDrawRectangle.Height = 20; } public override void OnInteraction(GameObject sender) { diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Wood.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Wood.cs index 15d6ee6..7cfad32 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Wood.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Wood.cs @@ -5,7 +5,7 @@ using ZoFo.GameCore.GameManagers.CollisionManager; using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; using ZoFo.GameCore.Graphics; -namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables; +namespace ZoFo.GameCore.GameObjects; public class Wood : Collectable { @@ -13,7 +13,8 @@ public class Wood : Collectable public Wood(Vector2 position) : base(position) { - + graphicsComponent.ObjectDrawRectangle.Width = 20; + graphicsComponent.ObjectDrawRectangle.Height = 20; } public override void OnInteraction(GameObject sender) {