game_ui.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # This Python file uses the following encoding: utf-8
  2. # @author runhey
  3. # github https://github.com/runhey
  4. import time
  5. from tasks.GameUi.assets import GameUiAssets
  6. from tasks.base_task import BaseTask
  7. from tasks.GeneralBattle.general_battle import GeneralBattle
  8. from tasks.AreaBoss.assets import AreaBossAssets
  9. from module.logger import logger
  10. class GameUi(BaseTask, GameUiAssets):
  11. def home_explore(self) -> bool:
  12. """
  13. 使用ocr识别到探索按钮并点击
  14. :return:
  15. """
  16. while 1:
  17. self.screenshot()
  18. if self.ocr_appear_click(self.O_HOME_EXPLORE, interval=2):
  19. continue
  20. if self.appear(self.I_BACK_BLUE, threshold=0.6):
  21. break
  22. logger.info(f'Click {self.O_HOME_EXPLORE.name}')
  23. return True
  24. def explore_home(self) -> bool:
  25. """
  26. :return:
  27. """
  28. while 1:
  29. self.screenshot()
  30. if self.appear_then_click(self.I_BACK_BLUE, threshold=0.6, interval=2):
  31. continue
  32. if self.appear(self.I_HOME_SHIKIKAMI, threshold=0.6):
  33. break
  34. logger.info(f'Click {self.I_HOME_SHIKIKAMI.name}')
  35. return True