Skip to content

Commit

Permalink
模拟宇宙 修复进入首领前可能交互黑塔卡死
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorReid committed Sep 21, 2024
1 parent 701f364 commit b8453d7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
12 changes: 2 additions & 10 deletions src/sr/sim_uni/op/sim_uni_move/sim_uni_move_to_next_level_v2.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import time
from typing import Optional, List

import numpy as np
from cv2.typing import MatLike
from typing import Optional, List

from basic import str_utils
from basic.i18_utils import gt
from basic.log_utils import log
from sr.const import OPPOSITE_DIRECTION
from sr.context.context import Context
from sr.control import GameController
from sr.image.sceenshot import screen_state
from sr.operation import OperationOneRoundResult, OperationResult
from sr.operation.unit.interact import get_move_interact_words
from sr.screen_area.screen_normal_world import ScreenNormalWorld
from sr.sim_uni.op.move_in_sim_uni import MoveToNextLevel
from sr.sim_uni.op.sim_uni_move.sim_uni_move_by_detect import delta_angle_to_detected_object, turn_by_angle_slowly
from sr.sim_uni.sim_uni_const import SimUniLevelType
Expand Down Expand Up @@ -93,13 +91,7 @@ def _move_and_interact(self) -> OperationOneRoundResult:
now = time.time()

# 等待最开始的交互词消失了 就可以无脑交互了
need_ocr: bool = len(self.existed_interact_word) > 0
log.debug('是否需要OCR %s', need_ocr)
if not need_ocr:
self.ctx.controller.interact(
pos=ScreenNormalWorld.MOVE_INTERACT_SINGLE_LINE.value.center,
interact_type=GameController.MOVE_INTERACT_TYPE
)
need_ocr: bool = True # 现在OCR速度快 可以保持使用

screen = self.screenshot()

Expand Down
12 changes: 2 additions & 10 deletions src/sr/sim_uni/op/sim_uni_move/sim_uni_move_to_next_level_v3.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import time
from typing import Optional, List

import numpy as np
from cv2.typing import MatLike
from typing import Optional, List

from basic import str_utils, cal_utils
from basic.i18_utils import gt
Expand All @@ -14,7 +14,6 @@
from sr.image.sceenshot import screen_state, mini_map
from sr.operation import OperationOneRoundResult, StateOperation, StateOperationNode, Operation
from sr.operation.unit.interact import get_move_interact_words
from sr.screen_area.screen_normal_world import ScreenNormalWorld
from sr.sim_uni.op.move_in_sim_uni import MoveToNextLevel
from sr.sim_uni.op.sim_uni_move.sim_uni_move_by_detect import delta_angle_to_detected_object, turn_by_angle_slowly
from sr.sim_uni.sim_uni_const import SimUniLevelType, SimUniLevelTypeEnum
Expand Down Expand Up @@ -223,14 +222,7 @@ def move_and_interact(self) -> OperationOneRoundResult:
now = time.time()

# 出现过交互词 且消失了 就可以无脑交互了
need_ocr: bool = not self.existed_interact_word or len(self.current_interact_word) > 0
log.debug('是否需要OCR %s', need_ocr)
if not need_ocr:
self.ctx.controller.interact(
pos=ScreenNormalWorld.MOVE_INTERACT_SINGLE_LINE.value.center,
interact_type=GameController.MOVE_INTERACT_TYPE
)
time.sleep(0.2)
need_ocr: bool = True # 现在OCR速度快 可以保持使用

screen = self.screenshot()

Expand Down
2 changes: 1 addition & 1 deletion version.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: "2.5.0"
version: "2.5.1"

0 comments on commit b8453d7

Please sign in to comment.