Просмотр исходного кода

fix: Appear special pop-ups when goto daily

runhey 3 лет назад
Родитель
Сommit
a713e92ce8
2 измененных файлов с 33 добавлено и 6 удалено
  1. 31 5
      tasks/GameUi/game_ui.py
  2. 2 1
      tasks/TalismanPass/script_task.py

+ 31 - 5
tasks/GameUi/game_ui.py

@@ -20,16 +20,21 @@ class GameUi(BaseTask, GameUiAssets):
     ui_current: Page = None
     ui_current: Page = None
     ui_pages = [page_main, page_summon, page_exploration, page_town,
     ui_pages = [page_main, page_summon, page_exploration, page_town,
                 # 探索的
                 # 探索的
-                page_awake_zones, page_soul_zones, page_realm_raid, page_goryou_realm, page_delegation, page_secret_zones, page_area_boss, page_heian_kitan, page_six_gates, page_bondling_fairyland, page_kekkai_toppa,
+                page_awake_zones, page_soul_zones, page_realm_raid, page_goryou_realm, page_delegation,
+                page_secret_zones, page_area_boss, page_heian_kitan, page_six_gates, page_bondling_fairyland,
+                page_kekkai_toppa,
                 # 町中的
                 # 町中的
                 page_duel, page_demon_encounter, page_hunt, page_draft_duel, page_hyakkisen,
                 page_duel, page_demon_encounter, page_hunt, page_draft_duel, page_hyakkisen,
                 # 庭院里面的
                 # 庭院里面的
-                page_shikigami_records, page_onmyodo, page_friends, page_daily, page_mall, page_guild, page_team, page_collection
+                page_shikigami_records, page_onmyodo, page_friends, page_daily, page_mall, page_guild, page_team,
+                page_collection
                 ]
                 ]
     ui_close = [GameUiAssets.I_BACK_BLUE, GameUiAssets.I_BACK_Y, GameUiAssets.I_BACK_MALL,
     ui_close = [GameUiAssets.I_BACK_BLUE, GameUiAssets.I_BACK_Y, GameUiAssets.I_BACK_MALL,
                 GameUiAssets.I_BACK_FRIENDS, GameUiAssets.I_BACK_DAILY,
                 GameUiAssets.I_BACK_FRIENDS, GameUiAssets.I_BACK_DAILY,
-                GameUiAssets.I_BONDLING_GOTO_EXPLORATION, GameUiAssets.I_REALM_RAID_GOTO_EXPLORATION, GameUiAssets.I_SIX_GATES_GOTO_EXPLORATION, GameUiAssets.I_SUMMON_GOTO_MAIN
+                GameUiAssets.I_BONDLING_GOTO_EXPLORATION, GameUiAssets.I_REALM_RAID_GOTO_EXPLORATION,
+                GameUiAssets.I_SIX_GATES_GOTO_EXPLORATION, GameUiAssets.I_SUMMON_GOTO_MAIN
                 ]
                 ]
+
     def home_explore(self) -> bool:
     def home_explore(self) -> bool:
         """
         """
         使用ocr识别到探索按钮并点击
         使用ocr识别到探索按钮并点击
@@ -144,7 +149,6 @@ class GameUi(BaseTask, GameUiAssets):
         logger.critical("Please switch to a supported page before starting oas")
         logger.critical("Please switch to a supported page before starting oas")
         raise GamePageUnknownError
         raise GamePageUnknownError
 
 
-
     def ui_button_interval_reset(self, button):
     def ui_button_interval_reset(self, button):
         """
         """
         Reset interval of some button to avoid mistaken clicks
         Reset interval of some button to avoid mistaken clicks
@@ -183,7 +187,6 @@ class GameUi(BaseTask, GameUiAssets):
                 break
                 break
             visited = new
             visited = new
 
 
-
         logger.hr(f"UI goto {destination}")
         logger.hr(f"UI goto {destination}")
         confirm_timer = Timer(confirm_wait, count=int(confirm_wait // 0.5)).start()
         confirm_timer = Timer(confirm_wait, count=int(confirm_wait // 0.5)).start()
         while 1:
         while 1:
@@ -238,10 +241,33 @@ class GameUi(BaseTask, GameUiAssets):
         for page in self.ui_pages:
         for page in self.ui_pages:
             page.parent = None
             page.parent = None
 
 
+    # ------------------------------------------------------------------------------------------------------------------
+    # 下面的这些是一些特殊的页面,需要额外处理
+    # ------------------------------------------------------------------------------------------------------------------
+
+    def main_goto_daily(self):
+        """
+        无法直接一步到花合战,需要先到主页,然后再到花合战
+        :return:
+        """
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_CHECK_DAILY):
+                break
+            if self.appear_then_click(self.I_MAIN_GOTO_DAILY, interval=1):
+                continue
+            if self.ocr_appear_click(self.O_CLICK_CLOSE_1, interval=1):
+                continue
+            if self.ocr_appear_click(self.O_CLICK_CLOSE_2, interval=1):
+                continue
+        logger.info('Page arrive: Daily')
+        return
+
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
     from module.config.config import Config
     from module.config.config import Config
     from module.device.device import Device
     from module.device.device import Device
+
     c = Config('oas1')
     c = Config('oas1')
     d = Device(c)
     d = Device(c)
     game = GameUi(config=c, device=d)
     game = GameUi(config=c, device=d)

+ 2 - 1
tasks/TalismanPass/script_task.py

@@ -14,7 +14,8 @@ class ScriptTask(GameUi, TalismanPassAssets):
 
 
     def run(self):
     def run(self):
         self.ui_get_current_page()
         self.ui_get_current_page()
-        self.ui_goto(page_daily)
+        self.ui_goto(page_main)
+        self.main_goto_daily()
 
 
         # 收取全部奖励
         # 收取全部奖励
         self.get_all()
         self.get_all()