Merge branch 'dev' into refactor/inject

This commit is contained in:
uye
2023-02-11 01:14:43 +08:00
committed by GitHub
6 changed files with 64 additions and 14 deletions

View File

@@ -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,

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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)
{

View File

@@ -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<ObservableCollection<string>>(addressListJson);
}
}
private List<string> _listTitle = new List<string>();
@@ -1756,6 +1763,14 @@ namespace MaaWpfGui
}
}
private ObservableCollection<string> _connectAddressHistory = new ObservableCollection<string>();
public ObservableCollection<string> ConnectAddressHistory
{
get => _connectAddressHistory;
set => SetAndNotify(ref _connectAddressHistory, value);
}
private string _connectAddress = ViewStatusStorage.Get("Connect.Address", string.Empty);
/// <summary>
@@ -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;
}
}

View File

@@ -83,14 +83,16 @@
Style="{StaticResource TextBlockDefault}"
Text="{DynamicResource ConnectionAddress}"
TextWrapping="Wrap" />
<TextBox
<ComboBox
Grid.Row="2"
Grid.Column="1"
Width="250"
Height="30"
Margin="10"
IsEditable="True"
IsEnabled="{c:Binding !AutoDetectConnection}"
Text="{Binding ConnectAddress}"
ItemsSource="{Binding ConnectAddressHistory}"
Text="{Binding ConnectAddress, UpdateSourceTrigger=LostFocus}"
ToolTip="{DynamicResource ConnectionAddressTip}" />
<TextBlock