Upd: Support reward assets

This commit is contained in:
LmeSzinc 2024-05-08 13:55:14 +08:00
parent 5ce334ca8c
commit a271bf6ba5
5 changed files with 28 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@ -7,20 +7,20 @@ CAN_GET_REWARD = ButtonWrapper(
name='CAN_GET_REWARD',
share=Button(
file='./assets/share/freebies/support_reward/CAN_GET_REWARD.png',
area=(1066, 121, 1097, 144),
search=(1046, 101, 1117, 164),
color=(245, 225, 170),
button=(1066, 121, 1097, 144),
area=(1092, 181, 1123, 204),
search=(1072, 161, 1143, 224),
color=(246, 227, 173),
button=(1092, 181, 1123, 204),
),
)
IN_PROFILE = ButtonWrapper(
name='IN_PROFILE',
share=Button(
file='./assets/share/freebies/support_reward/IN_PROFILE.png',
area=(647, 128, 673, 146),
search=(627, 108, 693, 166),
area=(640, 155, 666, 173),
search=(620, 135, 686, 193),
color=(109, 97, 83),
button=(647, 128, 673, 146),
button=(640, 155, 666, 173),
),
)
MENU_TO_PROFILE = ButtonWrapper(
@ -50,3 +50,13 @@ PROFILE = ButtonWrapper(
button=(907, 102, 1092, 132),
),
)
REWARD_POPUP = ButtonWrapper(
name='REWARD_POPUP',
share=Button(
file='./assets/share/freebies/support_reward/REWARD_POPUP.png',
area=(883, 552, 914, 580),
search=(863, 532, 934, 600),
color=(88, 89, 114),
button=(883, 552, 914, 580),
),
)

View File

@ -1,13 +1,14 @@
from module.base.timer import Timer
from module.logger import logger
from tasks.base.assets.assets_base_page import MENU_CHECK
from tasks.base.assets.assets_base_page import CLOSE, MENU_CHECK
from tasks.base.page import page_menu
from tasks.base.ui import UI
from tasks.freebies.assets.assets_freebies_support_reward import (
CAN_GET_REWARD,
IN_PROFILE,
MENU_TO_PROFILE,
PROFILE
PROFILE,
REWARD_POPUP,
)
@ -70,6 +71,9 @@ class SupportReward(UI):
if self.reward_appear():
logger.info('Got reward')
break
if self.appear(REWARD_POPUP):
logger.info('Got reward popup')
break
if timeout.reached():
logger.warning('Get support reward timeout')
break
@ -96,10 +100,14 @@ class SupportReward(UI):
if self.appear(MENU_CHECK):
return True
if self.appear_then_click(REWARD_POPUP, interval=2):
logger.info(f'{REWARD_POPUP} - {CLOSE}')
self.device.click(CLOSE)
continue
if self.handle_ui_close(IN_PROFILE, interval=2):
continue
if self.handle_reward(click_button=CAN_GET_REWARD):
# # Avoid clicking on some other buttons
# Avoid clicking on some other buttons
continue