From 3849435115c3f41cbb2c4e5d24e989384de721e6 Mon Sep 17 00:00:00 2001 From: rawer470 Date: Sat, 17 Aug 2024 11:24:12 +0300 Subject: [PATCH 01/15] MbReadyMultiPlayer --- ZoFo/GameCore/Client.cs | 4 ++ ZoFo/GameCore/GUI/SelectingServerGUI.cs | 49 ++++++++++++++--------- ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs | 33 ++++++++++++--- 3 files changed, 62 insertions(+), 24 deletions(-) diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs index f49020f..64d088c 100644 --- a/ZoFo/GameCore/Client.cs +++ b/ZoFo/GameCore/Client.cs @@ -14,6 +14,8 @@ using ZoFo.GameCore.GameObjects.MapObjects.Tiles; using System.Drawing; using System.Reflection; using ZoFo.GameCore.GameObjects.Entities; +using System.Net.Sockets; +using System.Net; namespace ZoFo.GameCore { @@ -22,6 +24,8 @@ namespace ZoFo.GameCore ClientNetworkManager networkManager; public bool IsConnected { get { return networkManager.IsConnected; } } + public IPEndPoint InfoConnect => networkManager.InfoConnect; + public Client() { networkManager = new ClientNetworkManager(); diff --git a/ZoFo/GameCore/GUI/SelectingServerGUI.cs b/ZoFo/GameCore/GUI/SelectingServerGUI.cs index fafc259..f2c911c 100644 --- a/ZoFo/GameCore/GUI/SelectingServerGUI.cs +++ b/ZoFo/GameCore/GUI/SelectingServerGUI.cs @@ -21,14 +21,14 @@ 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", @@ -38,13 +38,15 @@ public class SelectingServerGUI : AbstractGUI textAligment = MonogameLibrary.UI.Enums.TextAligment.Left, fontName = "Fonts/Font" }; - 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,34 @@ 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); + Server server = new Server(); + AppManager.Instance.SetServer(server); + 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,9 +99,9 @@ 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); @@ -99,9 +112,9 @@ public class SelectingServerGUI : AbstractGUI 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 12a67b9..dd9cd13 100644 --- a/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs +++ b/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs @@ -31,12 +31,13 @@ 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); - // 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); + // string pcIp = + 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 +46,34 @@ public class WaitingForPlayersGUI : AbstractGUI mainColor = Color.Gray, fontName = "Fonts/Font" }; - startButton.LeftButtonPressed += () => + startButton.LeftButtonPressed += () => { // start - + // ваш код здесь }; 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 + + // ваш код здесь + }; + 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"}; From 2cce4ea9b92ce1ab434ed0a5a7f66b9ee3ece531 Mon Sep 17 00:00:00 2001 From: rawer470 Date: Sat, 17 Aug 2024 12:25:53 +0300 Subject: [PATCH 02/15] CreateConnectMultiplayer --- ZoFo/GameCore/GUI/SelectingServerGUI.cs | 8 +++----- ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs | 4 ++-- ZoFo/GameCore/GameManagers/AppManager.cs | 2 +- .../GameManagers/NetworkManager/ServerNetworkManager.cs | 7 +++++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ZoFo/GameCore/GUI/SelectingServerGUI.cs b/ZoFo/GameCore/GUI/SelectingServerGUI.cs index f2c911c..717e2b3 100644 --- a/ZoFo/GameCore/GUI/SelectingServerGUI.cs +++ b/ZoFo/GameCore/GUI/SelectingServerGUI.cs @@ -32,11 +32,11 @@ public class SelectingServerGUI : AbstractGUI { 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 => { @@ -76,8 +76,6 @@ public class SelectingServerGUI : AbstractGUI { client.JoinRoom(endpoint[0], port); AppManager.Instance.SetClient(client); - Server server = new Server(); - AppManager.Instance.SetServer(server); AppManager.Instance.SetGUI(new WaitingForPlayersGUI(false)); } } @@ -104,7 +102,7 @@ public class SelectingServerGUI : AbstractGUI // host Server server = new Server(); //Server Logic MultiPlayer - server.CreateRoom(5); + server.CreateRoom(1); AppManager.Instance.SetServer(server); string key = server.MyIp.ToString(); AppManager.Instance.debugHud.Set(key, "MultiPlayer"); diff --git a/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs b/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs index dd9cd13..7bcf287 100644 --- a/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs +++ b/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs @@ -49,7 +49,7 @@ public class WaitingForPlayersGUI : AbstractGUI startButton.LeftButtonPressed += () => { // start - + AppManager.Instance.ChangeState(GameState.HostPlaying); // ваш код здесь }; Elements.Add(startButton); @@ -69,7 +69,7 @@ public class WaitingForPlayersGUI : AbstractGUI waitButton.LeftButtonPressed += () => { // start - + AppManager.Instance.ChangeState(GameState.ClientPlaying); // ваш код здесь }; Elements.Add(waitButton); diff --git a/ZoFo/GameCore/GameManagers/AppManager.cs b/ZoFo/GameCore/GameManagers/AppManager.cs index fba2e17..48d923c 100644 --- a/ZoFo/GameCore/GameManagers/AppManager.cs +++ b/ZoFo/GameCore/GameManagers/AppManager.cs @@ -101,7 +101,7 @@ namespace ZoFo.GameCore.GameManagers break; case GameState.HostPlaying: server.Update(gameTime); - client.Update(gameTime); + // client.Update(gameTime); break; case GameState.ClientPlaying: server.Update(gameTime); diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs index 76e72c2..1d0ae62 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs @@ -142,13 +142,16 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager for (int i = 0; i < playNumber; i++) { Socket client = socket.Accept(); + AppManager.Instance.debugHud.Set("Connect", client.ToString()); Thread thread = new Thread(StartListening); thread.IsBackground = true; thread.Start(client); managerThread.Add(client, thread); - clients.Add(client); //добавляем клиентов в лист + clients.Add(client); + //AppManager.Instance.ChangeState(GameState.HostPlaying); + //добавляем клиентов в лист } - + AppManager.Instance.ChangeState(GameState.HostPlaying); } /// From d95c65c12caf72d0adab18479b03ea9113727125 Mon Sep 17 00:00:00 2001 From: rawer470 Date: Sat, 17 Aug 2024 14:03:06 +0300 Subject: [PATCH 03/15] SwitchOnServer --- ZoFo/GameCore/GameManagers/AppManager.cs | 2 +- .../ServerToClient/UpdateInteraction.cs | 3 +- .../ServerToClient/UpdateInteractionReady.cs | 2 +- ZoFo/GameCore/Server.cs | 32 +++++++++++++++++-- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/ZoFo/GameCore/GameManagers/AppManager.cs b/ZoFo/GameCore/GameManagers/AppManager.cs index 48d923c..fba2e17 100644 --- a/ZoFo/GameCore/GameManagers/AppManager.cs +++ b/ZoFo/GameCore/GameManagers/AppManager.cs @@ -101,7 +101,7 @@ namespace ZoFo.GameCore.GameManagers break; case GameState.HostPlaying: server.Update(gameTime); - // client.Update(gameTime); + client.Update(gameTime); break; case GameState.ClientPlaying: server.Update(gameTime); diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteraction.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteraction.cs index e42f0f4..96ecef2 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteraction.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteraction.cs @@ -5,6 +5,5 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; /// public class UpdateInteraction : UpdateData { - public int IdEntity { get; set; } - public string UpdateType { get; set; } + public UpdateInteraction() { UpdateType = "UpdateInteraction"; } } \ 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/Server.cs b/ZoFo/GameCore/Server.cs index 4bea6cc..8dd53dc 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -21,7 +21,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(); @@ -46,6 +46,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() @@ -136,8 +162,8 @@ namespace ZoFo.GameCore AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name } - ); - + ); + } } #endregion From 6c07557debc9b118356457768ba85c1518b6bbf5 Mon Sep 17 00:00:00 2001 From: rawer470 Date: Sat, 17 Aug 2024 19:02:02 +0300 Subject: [PATCH 04/15] FixGetIp --- .../GameManagers/NetworkManager/ServerNetworkManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs index 1d0ae62..9ea5de2 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs @@ -53,8 +53,9 @@ 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 + 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(myIP); } From ae050576d51b4f53550f2372f2c10ead495ca895 Mon Sep 17 00:00:00 2001 From: Mootfrost777 Date: Sat, 17 Aug 2024 19:32:12 +0300 Subject: [PATCH 05/15] Fix start --- .../MapManager/MapElements/Object.cs | 8 +-- .../MapManager/MapElements/Tile.cs | 2 +- .../GameManagers/MapManager/MapManager.cs | 53 +++++++++++-------- ZoFo/GameCore/Graphics/AnimationComponent.cs | 6 +++ 4 files changed, 43 insertions(+), 26 deletions(-) create mode 100644 ZoFo/GameCore/Graphics/AnimationComponent.cs 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..34530f5 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(); @@ -56,32 +57,43 @@ namespace ZoFo.GameCore.GameManagers.MapManager 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 + [i]; // По факту может быть 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/TileSetImages/" + + 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())); + 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: изменить конструктор, засунув коллизии. break; default: break; } - } } } @@ -112,16 +124,15 @@ namespace ZoFo.GameCore.GameManagers.MapManager /// /// /// - private List LoadRectangles(Tile tile) { + private List LoadRectangles(Tile tile) + { List collisionRectangles = new List(); - foreach (var objectGroup in tile.Objectgroup) + foreach (var obj in tile.Objectgroup.Objects) { - foreach (var obj in objectGroup.Objects) - { - collisionRectangles.Add(new Rectangle(obj.X, obj.Y, obj.Width, obj.Height)); - } + 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/Graphics/AnimationComponent.cs b/ZoFo/GameCore/Graphics/AnimationComponent.cs new file mode 100644 index 0000000..084b912 --- /dev/null +++ b/ZoFo/GameCore/Graphics/AnimationComponent.cs @@ -0,0 +1,6 @@ +namespace ZoFo.GameCore.Graphics; + +public class AnimationComponent +{ + +} \ No newline at end of file From 9e00e4d05d8dc1dac33fe35dd36a8fd8489b9833 Mon Sep 17 00:00:00 2001 From: Kaktus200020 Date: Sat, 17 Aug 2024 19:36:30 +0300 Subject: [PATCH 06/15] LootData --- .../GameObjects/Entities/LivingEntities/Player/LootData.cs | 7 ++++--- .../GameObjects/Entities/LivingEntities/Player/Player.cs | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) 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 026a746..3078de9 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs @@ -20,6 +20,7 @@ public class Player : LivingEntity public bool IsTryingToShoot { get; set; } private float speed; private int health; + private LootData lootData; public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List { "player_running_top_rotate" }, "player_running_top_rotate"); public Player(Vector2 position) : base(position) { From c9d766242fd28f362a9e89e9e1c2fd44682ce05e Mon Sep 17 00:00:00 2001 From: Lev Date: Sat, 17 Aug 2024 19:42:55 +0300 Subject: [PATCH 07/15] add vectors in UpdateInput, add event ActionEvent and Subscribing to the actions of the input manager --- ZoFo/GameCore/Client.cs | 9 +++++++ ZoFo/GameCore/GameManagers/InputManager.cs | 26 +++++++++++++++---- .../Updates/ClientToServer/UpdateInput.cs | 15 +++++++---- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs index f49020f..ee0355c 100644 --- a/ZoFo/GameCore/Client.cs +++ b/ZoFo/GameCore/Client.cs @@ -14,6 +14,8 @@ using ZoFo.GameCore.GameObjects.MapObjects.Tiles; using System.Drawing; using System.Reflection; using ZoFo.GameCore.GameObjects.Entities; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer; namespace ZoFo.GameCore { @@ -26,6 +28,13 @@ namespace ZoFo.GameCore { networkManager = new ClientNetworkManager(); networkManager.GetDataSent += OnDataSend; + + // Подписка на действия инпутменеджера. + // Отправляются данные апдейтса с обновлением инпута + AppManager.Instance.InputManager.ActionEvent += () => networkManager.AddData(new UpdateInput(){ + InputMovementDirection = AppManager.Instance.InputManager.InputMovementDirection, + InputAttackDirection = AppManager.Instance.InputManager.InputAttackDirection + }); } public void OnDataSend(string data) diff --git a/ZoFo/GameCore/GameManagers/InputManager.cs b/ZoFo/GameCore/GameManagers/InputManager.cs index 9bf702b..dd13535 100644 --- a/ZoFo/GameCore/GameManagers/InputManager.cs +++ b/ZoFo/GameCore/GameManagers/InputManager.cs @@ -17,17 +17,21 @@ namespace ZoFo.GameCore.GameManagers public class InputManager { - public delegate void Delegat(); - public event Delegat ShootEvent; // событие удара(когда нажат X, событие срабатывает) + public event Action ShootEvent; // событие удара(когда нажат X, событие срабатывает) - public event Delegat OnInteract; // событие взаимодействия с collectable(например, лутом) + public event Action OnInteract; // событие взаимодействия с collectable(например, лутом) //с помощью кнопки E. + + public event Action ActionEvent; public Vector2 InputMovementDirection; + private Vector2 prevInputMovementDirection; public Vector2 InputAttackDirection; + private Vector2 prevInputAttackDirection; - public event Delegat TalkEvent; + public event Action TalkEvent; - ScopeState currentScopeState; // Положение оружия. Left, Right, Straight, Back, StraightLeft, StraightRight, BackLeft, BackRight. + public ScopeState currentScopeState; // Положение оружия. Left, Right, Straight, Back, StraightLeft, StraightRight, BackLeft, BackRight. + private ScopeState prevCurrentScopeState; private bool _cheatsEnabled = false; public bool InvincibilityCheat { get; private set; } = false; public bool CollisionsCheat { get; private set; } = false; @@ -128,6 +132,7 @@ namespace ZoFo.GameCore.GameManagers lastGamePadState = gamePadState; #endregion #region Работа с KeyBoard + #region InputAttack with mouse MouseState mouseState = Mouse.GetState(); AppManager.Instance.debugHud.Set("mouse position", $"({mouseState.X}, {mouseState.Y}"); @@ -231,6 +236,17 @@ namespace ZoFo.GameCore.GameManagers lastKeyboardState = keyBoardState; #endregion + #region ActionEvent + if(InputMovementDirection != prevInputMovementDirection || + InputAttackDirection != prevInputAttackDirection || + currentScopeState != prevCurrentScopeState) + { + ActionEvent?.Invoke(); + } + prevInputMovementDirection = InputMovementDirection; + prevInputAttackDirection = InputAttackDirection; + prevCurrentScopeState = currentScopeState; + #endregion } } } diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ClientToServer/UpdateInput.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ClientToServer/UpdateInput.cs index bb2ea93..350fd41 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ClientToServer/UpdateInput.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ClientToServer/UpdateInput.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Xna.Framework; +using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; @@ -8,10 +10,13 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer { public class UpdateInput :UpdateData { - // public int IdEntity { get; set; } - public UpdateInput() - { - UpdateType = "UpdateInput"; - } + // public int IdEntity { get; set; } + public Vector2 InputMovementDirection{get;set;} + public Vector2 InputAttackDirection {get;set;} + public UpdateInput() + { + UpdateType = "UpdateInput"; + } + } } From a06f9c7ddb738f048bc707b5c7e786d1794dfa1d Mon Sep 17 00:00:00 2001 From: rawer470 Date: Sat, 17 Aug 2024 22:25:03 +0300 Subject: [PATCH 08/15] MaybeFinallyMultiplayer --- ZoFo/GameCore/GUI/SelectingServerGUI.cs | 5 ++++- ZoFo/GameCore/GameManagers/AppManager.cs | 4 ++-- .../GameManagers/NetworkManager/ServerNetworkManager.cs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ZoFo/GameCore/GUI/SelectingServerGUI.cs b/ZoFo/GameCore/GUI/SelectingServerGUI.cs index 717e2b3..9460341 100644 --- a/ZoFo/GameCore/GUI/SelectingServerGUI.cs +++ b/ZoFo/GameCore/GUI/SelectingServerGUI.cs @@ -102,8 +102,11 @@ public class SelectingServerGUI : AbstractGUI // host Server server = new Server(); //Server Logic MultiPlayer - server.CreateRoom(1); + 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"); // ваш код здесь diff --git a/ZoFo/GameCore/GameManagers/AppManager.cs b/ZoFo/GameCore/GameManagers/AppManager.cs index fba2e17..f328803 100644 --- a/ZoFo/GameCore/GameManagers/AppManager.cs +++ b/ZoFo/GameCore/GameManagers/AppManager.cs @@ -91,7 +91,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); @@ -104,7 +104,7 @@ namespace ZoFo.GameCore.GameManagers client.Update(gameTime); break; case GameState.ClientPlaying: - server.Update(gameTime); + client.Update(gameTime); break; default: break; diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs index 9ea5de2..f6452af 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs @@ -143,7 +143,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager for (int i = 0; i < playNumber; i++) { Socket client = socket.Accept(); - AppManager.Instance.debugHud.Set("Connect", client.ToString()); + AppManager.Instance.debugHud.Set("Connect", client.LocalEndPoint.ToString()); Thread thread = new Thread(StartListening); thread.IsBackground = true; thread.Start(client); From 85b55f6f41fcf4d353595d67a48292e4abc4904c Mon Sep 17 00:00:00 2001 From: Kaktus200020 Date: Sat, 17 Aug 2024 22:26:02 +0300 Subject: [PATCH 09/15] addCollectable --- .../Collectables/BottleOfWater.cs | 21 +++++++++++++++++++ .../Interactables/Collectables/Peeble.cs | 21 +++++++++++++++++++ .../Collectables/PureBottleOfWater.cs | 19 +++++++++++++++++ .../Interactables/Collectables/Steel.cs | 19 +++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/BottleOfWater.cs create mode 100644 ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Peeble.cs create mode 100644 ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/PureBottleOfWater.cs create mode 100644 ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Steel.cs 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..b38fda7 --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/BottleOfWater.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.Graphics; + +using Microsoft.Xna.Framework; + +namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +{ + public class BottleOfWater : Collectable + { + public override GraphicsComponent graphicsComponent { get; } = new(new List { "BottleOfWater" }, "BottleOfWater"); + public BottleOfWater(Vector2 position) : base(position) + { + + } + + } +} 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..c2126eb --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Peeble.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.Graphics; +using Microsoft.Xna.Framework; + + +namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +{ + public class Peeble:Collectable + { + public override GraphicsComponent graphicsComponent { get; } = new(new List { "Peeble" }, "Peeble"); + + public Peeble(Vector2 position) : base(position) + { + + } + } +} 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..299860a --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/PureBottleOfWater.cs @@ -0,0 +1,19 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.Graphics; + +namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +{ + class PureBottleOfWater:Collectable + { + public override GraphicsComponent graphicsComponent { get; } = new(new List { "PureBottleOfWater" }, "PureBottleOfWater"); + + public PureBottleOfWater(Vector2 position) : base(position) + { + } + } +} 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..899d8d0 --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Steel.cs @@ -0,0 +1,19 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.Graphics; + +namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables +{ + class Steel:Collectable + { + public override GraphicsComponent graphicsComponent { get; } = new(new List { "Steel" }, "Steel"); + + public Steel(Vector2 position) : base(position) + { + } + } +} From 8eab09980aa62d511c596db0f8ab93021dc953ec Mon Sep 17 00:00:00 2001 From: Kaktus200020 Date: Sun, 18 Aug 2024 00:31:53 +0300 Subject: [PATCH 10/15] updateLoot --- .../GameManagers/ItemManager/ItemManager.cs | 6 ++--- .../Updates/ServerToClient/UpdateLoot.cs | 8 +++++- .../Interactables/Collectables/Ammo.cs | 27 +++++++++++++++++++ .../Interactables/Collectables/Antiradine.cs | 27 +++++++++++++++++++ .../Collectables/BottleOfWater.cs | 9 ++++++- .../Interactables/Collectables/Peeble.cs | 8 ++++++ .../Collectables/PureBottleOfWater.cs | 8 ++++++ .../Interactables/Collectables/RottenFlesh.cs | 27 +++++++++++++++++++ .../Interactables/Collectables/Steel.cs | 8 ++++++ .../Interactables/Collectables/Wood.cs | 9 +++++++ 10 files changed, 132 insertions(+), 5 deletions(-) create mode 100644 ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Ammo.cs create mode 100644 ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Antiradine.cs create mode 100644 ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/RottenFlesh.cs diff --git a/ZoFo/GameCore/GameManagers/ItemManager/ItemManager.cs b/ZoFo/GameCore/GameManagers/ItemManager/ItemManager.cs index 6d00e0c..9f7c724 100644 --- a/ZoFo/GameCore/GameManagers/ItemManager/ItemManager.cs +++ b/ZoFo/GameCore/GameManagers/ItemManager/ItemManager.cs @@ -24,9 +24,9 @@ namespace ZoFo.GameCore.GameManagers.ItemManager } 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)); + tagItemPairs.Add("Wood", new ItemInfo("Wood","Wood",false,null)); + tagItemPairs.Add("Peeble", new ItemInfo("Peeble", "Peeble", false, null)); + tagItemPairs.Add("Steel", new ItemInfo("Steel", "Steel", false, null)); } } 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/GameObjects/Entities/Interactables/Collectables/Ammo.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Ammo.cs new file mode 100644 index 0000000..040e461 --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Ammo.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 Ammo:Collectable + { + public override GraphicsComponent graphicsComponent { get; } = new(new List { "Ammo" }, "Ammo"); + public Ammo(Vector2 position) : base(position) + { + + } + 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..e575538 --- /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 GraphicsComponent graphicsComponent { get; } = new(new List { "Antiradine" }, "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 index b38fda7..4b51206 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/BottleOfWater.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/BottleOfWater.cs @@ -6,6 +6,9 @@ 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 { @@ -16,6 +19,10 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables { } - + 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 index c2126eb..8623b76 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Peeble.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Peeble.cs @@ -5,6 +5,9 @@ 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 @@ -17,5 +20,10 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables { } + 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 index 299860a..2a55323 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/PureBottleOfWater.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/PureBottleOfWater.cs @@ -4,6 +4,9 @@ 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 @@ -15,5 +18,10 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables 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..5649f5a --- /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 GraphicsComponent graphicsComponent { get; } = new(new List { "RottenFlesh" }, "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 index 899d8d0..41d73ed 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Steel.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Steel.cs @@ -4,6 +4,9 @@ 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 @@ -15,5 +18,10 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables 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..e79ba5c 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Wood.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Wood.cs @@ -1,5 +1,8 @@ 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; @@ -10,5 +13,11 @@ public class Wood : Collectable 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 From 3ec0069f75162ba1c999e6119c46d9e66bf1b95a Mon Sep 17 00:00:00 2001 From: SergoDobro Date: Sun, 18 Aug 2024 00:38:41 +0300 Subject: [PATCH 11/15] Hot fixes --- .../GameManagers/CollisionManager/CollisionManager.cs | 2 +- .../GameObjects/Entities/LivingEntities/Player/Player.cs | 7 ++++++- ZoFo/GameCore/Server.cs | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs index 6bb9698..7c0b998 100644 --- a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs +++ b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs @@ -93,7 +93,7 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager } else { - entity.position.X += entity.velocity.Y; + entity.position.Y += entity.velocity.Y; newRect.Y = tryingRectY.Y;//значение по X для нового РЕК приравниваем к значению испытуемого РЕК } diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs index c5fccc3..d2fb023 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; using System; using System.Collections.Generic; using ZoFo.GameCore.GameManagers; @@ -39,11 +40,15 @@ public class Player : LivingEntity float t; public void MovementLogic() { - velocity.X = (float)Math.Sin(t); + //velocity.X = 3+(float)Math.Sin(t); t++; if (InputPlayerRotation.X > 0.9) { } + if (Keyboard.GetState().IsKeyDown(Keys.D)) velocity.X = 5; + if (Keyboard.GetState().IsKeyDown(Keys.A)) velocity.X = -5; + if (Keyboard.GetState().IsKeyDown(Keys.S)) velocity.Y = 5; + if (Keyboard.GetState().IsKeyDown(Keys.W)) velocity.Y = -5; } public void HandleNewInput(UpdateInput updateInput) { diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs index de52802..17502b9 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -99,6 +99,7 @@ namespace ZoFo.GameCore 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))); } /// From 3e9f6d6c7fea72650e2c8af91f7b84cf12a323fe Mon Sep 17 00:00:00 2001 From: polten0 Date: Sun, 18 Aug 2024 01:15:18 +0300 Subject: [PATCH 12/15] fixes --- ZoFo/Content/Content.mgcb | 136 +- ZoFo/Content/MapData/MapSession.tiled-session | 25 +- ZoFo/Content/MapData/TileMaps/main.tmj | 240 +--- .../MapData/TileSets/CollisionTileSet.tsj | 231 +++- ZoFo/Content/MapData/TileSets/TileSet 1.tsj | 1232 +++++++++++++++++ .../GameManagers/MapManager/MapManager.cs | 15 +- .../NetworkManager/ClientNetworkManager.cs | 2 +- .../NetworkManager/ServerNetworkManager.cs | 3 +- 8 files changed, 1648 insertions(+), 236 deletions(-) diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index c4dedca..3af7cd8 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -103,18 +103,6 @@ #begin Textures/Animations/testAnimationExample.animation /copy:Textures/Animations/testAnimationExample.animation -#begin Textures/AnimationTextures/Character/hr-level1_idle_gun.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/AnimationTextures/Character/hr-level1_idle_gun.png - #begin Textures/AnimationTextures/Character/hr-level1_idle.png /importer:TextureImporter /processor:TextureProcessor @@ -127,6 +115,18 @@ /processorParam:TextureFormat=Color /build:Textures/AnimationTextures/Character/hr-level1_idle.png +#begin Textures/AnimationTextures/Character/hr-level1_idle_gun.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/AnimationTextures/Character/hr-level1_idle_gun.png + #begin Textures/AnimationTextures/Character/hr-level1_mining_tool-1.png /importer:TextureImporter /processor:TextureProcessor @@ -151,18 +151,6 @@ /processorParam:TextureFormat=Color /build:Textures/AnimationTextures/Character/hr-level1_mining_tool-2.png -#begin Textures/AnimationTextures/Character/hr-level1_running_gun.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/AnimationTextures/Character/hr-level1_running_gun.png - #begin Textures/AnimationTextures/Character/hr-level1_running.png /importer:TextureImporter /processor:TextureProcessor @@ -175,6 +163,18 @@ /processorParam:TextureFormat=Color /build:Textures/AnimationTextures/Character/hr-level1_running.png +#begin Textures/AnimationTextures/Character/hr-level1_running_gun.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/AnimationTextures/Character/hr-level1_running_gun.png + #begin Textures/AnimationTextures/unicorn.png /importer:TextureImporter /processor:TextureProcessor @@ -271,18 +271,6 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/background/waiting.png -#begin Textures/GUI/checkboxs_off-on.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/GUI/checkboxs_off-on.png - #begin Textures/GUI/checkboxs_off.png /importer:TextureImporter /processor:TextureProcessor @@ -295,6 +283,18 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/checkboxs_off.png +#begin Textures/GUI/checkboxs_off-on.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/GUI/checkboxs_off-on.png + #begin Textures/GUI/checkboxs_on.png /importer:TextureImporter /processor:TextureProcessor @@ -331,6 +331,18 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/mouse.png +#begin Textures/GUI/switch.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/GUI/switch.png + #begin Textures/GUI/Switch_backgrownd.png /importer:TextureImporter /processor:TextureProcessor @@ -343,7 +355,7 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/Switch_backgrownd.png -#begin Textures/GUI/switch.png +#begin Textures/TileSetImages/Tilelist1.png /importer:TextureImporter /processor:TextureProcessor /processorParam:ColorKeyColor=255,0,255,255 @@ -353,7 +365,55 @@ /processorParam:ResizeToPowerOfTwo=False /processorParam:MakeSquare=False /processorParam:TextureFormat=Color -/build:Textures/GUI/switch.png +/build:Textures/TileSetImages/Tilelist1.png + +#begin Textures/TileSetImages/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/TileSetImages/Tilelist2.png + +#begin Textures/TileSetImages/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/TileSetImages/Tilelist3.png + +#begin Textures/TileSetImages/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/TileSetImages/Tilelist4.png + +#begin Textures/TileSetImages/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/TileSetImages/TilesetFloor.png #begin Textures/TileSetImages/TilesetFloor.png /importer:TextureImporter 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/GameCore/GameManagers/MapManager/MapManager.cs b/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs index 34530f5..d38ccbf 100644 --- a/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs +++ b/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs @@ -43,6 +43,7 @@ namespace ZoFo.GameCore.GameManagers.MapManager tileSet.FirstGid = tileSetInfo.FirstGid; tileSets.Add(tileSet); } + tileSets.Reverse(); foreach (var layer in tileMap.Layers) { @@ -52,7 +53,7 @@ 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; @@ -67,10 +68,7 @@ namespace ZoFo.GameCore.GameManagers.MapManager (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) { @@ -89,11 +87,11 @@ namespace ZoFo.GameCore.GameManagers.MapManager "Textures/TileSetImages/" + Path.GetFileName(tileSet.Image).Replace(".png", ""), collisionRectangles.ToArray())); - // TODO: изменить конструктор, засунув коллизии. break; default: break; } + break; } } } @@ -126,6 +124,11 @@ namespace ZoFo.GameCore.GameManagers.MapManager /// private List LoadRectangles(Tile tile) { + if (tile.Objectgroup == null) + { + return new List(); + } + List collisionRectangles = new List(); foreach (var obj in tile.Objectgroup.Objects) { diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs b/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs index 2a93f71..67c09bc 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs @@ -87,7 +87,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager /// public void JoinYourself(int port) // single player { - endPoint = new IPEndPoint(GetIp(), port); + endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), port); socket.Connect(endPoint); SendData(); Thread listen = new Thread(StartListening); diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs index 76e72c2..e51577e 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(IPAddress.Parse("127.0.0.1"), port); socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); managerThread = new Dictionary(); clients = new List(); From e2ac9286e512b474b92dae345440f135608e25f9 Mon Sep 17 00:00:00 2001 From: SergoDobro Date: Sun, 18 Aug 2024 02:41:09 +0300 Subject: [PATCH 13/15] Collisions ara Working!!!! Next Is Trigger! it is 2:40... help me.... --- ZoFo/Content/Content.mgcb | 208 +++++++++++++----- ZoFo/GameCore/Client.cs | 24 +- .../CollisionManager/CollisionComponent.cs | 2 +- .../CollisionManager/CollisionManager.cs | 27 ++- .../GameManagers/MapManager/MapManager.cs | 2 +- .../ServerToClient/UpdateTileCreated.cs | 13 ++ .../Interactables/Collectables/Ammo.cs | 5 +- .../Entities/Interactables/Door.cs | 2 +- .../GameObjects/MapObjects/MapObject.cs | 2 + .../MapObjects/StopObjects/StopObject.cs | 17 +- ZoFo/GameCore/Server.cs | 32 ++- 11 files changed, 262 insertions(+), 72 deletions(-) diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index 3af7cd8..2fa4e0e 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -103,18 +103,6 @@ #begin Textures/Animations/testAnimationExample.animation /copy:Textures/Animations/testAnimationExample.animation -#begin Textures/AnimationTextures/Character/hr-level1_idle.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/AnimationTextures/Character/hr-level1_idle.png - #begin Textures/AnimationTextures/Character/hr-level1_idle_gun.png /importer:TextureImporter /processor:TextureProcessor @@ -127,6 +115,18 @@ /processorParam:TextureFormat=Color /build:Textures/AnimationTextures/Character/hr-level1_idle_gun.png +#begin Textures/AnimationTextures/Character/hr-level1_idle.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/AnimationTextures/Character/hr-level1_idle.png + #begin Textures/AnimationTextures/Character/hr-level1_mining_tool-1.png /importer:TextureImporter /processor:TextureProcessor @@ -151,18 +151,6 @@ /processorParam:TextureFormat=Color /build:Textures/AnimationTextures/Character/hr-level1_mining_tool-2.png -#begin Textures/AnimationTextures/Character/hr-level1_running.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/AnimationTextures/Character/hr-level1_running.png - #begin Textures/AnimationTextures/Character/hr-level1_running_gun.png /importer:TextureImporter /processor:TextureProcessor @@ -175,6 +163,18 @@ /processorParam:TextureFormat=Color /build:Textures/AnimationTextures/Character/hr-level1_running_gun.png +#begin Textures/AnimationTextures/Character/hr-level1_running.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/AnimationTextures/Character/hr-level1_running.png + #begin Textures/AnimationTextures/unicorn.png /importer:TextureImporter /processor:TextureProcessor @@ -271,18 +271,6 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/background/waiting.png -#begin Textures/GUI/checkboxs_off.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/GUI/checkboxs_off.png - #begin Textures/GUI/checkboxs_off-on.png /importer:TextureImporter /processor:TextureProcessor @@ -295,6 +283,18 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/checkboxs_off-on.png +#begin Textures/GUI/checkboxs_off.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/GUI/checkboxs_off.png + #begin Textures/GUI/checkboxs_on.png /importer:TextureImporter /processor:TextureProcessor @@ -331,6 +331,18 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/mouse.png +#begin Textures/GUI/Switch_backgrownd.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/GUI/Switch_backgrownd.png + #begin Textures/GUI/switch.png /importer:TextureImporter /processor:TextureProcessor @@ -343,7 +355,7 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/switch.png -#begin Textures/GUI/Switch_backgrownd.png +#begin Textures/icons/12.png /importer:TextureImporter /processor:TextureProcessor /processorParam:ColorKeyColor=255,0,255,255 @@ -353,7 +365,115 @@ /processorParam:ResizeToPowerOfTwo=False /processorParam:MakeSquare=False /processorParam:TextureFormat=Color -/build:Textures/GUI/Switch_backgrownd.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/TileSetImages/Tilelist1.png /importer:TextureImporter @@ -415,15 +535,3 @@ /processorParam:TextureFormat=Color /build:Textures/TileSetImages/TilesetFloor.png -#begin Textures/TileSetImages/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/TileSetImages/TilesetFloor.png - diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs index 00c2a91..5b7f1bd 100644 --- a/ZoFo/GameCore/Client.cs +++ b/ZoFo/GameCore/Client.cs @@ -19,6 +19,8 @@ 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; namespace ZoFo.GameCore { public class Client @@ -63,6 +65,7 @@ namespace ZoFo.GameCore List mapObjects = new List(); List gameObjects = new List(); + List stopObjects = new List(); /// /// Клиент должен обнговлять игру анимаций /// @@ -80,6 +83,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); @@ -88,7 +95,7 @@ namespace ZoFo.GameCore internal void GotData(UpdateData update) { - if (update is UpdateTileCreated) + if (update is UpdateTileCreated) { mapObjects.Add( new MapObject( @@ -98,13 +105,26 @@ 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) { 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)); - + if ((update as UpdateGameObjectCreated).GameObjectType == "Ammo") + gameObjects.Add(new Ammo((update as UpdateGameObjectCreated).position)); + (gameObjects.Last() as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity); //var a = Assembly.GetAssembly(typeof(GameObject)); //gameObjects.Add( TODO reflection 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/MapManager/MapManager.cs b/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs index d38ccbf..07b0e86 100644 --- a/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs +++ b/ZoFo/GameCore/GameManagers/MapManager/MapManager.cs @@ -81,7 +81,7 @@ namespace ZoFo.GameCore.GameManagers.MapManager break; case "StopObject": var collisionRectangles = LoadRectangles(tile); // Грузит коллизии обьектов - AppManager.Instance.server.RegisterGameObject(new StopObject(position, + AppManager.Instance.server.RegisterGameObject(new StopObject(position/4,//TODO new Vector2(tileSet.TileWidth, tileSet.TileHeight), sourceRectangle, "Textures/TileSetImages/" + 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/GameObjects/Entities/Interactables/Collectables/Ammo.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Ammo.cs index 040e461..fe3fb67 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Ammo.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Ammo.cs @@ -13,10 +13,11 @@ namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables { class Ammo:Collectable { - public override GraphicsComponent graphicsComponent { get; } = new(new List { "Ammo" }, "Ammo"); + public override GraphicsComponent 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) { diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs index 640c9c1..06e7e8b 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs @@ -13,7 +13,7 @@ public class Door : Interactable public Door(Vector2 position) : base(position) { - graphicsComponent.OnAnimationEnd += _ => { isOpened = !isOpened; }; + graphicsComponent.OnAnimationEnd += _ => { isOpened = !isOpened; };//, - SD } public override void OnInteraction(object sender, CollisionComponent e) diff --git a/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs b/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs index 15ac53c..1c2b5b3 100644 --- a/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs +++ b/ZoFo/GameCore/GameObjects/MapObjects/MapObject.cs @@ -36,6 +36,8 @@ namespace ZoFo.GameCore.GameObjects.MapObjects public override void Draw(SpriteBatch spriteBatch) { graphicsComponent.DrawAnimation(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/Server.cs b/ZoFo/GameCore/Server.cs index 17502b9..575778e 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -15,9 +15,11 @@ 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; namespace ZoFo.GameCore { @@ -95,11 +97,11 @@ namespace ZoFo.GameCore collisionManager = new CollisionManager(); gameObjects = new List(); entities = new List(); - //new MapManager().LoadMap(); + 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 Player(new Vector2(740, 140))); + AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(140, 440))); } /// @@ -139,6 +141,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.mainTextureName + });//TODO + foreach (var item in (gameObject as StopObject).collisionComponents) + { + collisionManager.Register(item); + + } + return; + } if (gameObject is MapObject) { AddData(new UpdateTileCreated() @@ -152,11 +171,14 @@ namespace ZoFo.GameCore } if (gameObject is Entity) { - AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, IdEntity = (gameObject as Entity).Id }); + AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, IdEntity = (gameObject as Entity).Id, + position = gameObject.position}); collisionManager.Register((gameObject as Entity).collisionComponent); } else - AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name }); + AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, + position = gameObject.position + }); ////var elems = gameObject.GetType().GetProperties(System.Reflection.BindingFlags.Public); From 7c9e13a490545bd758992bbc45fc0f068f0e0622 Mon Sep 17 00:00:00 2001 From: Monti Date: Sun, 18 Aug 2024 10:26:14 +0300 Subject: [PATCH 14/15] animationBronya --- .../Textures/Animations/player_idle_rotate_weapon.animation | 1 - ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 ZoFo/Content/Textures/Animations/player_idle_rotate_weapon.animation 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/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs b/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs index adafb5e..379e68b 100644 --- a/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs +++ b/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs @@ -12,7 +12,7 @@ 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 GraphicsComponent(new List { "player_idle_top-right_noweapon" }, "player_idle_top-right_noweapon"); public EntittyForAnimationTests(Vector2 position) : base(position) { graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0,16*12, 16 * 16); From 0afee1fb815ba052433c1d4d322b021f96edf84d Mon Sep 17 00:00:00 2001 From: rawer470 Date: Sun, 18 Aug 2024 10:43:02 +0300 Subject: [PATCH 15/15] WorkConnectMultiPlayer --- .../GameManagers/NetworkManager/ClientNetworkManager.cs | 2 +- .../GameManagers/NetworkManager/ServerNetworkManager.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs b/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs index 2a93f71..9c6137b 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/ClientNetworkManager.cs @@ -108,7 +108,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 f6452af..dcdaf1c 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs @@ -71,7 +71,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