mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2025-12-16 22:05:12 +00:00
Compare commits
2 Commits
ff1314ab88
...
dff39db5b6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dff39db5b6 | ||
|
|
5e229d7797 |
@ -31,6 +31,9 @@ starlette==0.14.2
|
||||
uvicorn[standard]==0.17.6
|
||||
aiofiles
|
||||
|
||||
# GUI
|
||||
customtkinter
|
||||
|
||||
# For dev
|
||||
# pip-tools
|
||||
pynput
|
||||
|
||||
@ -19,6 +19,8 @@ cigam==0.0.3 # via apkutils2
|
||||
click==8.1.3 # via uvicorn
|
||||
colorama==0.4.6 # via click, logzero, tqdm, uvicorn
|
||||
coloredlogs==15.0.1 # via onnxruntime
|
||||
customtkinter==5.2.1 # via -r requirements-in.txt
|
||||
darkdetect==0.8.0 # via customtkinter
|
||||
decorator==5.1.1 # via retry
|
||||
deprecated==1.2.13 # via uiautomator2
|
||||
deprecation==2.1.0 # via adbutils
|
||||
|
||||
@ -33,7 +33,7 @@ class MomoTalk(MomoTalkUI):
|
||||
return MomoTalkStatus.OPEN
|
||||
case MomoTalkStatus.STORY:
|
||||
if self.skip_story():
|
||||
return MomoTalkStatus.OPEN
|
||||
return MomoTalkStatus.CHAT
|
||||
case MomoTalkStatus.FINISHED:
|
||||
return status
|
||||
case _:
|
||||
|
||||
@ -33,6 +33,7 @@ class MomoTalkUI(UI):
|
||||
super().__init__(config, device)
|
||||
self.swipe_vector_range = (0.65, 0.85)
|
||||
self.list = CHAT_AREA
|
||||
self.click_coords = self.device.click_methods.get(self.config.Emulator_ControlMethod, self.device.click_adb)
|
||||
|
||||
def swipe_page(self, direction: str, main: ModuleBase, vector_range=None, reverse=False):
|
||||
"""
|
||||
@ -58,16 +59,6 @@ class MomoTalkUI(UI):
|
||||
vector = (-vector[0], -vector[1])
|
||||
main.device.swipe_vector(vector, self.list.button)
|
||||
|
||||
def select_then_check(self, dest_enter: ButtonWrapper, dest_check: ButtonWrapper, similarity=0.85):
|
||||
timer = Timer(5, 10).start()
|
||||
while 1:
|
||||
self.device.screenshot()
|
||||
self.appear_then_click(dest_enter, interval=1, similarity=similarity)
|
||||
if self.appear(dest_check, similarity=similarity):
|
||||
return True
|
||||
if timer.reached():
|
||||
return False
|
||||
|
||||
def select_then_disappear(self, dest_enter: ButtonWrapper, dest_check: ButtonWrapper):
|
||||
timer = Timer(5, 10).start()
|
||||
while 1:
|
||||
@ -94,10 +85,8 @@ class MomoTalkUI(UI):
|
||||
def click_all(self, template, x_add=0, y_add=0):
|
||||
"""
|
||||
Find the all the locations of the template adding an offset if specified and click them.
|
||||
TODO: filter coords that are not inside the chat area as otherwise it will close momotalk.
|
||||
If after filter, no coords then swipe.
|
||||
"""
|
||||
click_coords = self.device.click_methods.get(self.config.Emulator_ControlMethod, self.device.click_adb)
|
||||
image = self.device.screenshot()
|
||||
result = cv2.matchTemplate(image, template, cv2.TM_CCOEFF_NORMED)
|
||||
threshold = 0.8
|
||||
@ -109,7 +98,7 @@ class MomoTalkUI(UI):
|
||||
if seen:
|
||||
if y_add != 0:
|
||||
seen = filter(lambda x: point_in_area(x, CHAT_AREA.area), seen)
|
||||
[click_coords(coords[0], coords[1]) for coords in seen]
|
||||
[self.click_coords(coords[0], coords[1]) for coords in seen]
|
||||
self.swipe_page("down", self)
|
||||
return True
|
||||
return False
|
||||
|
||||
Loading…
Reference in New Issue
Block a user