diff --git a/resource/tasks.json b/resource/tasks.json index 05d2e97eca..483ff8b0f2 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -5692,6 +5692,7 @@ 41, 41 ], + "preDelay": 2500, "next": [ "InfrastClueSelfNew", "InfrastClueFriendNew", @@ -9701,6 +9702,8 @@ "SSSHalfTimeDropsBegin": { "template": "SSSHalfTimeDropsCancel.png", "action": "DoNothing", + "templThreshold": 0.7, + "cache": false, "roi": [ 148, 332, @@ -9729,6 +9732,7 @@ }, "SSSHalfTimeDropsConfirm": { "action": "ClickSelf", + "templThreshold": 0.7, "cache": false, "roi": [ 1035, @@ -9739,6 +9743,7 @@ }, "SSSHalfTimeDropsCancel": { "action": "ClickSelf", + "templThreshold": 0.7, "cache": false, "roi": [ 100, @@ -9752,6 +9757,7 @@ }, "SSSHalfTimeDropsCancelConfirm": { "action": "ClickSelf", + "templThreshold": 0.7, "roi": [ 716, 410, 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); 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); } 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) { diff --git a/src/MaaWpfGui/Main/SettingsViewModel.cs b/src/MaaWpfGui/Main/SettingsViewModel.cs index 150c7b75f0..af652fb572 100644 --- a/src/MaaWpfGui/Main/SettingsViewModel.cs +++ b/src/MaaWpfGui/Main/SettingsViewModel.cs @@ -27,6 +27,7 @@ using System.Windows.Interop; using IWshRuntimeLibrary; using MaaWpfGui.Helper; using MaaWpfGui.MaaHotKeys; +using Newtonsoft.Json; using Stylet; using StyletIoC; @@ -132,6 +133,12 @@ namespace MaaWpfGui { Application.Current.MainWindow.Closing += SaveGUIParameters; } + + var addressListJson = ViewStatusStorage.Get("Connect.AddressHistory", string.Empty); + if (!string.IsNullOrEmpty(addressListJson)) + { + ConnectAddressHistory = JsonConvert.DeserializeObject>(addressListJson); + } } private List _listTitle = new List(); @@ -1756,6 +1763,14 @@ namespace MaaWpfGui } } + private ObservableCollection _connectAddressHistory = new ObservableCollection(); + + public ObservableCollection ConnectAddressHistory + { + get => _connectAddressHistory; + set => SetAndNotify(ref _connectAddressHistory, value); + } + private string _connectAddress = ViewStatusStorage.Get("Connect.Address", string.Empty); /// @@ -1766,7 +1781,27 @@ namespace MaaWpfGui get => _connectAddress; set { + if (ConnectAddress == value || string.IsNullOrEmpty(value)) + { + return; + } + + if (!ConnectAddressHistory.Contains(value)) + { + ConnectAddressHistory.Insert(0, value); + while (ConnectAddressHistory.Count > 5) + { + ConnectAddressHistory.RemoveAt(ConnectAddressHistory.Count - 1); + } + } + else + { + ConnectAddressHistory.Remove(value); + ConnectAddressHistory.Insert(0, value); + } + SetAndNotify(ref _connectAddress, value); + ViewStatusStorage.Set("Connect.AddressHistory", JsonConvert.SerializeObject(ConnectAddressHistory)); ViewStatusStorage.Set("Connect.Address", value); UpdateWindowTitle(); /* 每次修改连接地址时更新WindowTitle */ } @@ -1799,6 +1834,7 @@ namespace MaaWpfGui { SetAndNotify(ref _connectConfig, value); ViewStatusStorage.Set("Connect.ConnectConfig", value); + UpdateWindowTitle(); /* 每次修改连接配置时更新WindowTitle */ } } @@ -2289,6 +2325,8 @@ namespace MaaWpfGui SetAndNotify(ref _customStageCode, value); ViewStatusStorage.Set("GUI.CustomStageCode", value.ToString()); _taskQueueViewModel.CustomStageCode = value; + _taskQueueViewModel.RemainingSanityStageDisplay1 = UseRemainingSanityStage && !value; + _taskQueueViewModel.RemainingSanityStageDisplay2 = UseRemainingSanityStage && value; } } diff --git a/src/MaaWpfGui/Views/UserControl/ConnectSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/ConnectSettingsUserControl.xaml index b53b033e11..fe70e5f378 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" /> -