New visual routes and new GUI

This commit is contained in:
erik 2025-05-29 17:52:30 +02:00
parent 037e5cd940
commit 1f85d9c6f0
4 changed files with 76 additions and 15 deletions

View file

@ -12,6 +12,7 @@ using System.Threading.Tasks;
using System.Timers;
using Decal.Adapter;
using Decal.Adapter.Wrappers;
using MosswartMassacre.Views;
namespace MosswartMassacre
{
@ -34,6 +35,7 @@ namespace MosswartMassacre
public bool WebSocketEnabled { get; set; } = false;
public bool InventoryLogEnabled { get; set; } = false;
private MossyInventory _inventoryLogger;
public static NavVisualization navVisualization;
private static Queue<string> rareMessageQueue = new Queue<string>();
private static DateTime _lastSent = DateTime.MinValue;
@ -60,8 +62,8 @@ namespace MosswartMassacre
updateTimer.Elapsed += UpdateStats;
updateTimer.Start();
// Initialize the view (UI)
MainView.ViewInit();
// Initialize the view (UI) - use tabbed interface by default
TabbedMainView.ViewInit();
// Enable TLS1.2
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
@ -73,6 +75,9 @@ namespace MosswartMassacre
_inventoryLogger = new MossyInventory();
// Initialize navigation visualization system
navVisualization = new NavVisualization();
}
@ -108,7 +113,7 @@ namespace MosswartMassacre
}
// Clean up the view
MainView.ViewDestroy();
TabbedMainView.ViewDestroy();
//Disable vtank interface
vTank.Disable();
// sluta lyssna på commands
@ -117,6 +122,13 @@ namespace MosswartMassacre
//shutdown inv
_inventoryLogger.Dispose();
// Clean up navigation visualization
if (navVisualization != null)
{
navVisualization.Dispose();
navVisualization = null;
}
MyHost = null;
}
catch (Exception ex)
@ -137,7 +149,8 @@ namespace MosswartMassacre
HttpServerEnabled = PluginSettings.Instance.HttpServerEnabled;
TelemetryEnabled = PluginSettings.Instance.TelemetryEnabled;
CharTag = PluginSettings.Instance.CharTag;
MainView.SetRareMetaToggleState(RareMetaEnabled);
TabbedMainView.SetRareMetaToggleState(RareMetaEnabled);
TabbedMainView.RefreshSettingsFromConfig(); // Refresh all UI settings after loading
if (TelemetryEnabled)
Telemetry.Start();
if (WebSocketEnabled)
@ -225,13 +238,13 @@ namespace MosswartMassacre
totalKills++;
lastKillTime = DateTime.Now;
CalculateKillsPerInterval();
MainView.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
TabbedMainView.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
}
if (IsRareDiscoveryMessage(e.Text, out string rareText))
{
rareCount++;
MainView.UpdateRareCount(rareCount);
TabbedMainView.UpdateRareCount(rareCount);
if (RareMetaEnabled)
{
@ -311,11 +324,11 @@ namespace MosswartMassacre
{
// Update the elapsed time
TimeSpan elapsed = DateTime.Now - statsStartTime;
MainView.UpdateElapsedTime(elapsed);
TabbedMainView.UpdateElapsedTime(elapsed);
// Recalculate kill rates
CalculateKillsPerInterval();
MainView.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
TabbedMainView.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
}
catch (Exception ex)
{
@ -413,14 +426,14 @@ namespace MosswartMassacre
killsPerHour = 0;
WriteToChat("Stats have been reset.");
MainView.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
MainView.UpdateRareCount(rareCount);
TabbedMainView.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
TabbedMainView.UpdateRareCount(rareCount);
}
public static void ToggleRareMeta()
{
PluginSettings.Instance.RareMetaEnabled = !PluginSettings.Instance.RareMetaEnabled;
RareMetaEnabled = PluginSettings.Instance.RareMetaEnabled;
MainView.SetRareMetaToggleState(RareMetaEnabled);
TabbedMainView.SetRareMetaToggleState(RareMetaEnabled);
}
[DllImport("Decal.dll")]
@ -550,7 +563,7 @@ namespace MosswartMassacre
case "meta":
RareMetaEnabled = !RareMetaEnabled;
WriteToChat($"Rare meta state is now {(RareMetaEnabled ? "ON" : "OFF")}");
MainView.SetRareMetaToggleState(RareMetaEnabled); // <-- sync the UI
TabbedMainView.SetRareMetaToggleState(RareMetaEnabled); // <-- sync the UI
break;
case "http":