StartCreateLogicMultiPlayer2

This commit is contained in:
rawer470 2024-08-17 11:10:17 +03:00
parent dbabd56119
commit c1d2a6b210
5 changed files with 13 additions and 8 deletions

View file

@ -39,7 +39,7 @@ namespace ZoFo.GameCore
}
public void GameEndedUnexpectedly() { }
public void JoinRoom(string ip)
public void JoinRoom(string ip, int port)
{
networkManager.JoinRoom(ip);
}

View file

@ -59,7 +59,7 @@ namespace ZoFo.GameCore.GameManagers
SettingsManager.LoadSettings();
SoundManager = new SoundManager();
SoundManager.LoadSounds();
currentGUI = new MainMenuGUI();
debugHud = new DebugHUD();
@ -70,7 +70,7 @@ namespace ZoFo.GameCore.GameManagers
protected override void Initialize()
{
currentGUI.Initialize();
debugHud.Initialize();
debugHud.Initialize();
base.Initialize();
@ -83,15 +83,15 @@ namespace ZoFo.GameCore.GameManagers
currentGUI.LoadContent();
animationBuilder = new AnimationBuilder();
animationBuilder.LoadAnimations();
}
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
Keyboard.GetState().IsKeyDown(Keys.Escape)) { server.CloseConnection(); Exit(); }
debugHud.Set("key", "value");

View file

@ -60,7 +60,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
/// </summary>
/// <param name="ip"></param>
/// <param name="port"></param>
public void JoinRoom(string ip) // multyplayer
public void JoinRoom(string ip, int port) // multyplayer
{
endPoint = new IPEndPoint(IPAddress.Parse(ip), port);

View file

@ -152,7 +152,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
string response = Encoding.UTF8.GetString(buff, 0, answ);
GetDataSend(response);
}
Thread.Sleep(-1);
Task.Delay(-1);
}
}

View file

@ -46,6 +46,11 @@ namespace ZoFo.GameCore
//ТУТ Switch case будет честное слово
}
public void CloseConnection()
{
networkManager.CloseConnection();
}
/// <summary>
/// Для красоты) Отдел Серверов
/// добавляет в лист updates новую data