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

Method answer

tasks/DemonEncounter/script_task.py:241–263  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

239 def _mail(self, target_click):
240 # 答题,还没有碰到过答题的
241 def answer():
242 click_match = {
243 1: self.C_ANSWER_1,
244 2: self.C_ANSWER_2,
245 3: self.C_ANSWER_3,
246 }
247 index = None
248 self.screenshot()
249 question = self.O_LETTER_QUESTION.detect_text(self.device.image)
250 question = question.replace('?', '').replace('?', '')
251 answer_1 = self.O_LETTER_ANSWER_1.detect_text(self.device.image)
252 answer_2 = self.O_LETTER_ANSWER_2.detect_text(self.device.image)
253 answer_3 = self.O_LETTER_ANSWER_3.detect_text(self.device.image)
254 if answer_1 == '其余选项皆对':
255 index = 1
256 elif answer_2 == '其余选项皆对':
257 index = 2
258 elif answer_3 == '其余选项皆对':
259 index = 3
260 if not index:
261 index = answer_one(question=question, options=[answer_1, answer_2, answer_3])
262 logger.info(f'Question: {question}, Answer: {index}')
263 return click_match[index]
264
265 while 1:
266 self.screenshot()

Callers

nothing calls this directly

Calls 3

answer_oneFunction · 0.90
detect_textMethod · 0.80
screenshotMethod · 0.45

Tested by

no test coverage detected