diff --git a/assets/cn/daily/PICTURE_TAKEN.png b/assets/cn/daily/PICTURE_TAKEN.png new file mode 100644 index 000000000..b0caea804 Binary files /dev/null and b/assets/cn/daily/PICTURE_TAKEN.png differ diff --git a/assets/share/base/page/CAMERA_CHECK.png b/assets/share/base/page/CAMERA_CHECK.png new file mode 100644 index 000000000..5dd991517 Binary files /dev/null and b/assets/share/base/page/CAMERA_CHECK.png differ diff --git a/assets/share/base/page/MENU_GOTO_CAMERA.png b/assets/share/base/page/MENU_GOTO_CAMERA.png new file mode 100644 index 000000000..2996c75d7 Binary files /dev/null and b/assets/share/base/page/MENU_GOTO_CAMERA.png differ diff --git a/assets/share/daily/TAKE_PICTURE.png b/assets/share/daily/TAKE_PICTURE.png new file mode 100644 index 000000000..5dd991517 Binary files /dev/null and b/assets/share/daily/TAKE_PICTURE.png differ diff --git a/tasks/base/assets/assets_base_page.py b/tasks/base/assets/assets_base_page.py index 70e8d1952..535255c9b 100644 --- a/tasks/base/assets/assets_base_page.py +++ b/tasks/base/assets/assets_base_page.py @@ -13,6 +13,16 @@ BATTLE_PASS_CHECK = ButtonWrapper( button=(42, 22, 72, 55), ), ) +CAMERA_CHECK = ButtonWrapper( + name='CAMERA_CHECK', + share=Button( + file='./assets/share/base/page/CAMERA_CHECK.png', + area=(1120, 346, 1160, 375), + search=(1100, 326, 1180, 395), + color=(215, 215, 215), + button=(1120, 346, 1160, 375), + ), +) CHARACTER_CHECK = ButtonWrapper( name='CHARACTER_CHECK', share=Button( @@ -203,6 +213,16 @@ MENU_CHECK = ButtonWrapper( button=(1222, 638, 1252, 669), ), ) +MENU_GOTO_CAMERA = ButtonWrapper( + name='MENU_GOTO_CAMERA', + share=Button( + file='./assets/share/base/page/MENU_GOTO_CAMERA.png', + area=(1219, 465, 1255, 495), + search=(1199, 445, 1275, 515), + color=(51, 52, 53), + button=(1219, 465, 1255, 495), + ), +) MESSAGE_CLOSE = ButtonWrapper( name='MESSAGE_CLOSE', share=Button( diff --git a/tasks/base/page.py b/tasks/base/page.py index 08da9df44..bc800f5f7 100644 --- a/tasks/base/page.py +++ b/tasks/base/page.py @@ -125,3 +125,8 @@ page_main.link(MAIN_GOTO_MISSION, destination=page_mission) page_message = Page(MESSAGE_CLOSE) page_message.link(MESSAGE_CLOSE, destination=page_main) page_main.link(MAIN_GOTO_MESSAGE, destination=page_message) + +# Camera +page_camera = Page(CAMERA_CHECK) +page_camera.link(CLOSE, destination=page_menu) +page_menu.link(MENU_GOTO_CAMERA, destination=page_camera) diff --git a/tasks/daily/assets/assets_daily.py b/tasks/daily/assets/assets_daily.py new file mode 100644 index 000000000..5f785afbc --- /dev/null +++ b/tasks/daily/assets/assets_daily.py @@ -0,0 +1,25 @@ +from module.base.button import Button, ButtonWrapper + +# This file was auto-generated, do not modify it manually. To generate: +# ``` python -m dev_tools.button_extract ``` + +PICTURE_TAKEN = ButtonWrapper( + name='PICTURE_TAKEN', + cn=Button( + file='./assets/cn/daily/PICTURE_TAKEN.png', + area=(1030, 620, 1069, 639), + search=(1010, 600, 1089, 659), + color=(153, 153, 155), + button=(1030, 620, 1069, 639), + ), +) +TAKE_PICTURE = ButtonWrapper( + name='TAKE_PICTURE', + share=Button( + file='./assets/share/daily/TAKE_PICTURE.png', + area=(1120, 346, 1160, 375), + search=(1100, 326, 1180, 395), + color=(215, 215, 215), + button=(1120, 346, 1160, 375), + ), +) diff --git a/tasks/daily/camera.py b/tasks/daily/camera.py new file mode 100644 index 000000000..d1fa2edc4 --- /dev/null +++ b/tasks/daily/camera.py @@ -0,0 +1,43 @@ +from module.logger import logger +from module.ocr.ocr import * +from tasks.base.page import page_camera +from tasks.base.ui import UI +from tasks.base.assets.assets_base_page import CLOSE +from tasks.daily.assets.assets_daily import * + +class CameraUI(UI): + def take_picture(self, skip_first_screenshot=True): + """ + Examples: + self = CameraUI('alas') + self.device.screenshot() + self.take_picture() + """ + self.ui_ensure(page_camera, skip_first_screenshot) + # Take picture + skip_first_screenshot = True + while 1: + if skip_first_screenshot: + skip_first_screenshot = False + else: + self.device.screenshot() + if self.appear_then_click(TAKE_PICTURE): + logger.info('Taking picture') + continue + if self.appear(PICTURE_TAKEN): + logger.info('Picture was taken') + break + # Quit from the picture ui + skip_first_screenshot = True + while 1: + if skip_first_screenshot: + skip_first_screenshot = False + else: + self.device.screenshot() + if self.appear(TAKE_PICTURE): + logger.info('Back to camera main page') + break + if self.appear_then_click(CLOSE): + logger.info('Photo page was exited') + continue + \ No newline at end of file