New GUI overhaul!, version 3.0.1.0
This commit is contained in:
parent
c05d6c9d1b
commit
79304baaad
16 changed files with 1579 additions and 4589 deletions
|
|
@ -28,6 +28,45 @@ namespace MosswartMassacre
|
|||
internal static DateTime statsStartTime = DateTime.Now;
|
||||
internal static Timer updateTimer;
|
||||
public static bool RareMetaEnabled { get; set; } = true;
|
||||
|
||||
// VVS View Management
|
||||
private static class ViewManager
|
||||
{
|
||||
public static void ViewInit()
|
||||
{
|
||||
Views.VVSTabbedMainView.ViewInit();
|
||||
}
|
||||
|
||||
public static void ViewDestroy()
|
||||
{
|
||||
Views.VVSTabbedMainView.ViewDestroy();
|
||||
}
|
||||
|
||||
public static void UpdateKillStats(int totalKills, double killsPer5Min, double killsPerHour)
|
||||
{
|
||||
Views.VVSTabbedMainView.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
|
||||
}
|
||||
|
||||
public static void UpdateElapsedTime(TimeSpan elapsed)
|
||||
{
|
||||
Views.VVSTabbedMainView.UpdateElapsedTime(elapsed);
|
||||
}
|
||||
|
||||
public static void UpdateRareCount(int rareCount)
|
||||
{
|
||||
Views.VVSTabbedMainView.UpdateRareCount(rareCount);
|
||||
}
|
||||
|
||||
public static void SetRareMetaToggleState(bool enabled)
|
||||
{
|
||||
Views.VVSTabbedMainView.SetRareMetaToggleState(enabled);
|
||||
}
|
||||
|
||||
public static void RefreshSettingsFromConfig()
|
||||
{
|
||||
Views.VVSTabbedMainView.RefreshSettingsFromConfig();
|
||||
}
|
||||
}
|
||||
public static bool RemoteCommandsEnabled { get; set; } = false;
|
||||
public static bool HttpServerEnabled { get; set; } = false;
|
||||
public static string CharTag { get; set; } = "";
|
||||
|
|
@ -63,7 +102,7 @@ namespace MosswartMassacre
|
|||
updateTimer.Start();
|
||||
|
||||
// Initialize the view (UI) - use tabbed interface by default
|
||||
TabbedMainView.ViewInit();
|
||||
ViewManager.ViewInit();
|
||||
|
||||
// Enable TLS1.2
|
||||
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
|
||||
|
|
@ -113,7 +152,7 @@ namespace MosswartMassacre
|
|||
}
|
||||
|
||||
// Clean up the view
|
||||
TabbedMainView.ViewDestroy();
|
||||
ViewManager.ViewDestroy();
|
||||
//Disable vtank interface
|
||||
vTank.Disable();
|
||||
// sluta lyssna på commands
|
||||
|
|
@ -149,8 +188,8 @@ namespace MosswartMassacre
|
|||
HttpServerEnabled = PluginSettings.Instance.HttpServerEnabled;
|
||||
TelemetryEnabled = PluginSettings.Instance.TelemetryEnabled;
|
||||
CharTag = PluginSettings.Instance.CharTag;
|
||||
TabbedMainView.SetRareMetaToggleState(RareMetaEnabled);
|
||||
TabbedMainView.RefreshSettingsFromConfig(); // Refresh all UI settings after loading
|
||||
ViewManager.SetRareMetaToggleState(RareMetaEnabled);
|
||||
ViewManager.RefreshSettingsFromConfig(); // Refresh all UI settings after loading
|
||||
if (TelemetryEnabled)
|
||||
Telemetry.Start();
|
||||
if (WebSocketEnabled)
|
||||
|
|
@ -238,13 +277,13 @@ namespace MosswartMassacre
|
|||
totalKills++;
|
||||
lastKillTime = DateTime.Now;
|
||||
CalculateKillsPerInterval();
|
||||
TabbedMainView.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
|
||||
ViewManager.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
|
||||
}
|
||||
|
||||
if (IsRareDiscoveryMessage(e.Text, out string rareText))
|
||||
{
|
||||
rareCount++;
|
||||
TabbedMainView.UpdateRareCount(rareCount);
|
||||
ViewManager.UpdateRareCount(rareCount);
|
||||
|
||||
if (RareMetaEnabled)
|
||||
{
|
||||
|
|
@ -324,11 +363,11 @@ namespace MosswartMassacre
|
|||
{
|
||||
// Update the elapsed time
|
||||
TimeSpan elapsed = DateTime.Now - statsStartTime;
|
||||
TabbedMainView.UpdateElapsedTime(elapsed);
|
||||
ViewManager.UpdateElapsedTime(elapsed);
|
||||
|
||||
// Recalculate kill rates
|
||||
CalculateKillsPerInterval();
|
||||
TabbedMainView.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
|
||||
ViewManager.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -426,14 +465,14 @@ namespace MosswartMassacre
|
|||
killsPerHour = 0;
|
||||
|
||||
WriteToChat("Stats have been reset.");
|
||||
TabbedMainView.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
|
||||
TabbedMainView.UpdateRareCount(rareCount);
|
||||
ViewManager.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
|
||||
ViewManager.UpdateRareCount(rareCount);
|
||||
}
|
||||
public static void ToggleRareMeta()
|
||||
{
|
||||
PluginSettings.Instance.RareMetaEnabled = !PluginSettings.Instance.RareMetaEnabled;
|
||||
RareMetaEnabled = PluginSettings.Instance.RareMetaEnabled;
|
||||
TabbedMainView.SetRareMetaToggleState(RareMetaEnabled);
|
||||
ViewManager.SetRareMetaToggleState(RareMetaEnabled);
|
||||
}
|
||||
|
||||
[DllImport("Decal.dll")]
|
||||
|
|
@ -563,7 +602,7 @@ namespace MosswartMassacre
|
|||
case "meta":
|
||||
RareMetaEnabled = !RareMetaEnabled;
|
||||
WriteToChat($"Rare meta state is now {(RareMetaEnabled ? "ON" : "OFF")}");
|
||||
TabbedMainView.SetRareMetaToggleState(RareMetaEnabled); // <-- sync the UI
|
||||
ViewManager.SetRareMetaToggleState(RareMetaEnabled); // <-- sync the UI
|
||||
break;
|
||||
|
||||
case "http":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue