Upd: Language irrelevant assets for base/popup

This commit is contained in:
LmeSzinc 2023-09-17 05:00:16 +08:00
parent 194e4df4fe
commit d0cba894e0
16 changed files with 58 additions and 36 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -13,28 +13,6 @@ BATTLE_PASS_NOTIFICATION = ButtonWrapper(
button=(895, 595, 1180, 630), button=(895, 595, 1180, 630),
), ),
) )
CANCEL_POPUP = ButtonWrapper(
name='CANCEL_POPUP',
cn=Button(
file='./assets/cn/base/popup/CANCEL_POPUP.png',
area=(427, 536, 503, 562),
search=(321, 432, 661, 668),
color=(157, 156, 152),
button=(427, 536, 503, 562),
),
en=None,
)
CONFIRM_POPUP = ButtonWrapper(
name='CONFIRM_POPUP',
cn=Button(
file='./assets/cn/base/popup/CONFIRM_POPUP.png',
area=(774, 534, 855, 563),
search=(617, 434, 966, 652),
color=(170, 169, 166),
button=(774, 534, 855, 563),
),
en=None,
)
GET_REWARD = ButtonWrapper( GET_REWARD = ButtonWrapper(
name='GET_REWARD', name='GET_REWARD',
share=Button( share=Button(
@ -65,6 +43,26 @@ MONTHLY_CARD_REWARD = ButtonWrapper(
button=(741, 495, 1071, 644), button=(741, 495, 1071, 644),
), ),
) )
POPUP_CANCEL = ButtonWrapper(
name='POPUP_CANCEL',
share=Button(
file='./assets/share/base/popup/POPUP_CANCEL.png',
area=(428, 537, 452, 561),
search=(334, 453, 594, 653),
color=(98, 92, 80),
button=(419, 531, 512, 567),
),
)
POPUP_CONFIRM = ButtonWrapper(
name='POPUP_CONFIRM',
share=Button(
file='./assets/share/base/popup/POPUP_CONFIRM.png',
area=(776, 537, 800, 561),
search=(683, 464, 943, 644),
color=(95, 90, 78),
button=(767, 531, 862, 567),
),
)
POPUP_SINGLE = ButtonWrapper( POPUP_SINGLE = ButtonWrapper(
name='POPUP_SINGLE', name='POPUP_SINGLE',
share=Button( share=Button(

View File

@ -48,6 +48,32 @@ class PopupHandler(ModuleBase):
return False return False
def handle_popup_cancel(self, interval=2) -> bool:
"""
Args:
interval:
Returns:
If handled.
"""
if self.appear_then_click(POPUP_CANCEL, interval=interval):
return True
return False
def handle_popup_confirm(self, interval=2) -> bool:
"""
Args:
interval:
Returns:
If handled.
"""
if self.appear_then_click(POPUP_CONFIRM, interval=interval):
return True
return False
def handle_popup_single(self, interval=2) -> bool: def handle_popup_single(self, interval=2) -> bool:
""" """
Popup with one single confirm button in the middle. Popup with one single confirm button in the middle.

View File

@ -7,7 +7,7 @@ from module.base.timer import Timer
from module.base.utils import area_size, crop, rgb2luma, load_image, crop from module.base.utils import area_size, crop, rgb2luma, load_image, crop
from module.logger import logger from module.logger import logger
from module.ui.scroll import Scroll from module.ui.scroll import Scroll
from tasks.base.assets.assets_base_popup import CANCEL_POPUP from tasks.base.assets.assets_base_popup import POPUP_CANCEL
from tasks.base.ui import UI from tasks.base.ui import UI
from tasks.combat.assets.assets_combat_support import COMBAT_SUPPORT_ADD, COMBAT_SUPPORT_LIST, \ from tasks.combat.assets.assets_combat_support import COMBAT_SUPPORT_ADD, COMBAT_SUPPORT_LIST, \
COMBAT_SUPPORT_LIST_SCROLL, COMBAT_SUPPORT_SELECTED, COMBAT_SUPPORT_LIST_GRID COMBAT_SUPPORT_LIST_SCROLL, COMBAT_SUPPORT_SELECTED, COMBAT_SUPPORT_LIST_GRID
@ -209,12 +209,12 @@ class CombatSupport(UI):
self.device.click(COMBAT_TEAM_SUPPORT) self.device.click(COMBAT_TEAM_SUPPORT)
self.interval_reset(COMBAT_TEAM_SUPPORT) self.interval_reset(COMBAT_TEAM_SUPPORT)
continue continue
if self.appear(CANCEL_POPUP, interval=1): if self.appear(POPUP_CANCEL, interval=1):
logger.warning( logger.warning(
"selected identical character, trying select another") "selected identical character, trying select another")
self._cancel_popup() self._cancel_popup()
self._select_next_support() self._select_next_support()
self.interval_reset(CANCEL_POPUP) self.interval_reset(POPUP_CANCEL)
continue continue
if self.appear(COMBAT_SUPPORT_LIST, interval=1): if self.appear(COMBAT_SUPPORT_LIST, interval=1):
if support_character_name != "FirstCharacter": if support_character_name != "FirstCharacter":
@ -326,8 +326,7 @@ class CombatSupport(UI):
logger.info("Popup canceled") logger.info("Popup canceled")
return return
if self.appear(CANCEL_POPUP): if self.handle_popup_cancel():
self.device.click(CANCEL_POPUP)
continue continue
def _select_next_support(self): def _select_next_support(self):

View File

@ -5,7 +5,7 @@ from tasks.base.assets.assets_base_popup import GET_REWARD
from tasks.base.page import Page, page_menu, page_synthesize from tasks.base.page import Page, page_menu, page_synthesize
from tasks.base.ui import UI from tasks.base.ui import UI
from tasks.base.assets.assets_base_page import MENU_SCROLL from tasks.base.assets.assets_base_page import MENU_SCROLL
from tasks.base.assets.assets_base_popup import CONFIRM_POPUP from tasks.base.assets.assets_base_popup import POPUP_CONFIRM
from tasks.daily.assets.assets_daily_synthesize_consumable import * from tasks.daily.assets.assets_daily_synthesize_consumable import *
from tasks.daily.assets.assets_daily_synthesize_material import * from tasks.daily.assets.assets_daily_synthesize_material import *
@ -137,7 +137,7 @@ class SynthesizeUI(UI):
else: else:
self.device.screenshot() self.device.screenshot()
if self.appear(CONFIRM_POPUP): if self.appear(POPUP_CONFIRM):
logger.info('Synthesize confirm popup window appear') logger.info('Synthesize confirm popup window appear')
break break
# The recipe of the item has not been unlocked yet, but it can be unlocked now # The recipe of the item has not been unlocked yet, but it can be unlocked now
@ -161,8 +161,7 @@ class SynthesizeUI(UI):
logger.info('Synthesize consumable completed') logger.info('Synthesize consumable completed')
break break
# Synthesize confirm # Synthesize confirm
if self.appear_then_click(CONFIRM_POPUP): if self.handle_popup_confirm():
logger.info('Click the confirm button')
continue continue
def _back_to_synthesize_page(self, skip_first_screenshot=True): def _back_to_synthesize_page(self, skip_first_screenshot=True):

View File

@ -1,6 +1,6 @@
from module.ocr.ocr import * from module.ocr.ocr import *
from module.ui.scroll import Scroll from module.ui.scroll import Scroll
from tasks.base.assets.assets_base_popup import CONFIRM_POPUP from tasks.base.assets.assets_base_popup import POPUP_CONFIRM
from tasks.base.page import page_item from tasks.base.page import page_item
from tasks.daily.assets.assets_daily_synthesize_consumable import \ from tasks.daily.assets.assets_daily_synthesize_consumable import \
SIMPLE_PROTECTIVE_GEAR as SYNTHESIZE_SIMPLE_PROTECTIVE_GEAR, \ SIMPLE_PROTECTIVE_GEAR as SYNTHESIZE_SIMPLE_PROTECTIVE_GEAR, \
@ -110,7 +110,7 @@ class ConsumableUsageUI(ItemUI):
else: else:
self.device.screenshot() self.device.screenshot()
if self.appear(CONFIRM_POPUP): if self.appear(POPUP_CONFIRM):
logger.info('Item consumable usage popup appear') logger.info('Item consumable usage popup appear')
break break
if self.appear_then_click(USE_CONSUMABLE, interval=2): if self.appear_then_click(USE_CONSUMABLE, interval=2):
@ -129,6 +129,6 @@ class ConsumableUsageUI(ItemUI):
break break
# If there is already consumable effect, a confirmation box will pop up again, # If there is already consumable effect, a confirmation box will pop up again,
# so shorten the judgment interval of the confirmation box # so shorten the judgment interval of the confirmation box
if self.appear_then_click(CONFIRM_POPUP, interval=1): if self.handle_popup_confirm(interval=1):
logger.info('Confirm the use of consumable') logger.info('Confirm the use of consumable')
continue continue

View File

@ -1,7 +1,7 @@
from module.base.timer import Timer from module.base.timer import Timer
from module.logger import logger from module.logger import logger
from tasks.base.assets.assets_base_page import CLOSE from tasks.base.assets.assets_base_page import CLOSE
from tasks.base.assets.assets_base_popup import CONFIRM_POPUP, GET_REWARD from tasks.base.assets.assets_base_popup import GET_REWARD
from tasks.item.assets.assets_item_relics import * from tasks.item.assets.assets_item_relics import *
from tasks.item.keywords import KEYWORD_ITEM_TAB from tasks.item.keywords import KEYWORD_ITEM_TAB
from tasks.item.ui import ItemUI from tasks.item.ui import ItemUI
@ -60,7 +60,7 @@ class RelicsUI(ItemUI):
break break
if self.appear_then_click(SALVAGE, interval=2): if self.appear_then_click(SALVAGE, interval=2):
continue continue
if self.appear_then_click(CONFIRM_POPUP, interval=2): if self.handle_popup_confirm():
continue continue
skip_first_screenshot = True skip_first_screenshot = True