From dc555215ce64a9fa0ca4e601724b45a6d76c735e Mon Sep 17 00:00:00 2001 From: status102 Date: Thu, 30 Nov 2023 19:43:24 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E6=9C=80=E5=BF=AB=E6=88=AA=E5=9B=BE=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E5=90=8E=E8=BE=93=E5=87=BA=E6=88=AA=E5=9B=BE=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=92=8C=E8=80=97=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaCore/Controller/AdbController.cpp | 10 ++++++++++ src/MaaWpfGui/Main/AsstProxy.cs | 4 ++++ src/MaaWpfGui/Res/Localizations/en-us.xaml | 1 + src/MaaWpfGui/Res/Localizations/ja-jp.xaml | 1 + src/MaaWpfGui/Res/Localizations/ko-kr.xaml | 1 + src/MaaWpfGui/Res/Localizations/zh-cn.xaml | 1 + src/MaaWpfGui/Res/Localizations/zh-tw.xaml | 1 + 7 files changed, 19 insertions(+) diff --git a/src/MaaCore/Controller/AdbController.cpp b/src/MaaCore/Controller/AdbController.cpp index 0110cfd3f2..26113b100f 100644 --- a/src/MaaCore/Controller/AdbController.cpp +++ b/src/MaaCore/Controller/AdbController.cpp @@ -427,6 +427,16 @@ bool asst::AdbController::screencap(cv::Mat& image_payload, bool allow_reconnect { AdbProperty::ScreencapMethod::Encode, "Encode" }, }; Log.info("The fastest way is", MethodName.at(m_adb.screencap_method), ", cost:", min_cost.count(), "ms"); + json::value info = json::object { + { "uuid", m_uuid }, + { "what", "FastestWayToScreencap" }, + { "details", + json::object { + { "method", MethodName.at(m_adb.screencap_method) }, + { "cost", min_cost.count() }, + } }, + }; + callback(AsstMsg::ConnectionInfo, info); clear_lf_info(); return m_adb.screencap_method != AdbProperty::ScreencapMethod::UnknownYet; } break; diff --git a/src/MaaWpfGui/Main/AsstProxy.cs b/src/MaaWpfGui/Main/AsstProxy.cs index 8594902dd0..de2b51aac5 100644 --- a/src/MaaWpfGui/Main/AsstProxy.cs +++ b/src/MaaWpfGui/Main/AsstProxy.cs @@ -455,6 +455,10 @@ namespace MaaWpfGui.Main case "TouchModeNotAvailable": Instances.TaskQueueViewModel.AddLog(LocalizationHelper.GetString("TouchModeNotAvailable"), UiLogColor.Error); break; + + case "FastestWayToScreencap": + Instances.TaskQueueViewModel.AddLog(string.Format(LocalizationHelper.GetString("FastestWayToScreencap"), details["details"]?["method"]?.ToString(), details["details"]?["cost"]?.ToString())); + break; } } diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index a56491013d..10652109bb 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -556,6 +556,7 @@ The video aspect ratio needs to be 16:9 without interference factors such as bla Reconnection failed. The connection is down! Touch mode is not available, please go to 「Settings - Connection Settings」 to switch to a different touch mode. Screencap failed. If it happens repeatedly, try to restart or change the emulator! + Fastest screenshot method: {0}, time taken: {1:#,#}ms 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 5a1414bbbf..7346fad6d1 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -556,6 +556,7 @@ Bilibili: ログイン インターフェイスに表示されるアカウント 再接続に失敗、切断されました! タッチモードは利用できません。設定-接続設定に入って、他のタッチモードに変更してください。 スクリーンキャプチャに失敗しました。繰り返し発生する場合は、エミュレータの再起動または変更をお試しください! + 最速のスクリーンショット方法: {0}, 所要時間: {1:#,#}ms 認識エラー タスクエラー: 戦闘エラー diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index 00f78579ee..87ca1abcb2 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -556,6 +556,7 @@ Bilibili: 로그인 인터페이스에 표시되는 계정 이름(예: 장산) 다시 연결하지 못했습니다. 연결 해제되었습니다! 터치 수행 방식이 사용 불가능합니다. 설정 - 연결 설정에서 다른 방식으로 변경해 주세요. 스크린샷 캡처에 실패했습니다. 반복적으로 발생 시 에뮬레이터를 다시 시작하거나 변경해 보세요! + 가장 빠른 스크린샷 방법: {0}, 소요 시간: {1:#,#}ms 인식 오류 작업 오류: 작전 오류 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 5bea7adfb8..0515a4e413 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -556,6 +556,7 @@ 重连失败,连接断开! 触控模式不可用。请进入 设置 - 连接设置 切换其他触控模式。 截图失败,如反复出现请尝试重启或更换模拟器! + 最快截图方式: {0}, 耗时: {1:#,#}ms 识别错误 任务出错: 战斗出错 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index 317081d1b1..28366bbb08 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -556,6 +556,7 @@ 重連失敗,連接斷開! 觸控模式不可用。請進入 設定 - 連接設定 切換其他觸控模式。 截圖失敗,如反覆出現請嘗試重開或更換模擬器! + 最快截圖方式: {0}, 耗時: {1:#,#}ms 辨識錯誤 任務出錯: 戰鬥出錯 From 1e2fc2293fccc5e6b65975041c6f5987876b2865 Mon Sep 17 00:00:00 2001 From: status102 Date: Thu, 30 Nov 2023 19:47:15 +0800 Subject: [PATCH 2/5] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Res/Localizations/zh-cn.xaml | 2 +- src/MaaWpfGui/Res/Localizations/zh-tw.xaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 0515a4e413..76dcae9609 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -556,7 +556,7 @@ 重连失败,连接断开! 触控模式不可用。请进入 设置 - 连接设置 切换其他触控模式。 截图失败,如反复出现请尝试重启或更换模拟器! - 最快截图方式: {0}, 耗时: {1:#,#}ms + 最快截图: {0}, 耗时: {1:#,#}ms 识别错误 任务出错: 战斗出错 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index 28366bbb08..2d7eeb6ec3 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -556,7 +556,7 @@ 重連失敗,連接斷開! 觸控模式不可用。請進入 設定 - 連接設定 切換其他觸控模式。 截圖失敗,如反覆出現請嘗試重開或更換模擬器! - 最快截圖方式: {0}, 耗時: {1:#,#}ms + 最快截圖: {0}, 耗時: {1:#,#}ms 辨識錯誤 任務出錯: 戰鬥出錯 From 7720967981a3796ac7b79c5651c563515f62285b Mon Sep 17 00:00:00 2001 From: status102 Date: Fri, 1 Dec 2023 12:13:13 +0800 Subject: [PATCH 3/5] =?UTF-8?q?perf:=20=E4=B8=BA=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E8=80=97=E6=97=B6=E7=9A=84=E8=BE=93=E5=87=BA=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E9=A2=9C=E8=89=B2=EF=BC=8C=E9=98=88=E5=80=BC?= =?UTF-8?q?400/800?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Main/AsstProxy.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/MaaWpfGui/Main/AsstProxy.cs b/src/MaaWpfGui/Main/AsstProxy.cs index de2b51aac5..430fb11cbd 100644 --- a/src/MaaWpfGui/Main/AsstProxy.cs +++ b/src/MaaWpfGui/Main/AsstProxy.cs @@ -457,7 +457,20 @@ namespace MaaWpfGui.Main break; case "FastestWayToScreencap": - Instances.TaskQueueViewModel.AddLog(string.Format(LocalizationHelper.GetString("FastestWayToScreencap"), details["details"]?["method"]?.ToString(), details["details"]?["cost"]?.ToString())); + string color = UiLogColor.Trace; + if (!int.TryParse(details["details"]?["cost"]?.ToString() ?? "-1", out var timeCost)) + { + } + else if (timeCost > 800) + { + color = UiLogColor.Error; + } + else if (timeCost > 400) + { + color = UiLogColor.Warning; + } + + Instances.TaskQueueViewModel.AddLog(string.Format(LocalizationHelper.GetString("FastestWayToScreencap"), details["details"]?["method"]?.ToString(), details["details"]?["cost"]?.ToString()), color); break; } } From 0ed45636fb537fca21730995dd226c6eef1faf6c Mon Sep 17 00:00:00 2001 From: status102 Date: Fri, 1 Dec 2023 13:46:56 +0800 Subject: [PATCH 4/5] =?UTF-8?q?perf:=20=E8=B0=83=E6=95=B4=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Res/Localizations/en-us.xaml | 2 +- src/MaaWpfGui/Res/Localizations/ja-jp.xaml | 2 +- src/MaaWpfGui/Res/Localizations/ko-kr.xaml | 2 +- src/MaaWpfGui/Res/Localizations/zh-cn.xaml | 2 +- src/MaaWpfGui/Res/Localizations/zh-tw.xaml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index 10652109bb..7e547612d0 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -556,7 +556,7 @@ The video aspect ratio needs to be 16:9 without interference factors such as bla Reconnection failed. The connection is down! Touch mode is not available, please go to 「Settings - Connection Settings」 to switch to a different touch mode. Screencap failed. If it happens repeatedly, try to restart or change the emulator! - Fastest screenshot method: {0}, time taken: {1:#,#}ms + Fastest screenshot method: {0} ({1:#,#}ms) 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 7346fad6d1..1e2fb07da5 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -556,7 +556,7 @@ Bilibili: ログイン インターフェイスに表示されるアカウント 再接続に失敗、切断されました! タッチモードは利用できません。設定-接続設定に入って、他のタッチモードに変更してください。 スクリーンキャプチャに失敗しました。繰り返し発生する場合は、エミュレータの再起動または変更をお試しください! - 最速のスクリーンショット方法: {0}, 所要時間: {1:#,#}ms + 最速のスクリーンショット方法: {0} ({1:#,#}ms) 認識エラー タスクエラー: 戦闘エラー diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index 87ca1abcb2..98baef3cab 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -556,7 +556,7 @@ Bilibili: 로그인 인터페이스에 표시되는 계정 이름(예: 장산) 다시 연결하지 못했습니다. 연결 해제되었습니다! 터치 수행 방식이 사용 불가능합니다. 설정 - 연결 설정에서 다른 방식으로 변경해 주세요. 스크린샷 캡처에 실패했습니다. 반복적으로 발생 시 에뮬레이터를 다시 시작하거나 변경해 보세요! - 가장 빠른 스크린샷 방법: {0}, 소요 시간: {1:#,#}ms + 가장 빠른 스크린샷 방법: {0} ({1:#,#}ms) 인식 오류 작업 오류: 작전 오류 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 76dcae9609..bcee3c11da 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -556,7 +556,7 @@ 重连失败,连接断开! 触控模式不可用。请进入 设置 - 连接设置 切换其他触控模式。 截图失败,如反复出现请尝试重启或更换模拟器! - 最快截图: {0}, 耗时: {1:#,#}ms + 最快截图: {0} ({1:#,#}ms) 识别错误 任务出错: 战斗出错 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index 2d7eeb6ec3..71f4ae6395 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -556,7 +556,7 @@ 重連失敗,連接斷開! 觸控模式不可用。請進入 設定 - 連接設定 切換其他觸控模式。 截圖失敗,如反覆出現請嘗試重開或更換模擬器! - 最快截圖: {0}, 耗時: {1:#,#}ms + 最快截圖: {0} ({1:#,#}ms) 辨識錯誤 任務出錯: 戰鬥出錯 From d112d257ac32e7dbee3b18805af623186800ef70 Mon Sep 17 00:00:00 2001 From: status102 Date: Fri, 1 Dec 2023 14:28:30 +0800 Subject: [PATCH 5/5] =?UTF-8?q?perf:=20=E9=9D=9E=E9=A2=84=E6=9C=9F?= =?UTF-8?q?=E5=80=BC=E8=BE=93=E5=87=BA=3F=3F=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: uye <99072975+ABA2396@users.noreply.github.com> --- src/MaaWpfGui/Main/AsstProxy.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/MaaWpfGui/Main/AsstProxy.cs b/src/MaaWpfGui/Main/AsstProxy.cs index 430fb11cbd..90bc7a15fd 100644 --- a/src/MaaWpfGui/Main/AsstProxy.cs +++ b/src/MaaWpfGui/Main/AsstProxy.cs @@ -457,9 +457,14 @@ namespace MaaWpfGui.Main break; case "FastestWayToScreencap": + var detailsObj = details["details"]; + string costString = detailsObj?["cost"]?.ToString() ?? "???"; + string method = detailsObj?["method"]?.ToString() ?? "???"; + string color = UiLogColor.Trace; - if (!int.TryParse(details["details"]?["cost"]?.ToString() ?? "-1", out var timeCost)) + if (!int.TryParse(costString, out var timeCost)) { + color = UiLogColor.Error; } else if (timeCost > 800) { @@ -470,7 +475,8 @@ namespace MaaWpfGui.Main color = UiLogColor.Warning; } - Instances.TaskQueueViewModel.AddLog(string.Format(LocalizationHelper.GetString("FastestWayToScreencap"), details["details"]?["method"]?.ToString(), details["details"]?["cost"]?.ToString()), color); + string logMessage = string.Format(LocalizationHelper.GetString("FastestWayToScreencap"), method, costString); + Instances.TaskQueueViewModel.AddLog(logMessage, color); break; } }