From fddbe5e3aeb09c73407dd56bcf1c3aa23e36c270 Mon Sep 17 00:00:00 2001 From: uye <2396806385@qq.com> Date: Thu, 9 Feb 2023 20:52:02 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E8=BF=91=E4=BA=94=E6=AC=A1=E8=BF=9E=E6=8E=A5=E7=9A=84?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #3614 --- src/MaaWpfGui/Main/SettingsViewModel.cs | 35 +++++++++++++++++++ .../ConnectSettingsUserControl.xaml | 6 ++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/MaaWpfGui/Main/SettingsViewModel.cs b/src/MaaWpfGui/Main/SettingsViewModel.cs index 1f66c85e5a..3e6e01e114 100644 --- a/src/MaaWpfGui/Main/SettingsViewModel.cs +++ b/src/MaaWpfGui/Main/SettingsViewModel.cs @@ -28,6 +28,7 @@ using System.Windows.Interop; using IWshRuntimeLibrary; using MaaWpfGui.Helper; using MaaWpfGui.MaaHotKeys; +using Newtonsoft.Json; using Stylet; namespace MaaWpfGui @@ -119,6 +120,12 @@ namespace MaaWpfGui { Application.Current.MainWindow.Closing += SaveGUIParameters; } + + var addressesJson = ViewStatusStorage.Get("Connect.Addresses", string.Empty); + if (!string.IsNullOrEmpty(addressesJson)) + { + ConnectAddresses = JsonConvert.DeserializeObject>(addressesJson); + } } private List _listTitle = new List(); @@ -1747,6 +1754,14 @@ namespace MaaWpfGui } } + private ObservableCollection _connectAddresses = new ObservableCollection(); + + public ObservableCollection ConnectAddresses + { + get => _connectAddresses; + set => SetAndNotify(ref _connectAddresses, value); + } + private string _connectAddress = ViewStatusStorage.Get("Connect.Address", string.Empty); /// @@ -1757,7 +1772,27 @@ namespace MaaWpfGui get => _connectAddress; set { + if (ConnectAddress == value || string.IsNullOrEmpty(value)) + { + return; + } + + if (!ConnectAddresses.Contains(value)) + { + ConnectAddresses.Insert(0, value); + while (ConnectAddresses.Count > 5) + { + ConnectAddresses.RemoveAt(ConnectAddresses.Count - 1); + } + } + else + { + ConnectAddresses.Remove(value); + ConnectAddresses.Insert(0, value); + } + SetAndNotify(ref _connectAddress, value); + ViewStatusStorage.Set("Connect.Addresses", JsonConvert.SerializeObject(ConnectAddresses)); ViewStatusStorage.Set("Connect.Address", value); UpdateWindowTitle(); /* 每次修改连接地址时更新WindowTitle */ } diff --git a/src/MaaWpfGui/Views/UserControl/ConnectSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/ConnectSettingsUserControl.xaml index b53b033e11..112ff92591 100644 --- a/src/MaaWpfGui/Views/UserControl/ConnectSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/ConnectSettingsUserControl.xaml @@ -83,14 +83,16 @@ Style="{StaticResource TextBlockDefault}" Text="{DynamicResource ConnectionAddress}" TextWrapping="Wrap" /> - Date: Thu, 9 Feb 2023 20:49:02 +0800 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=E4=BF=9D=E5=85=A8core=E4=B8=8A?= =?UTF-8?q?=E6=BB=A1=E4=BA=86=E5=B0=B1=E4=B8=8D=E5=86=8D=E4=B8=8A=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E4=BA=BA=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaCore/Task/SSS/SSSBattleProcessTask.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/MaaCore/Task/SSS/SSSBattleProcessTask.cpp b/src/MaaCore/Task/SSS/SSSBattleProcessTask.cpp index 80e77cf6f4..29e623c4b7 100644 --- a/src/MaaCore/Task/SSS/SSSBattleProcessTask.cpp +++ b/src/MaaCore/Task/SSS/SSSBattleProcessTask.cpp @@ -58,21 +58,21 @@ bool asst::SSSBattleProcessTask::do_strategic_action(const cv::Mat& reusable) { LogTraceFunction; cv::Mat image = reusable.empty() ? ctrler()->get_image() : reusable; - + if (check_and_get_drops(image)) { return true; } - + if (m_sss_combat_data.draw_as_possible && draw_card(false, image)) { image = ctrler()->get_image(); } - + if (check_and_do_strategy(image)) { image = ctrler()->get_image(); } - + if (use_all_ready_skill(image)) { - //image = ctrler()->get_image(); + // image = ctrler()->get_image(); } return true; @@ -88,6 +88,10 @@ bool asst::SSSBattleProcessTask::wait_until_start(bool weak) bool asst::SSSBattleProcessTask::check_and_do_strategy(const cv::Mat& reusable) { + if (m_all_cores.empty()) { + return false; + } + cv::Mat image = reusable.empty() ? ctrler()->get_image() : reusable; if (!update_deployment(false, image)) { return false; @@ -115,6 +119,7 @@ bool asst::SSSBattleProcessTask::check_and_do_strategy(const cv::Mat& reusable) // 直接返回,等费用,等下次循环处理部署逻辑 break; } + m_all_cores.erase(strategy.core); // 部署完,画面会发生变化,所以直接返回,后续逻辑交给下次循环处理 return deploy_oper(strategy.core, strategy.location, strategy.direction); } From a9b2ad883fcf8c0711d611ca9618d89f6c557764 Mon Sep 17 00:00:00 2001 From: MistEO Date: Thu, 9 Feb 2023 20:58:14 +0800 Subject: [PATCH 3/9] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BF=9D=E5=85=A8?= =?UTF-8?q?=E7=AC=AC=E4=B8=89=E5=B1=82=E4=B8=AD=E9=80=94=E6=8E=89=E8=90=BD?= =?UTF-8?q?=E5=8D=A1=E4=BD=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/tasks.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resource/tasks.json b/resource/tasks.json index 05d2e97eca..7183042ccf 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -9701,6 +9701,8 @@ "SSSHalfTimeDropsBegin": { "template": "SSSHalfTimeDropsCancel.png", "action": "DoNothing", + "templThreshold": 0.7, + "cache": false, "roi": [ 148, 332, @@ -9729,6 +9731,7 @@ }, "SSSHalfTimeDropsConfirm": { "action": "ClickSelf", + "templThreshold": 0.7, "cache": false, "roi": [ 1035, @@ -9739,6 +9742,7 @@ }, "SSSHalfTimeDropsCancel": { "action": "ClickSelf", + "templThreshold": 0.7, "cache": false, "roi": [ 100, @@ -9752,6 +9756,7 @@ }, "SSSHalfTimeDropsCancelConfirm": { "action": "ClickSelf", + "templThreshold": 0.7, "roi": [ 716, 410, From b4118c97e3759f6fbd09ab1b52fbea90781decf8 Mon Sep 17 00:00:00 2001 From: uye <2396806385@qq.com> Date: Thu, 9 Feb 2023 21:26:09 +0800 Subject: [PATCH 4/9] =?UTF-8?q?chore:=20=E6=94=B9=E4=B8=AA=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Main/SettingsViewModel.cs | 28 +++++++++---------- .../ConnectSettingsUserControl.xaml | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/MaaWpfGui/Main/SettingsViewModel.cs b/src/MaaWpfGui/Main/SettingsViewModel.cs index 3e6e01e114..07cbf44ec9 100644 --- a/src/MaaWpfGui/Main/SettingsViewModel.cs +++ b/src/MaaWpfGui/Main/SettingsViewModel.cs @@ -121,10 +121,10 @@ namespace MaaWpfGui Application.Current.MainWindow.Closing += SaveGUIParameters; } - var addressesJson = ViewStatusStorage.Get("Connect.Addresses", string.Empty); - if (!string.IsNullOrEmpty(addressesJson)) + var addressListJson = ViewStatusStorage.Get("Connect.AddressHistory", string.Empty); + if (!string.IsNullOrEmpty(addressListJson)) { - ConnectAddresses = JsonConvert.DeserializeObject>(addressesJson); + ConnectAddressHistory = JsonConvert.DeserializeObject>(addressListJson); } } @@ -1754,12 +1754,12 @@ namespace MaaWpfGui } } - private ObservableCollection _connectAddresses = new ObservableCollection(); + private ObservableCollection _connectAddressHistory = new ObservableCollection(); - public ObservableCollection ConnectAddresses + public ObservableCollection ConnectAddressHistory { - get => _connectAddresses; - set => SetAndNotify(ref _connectAddresses, value); + get => _connectAddressHistory; + set => SetAndNotify(ref _connectAddressHistory, value); } private string _connectAddress = ViewStatusStorage.Get("Connect.Address", string.Empty); @@ -1777,22 +1777,22 @@ namespace MaaWpfGui return; } - if (!ConnectAddresses.Contains(value)) + if (!ConnectAddressHistory.Contains(value)) { - ConnectAddresses.Insert(0, value); - while (ConnectAddresses.Count > 5) + ConnectAddressHistory.Insert(0, value); + while (ConnectAddressHistory.Count > 5) { - ConnectAddresses.RemoveAt(ConnectAddresses.Count - 1); + ConnectAddressHistory.RemoveAt(ConnectAddressHistory.Count - 1); } } else { - ConnectAddresses.Remove(value); - ConnectAddresses.Insert(0, value); + ConnectAddressHistory.Remove(value); + ConnectAddressHistory.Insert(0, value); } SetAndNotify(ref _connectAddress, value); - ViewStatusStorage.Set("Connect.Addresses", JsonConvert.SerializeObject(ConnectAddresses)); + ViewStatusStorage.Set("Connect.AddressHistory", JsonConvert.SerializeObject(ConnectAddressHistory)); ViewStatusStorage.Set("Connect.Address", value); UpdateWindowTitle(); /* 每次修改连接地址时更新WindowTitle */ } diff --git a/src/MaaWpfGui/Views/UserControl/ConnectSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/ConnectSettingsUserControl.xaml index 112ff92591..fe70e5f378 100644 --- a/src/MaaWpfGui/Views/UserControl/ConnectSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/ConnectSettingsUserControl.xaml @@ -91,7 +91,7 @@ Margin="10" IsEditable="True" IsEnabled="{c:Binding !AutoDetectConnection}" - ItemsSource="{Binding ConnectAddresses}" + ItemsSource="{Binding ConnectAddressHistory}" Text="{Binding ConnectAddress, UpdateSourceTrigger=LostFocus}" ToolTip="{DynamicResource ConnectionAddressTip}" /> From 610443fb608e84988dec9e22ccea1575d84ed0a8 Mon Sep 17 00:00:00 2001 From: uye <2396806385@qq.com> Date: Thu, 9 Feb 2023 21:40:45 +0800 Subject: [PATCH 5/9] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E9=85=8D=E7=BD=AE=E6=97=B6=E6=9B=B4=E6=96=B0WindowTit?= =?UTF-8?q?le?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Main/SettingsViewModel.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MaaWpfGui/Main/SettingsViewModel.cs b/src/MaaWpfGui/Main/SettingsViewModel.cs index 07cbf44ec9..f71e85773a 100644 --- a/src/MaaWpfGui/Main/SettingsViewModel.cs +++ b/src/MaaWpfGui/Main/SettingsViewModel.cs @@ -1825,6 +1825,7 @@ namespace MaaWpfGui { SetAndNotify(ref _connectConfig, value); ViewStatusStorage.Set("Connect.ConnectConfig", value); + UpdateWindowTitle(); /* 每次修改连接配置时更新WindowTitle */ } } From 21bb9825c97273d078ac4c95e0a775b1d338e511 Mon Sep 17 00:00:00 2001 From: MistEO Date: Thu, 9 Feb 2023 22:33:33 +0800 Subject: [PATCH 6/9] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=8D=E5=BA=94=E7=94=A8=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Helper/WebService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MaaWpfGui/Helper/WebService.cs b/src/MaaWpfGui/Helper/WebService.cs index debb0feec3..32afaf5244 100644 --- a/src/MaaWpfGui/Helper/WebService.cs +++ b/src/MaaWpfGui/Helper/WebService.cs @@ -29,7 +29,7 @@ namespace MaaWpfGui.Helper { public const string RequestUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 Edg/97.0.1072.76"; - public static string Proxy { get; set; } = string.Empty; + public static string Proxy { get; set; } = ViewStatusStorage.Get("VersionUpdate.Proxy", string.Empty); public static string RequestUrl(string url) { From be9b055b6adf4347097381e2ce9a75820f9ec04c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=93=E9=BA=BB=E5=B0=86=E6=9C=89=E7=82=B9=E7=B4=AF?= <46131793+Sed66666@users.noreply.github.com> Date: Fri, 10 Feb 2023 11:17:01 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=A0=E8=B5=A0?= =?UTF-8?q?=E9=80=81=E7=BA=BF=E7=B4=A2=E5=BC=B9=E7=AA=97=E9=81=AE=E6=8C=A1?= =?UTF-8?q?new=E5=9B=BE=E6=A0=87=E5=AF=BC=E8=87=B4=E7=9A=84=E5=9B=A0?= =?UTF-8?q?=E7=BA=BF=E7=B4=A2=E5=B7=B2=E6=BB=A1=E8=B5=A0=E9=80=81=E5=90=8E?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=A2=86=E5=8F=96=E8=87=AA=E5=B7=B1=E7=BA=BF?= =?UTF-8?q?=E7=B4=A2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/tasks.json | 1 + 1 file changed, 1 insertion(+) diff --git a/resource/tasks.json b/resource/tasks.json index 7183042ccf..483ff8b0f2 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -5692,6 +5692,7 @@ 41, 41 ], + "preDelay": 2500, "next": [ "InfrastClueSelfNew", "InfrastClueFriendNew", From 628575dcc9463aabac72f040d85f85164982eb0d Mon Sep 17 00:00:00 2001 From: uye <2396806385@qq.com> Date: Fri, 10 Feb 2023 21:57:48 +0800 Subject: [PATCH 8/9] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=89=A9=E4=BD=99?= =?UTF-8?q?=E7=90=86=E6=99=BA=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Main/SettingsViewModel.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/MaaWpfGui/Main/SettingsViewModel.cs b/src/MaaWpfGui/Main/SettingsViewModel.cs index f71e85773a..5d5ae2e874 100644 --- a/src/MaaWpfGui/Main/SettingsViewModel.cs +++ b/src/MaaWpfGui/Main/SettingsViewModel.cs @@ -2320,9 +2320,11 @@ namespace MaaWpfGui set { SetAndNotify(ref _customStageCode, value); - ViewStatusStorage.Set("GUI.CustomStageCode", value.ToString()); var mainModel = _container.Get(); + mainModel.RemainingSanityStageDisplay1 = UseRemainingSanityStage && !value; + mainModel.RemainingSanityStageDisplay2 = UseRemainingSanityStage && value; mainModel.CustomStageCode = value; + ViewStatusStorage.Set("GUI.CustomStageCode", value.ToString()); } } From c3703f685106b202ff2235da25e678fcdb3609d1 Mon Sep 17 00:00:00 2001 From: uye <2396806385@qq.com> Date: Fri, 10 Feb 2023 23:28:15 +0800 Subject: [PATCH 9/9] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96sleep=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E9=80=80=E5=87=BA=E7=9A=84=E9=97=B4=E9=9A=94=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaCore/InstHelper.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/MaaCore/InstHelper.cpp b/src/MaaCore/InstHelper.cpp index 317a90a5ee..66b19e887b 100644 --- a/src/MaaCore/InstHelper.cpp +++ b/src/MaaCore/InstHelper.cpp @@ -29,16 +29,15 @@ bool asst::InstHelper::sleep(unsigned millisecond) const std::this_thread::yield(); return true; } - auto start = std::chrono::steady_clock::now(); Log.trace("ready to sleep", millisecond); auto millisecond_ms = std::chrono::milliseconds(millisecond); - auto interval = millisecond_ms / 5; + auto interval = std::chrono::milliseconds(std::min(millisecond, 5000U)); - while (!need_exit()) { + for (auto sleep_time = interval; sleep_time <= millisecond_ms && !need_exit(); sleep_time += interval) { std::this_thread::sleep_for(interval); - if (std::chrono::steady_clock::now() - start > millisecond_ms) { - break; - } + } + if (!need_exit()) { + std::this_thread::sleep_for(millisecond_ms % interval); } Log.trace("end of sleep", millisecond);