1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-17 01:45:25 +08:00

Fix: Chain call minitouch in dorm

This commit is contained in:
LmeSzinc
2024-04-15 19:20:52 +08:00
parent 8376d62843
commit 485c024b44

View File

@@ -108,12 +108,13 @@ class RewardDorm(UI):
# Long tap to feed. This requires minitouch. # Long tap to feed. This requires minitouch.
timeout = Timer(count // 5 + 5).start() timeout = Timer(count // 5 + 5).start()
x, y = random_rectangle_point(button.button) x, y = random_rectangle_point(button.button)
self.device.minitouch_builder.down(x, y).commit() builder = self.device.minitouch_builder
self.device.minitouch_send() builder.down(x, y).commit()
builder.send()
while 1: while 1:
self.device.minitouch_builder.move(x, y).commit().wait(10) builder.move(x, y).commit().wait(10)
self.device.minitouch_send() builder.send()
self.device.screenshot() self.device.screenshot()
if not self._dorm_has_food(button) \ if not self._dorm_has_food(button) \
@@ -124,19 +125,20 @@ class RewardDorm(UI):
logger.warning('Wait dorm feed timeout') logger.warning('Wait dorm feed timeout')
break break
self.device.minitouch_builder.up().commit() builder.up().commit()
self.device.minitouch_send() builder.send()
@Config.when(DEVICE_CONTROL_METHOD='MaaTouch') @Config.when(DEVICE_CONTROL_METHOD='MaaTouch')
def _dorm_feed_long_tap(self, button, count): def _dorm_feed_long_tap(self, button, count):
timeout = Timer(count // 5 + 5).start() timeout = Timer(count // 5 + 5).start()
x, y = random_rectangle_point(button.button) x, y = random_rectangle_point(button.button)
self.device.maatouch_builder.down(x, y).commit() builder = self.device.maatouch_builder
self.device.maatouch_send() builder.down(x, y).commit()
builder.send()
while 1: while 1:
self.device.maatouch_builder.move(x, y).commit().wait(10) builder.move(x, y).commit().wait(10)
self.device.maatouch_send() builder.send()
self.device.screenshot() self.device.screenshot()
if not self._dorm_has_food(button) \ if not self._dorm_has_food(button) \
@@ -147,8 +149,8 @@ class RewardDorm(UI):
logger.warning('Wait dorm feed timeout') logger.warning('Wait dorm feed timeout')
break break
self.device.maatouch_builder.up().commit() builder.up().commit()
self.device.maatouch_send() builder.send()
@Config.when(DEVICE_CONTROL_METHOD='uiautomator2') @Config.when(DEVICE_CONTROL_METHOD='uiautomator2')
def _dorm_feed_long_tap(self, button, count): def _dorm_feed_long_tap(self, button, count):