feat(task): 处理游戏本体需要更新的弹窗
This commit is contained in:
parent
87d64fafbb
commit
d9bedfc1ee
Binary file not shown.
After Width: | Height: | Size: 410 KiB |
|
@ -0,0 +1 @@
|
|||
{"definitions":{"71d6160f-ce9e-40fa-8d0b-8fa9cb3f841d":{"name":"Daily.BoxApkUpdateDialogTitle","displayName":"游戏本体更新提示对话框标题 区域","type":"hint-box","annotationId":"71d6160f-ce9e-40fa-8d0b-8fa9cb3f841d","useHintRect":false}},"annotations":[{"id":"71d6160f-ce9e-40fa-8d0b-8fa9cb3f841d","type":"rect","data":{"x1":26,"y1":905,"x2":342,"y2":967}}]}
|
|
@ -1,11 +1,21 @@
|
|||
class UnrecoverableError(Exception):
|
||||
class KotonebotError(Exception):
|
||||
pass
|
||||
|
||||
class ResourceFileMissingError(Exception):
|
||||
class KotonebotWarning(Warning):
|
||||
pass
|
||||
|
||||
class UnrecoverableError(KotonebotError):
|
||||
pass
|
||||
|
||||
class GameUpdateNeededError(UnrecoverableError):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
'Game update required. '
|
||||
'Please go to Play Store and update the game manually.'
|
||||
)
|
||||
|
||||
class ResourceFileMissingError(KotonebotError):
|
||||
def __init__(self, file_path: str, description: str):
|
||||
self.file_path = file_path
|
||||
self.description = description
|
||||
super().__init__(f'Resource file ({description}) "{file_path}" is missing.')
|
||||
|
||||
class KotonebotWarning(Warning):
|
||||
pass
|
||||
super().__init__(f'Resource file ({description}) "{file_path}" is missing.')
|
|
@ -1,7 +1,8 @@
|
|||
"""启动游戏,领取登录奖励,直到首页为止"""
|
||||
import logging
|
||||
|
||||
from kotonebot import task, device, image, cropped, AdaptiveWait, sleep
|
||||
from kotonebot import task, device, image, cropped, AdaptiveWait, sleep, ocr
|
||||
from kotonebot.errors import GameUpdateNeededError
|
||||
from . import R
|
||||
from .common import Priority
|
||||
from .actions.loading import loading
|
||||
|
@ -38,6 +39,9 @@ def start_game():
|
|||
# [screenshots/startup/update.png]
|
||||
elif image.find(R.Common.TextGameUpdate):
|
||||
device.click(image.expect(R.Common.ButtonConfirm))
|
||||
# [kotonebot-resource/sprites/jp/daily/screenshot_apk_update.png]
|
||||
elif ocr.find('アップデート', rect=R.Daily.BoxApkUpdateDialogTitle):
|
||||
raise GameUpdateNeededError()
|
||||
# [screenshots/startup/announcement1.png]
|
||||
elif image.find(R.Common.ButtonIconClose):
|
||||
device.click()
|
||||
|
|
Loading…
Reference in New Issue