Server sleep time is slightly smarter + loading debug messages

This commit is contained in:
juanjp600
2017-06-22 00:24:30 -03:00
parent 6b65e94d41
commit c1780fa7b7
4 changed files with 12 additions and 3 deletions
@@ -44,6 +44,7 @@ namespace Barotrauma
set set
{ {
loadState = value; loadState = value;
DebugConsole.NewMessage("Loading: " + value.ToString() + "%",Color.Yellow);
DrawLoadingText = true; DrawLoadingText = true;
} }
} }
+2
View File
@@ -192,6 +192,7 @@ namespace Barotrauma
private IEnumerable<object> Load() private IEnumerable<object> Load()
{ {
DebugConsole.NewMessage("LOADING COROUTINE", Color.Lime);
GUI.GraphicsDevice = base.GraphicsDevice; GUI.GraphicsDevice = base.GraphicsDevice;
GUI.Init(Content); GUI.Init(Content);
@@ -269,6 +270,7 @@ namespace Barotrauma
TitleScreen.LoadState = 100.0f; TitleScreen.LoadState = 100.0f;
hasLoaded = true; hasLoaded = true;
DebugConsole.NewMessage("LOADING COROUTINE FINISHED", Color.Lime);
yield return CoroutineStatus.Success; yield return CoroutineStatus.Success;
} }
+8 -2
View File
@@ -100,14 +100,20 @@ namespace Barotrauma
NetLobbyScreen = new NetLobbyScreen(); NetLobbyScreen = new NetLobbyScreen();
Server = new GameServer("Dedicated Server Test", 14242, false, "asd", false, 10); Server = new GameServer("Dedicated Server Test", 14242, false, "asd", false, 10);
DateTime prevTime = DateTime.Now;
while (true) while (true)
{ {
prevTime = DateTime.Now;
DebugConsole.Update(); DebugConsole.Update();
if (Screen.Selected != null) Screen.Selected.Update((float)Timing.Step); if (Screen.Selected != null) Screen.Selected.Update((float)Timing.Step);
Server.Update((float)Timing.Step); Server.Update((float)Timing.Step);
CoroutineManager.Update((float)Timing.Step, (float)Timing.Step); CoroutineManager.Update((float)Timing.Step, (float)Timing.Step);
Thread.Sleep((int)(Timing.Step * 1000.0)); int frameTime = DateTime.Now.Subtract(prevTime).Milliseconds;
Thread.Sleep(Math.Max((int)(Timing.Step * 1000.0) - frameTime,0));
} }
} }
+1 -1
View File
@@ -29,7 +29,7 @@ namespace Barotrauma
static partial class DebugConsole static partial class DebugConsole
{ {
const int MaxMessages = 20000; const int MaxMessages = 200;
public static List<ColoredText> Messages = new List<ColoredText>(); public static List<ColoredText> Messages = new List<ColoredText>();