Skip to content

Commit

Permalink
#238 调试模式加入自动保存模拟宇宙截图
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorReid committed Apr 19, 2024
1 parent 125fecd commit bbdb611
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/sr/one_dragon_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,22 @@ def proxy_address(self) -> Optional[str]:
proxy = self.personal_proxy
return None if proxy == '' else proxy
return None


@property
def screen_sim_uni_route(self) -> List[str]:
"""
完成了截图的模拟宇宙路线
:return:
"""
return self.get('screen_sim_uni_route', [])

def add_screen_sim_uni_route(self, route_id: str):
"""
增加完成了截图的模拟宇宙路线
:param route_id:
:return:
"""
old_list = self.screen_sim_uni_route
old_list.append(route_id)
self.update('screen_sim_uni_route', old_list)
8 changes: 8 additions & 0 deletions src/sr/sim_uni/op/sim_uni_run_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ def _before_route(self) -> OperationOneRoundResult:
interact_pos = self._cal_interact_pos()

if self.level_type == SimUniLevelTypeEnum.RESPITE.value:
if self.ctx.one_dragon_config.is_debug:
if self.route.display_name not in self.ctx.one_dragon_config.screen_sim_uni_route:
self.ctx.one_dragon_config.add_screen_sim_uni_route(self.route.display_name)
return Operation.round_fail('%s 未进行截图' % self.route.display_name)
op = SimUniEnterFight(self.ctx, config=self.config, disposable=True) # 攻击可破坏物 统一用这个处理大乐透
op_result = op.execute()
if not op_result.success:
Expand Down Expand Up @@ -583,6 +587,10 @@ def _before_route(self) -> OperationOneRoundResult:
检测小地图上的红点 识别敌人 在大地图上的哪个位置
:return:
"""
if self.ctx.one_dragon_config.is_debug:
if self.route.display_name not in self.ctx.one_dragon_config.screen_sim_uni_route:
self.ctx.one_dragon_config.add_screen_sim_uni_route(self.route.display_name)
return Operation.round_fail('%s 未进行截图' % self.route.display_name)
screen = self.screenshot()
mm = mini_map.cut_mini_map(screen, self.ctx.game_config.mini_map_pos)
red_pos = mini_map.find_one_enemy_pos(self.ctx.im, mm=mm)
Expand Down

0 comments on commit bbdb611

Please sign in to comment.