Skip to content

Commit

Permalink
fix: 修正M Touch 子单元多次添加的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Oct 19, 2023
1 parent 174b96a commit 0fdf1f5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 5 additions & 3 deletions source/MaaControlUnit/Input/MaatouchInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class MaatouchInput : public MtouchHelper, public KeyInputBase
public:
MaatouchInput(std::filesystem::path agent_path) : agent_path_(std::move(agent_path))
{
TouchInputBase::children_.emplace_back(invoke_app_);
KeyInputBase::children_.emplace_back(invoke_app_);
}
virtual ~MaatouchInput() override = default;
Expand All @@ -23,17 +24,17 @@ class MaatouchInput : public MtouchHelper, public KeyInputBase

virtual void set_io(std::shared_ptr<PlatformIO> io_ptr) override
{
MtouchHelper::set_io(io_ptr);
TouchInputBase::set_io(io_ptr);
KeyInputBase::set_io(io_ptr);
}
virtual void set_replacement(Argv::replacement argv_replace) override
{
MtouchHelper::set_replacement(argv_replace);
TouchInputBase::set_replacement(argv_replace);
KeyInputBase::set_replacement(argv_replace);
}
virtual void merge_replacement(Argv::replacement argv_replace, bool _override = true) override
{
MtouchHelper::merge_replacement(argv_replace, _override);
TouchInputBase::merge_replacement(argv_replace, _override);
KeyInputBase::merge_replacement(argv_replace, _override);
}

Expand All @@ -58,6 +59,7 @@ class MaatouchInput : public MtouchHelper, public KeyInputBase

std::filesystem::path agent_path_;
std::string package_name_;
std::shared_ptr<InvokeApp> invoke_app_ = std::make_shared<InvokeApp>();
};

MAA_CTRL_UNIT_NS_END
1 change: 1 addition & 0 deletions source/MaaControlUnit/Input/MinitouchInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class MinitouchInput : public MtouchHelper

std::filesystem::path agent_path_;
std::vector<std::string> arch_list_;
std::shared_ptr<InvokeApp> invoke_app_ = std::make_shared<InvokeApp>();
};

MAA_CTRL_UNIT_NS_END
2 changes: 0 additions & 2 deletions source/MaaControlUnit/Input/MtouchHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ MAA_CTRL_UNIT_NS_BEGIN
class MtouchHelper : public TouchInputBase
{
public:
MtouchHelper() { children_.emplace_back(invoke_app_); }
virtual ~MtouchHelper() override = default;

public: // from TouchInputAPI
Expand All @@ -25,7 +24,6 @@ class MtouchHelper : public TouchInputBase
virtual std::pair<int, int> screen_to_touch(int x, int y) = 0;
virtual std::pair<int, int> screen_to_touch(double x, double y) = 0;

std::shared_ptr<InvokeApp> invoke_app_ = std::make_shared<InvokeApp>();
std::shared_ptr<IOHandler> shell_handler_ = nullptr;

int screen_width_ = 0;
Expand Down

0 comments on commit 0fdf1f5

Please sign in to comment.