Fix UI + Amélioration AutoDetect & Self Analyse + Update Penumbra API

This commit is contained in:
2025-10-12 12:42:31 +02:00
parent d4a46910f9
commit d225a3844a
14 changed files with 763 additions and 95 deletions

View File

@@ -9,12 +9,14 @@ using MareSynchronos.UI;
using MareSynchronos.WebAPI;
using System.Globalization;
using System.Text;
using System.Numerics;
namespace MareSynchronos.Services;
public sealed class CommandManagerService : IDisposable
{
private const string _commandName = "/usync";
private const string _autoDetectCommand = "/autodetect";
private const string _ssCommandPrefix = "/ums";
private readonly ApiController _apiController;
@@ -43,6 +45,11 @@ public sealed class CommandManagerService : IDisposable
HelpMessage = "Opens the UmbraSync UI"
});
_commandManager.AddHandler(_autoDetectCommand, new CommandInfo(OnAutoDetectCommand)
{
HelpMessage = "Opens the AutoDetect window"
});
// Lazy registration of all possible /ss# commands which tbf is what the game does for linkshells anyway
for (int i = 1; i <= ChatService.CommandMaxNumber; ++i)
{
@@ -56,12 +63,21 @@ public sealed class CommandManagerService : IDisposable
public void Dispose()
{
_commandManager.RemoveHandler(_commandName);
_commandManager.RemoveHandler(_autoDetectCommand);
for (int i = 1; i <= ChatService.CommandMaxNumber; ++i)
_commandManager.RemoveHandler($"{_ssCommandPrefix}{i}");
}
private void OnAutoDetectCommand(string command, string args)
{
UiSharedService.AccentColor = new Vector4(0x8D / 255f, 0x37 / 255f, 0xC0 / 255f, 1f);
UiSharedService.AccentHoverColor = new Vector4(0x3A / 255f, 0x15 / 255f, 0x50 / 255f, 1f);
UiSharedService.AccentActiveColor = UiSharedService.AccentHoverColor;
_mediator.Publish(new UiToggleMessage(typeof(AutoDetectUi)));
}
private void OnCommand(string command, string args)
{
var splitArgs = args.ToLowerInvariant().Trim().Split(" ", StringSplitOptions.RemoveEmptyEntries);
@@ -145,4 +161,4 @@ public sealed class CommandManagerService : IDisposable
_chatService.SendChatShell(shellNumber, chatBytes);
}
}
}
}