Fix: Handle mail full popup

This commit is contained in:
LmeSzinc 2024-06-03 09:30:59 +08:00
parent 73c1f914c9
commit 77d48937fc
10 changed files with 35 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -8,6 +8,7 @@ from module.exception import GameNotRunningError
from module.handler.assets import *
from module.logger import logger
from module.os_handler.assets import CLICK_SAFE_AREA as OS_CLICK_SAFE_AREA
from module.ui_white.assets import POPUP_SINGLE_WHITE, POPUP_CONFIRM_WHITE, POPUP_CANCEL_WHITE
def info_letter_preprocess(image):
@ -99,6 +100,11 @@ class InfoHandler(ModuleBase):
self.device.click(POPUP_CONFIRM)
POPUP_CONFIRM.name = POPUP_CONFIRM.name[:-len(name) - 1]
return True
if self.appear(POPUP_CONFIRM_WHITE, offset=offset, interval=interval):
POPUP_CONFIRM_WHITE.name = POPUP_CONFIRM_WHITE.name + '_' + name
self.device.click(POPUP_CONFIRM_WHITE)
POPUP_CONFIRM_WHITE.name = POPUP_CONFIRM_WHITE.name[:-len(name) - 1]
return True
return False
def handle_popup_cancel(self, name='', offset=None, interval=2):
@ -110,6 +116,11 @@ class InfoHandler(ModuleBase):
self.device.click(POPUP_CANCEL)
POPUP_CANCEL.name = POPUP_CANCEL.name[:-len(name) - 1]
return True
if self.appear(POPUP_CANCEL_WHITE, offset=offset, interval=interval):
POPUP_CANCEL_WHITE.name = POPUP_CANCEL_WHITE.name + '_' + name
self.device.click(POPUP_CONFIRM_WHITE)
POPUP_CANCEL_WHITE.name = POPUP_CANCEL_WHITE.name[:-len(name) - 1]
return True
return False
def handle_popup_single(self, name='', offset=None, interval=2):
@ -124,8 +135,16 @@ class InfoHandler(ModuleBase):
return False
def handle_popup_single_white(self, interval=2):
if self.appear_then_click(POPUP_SINGLE_WHITE, offset=(20, 20), interval=interval):
return True
return False
def popup_interval_clear(self):
self.interval_clear([POPUP_CANCEL, POPUP_CONFIRM])
self.interval_clear([
POPUP_CANCEL, POPUP_CONFIRM,
POPUP_CANCEL_WHITE, POPUP_CONFIRM_WHITE,
])
_hot_fix_check_wait = Timer(6)

View File

@ -270,6 +270,12 @@ page_build.link(button=GOTO_MAIN, destination=page_main)
page_main.link(button=MAIN_GOTO_BUILD, destination=page_build)
page_main_white.link(button=MAIN_GOTO_BUILD_WHITE, destination=page_build)
# Mail
page_mail = Page(MAIL_CHECK)
page_mail.link(button=GOTO_MAIN_WHITE, destination=page_main)
# Mail enter varies from different UI
# page_main.link(button=MAIL_ENTER_WHITE, destination=page_mail)
# RPG event (raid_20240328)
page_rpg_stage = Page(RPG_GOTO_STORY)
page_rpg_story = Page(RPG_GOTO_STAGE)

View File

@ -391,6 +391,9 @@ class UI(InfoHandler):
# Item expired offset=(37, 72), skin expired, offset=(24, 68)
if self.handle_popup_single(offset=(-6, 48, 54, 88), name='ITEM_EXPIRED'):
return True
# Mail full popup
if self.handle_popup_single_white():
return True
# Routed from confirm click
if self.appear(SHIPYARD_CHECK, offset=(30, 30), interval=3):
logger.info(f'UI additional: {SHIPYARD_CHECK} -> {GOTO_MAIN}')

View File

