From aef7a82007272ab949afb4bdcfc8b2e58af90ffa Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Wed, 6 Mar 2024 00:00:50 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=B7=BB=E5=8A=A0=E6=88=AA=E5=9B=BE?= =?UTF-8?q?=E8=BF=87=E9=95=BF=E8=A7=A3=E5=86=B3=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Main/AsstProxy.cs | 63 +++++++++++++--------- src/MaaWpfGui/Res/Localizations/en-us.xaml | 1 + src/MaaWpfGui/Res/Localizations/ja-jp.xaml | 3 +- src/MaaWpfGui/Res/Localizations/ko-kr.xaml | 1 + src/MaaWpfGui/Res/Localizations/zh-cn.xaml | 5 +- src/MaaWpfGui/Res/Localizations/zh-tw.xaml | 5 +- 6 files changed, 49 insertions(+), 29 deletions(-) diff --git a/src/MaaWpfGui/Main/AsstProxy.cs b/src/MaaWpfGui/Main/AsstProxy.cs index 0ff07dae45..3e714b9cd9 100644 --- a/src/MaaWpfGui/Main/AsstProxy.cs +++ b/src/MaaWpfGui/Main/AsstProxy.cs @@ -460,19 +460,23 @@ namespace MaaWpfGui.Main StringBuilder fastestScreencapStringBuilder = new(); string color = UiLogColor.Trace; - if (!int.TryParse(costString, out var timeCost)) + if (int.TryParse(costString, out var timeCost)) + { + switch (timeCost) + { + case > 800: + color = UiLogColor.Error; + costString = timeCost.ToString("#,#"); + break; + case > 400: + color = UiLogColor.Warning; + break; + } + } + else { color = UiLogColor.Error; } - else if (timeCost > 800) - { - color = UiLogColor.Error; - costString = timeCost.ToString("#,#"); - } - else if (timeCost > 400) - { - color = UiLogColor.Warning; - } fastestScreencapStringBuilder.Insert(0, string.Format(LocalizationHelper.GetString("FastestWayToScreencap"), costString)); Instances.TaskQueueViewModel.AddLog(fastestScreencapStringBuilder.ToString(), color); @@ -481,21 +485,32 @@ namespace MaaWpfGui.Main break; case "ScreencapCost": - Instances.SettingsViewModel.ScreencapCost = string.Format(LocalizationHelper.GetString("ScreencapCost"), details["details"]?["min"]?.ToString() ?? "???", details["details"]?["avg"]?.ToString() ?? "???", details["details"]?["max"]?.ToString() ?? "???", DateTimeOffset.Now.ToString("HH:mm:ss")); - if (HasPrintedScreencapWarning || !int.TryParse(details["details"]?["avg"]?.ToString() ?? "???", out var screencapCostAvg)) + var screencapCostMin = details["details"]?["min"]?.ToString() ?? "???"; + var screencapCostAvg = details["details"]?["avg"]?.ToString() ?? "???"; + var screencapCostMax = details["details"]?["max"]?.ToString() ?? "???"; + var currentTime = DateTimeOffset.Now.ToString("HH:mm:ss"); + Instances.SettingsViewModel.ScreencapCost = string.Format(LocalizationHelper.GetString("ScreencapCost"), screencapCostMin, screencapCostAvg, screencapCostMax, currentTime); + if (!HasPrintedScreencapWarning && int.TryParse(screencapCostAvg, out var screencapCostAvgInt)) { - } - else if (screencapCostAvg >= 800) - { - Instances.TaskQueueViewModel.AddLog(string.Format(LocalizationHelper.GetString("FastestWayToScreencapErrorTip"), screencapCostAvg), UiLogColor.Error); - Instances.CopilotViewModel.AddLog(string.Format(LocalizationHelper.GetString("FastestWayToScreencapErrorTip"), screencapCostAvg), UiLogColor.Error); - HasPrintedScreencapWarning = true; - } - else if (screencapCostAvg >= 400) - { - Instances.TaskQueueViewModel.AddLog(string.Format(LocalizationHelper.GetString("FastestWayToScreencapWarningTip"), screencapCostAvg), UiLogColor.Warning); - Instances.CopilotViewModel.AddLog(string.Format(LocalizationHelper.GetString("FastestWayToScreencapWarningTip"), screencapCostAvg), UiLogColor.Warning); - HasPrintedScreencapWarning = true; + static void AddLog(string message, string color) + { + Instances.TaskQueueViewModel.AddLog(message, color); + Instances.CopilotViewModel.AddLog(message, color); + } + + switch (screencapCostAvgInt) + { + case >= 800: + AddLog(string.Format(LocalizationHelper.GetString("FastestWayToScreencapErrorTip"), screencapCostAvgInt), UiLogColor.Error); + AddLog(string.Format(LocalizationHelper.GetString("OptimizationTips"), screencapCostAvgInt), UiLogColor.Error); + HasPrintedScreencapWarning = true; + break; + case >= 400: + AddLog(string.Format(LocalizationHelper.GetString("FastestWayToScreencapWarningTip"), screencapCostAvgInt), UiLogColor.Warning); + AddLog(string.Format(LocalizationHelper.GetString("OptimizationTips"), screencapCostAvgInt), UiLogColor.Warning); + HasPrintedScreencapWarning = true; + break; + } } break; diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index 51b7cc1dff..60eb36c205 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -587,6 +587,7 @@ The video aspect ratio needs to be 16:9 without interference factors such as bla Screenshot test tasks: {0}ms Screencap takes a long time (avg: {0}ms) which may cause some abnormal behaviors using automatic combat functions (e.g. Auto I. S.). Screencap takes too long (avg: {0}ms), so automatic combat functions (e.g. Auto I. S.) may not run properly. It is recommended to try restarting or changing the simulator! + This time consumption is unrelated to MAA, but related to computer performance, current usage, or emulator. You can try cleaning up background processes, changing emulators, or upgrading computer configurations. Recognition error Task error: Combat error diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml index f0c3f85867..5c0d728077 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -586,7 +586,8 @@ Bilibili: ログイン インターフェイスに表示されるアカウント スクリーンキャプチャに失敗しました。繰り返し発生する場合は、エミュレータの再起動または変更をお試しください! スクリーンショット テストには: {0}ms スクリーンキャップには時間がかかるため(平均: {0}ms)、自動戦闘機能 (Auto I.S. など) を使用すると異常な動作が発生する可能性があります。 - スクリーンキャップに時間がかかりすぎるため(平均: {0}ms)、自動戦闘機能 (Auto I.S. など) が適切に動作しない可能性があります。 シミュレーターを再起動または変更してみることをお勧めします。 + スクリーンキャップに時間がかかりすぎるため(平均: {0}ms)、自動戦闘機能 (Auto I.S. など) が適切に動作しない可能性があります。 + この時間の消費はMAAとは関係ありませんが、コンピューターのパフォーマンス、現在の使用状況、またはエミュレーターに関連しています。バックグラウンドプロセスをクリーンアップしたり、エミュレーターを変更したり、コンピューターの構成をアップグレードすることができます。 認識エラー タスクエラー: 戦闘エラー diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index 6bae6cb8c4..e2a2508b0b 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -587,6 +587,7 @@ Bilibili: 로그인 인터페이스에 표시되는 계정 이름(예: 장산) 스크린샷 캡쳐 속도: {0}ms 스크린샷 캡쳐 속도가 느리므로 (평균: {0}ms) 자동 전투 기능(예: Copilot)을 사용하면 비정상적인 동작이 발생할 수 있습니다. 스크린샷 캡쳐 속도가 느리므로 (평균: {0}ms) 자동 전투 기능(예: Copilot)이 제대로 실행되지 않을 수 있습니다. 시뮬레이터를 다시 시작하거나 변경해 보는 것이 좋습니다! + 이 시간 소모는 MAA와 무관하지만 컴퓨터 성능, 현재 사용량 또는 에뮬레이터와 관련이 있습니다. 백그라운드 프로세스를 정리하거나, 에뮬레이터를 변경하거나, 컴퓨터 구성을 업그레이드해 볼 수 있습니다. 인식 오류 작업 오류: 작전 오류 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 0bc3671c50..fe98bfd474 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -585,8 +585,9 @@ 触控模式不可用。请进入 设置 - 连接设置 切换其他触控模式。 截图失败,如反复出现请尝试重启或更换模拟器! 最快截图耗时: {0}ms - 截图用时较长(平均: {0}ms),使用自动战斗类功能(如自动肉鸽)时,可能出现部分异常表现 - 截图用时过长(平均: {0}ms),自动战斗类功能(如自动肉鸽)很可能无法正常运行,建议尝试重启或更换模拟器 + 截图用时较长(平均: {0}ms),使用自动战斗类功能(如自动肉鸽)时,可能出现部分异常表现。 + 截图用时过长(平均: {0}ms),自动战斗类功能(如自动肉鸽)很可能无法正常运行,建议尝试重启或更换模拟器。 + 此项耗时与MAA无关,与电脑性能、当前占用或模拟器相关,可尝试清理后台/更换模拟器/升级电脑配置 识别错误 任务出错: 战斗出错 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index 0b2f231afa..1f7ab080b8 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -583,8 +583,9 @@ 觸控模式不可用。請進入 設定 - 連接設定 切換其他觸控模式。 截圖失敗,如反覆出現請嘗試重開或更換模擬器! 最快截圖用時: {0}ms - 截圖用時較長(平均: {0}ms),使用自動戰鬥類功能(如自動肉鴿)時,可能會出現部分異常表現 - 截圖用時過長(平均: {0}ms),自動戰鬥類功能(如自動肉鴿)很可能無法正常運行,建議嘗試重新啟動或更換模擬器 + 截圖用時較長(平均: {0}ms),使用自動戰鬥類功能(如自動肉鴿)時,可能會出現部分異常表現。 + 截圖用時過長(平均: {0}ms),自動戰鬥類功能(如自動肉鴿)很可能無法正常運行,建議嘗試重新啟動或更換模擬器。 + 此項耗時與MAA無關,與電腦性能、當前佔用或模擬器相關,可嘗試清理後臺/更換模擬器/升級電腦配置。 辨識錯誤 任務出錯: 戰鬥出錯