1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2025-12-16 22:05:12 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
RedDeadDepresso
e06c86ecf7
Merge 7aeccc9d96 into 2cad7ebbac 2024-01-10 23:23:03 +00:00
RedDeadDepresso
7aeccc9d96 feat: start and exit ldplayer9 2024-01-10 22:56:10 +00:00
RedDeadDepresso
a005a46a41 feat: added quit for zht 2024-01-10 21:17:53 +00:00
RedDeadDepresso
e0b139cc2f fix: shop 2024-01-10 21:11:17 +00:00
RedDeadDepresso
e615f4b839 fix: login 2024-01-10 21:06:14 +00:00
9 changed files with 49 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -12,6 +12,7 @@ from module.device.platform.platform_base import PlatformBase
from module.device.platform.emulator_windows import Emulator, EmulatorInstance, EmulatorManager from module.device.platform.emulator_windows import Emulator, EmulatorInstance, EmulatorManager
from module.logger import logger from module.logger import logger
import os
class EmulatorUnknown(Exception): class EmulatorUnknown(Exception):
pass pass
@ -101,6 +102,11 @@ class PlatformWindows(PlatformBase, EmulatorManager):
elif instance == Emulator.BlueStacks4: elif instance == Emulator.BlueStacks4:
# BlueStacks\Client\Bluestacks.exe -vmname Android_1 # BlueStacks\Client\Bluestacks.exe -vmname Android_1
self.execute(f'"{exe}" -vmname {instance.name}') self.execute(f'"{exe}" -vmname {instance.name}')
elif instance == Emulator.LDPlayer9:
directory, filename = os.path.split(exe)
new_filename = 'ldconsole.exe'
exe = os.path.join(directory, new_filename)
self.execute(f'"{exe}" launch --index {instance.name.replace("leidian", "")}')
else: else:
raise EmulatorUnknown(f'Cannot start an unknown emulator instance: {instance}') raise EmulatorUnknown(f'Cannot start an unknown emulator instance: {instance}')
@ -155,6 +161,11 @@ class PlatformWindows(PlatformBase, EmulatorManager):
self.execute(f'"{exe}" -clone:{instance.name} -quit') self.execute(f'"{exe}" -clone:{instance.name} -quit')
elif instance == Emulator.BlueStacks5: elif instance == Emulator.BlueStacks5:
self.execute(f'taskkill /fi "WINDOWTITLE eq {instance.name}" /IM "HD-Player.exe" /F') self.execute(f'taskkill /fi "WINDOWTITLE eq {instance.name}" /IM "HD-Player.exe" /F')
elif instance == Emulator.LDPlayer9:
directory, filename = os.path.split(exe)
new_filename = 'ldconsole.exe'
exe = os.path.join(directory, new_filename)
self.execute(f'"{exe}" quit --index {instance.name.replace("leidian", "")}')
else: else:
raise EmulatorUnknown(f'Cannot stop an unknown emulator instance: {instance}') raise EmulatorUnknown(f'Cannot stop an unknown emulator instance: {instance}')

View File

@ -261,3 +261,21 @@ NETWORK_RECONNECT_OK = ButtonWrapper(
button=(540, 471, 744, 530), button=(540, 471, 744, 530),
), ),
) )
QUIT = ButtonWrapper(
name='QUIT',
jp=None,
en=Button(
file='./assets/en/base/popup/QUIT.png',
area=(587, 309, 688, 357),
search=(567, 289, 708, 377),
color=(225, 225, 225),
button=(410, 473, 623, 532),
),
zht=Button(
file='./assets/zht/base/popup/QUIT.png',
area=(556, 310, 713, 364),
search=(536, 290, 733, 384),
color=(215, 215, 215),
button=(411, 472, 620, 535),
),
)

View File

@ -116,4 +116,11 @@ class PopupHandler(ModuleBase):
if self.appear_then_click(LEVEL_UP, interval=interval): if self.appear_then_click(LEVEL_UP, interval=interval):
return True return True
return False return False
def handle_quit(self, interval=5) -> bool:
if self.appear_then_click(QUIT, interval=interval):
return True
return False

View File

@ -130,7 +130,7 @@ class UI(MainPage):
self.interval_clear(list(Page.iter_check_buttons())) self.interval_clear(list(Page.iter_check_buttons()))
# loading_timer = Timer(0.5) # loading_timer = Timer(0.5)
back_timer = Timer(10, 10) #back_timer = Timer(10, 10)
logger.hr(f"UI goto {destination}") logger.hr(f"UI goto {destination}")
while 1: while 1:
if skip_first_screenshot: if skip_first_screenshot:
@ -177,14 +177,14 @@ class UI(MainPage):
if self.ui_additional(): if self.ui_additional():
continue continue
back_timer.start() #back_timer.start()
if back_timer.reached_and_reset(): #if back_timer.reached_and_reset():
if self.match_color(LOGIN_LOADING, interval=5, threshold=80) or self.appear_trademark_year(): # if self.match_color(LOGIN_LOADING, interval=5, threshold=80) or self.appear_trademark_year():
from tasks.login.login import Login # from tasks.login.login import Login
Login(self.config, self.device).handle_app_login() # Login(self.config, self.device).handle_app_login()
continue # continue
self.device.back() # self.device.back()
logger.info("Unknown page, try to back") # logger.info("Unknown page, try to back")
# Reset connection # Reset connection
Page.clear_connection() Page.clear_connection()
@ -372,6 +372,8 @@ class UI(MainPage):
return True return True
if self.handle_daily_news(): if self.handle_daily_news():
return True return True
if self.handle_quit():
return True
if self.handle_network_reconnect(): if self.handle_network_reconnect():
return True return True
if self.handle_affection_level_up(): if self.handle_affection_level_up():

View File

@ -83,7 +83,7 @@ class Shop(ShopUI):
return ShopStatus.SELECT_SHOP return ShopStatus.SELECT_SHOP
return ShopStatus.END return ShopStatus.END
case ShopStatus.END: case ShopStatus.END:
if self.appear(page_shop.check_button): if self.appear(page_shop.check_button) and self.match_color(page_shop.check_button):
self.task.pop(0) self.task.pop(0)
return ShopStatus.SELECT_SHOP return ShopStatus.SELECT_SHOP
self.click_with_interval(BACK, interval=2) self.click_with_interval(BACK, interval=2)