mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 01:40:46 +08:00
feat: 新增仅MaaTouch支持的暂停下干员优化。下的更快!
This commit is contained in:
BIN
3rdparty/resource/minitouch/maatouch/minitouch
vendored
BIN
3rdparty/resource/minitouch/maatouch/minitouch
vendored
Binary file not shown.
@@ -23,7 +23,7 @@
|
||||
"armeabi-v7a",
|
||||
"armeabi"
|
||||
],
|
||||
"swipeWithPauseRequiredDistance": 50,
|
||||
"swipeWithPauseRequiredDistance": 20,
|
||||
"swipeWithPauseRequiredDistance_Doc": "暂停下干员滑动多远距离后开始按暂停",
|
||||
"penguinReport": {
|
||||
"Doc": "企鹅物流汇报: https://penguin-stats.cn/",
|
||||
|
||||
@@ -1186,7 +1186,14 @@ bool asst::Controller::swipe_without_scale(const Point& p1, const Point& p2, int
|
||||
if (need_pause && std::sqrt(std::pow(cur_x - _x1, 2) + std::pow(cur_y - _y1, 2)) >
|
||||
opt.swipe_with_pause_required_distance) {
|
||||
need_pause = false;
|
||||
pause_future = std::async(std::launch::async, [&]() { press_esc(); });
|
||||
if (m_use_maa_touch) {
|
||||
constexpr int EscKeyCode = 111;
|
||||
toucher.key_down(EscKeyCode);
|
||||
toucher.key_up(EscKeyCode, 0);
|
||||
}
|
||||
else {
|
||||
pause_future = std::async(std::launch::async, [&]() { press_esc(); });
|
||||
}
|
||||
}
|
||||
if (cur_x < 0 || cur_x > m_minitouch_props.max_x || cur_y < 0 || cur_y > m_minitouch_props.max_y) {
|
||||
continue;
|
||||
|
||||
@@ -243,6 +243,13 @@ namespace asst
|
||||
{
|
||||
return m_input_func(up_cmd(wait_ms, with_commit, contact));
|
||||
}
|
||||
bool key_down(int key_code, int wait_ms = DefaultClickDelay, bool with_commit = true) {
|
||||
return m_input_func(key_down_cmd(key_code, wait_ms, with_commit));
|
||||
}
|
||||
bool key_up(int key_code, int wait_ms = DefaultClickDelay, bool with_commit = true)
|
||||
{
|
||||
return m_input_func(key_up_cmd(key_code, wait_ms, with_commit));
|
||||
}
|
||||
bool wait(int ms) { return m_input_func(wait_cmd(ms)); }
|
||||
void clear() noexcept { m_wait_ms_count = 0; }
|
||||
|
||||
@@ -293,6 +300,28 @@ namespace asst
|
||||
return str;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string key_down_cmd(int key_code, int wait_ms = DefaultClickDelay, bool with_commit = true)
|
||||
{
|
||||
char buff[64] = { 0 };
|
||||
sprintf(buff, "k %d d\n", key_code);
|
||||
std::string str = buff;
|
||||
|
||||
if (with_commit) str += commit_cmd();
|
||||
if (wait_ms) str += wait_cmd(wait_ms);
|
||||
return str;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string key_up_cmd(int key_code, int wait_ms = DefaultClickDelay, bool with_commit = true)
|
||||
{
|
||||
char buff[64] = { 0 };
|
||||
sprintf(buff, "k %d u\n", key_code);
|
||||
std::string str = buff;
|
||||
|
||||
if (with_commit) str += commit_cmd();
|
||||
if (wait_ms) str += wait_cmd(wait_ms);
|
||||
return str;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string wait_cmd(int ms)
|
||||
{
|
||||
m_wait_ms_count += ms;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<CheckBox
|
||||
Grid.Row="0"
|
||||
@@ -142,5 +143,14 @@
|
||||
HorizontalAlignment="Left"
|
||||
Command="{s:Action ReplaceADB}"
|
||||
Content="{DynamicResource ForcedReplaceADB}" />
|
||||
<CheckBox
|
||||
Grid.Row="6"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Content="{DynamicResource DeploymentWithPause}"
|
||||
IsChecked="{Binding DeploymentWithPause}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -15,7 +15,6 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel
|
||||
@@ -166,16 +165,5 @@
|
||||
ToolTip="{DynamicResource StartingCoreCharTip}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<CheckBox
|
||||
Margin="10"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Content="{DynamicResource DeploymentWithPause}"
|
||||
IsChecked="{Binding DeploymentWithPause}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user