MCPcopy Create free account
hub / github.com/runhey/OnmyojiAutoScript / open_expect_level

Method open_expect_level

tasks/Exploration/script_task.py:78–109  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

76
77 # 查找指定的章节:
78 def open_expect_level(self):
79 swipeCount = 0
80 while 1:
81 # 探索的 config
82 explorationConfig = self.config.exploration
83
84 # 判断有无目标章节
85 self.screenshot()
86 # 获取当前章节名
87 results = self.O_E_EXPLORATION_LEVEL_NUMBER.detect_and_ocr(self.device.image)
88 text1 = [result.ocr_text for result in results]
89 # 判断当前章节有无目标章节
90 result = set(text1).intersection({explorationConfig.exploration_config.exploration_level})
91 # 有则跳出检测
92 if self.appear(self.I_E_EXPLORATION_CLICK) or result and len(result) > 0:
93 break
94 self.device.click_record_clear()
95 self.swipe(self.S_SWIPE_LEVEL_UP)
96 swipeCount += 1
97 if swipeCount >= 25:
98 return False
99
100 # 选中对应章节
101 while 1:
102 self.screenshot()
103 self.O_E_EXPLORATION_LEVEL_NUMBER.keyword = explorationConfig.exploration_config.exploration_level
104 if self.ocr_appear_click(self.O_E_EXPLORATION_LEVEL_NUMBER):
105 self.wait_until_appear(self.I_E_EXPLORATION_CLICK, wait_time=3)
106 if self.appear(self.I_E_EXPLORATION_CLICK):
107 break
108
109 return True
110
111 # 候补:
112 def enter_settings_and_do_operations(self):

Callers 1

runMethod · 0.95

Calls 7

detect_and_ocrMethod · 0.80
appearMethod · 0.80
click_record_clearMethod · 0.80
ocr_appear_clickMethod · 0.80
wait_until_appearMethod · 0.80
screenshotMethod · 0.45
swipeMethod · 0.45

Tested by

no test coverage detected