| 725 | } |
| 726 | |
| 727 | bool ControllerAgent::handle_click_key(const ClickKeyParam& param) |
| 728 | { |
| 729 | if (!control_unit_) { |
| 730 | LogError << "control_unit_ is nullptr"; |
| 731 | return false; |
| 732 | } |
| 733 | |
| 734 | bool ret = !param.keycode.empty(); |
| 735 | |
| 736 | bool use_key_down_up = control_unit_->get_features() & MaaControllerFeature_UseKeyboardDownAndUpInsteadOfClick; |
| 737 | |
| 738 | for (const auto& keycode : param.keycode) { |
| 739 | if (use_key_down_up) { |
| 740 | ret &= control_unit_->key_down(keycode); |
| 741 | std::this_thread::sleep_for(std::chrono::milliseconds(50)); |
| 742 | ret &= control_unit_->key_up(keycode); |
| 743 | } |
| 744 | else { |
| 745 | ret &= control_unit_->click_key(keycode); |
| 746 | } |
| 747 | } |
| 748 | |
| 749 | return ret; |
| 750 | } |
| 751 | |
| 752 | bool ControllerAgent::handle_long_press_key(const LongPressKeyParam& param) |
| 753 | { |
nothing calls this directly
no test coverage detected