StartCreateLogicMultiPlayer2
This commit is contained in:
parent
dbabd56119
commit
c1d2a6b210
5 changed files with 13 additions and 8 deletions
|
@ -39,7 +39,7 @@ namespace ZoFo.GameCore
|
||||||
|
|
||||||
}
|
}
|
||||||
public void GameEndedUnexpectedly() { }
|
public void GameEndedUnexpectedly() { }
|
||||||
public void JoinRoom(string ip)
|
public void JoinRoom(string ip, int port)
|
||||||
{
|
{
|
||||||
networkManager.JoinRoom(ip);
|
networkManager.JoinRoom(ip);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,8 +90,8 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
protected override void Update(GameTime gameTime)
|
protected override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
|
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
|
||||||
Keyboard.GetState().IsKeyDown(Keys.Escape))
|
Keyboard.GetState().IsKeyDown(Keys.Escape)) { server.CloseConnection(); Exit(); }
|
||||||
Exit();
|
|
||||||
|
|
||||||
debugHud.Set("key", "value");
|
debugHud.Set("key", "value");
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ip"></param>
|
/// <param name="ip"></param>
|
||||||
/// <param name="port"></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);
|
endPoint = new IPEndPoint(IPAddress.Parse(ip), port);
|
||||||
|
|
|
@ -152,7 +152,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
string response = Encoding.UTF8.GetString(buff, 0, answ);
|
string response = Encoding.UTF8.GetString(buff, 0, answ);
|
||||||
GetDataSend(response);
|
GetDataSend(response);
|
||||||
}
|
}
|
||||||
Thread.Sleep(-1);
|
Task.Delay(-1);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,11 @@ namespace ZoFo.GameCore
|
||||||
//ТУТ Switch case будет честное слово
|
//ТУТ Switch case будет честное слово
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CloseConnection()
|
||||||
|
{
|
||||||
|
networkManager.CloseConnection();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Для красоты) Отдел Серверов
|
/// Для красоты) Отдел Серверов
|
||||||
/// добавляет в лист updates новую data
|
/// добавляет в лист updates новую data
|
||||||
|
|
Loading…
Add table
Reference in a new issue