mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2026-01-07 14:05:12 +00:00
Compare commits
1 Commits
fea601e499
...
d104728e64
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d104728e64 |
@ -1,12 +1,14 @@
|
|||||||
from module.base.timer import Timer
|
from module.base.timer import Timer
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
from module.ui.switch import Switch
|
from module.ui.switch import Switch
|
||||||
|
from module.ui.scroll_select import ScrollSelect
|
||||||
from module.ocr.ocr import Digit
|
from module.ocr.ocr import Digit
|
||||||
from tasks.base.ui import UI
|
from tasks.base.ui import UI
|
||||||
from tasks.base.assets.assets_base_page import MISSION_CHECK
|
from tasks.base.assets.assets_base_page import MISSION_CHECK
|
||||||
from tasks.auto_mission.assets.assets_auto_mission import *
|
from tasks.auto_mission.assets.assets_auto_mission import *
|
||||||
from tasks.auto_mission.stage import StageState
|
from tasks.auto_mission.stage import StageState
|
||||||
|
|
||||||
|
SCROLL_SELECT = ScrollSelect(PRESET_WINDOW, PRESET_FIRST_ITEM, MOBILIZE, clickx=1150, responsey=60, swipeoffsetx=-600)
|
||||||
PRESETS = [PRESET1_ON, PRESET2_ON, PRESET3_ON, PRESET4_ON]
|
PRESETS = [PRESET1_ON, PRESET2_ON, PRESET3_ON, PRESET4_ON]
|
||||||
|
|
||||||
SWITCH_UNIT1 = Switch('Unit1_Switch')
|
SWITCH_UNIT1 = Switch('Unit1_Switch')
|
||||||
@ -53,13 +55,6 @@ class Copilot(UI):
|
|||||||
# sleep because clicks can be too fast when executing actions
|
# sleep because clicks can be too fast when executing actions
|
||||||
self.sleep(interval)
|
self.sleep(interval)
|
||||||
|
|
||||||
def click_then_check(self, coords, dest_check):
|
|
||||||
while 1:
|
|
||||||
self.device.screenshot()
|
|
||||||
if self.appear(dest_check):
|
|
||||||
return True
|
|
||||||
self.click(*coords, interval=2)
|
|
||||||
|
|
||||||
def select_then_check(self, dest_enter: ButtonWrapper, dest_check: ButtonWrapper):
|
def select_then_check(self, dest_enter: ButtonWrapper, dest_check: ButtonWrapper):
|
||||||
while 1:
|
while 1:
|
||||||
self.device.screenshot()
|
self.device.screenshot()
|
||||||
@ -93,33 +88,8 @@ class Copilot(UI):
|
|||||||
while not self.match_color(PRESET, threshold=50):
|
while not self.match_color(PRESET, threshold=50):
|
||||||
self.device.screenshot()
|
self.device.screenshot()
|
||||||
self.click_with_interval(PRESET, interval=1)
|
self.click_with_interval(PRESET, interval=1)
|
||||||
|
clickoffsety = [85, 85, 0, -120, 0]
|
||||||
click_first = lambda : self.click_then_check((1145, 320), MOBILIZE)
|
SCROLL_SELECT.select_index(main=self, target_index=row_index, clickoffsety=clickoffsety[row_index])
|
||||||
click_second = lambda : self.click_then_check((1145, 530), MOBILIZE)
|
|
||||||
swipe = lambda : self.device.swipe((500, 625), (500, 350))
|
|
||||||
wait = lambda : self.wait_until_stable(
|
|
||||||
PRESET_WINDOW,
|
|
||||||
timer=Timer(3, 0),
|
|
||||||
timeout=Timer(1.5, 5)
|
|
||||||
)
|
|
||||||
match row:
|
|
||||||
case 1:
|
|
||||||
click_first()
|
|
||||||
case 2:
|
|
||||||
click_second()
|
|
||||||
case 3:
|
|
||||||
swipe()
|
|
||||||
wait()
|
|
||||||
click_first()
|
|
||||||
case 4:
|
|
||||||
swipe()
|
|
||||||
wait()
|
|
||||||
click_second()
|
|
||||||
case 5:
|
|
||||||
swipe()
|
|
||||||
swipe()
|
|
||||||
wait()
|
|
||||||
click_second()
|
|
||||||
|
|
||||||
def choose_unit(self, unit):
|
def choose_unit(self, unit):
|
||||||
unit_index = unit - 1
|
unit_index = unit - 1
|
||||||
@ -127,7 +97,11 @@ class Copilot(UI):
|
|||||||
self.set_switch(unit_switch)
|
self.set_switch(unit_switch)
|
||||||
|
|
||||||
def goto_formation_page(self, start_coords):
|
def goto_formation_page(self, start_coords):
|
||||||
self.click_then_check(start_coords, MOBILIZE)
|
while 1:
|
||||||
|
self.device.screenshot()
|
||||||
|
if self.appear(MOBILIZE):
|
||||||
|
return True
|
||||||
|
self.click(*start_coords, interval=2)
|
||||||
|
|
||||||
def formation(self, stage, type_to_preset):
|
def formation(self, stage, type_to_preset):
|
||||||
if stage.state == StageState.SUB:
|
if stage.state == StageState.SUB:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user