1212from one_dragon .base .operation .operation_edge import node_from
1313from one_dragon .base .operation .operation_node import operation_node
1414from one_dragon .base .operation .operation_round_result import (
15- OperationRoundResult ,
15+ OperationRoundResult , OperationRoundResultEnum ,
1616)
1717from one_dragon .utils import cv2_utils , str_utils
1818from one_dragon .utils .i18_utils import gt
@@ -311,10 +311,14 @@ def check_game_tutorial(self) -> OperationRoundResult:
311311 def check_knock_knock (self ) -> OperationRoundResult :
312312 """
313313 判断是否在短信中
314+ 返回值:
315+ wait 表示检测成功, 上游执行 wait 操作
316+ retry 表示检测失败, 上游会继续检测别的场景
317+ 本函数不返回 success 和 fail
314318 """
315319 result = self .round_by_find_area (self .last_screenshot , '委托助手' , '标题-短信' )
316320 if not result .is_success :
317- return result
321+ return self . round_retry ()
318322
319323 area = self .ctx .screen_loader .get_area ('委托助手' , '区域-短信-文本框' )
320324 ocr_result_list = self .ctx .ocr_service .get_ocr_result_list (image = self .last_screenshot , rect = area .rect )
@@ -326,15 +330,19 @@ def check_knock_knock(self) -> OperationRoundResult:
326330 bottom_text = mr .data
327331
328332 if bottom_text is None :
329- return self .round_fail ()
333+ return self .round_retry ()
330334
331335 if '以上为最新' in bottom_text :
332- return self .round_by_find_and_click_area (self .last_screenshot , '委托助手' , '按钮-短信-关闭' )
336+ result = self .round_by_find_and_click_area (self .last_screenshot , '委托助手' , '按钮-短信-关闭' )
337+ if result .is_success :
338+ return self .round_wait (result .status , wait = 1 )
339+ else :
340+ return self .round_retry ()
333341 elif str_utils .find_by_lcs ('密友同行' , bottom_text , 0.75 ):
334- return self .round_success ('忽略密友同行界面' , wait = 1 )
342+ return self .round_wait ('忽略密友同行界面' , wait = 1 )
335343
336344 self .ctx .controller .click (bottom_mr .center )
337- return self .round_success (bottom_text )
345+ return self .round_wait (bottom_text , wait = 0.3 )
338346
339347 @node_from (from_name = '委托助手' , status = '自动战斗模式' )
340348 @operation_node (name = '自动战斗模式' )
@@ -483,8 +491,8 @@ def story_mode(self) -> OperationRoundResult:
483491 return self .round_wait (result .status , wait = 1 )
484492 # 判断短信
485493 result = self .check_knock_knock ()
486- if result .is_success :
487- return self . round_wait ( result . status , wait = 0.3 )
494+ if result .result == OperationRoundResultEnum . WAIT :
495+ return result
488496 # 判断钓鱼
489497 result = self .check_fishing ()
490498 if result is not None :
0 commit comments