RDPUpdate2
This commit is contained in:
commit
b1cc401b08
3 changed files with 12 additions and 2 deletions
|
@ -99,6 +99,10 @@ namespace ZoFo.GameCore
|
||||||
gameObjects[i].UpdateAnimations();
|
gameObjects[i].UpdateAnimations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void SendData()
|
||||||
|
{
|
||||||
|
networkManager.SendData();
|
||||||
|
}
|
||||||
internal void Draw(SpriteBatch spriteBatch)
|
internal void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < mapObjects.Count; i++)
|
for (int i = 0; i < mapObjects.Count; i++)
|
||||||
|
|
|
@ -72,6 +72,7 @@ public class WaitingForPlayersGUI : AbstractGUI
|
||||||
waitButton.LeftButtonPressed += () =>
|
waitButton.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
// start
|
// start
|
||||||
|
AppManager.Instance.client.SendData();
|
||||||
AppManager.Instance.ChangeState(GameState.ClientPlaying);
|
AppManager.Instance.ChangeState(GameState.ClientPlaying);
|
||||||
// ваш код здесь
|
// ваш код здесь
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,6 +38,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
endPoint = new IPEndPoint(GetIp(), 8081);
|
endPoint = new IPEndPoint(GetIp(), 8081);
|
||||||
socket.Bind(endPoint);
|
socket.Bind(endPoint);
|
||||||
Thread thread = new Thread(StartListening);
|
Thread thread = new Thread(StartListening);
|
||||||
|
thread.IsBackground = true;
|
||||||
thread.Start();
|
thread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,14 +145,18 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
{
|
{
|
||||||
string hostName = Dns.GetHostName(); // Retrive the Name of HOST
|
string hostName = Dns.GetHostName(); // Retrive the Name of HOST
|
||||||
var ipList = Dns.GetHostEntry(hostName).AddressList;
|
var ipList = Dns.GetHostEntry(hostName).AddressList;
|
||||||
|
var ipV4List = new List<IPAddress>();
|
||||||
foreach (var ip in ipList)
|
foreach (var ip in ipList)
|
||||||
{
|
{
|
||||||
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||||
{
|
{
|
||||||
return ip;
|
ipV4List.Add(ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ipV4List.Count>0)
|
||||||
|
{
|
||||||
|
return ipV4List[ipV4List.Count - 1];
|
||||||
|
}
|
||||||
return IPAddress.Loopback;
|
return IPAddress.Loopback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue