From f6204134a9885dee81185762e0e76ca92d9810c8 Mon Sep 17 00:00:00 2001 From: lvjia Date: Tue, 28 Apr 2026 13:09:34 +0800 Subject: [PATCH] /debug Multiple languages Co-authored-by: Copilot --- .../Message/LanguageCHS.cs | 16 ++++++++++++++ .../Message/LanguageCHT.cs | 16 ++++++++++++++ .../Message/LanguageEN.cs | 16 ++++++++++++++ GameServer/Command/Commands/CommandDebug.cs | 21 +++++++++++++------ 4 files changed, 63 insertions(+), 6 deletions(-) diff --git a/Common/Internationalization/Message/LanguageCHS.cs b/Common/Internationalization/Message/LanguageCHS.cs index adf2c19..5b030e0 100644 --- a/Common/Internationalization/Message/LanguageCHS.cs +++ b/Common/Internationalization/Message/LanguageCHS.cs @@ -121,6 +121,7 @@ public class CommandTextCHS public HelpTextCHS Help { get; } = new(); public GirlTextCHS Girl { get; } = new(); public GiveAllTextCHS GiveAll { get; } = new(); + public DebugTextCHS Debug { get; } = new(); } #endregion @@ -237,6 +238,21 @@ public class GiveAllTextCHS public string WeaponAdded => "已添加 {0} 把武器给玩家!"; } +/// +/// path: Game.Command.Debug +/// +public class DebugTextCHS +{ + public string Desc => "调试包输出开关"; + public string Usage => "用法: /debug [on|off|simple|detail|file]"; + public string Enabled => "已启用调试包输出。"; + public string Disabled => "已禁用调试包输出。"; + public string SimpleEnabled => "已启用简单调试包输出。"; + public string DetailEnabled => "已启用详细调试包输出。"; + public string FileEnabled => "个人调试文件输出已启用。"; + public string FileDisabled => "个人调试文件输出已禁用。"; +} + #endregion #endregion \ No newline at end of file diff --git a/Common/Internationalization/Message/LanguageCHT.cs b/Common/Internationalization/Message/LanguageCHT.cs index 2851943..04b4ca5 100644 --- a/Common/Internationalization/Message/LanguageCHT.cs +++ b/Common/Internationalization/Message/LanguageCHT.cs @@ -121,6 +121,7 @@ public class CommandTextCHT public HelpTextCHT Help { get; } = new(); public GirlTextCHT Girl { get; } = new(); public GiveAllTextCHT GiveAll { get; } = new(); + public DebugTextCHT Debug { get; } = new(); } #endregion @@ -237,6 +238,21 @@ public class GiveAllTextCHT public string WeaponAdded => "已添加 {0} 把武器給玩家!"; } +/// +/// path: Game.Command.Debug +/// +public class DebugTextCHT +{ + public string Desc => "切換調試封包輸出"; + public string Usage => "用法: /debug [on|off|simple|detail|file]"; + public string Enabled => "已啟用調試封包輸出。"; + public string Disabled => "已停用調試封包輸出。"; + public string SimpleEnabled => "已啟用簡易調試封包輸出。"; + public string DetailEnabled => "已啟用詳細調試封包輸出。"; + public string FileEnabled => "個人調試檔案輸出已啟用。"; + public string FileDisabled => "個人調試檔案輸出已停用。"; +} + #endregion #endregion \ No newline at end of file diff --git a/Common/Internationalization/Message/LanguageEN.cs b/Common/Internationalization/Message/LanguageEN.cs index 8dcffd9..8ec2a67 100644 --- a/Common/Internationalization/Message/LanguageEN.cs +++ b/Common/Internationalization/Message/LanguageEN.cs @@ -83,6 +83,7 @@ public class CommandTextEN public HelpTextEN Help { get; } = new(); public GirlTextEN Girl { get; } = new(); public GiveAllTextEN GiveAll { get; } = new(); + public DebugTextEN Debug { get; } = new(); } #endregion @@ -206,6 +207,21 @@ public class GiveAllTextEN public string WeaponAdded => "Added {0} weapon(s) to player!"; } +/// +/// path: Game.Command.Debug +/// +public class DebugTextEN +{ + public string Desc => "Toggle debug packet output"; + public string Usage => "Usage: /debug [on|off|simple|detail|file]"; + public string Enabled => "Debug packet output enabled."; + public string Disabled => "Debug packet output disabled."; + public string SimpleEnabled => "Simple debug packet output enabled."; + public string DetailEnabled => "Detailed debug packet output enabled."; + public string FileEnabled => "Personal debug file output enabled."; + public string FileDisabled => "Personal debug file output disabled."; +} + #endregion #endregion \ No newline at end of file diff --git a/GameServer/Command/Commands/CommandDebug.cs b/GameServer/Command/Commands/CommandDebug.cs index fb8feb5..a71da7a 100644 --- a/GameServer/Command/Commands/CommandDebug.cs +++ b/GameServer/Command/Commands/CommandDebug.cs @@ -1,6 +1,7 @@ using MikuSB.Configuration; using MikuSB.Enums.Player; using MikuSB.Util; +using MikuSB.Internationalization; namespace MikuSB.GameServer.Command.Commands; @@ -19,7 +20,7 @@ public class CommandDebug : ICommands "on" => EnableDebug(serverOption), "off" => DisableDebug(serverOption), "simple" => EnableSimpleDebug(serverOption), - "detail" => EnableDebug(serverOption), + "detail" => EnableDetailDebug(serverOption), "file" => ToggleDebugFile(serverOption), _ => "Usage: /debug [on|off|simple|detail|file]" }; @@ -33,13 +34,13 @@ public class CommandDebug : ICommands serverOption.EnableDebug = true; serverOption.DebugMessage = true; serverOption.DebugDetailMessage = true; - return "Debug packet output enabled."; + return I18NManager.Translate("Game.Command.Debug.Enabled"); } private static string DisableDebug(ServerOption serverOption) { serverOption.EnableDebug = false; - return "Debug packet output disabled."; + return I18NManager.Translate("Game.Command.Debug.Disabled"); } private static string EnableSimpleDebug(ServerOption serverOption) @@ -47,14 +48,22 @@ public class CommandDebug : ICommands serverOption.EnableDebug = true; serverOption.DebugMessage = true; serverOption.DebugDetailMessage = false; - return "Simple debug packet output enabled."; + return I18NManager.Translate("Game.Command.Debug.SimpleEnabled"); + } + + private static string EnableDetailDebug(ServerOption serverOption) + { + serverOption.EnableDebug = true; + serverOption.DebugMessage = true; + serverOption.DebugDetailMessage = true; + return I18NManager.Translate("Game.Command.Debug.DetailEnabled"); } private static string ToggleDebugFile(ServerOption serverOption) { serverOption.SavePersonalDebugFile = !serverOption.SavePersonalDebugFile; return serverOption.SavePersonalDebugFile - ? "Personal debug file output enabled." - : "Personal debug file output disabled."; + ? I18NManager.Translate("Game.Command.Debug.FileEnabled") + : I18NManager.Translate("Game.Command.Debug.FileDisabled"); } }