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); } ///