Merge branch 'networkFixes' of https://github.com/progtime-net/DangerousD into networkFixes
This commit is contained in:
commit
dcb7eaa960
2 changed files with 4 additions and 2 deletions
|
@ -23,7 +23,7 @@ namespace DangerousD.GameCore
|
||||||
public class AppManager : Game
|
public class AppManager : Game
|
||||||
{
|
{
|
||||||
public static AppManager Instance { get; private set; }
|
public static AppManager Instance { get; private set; }
|
||||||
public string IpAddress { get; private set; } = "127.0.0.1";
|
public string IpAddress { get; private set; } = "0.0.0.0";
|
||||||
private GraphicsDeviceManager _graphics;
|
private GraphicsDeviceManager _graphics;
|
||||||
private SpriteBatch _spriteBatch;
|
private SpriteBatch _spriteBatch;
|
||||||
public GameState gameState { get; private set; }
|
public GameState gameState { get; private set; }
|
||||||
|
@ -220,6 +220,7 @@ namespace DangerousD.GameCore
|
||||||
|
|
||||||
public void NetworkSync(List<NetworkTask> networkTasks)
|
public void NetworkSync(List<NetworkTask> networkTasks)
|
||||||
{
|
{
|
||||||
|
DebugHUD.Log("networksync");
|
||||||
foreach (NetworkTask networkTask in networkTasks)
|
foreach (NetworkTask networkTask in networkTasks)
|
||||||
{
|
{
|
||||||
switch (networkTask.operation)
|
switch (networkTask.operation)
|
||||||
|
|
|
@ -134,8 +134,9 @@ namespace DangerousD.GameCore
|
||||||
{
|
{
|
||||||
if (AppManager.Instance.NetworkTasks.Count > 0)
|
if (AppManager.Instance.NetworkTasks.Count > 0)
|
||||||
{
|
{
|
||||||
if (gameTime.ElapsedGameTime.Milliseconds - _lastUpdate > 1000)
|
if (gameTime.TotalGameTime.Milliseconds - _lastUpdate > 1000)
|
||||||
{
|
{
|
||||||
|
AppManager.Instance.DebugHUD.Log("sending");
|
||||||
AppManager.Instance.NetworkManager.SendMsg(AppManager.Instance.NetworkTasks.ToList());
|
AppManager.Instance.NetworkManager.SendMsg(AppManager.Instance.NetworkTasks.ToList());
|
||||||
AppManager.Instance.NetworkTasks.Clear();
|
AppManager.Instance.NetworkTasks.Clear();
|
||||||
_lastUpdate = gameTime.ElapsedGameTime.Milliseconds;
|
_lastUpdate = gameTime.ElapsedGameTime.Milliseconds;
|
||||||
|
|
Loading…
Add table
Reference in a new issue