Improvments at GUI

This commit is contained in:
VladMordock
2021-02-18 19:07:48 +01:00
parent 8a97ff84f8
commit a10cbcf565
4 changed files with 18 additions and 5 deletions

View File

@@ -48,8 +48,8 @@ class CurrentMissionClass
public string Pause = ""; // Mission pause public string Pause = ""; // Mission pause
public int PlayerCount = 0; // Actual player time public int PlayerCount = 0; // Actual player time
public string ModelTime = ""; // Mission time public float ModelTime = 0; // Mission time
public string RealTime = ""; // Server time public float RealTime = 0; // Server time
} }
internal class Globals internal class Globals

View File

@@ -5,6 +5,14 @@ using System.Text.RegularExpressions;
internal class PerunHelper internal class PerunHelper
{ {
public static string SecondsToString(float Seconds)
{
int Hours = (int) Seconds / 3600;
int Minutes = ((int)Seconds % 3600)/60 ;
string ToReturn = $"{Hours.ToString("00")}h {Minutes.ToString("00")}m";
return ToReturn;
}
public static void SetFrameRates(float frame_rate, float last_delay) public static void SetFrameRates(float frame_rate, float last_delay)
{ {
Globals.LastFrameTime = frame_rate; Globals.LastFrameTime = frame_rate;

View File

@@ -187,7 +187,12 @@ public class TCPController
Globals.ErrorsGame++; Globals.ErrorsGame++;
Console.WriteLine(e.ToString()); Console.WriteLine(e.ToString());
PerunHelper.LogError(ref Globals.arrGUILogHistory, $"ERROR TCP - connection closed or port in use, error: {e.Message}",1,1,"?"); PerunHelper.LogError(ref Globals.arrGUILogHistory, $"ERROR TCP - connection closed or port in use, error: {e.Message}",1,1,"?");
bTCPConnectionOnline = false;
// Reset last frame times on broken connection
Globals.LastFrameTime = 0f;
Globals.LastFrameDelay = 0f;
bTCPConnectionOnline = false;
} }
// Clean up and prepare for next connection // Clean up and prepare for next connection

View File

@@ -526,8 +526,8 @@ namespace Perun_v1
label18.Text = Globals.CurrentMission.Theatre; label18.Text = Globals.CurrentMission.Theatre;
label19.Text = Globals.CurrentMission.PlayerCount.ToString(); label19.Text = Globals.CurrentMission.PlayerCount.ToString();
label21.Text = Globals.CurrentMission.ModelTime; label21.Text = PerunHelper.SecondsToString(Globals.CurrentMission.ModelTime);
label16.Text = Globals.CurrentMission.RealTime; label16.Text = PerunHelper.SecondsToString(Globals.CurrentMission.RealTime);
if (Globals.CurrentMission.Pause == "True") if (Globals.CurrentMission.Pause == "True")
{ {