@ -4,6 +4,9 @@ from module.base.template import Template
# This file was automatically generated by dev_tools/button_extract.py.
# Don't modify it manually.
BACK_ARROW_WHITE = Button(area={'cn': (54, 30, 69, 53), 'en': (54, 30, 69, 53), 'jp': (54, 30, 69, 53), 'tw': (54, 30, 69, 53)}, color={'cn': (199, 199, 199), 'en': (199, 199, 199), 'jp': (199, 199, 199), 'tw': (199, 199, 199)}, button={'cn': (54, 30, 69, 53), 'en': (54, 30, 69, 53), 'jp': (54, 30, 69, 53), 'tw': (54, 30, 69, 53)}, file={'cn': './assets/cn/ui_white/BACK_ARROW_WHITE.png', 'en': './assets/cn/ui_white/BACK_ARROW_WHITE.png', 'jp': './assets/cn/ui_white/BACK_ARROW_WHITE.png', 'tw': './assets/cn/ui_white/BACK_ARROW_WHITE.png'})
GOTO_MAIN_WHITE = Button(area={'cn': (1211, 24, 1239, 47), 'en': (1211, 24, 1239, 47), 'jp': (1211, 24, 1239, 47), 'tw': (1211, 24, 1239, 47)}, color={'cn': (151, 151, 152), 'en': (151, 151, 152), 'jp': (151, 151, 152), 'tw': (151, 151, 152)}, button={'cn': (1211, 24, 1239, 47), 'en': (1211, 24, 1239, 47), 'jp': (1211, 24, 1239, 47), 'tw': (1211, 24, 1239, 47)}, file={'cn': './assets/cn/ui_white/GOTO_MAIN_WHITE.png', 'en': './assets/cn/ui_white/GOTO_MAIN_WHITE.png', 'jp': './assets/cn/ui_white/GOTO_MAIN_WHITE.png', 'tw': './assets/cn/ui_white/GOTO_MAIN_WHITE.png'})
MAIL_CHECK = Button(area={'cn': (141, 21, 181, 41), 'en': (141, 21, 181, 41), 'jp': (141, 21, 181, 41), 'tw': (141, 21, 181, 41)}, color={'cn': (101, 109, 122), 'en': (101, 109, 122), 'jp': (101, 109, 122), 'tw': (101, 109, 122)}, button={'cn': (141, 21, 181, 41), 'en': (141, 21, 181, 41), 'jp': (141, 21, 181, 41), 'tw': (141, 21, 181, 41)}, file={'cn': './assets/cn/ui_white/MAIL_CHECK.png', 'en': './assets/cn/ui_white/MAIL_CHECK.png', 'jp': './assets/cn/ui_white/MAIL_CHECK.png', 'tw': './assets/cn/ui_white/MAIL_CHECK.png'})
MAIL_ENTER_WHITE = Button(area={'cn': (1018, 22, 1087, 52), 'en': (1018, 22, 1085, 52), 'jp': (1020, 23, 1084, 51), 'tw': (1019, 21, 1086, 52)}, color={'cn': (194, 187, 190), 'en': (196, 194, 194), 'jp': (195, 187, 190), 'tw': (204, 196, 200)}, button={'cn': (1018, 22, 1087, 52), 'en': (1018, 22, 1085, 52), 'jp': (1020, 23, 1084, 51), 'tw': (1019, 21, 1086, 52)}, file={'cn': './assets/cn/ui_white/MAIL_ENTER_WHITE.png', 'en': './assets/en/ui_white/MAIL_ENTER_WHITE.png', 'jp': './assets/jp/ui_white/MAIL_ENTER_WHITE.png', 'tw': './assets/tw/ui_white/MAIL_ENTER_WHITE.png'})
MAIN_GOTO_BUILD_WHITE = Button(area={'cn': (959, 657, 1103, 703), 'en': (959, 657, 1104, 703), 'jp': (959, 657, 1105, 703), 'tw': (959, 657, 1105, 703)}, color={'cn': (229, 216, 216), 'en': (226, 220, 222), 'jp': (225, 216, 218), 'tw': (223, 212, 218)}, button={'cn': (959, 657, 1103, 703), 'en': (959, 657, 1104, 703), 'jp': (959, 657, 1105, 703), 'tw': (959, 657, 1105, 703)}, file={'cn': './assets/cn/ui_white/MAIN_GOTO_BUILD_WHITE.png', 'en': './assets/en/ui_white/MAIN_GOTO_BUILD_WHITE.png', 'jp': './assets/jp/ui_white/MAIN_GOTO_BUILD_WHITE.png', 'tw': './assets/tw/ui_white/MAIN_GOTO_BUILD_WHITE.png'})
MAIN_GOTO_CAMPAIGN_WHITE = Button(area={'cn': (1132, 529, 1187, 557), 'en': (1126, 549, 1219, 577), 'jp': (1133, 528, 1186, 554), 'tw': (1133, 527, 1188, 554)}, color={'cn': (152, 161, 161), 'en': (156, 164, 165), 'jp': (156, 165, 165), 'tw': (143, 152, 151)}, button={'cn': (1124, 437, 1260, 579), 'en': (1123, 439, 1260, 580), 'jp': (1123, 438, 1260, 580), 'tw': (1124, 437, 1260, 580)}, file={'cn': './assets/cn/ui_white/MAIN_GOTO_CAMPAIGN_WHITE.png', 'en': './assets/en/ui_white/MAIN_GOTO_CAMPAIGN_WHITE.png', 'jp': './assets/jp/ui_white/MAIN_GOTO_CAMPAIGN_WHITE.png', 'tw': './assets/tw/ui_white/MAIN_GOTO_CAMPAIGN_WHITE.png'})
@ -17,6 +20,9 @@ MAIN_GOTO_REWARD_WHITE = Button(area={'cn': (11, 209, 30, 259), 'en': (11, 216,
MAIN_GOTO_SHOP_WHITE = Button(area={'cn': (18, 656, 164, 703), 'en': (18, 656, 165, 703), 'jp': (19, 657, 165, 702), 'tw': (19, 657, 164, 702)}, color={'cn': (221, 214, 212), 'en': (232, 220, 204), 'jp': (231, 223, 218), 'tw': (232, 224, 222)}, button={'cn': (18, 656, 164, 703), 'en': (18, 656, 165, 703), 'jp': (19, 657, 165, 702), 'tw': (19, 657, 164, 702)}, file={'cn': './assets/cn/ui_white/MAIN_GOTO_SHOP_WHITE.png', 'en': './assets/en/ui_white/MAIN_GOTO_SHOP_WHITE.png', 'jp': './assets/jp/ui_white/MAIN_GOTO_SHOP_WHITE.png', 'tw': './assets/tw/ui_white/MAIN_GOTO_SHOP_WHITE.png'})
MAIN_GOTO_STORAGE_WHITE = Button(area={'cn': (331, 656, 478, 703), 'en': (331, 657, 478, 703), 'jp': (332, 657, 478, 703), 'tw': (332, 657, 477, 702)}, color={'cn': (212, 214, 219), 'en': (214, 215, 216), 'jp': (220, 217, 223), 'tw': (216, 214, 217)}, button={'cn': (331, 656, 478, 703), 'en': (331, 657, 478, 703), 'jp': (332, 657, 478, 703), 'tw': (332, 657, 477, 702)}, file={'cn': './assets/cn/ui_white/MAIN_GOTO_STORAGE_WHITE.png', 'en': './assets/en/ui_white/MAIN_GOTO_STORAGE_WHITE.png', 'jp': './assets/jp/ui_white/MAIN_GOTO_STORAGE_WHITE.png', 'tw': './assets/tw/ui_white/MAIN_GOTO_STORAGE_WHITE.png'})
MISSION_NOTICE_WHITE = Button(area={'cn': (923, 657, 947, 671), 'en': (923, 657, 947, 671), 'jp': (923, 657, 947, 671), 'tw': (923, 657, 947, 671)}, color={'cn': (227, 168, 159), 'en': (227, 168, 159), 'jp': (227, 168, 159), 'tw': (227, 168, 159)}, button={'cn': (923, 657, 947, 671), 'en': (923, 657, 947, 671), 'jp': (923, 657, 947, 671), 'tw': (923, 657, 947, 671)}, file={'cn': './assets/cn/ui_white/MISSION_NOTICE_WHITE.png', 'en': './assets/en/ui_white/MISSION_NOTICE_WHITE.png', 'jp': './assets/jp/ui_white/MISSION_NOTICE_WHITE.png', 'tw': './assets/tw/ui_white/MISSION_NOTICE_WHITE.png'})
POPUP_CANCEL_WHITE = Button(area={'cn': (487, 491, 531, 513), 'en': (487, 491, 531, 513), 'jp': (487, 491, 531, 513), 'tw': (487, 491, 531, 513)}, color={'cn': (214, 214, 214), 'en': (214, 214, 214), 'jp': (214, 214, 214), 'tw': (214, 214, 214)}, button={'cn': (487, 491, 531, 513), 'en': (487, 491, 531, 513), 'jp': (487, 491, 531, 513), 'tw': (487, 491, 531, 513)}, file={'cn': './assets/cn/ui_white/POPUP_CANCEL_WHITE.png', 'en': './assets/cn/ui_white/POPUP_CANCEL_WHITE.png', 'jp': './assets/cn/ui_white/POPUP_CANCEL_WHITE.png', 'tw': './assets/cn/ui_white/POPUP_CANCEL_WHITE.png'})
POPUP_CONFIRM_WHITE = Button(area={'cn': (746, 494, 791, 515), 'en': (746, 494, 791, 515), 'jp': (746, 494, 791, 515), 'tw': (746, 494, 791, 515)}, color={'cn': (133, 216, 255), 'en': (133, 216, 255), 'jp': (133, 216, 255), 'tw': (133, 216, 255)}, button={'cn': (746, 494, 791, 515), 'en': (746, 494, 791, 515), 'jp': (746, 494, 791, 515), 'tw': (746, 494, 791, 515)}, file={'cn': './assets/cn/ui_white/POPUP_CONFIRM_WHITE.png', 'en': './assets/cn/ui_white/POPUP_CONFIRM_WHITE.png', 'jp': './assets/cn/ui_white/POPUP_CONFIRM_WHITE.png', 'tw': './assets/cn/ui_white/POPUP_CONFIRM_WHITE.png'})
POPUP_SINGLE_WHITE = Button(area={'cn': (623, 493, 668, 515), 'en': (623, 493, 668, 515), 'jp': (623, 493, 668, 515), 'tw': (623, 493, 668, 515)}, color={'cn': (131, 215, 255), 'en': (131, 215, 255), 'jp': (131, 215, 255), 'tw': (131, 215, 255)}, button={'cn': (623, 493, 668, 515), 'en': (623, 493, 668, 515), 'jp': (623, 493, 668, 515), 'tw': (623, 493, 668, 515)}, file={'cn': './assets/cn/ui_white/POPUP_SINGLE_WHITE.png', 'en': './assets/cn/ui_white/POPUP_SINGLE_WHITE.png', 'jp': './assets/cn/ui_white/POPUP_SINGLE_WHITE.png', 'tw': './assets/cn/ui_white/POPUP_SINGLE_WHITE.png'})
REWARD_1_WHITE = Button(area={'cn': (437, 278, 496, 306), 'en': (411, 283, 523, 300), 'jp': (443, 282, 493, 306), 'tw': (441, 280, 490, 306)}, color={'cn': (255, 193, 97), 'en': (255, 212, 150), 'jp': (255, 196, 106), 'tw': (255, 199, 111)}, button={'cn': (437, 278, 496, 306), 'en': (411, 283, 523, 300), 'jp': (443, 282, 493, 306), 'tw': (441, 280, 490, 306)}, file={'cn': './assets/cn/ui_white/REWARD_1_WHITE.png', 'en': './assets/en/ui_white/REWARD_1_WHITE.png', 'jp': './assets/jp/ui_white/REWARD_1_WHITE.png', 'tw': './assets/tw/ui_white/REWARD_1_WHITE.png'})
REWARD_2_WHITE = Button(area={'cn': (436, 419, 497, 448), 'en': (411, 425, 523, 442), 'jp': (443, 422, 493, 447), 'tw': (439, 422, 490, 448)}, color={'cn': (255, 192, 94), 'en': (255, 212, 146), 'jp': (255, 195, 104), 'tw': (255, 198, 109)}, button={'cn': (436, 419, 497, 448), 'en': (411, 425, 523, 442), 'jp': (443, 422, 493, 447), 'tw': (439, 422, 490, 448)}, file={'cn': './assets/cn/ui_white/REWARD_2_WHITE.png', 'en': './assets/en/ui_white/REWARD_2_WHITE.png', 'jp': './assets/jp/ui_white/REWARD_2_WHITE.png', 'tw': './assets/tw/ui_white/REWARD_2_WHITE.png'})
REWARD_GOTO_COMMISSION_WHITE = Button(area={'cn': (440, 278, 494, 307), 'en': (420, 283, 512, 300), 'jp': (441, 280, 491, 305), 'tw': (440, 279, 489, 306)}, color={'cn': (103, 207, 255), 'en': (149, 220, 255), 'jp': (119, 212, 255), 'tw': (113, 211, 255)}, button={'cn': (440, 278, 494, 307), 'en': (420, 283, 512, 300), 'jp': (441, 280, 491, 305), 'tw': (440, 279, 489, 306)}, file={'cn': './assets/cn/ui_white/REWARD_GOTO_COMMISSION_WHITE.png', 'en': './assets/en/ui_white/REWARD_GOTO_COMMISSION_WHITE.png', 'jp': './assets/jp/ui_white/REWARD_GOTO_COMMISSION_WHITE.png', 'tw': './assets/tw/ui_white/REWARD_GOTO_COMMISSION_WHITE.png'})