Skip to content

Commit

Permalink
#229 锄大地开始时切换到1号位
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorReid committed Apr 6, 2024
1 parent 66f6e01 commit ea6e204
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
7 changes: 5 additions & 2 deletions src/sr/app/world_patrol/world_patrol_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from sr.context import Context
from sr.image.sceenshot import mini_map
from sr.operation import Operation, OperationResult, StateOperationEdge, StateOperationNode, OperationOneRoundResult
from sr.operation.combine.choose_team_in_world import ChooseTeamInWorld
from sr.operation.common.back_to_normal_world_plus import BackToNormalWorldPlus
from sr.operation.unit.team import SwitchMember, ChooseTeamInWorld


class WorldPatrol(Application):
Expand All @@ -30,8 +30,11 @@ def __init__(self, ctx: Context,
team = StateOperationNode('选择配队', self._choose_team)
edges.append(StateOperationEdge(world, team))

switch = StateOperationNode('切换1号位', op=SwitchMember(ctx, 1))
edges.append(StateOperationEdge(team, switch))

route = StateOperationNode('运行路线', self._run_route)
edges.append(StateOperationEdge(team, route, ignore_status=True))
edges.append(StateOperationEdge(switch, route, ignore_status=True))
edges.append(StateOperationEdge(route, route, ignore_status=False))

super().__init__(ctx, op_name=gt('锄大地', 'ui'),
Expand Down
23 changes: 0 additions & 23 deletions src/sr/operation/combine/choose_team_in_world.py

This file was deleted.

24 changes: 24 additions & 0 deletions src/sr/operation/unit/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
from basic.i18_utils import gt
from basic.img import cv2_utils
from basic.log_utils import log
from sr.const import phone_menu_const
from sr.const.character_const import Character, CHARACTER_LIST
from sr.context import Context
from sr.image.sceenshot import screen_state
from sr.operation import Operation, OperationOneRoundResult, StateOperation, StateOperationNode, StateOperationEdge
from sr.operation.battle.choose_team import ChooseTeam
from sr.operation.common.back_to_normal_world_plus import BackToNormalWorldPlus
from sr.operation.unit.menu.click_phone_menu_item import ClickPhoneMenuItem
from sr.operation.unit.menu.open_phone_menu import OpenPhoneMenu
from sr.screen_area import ScreenArea
from sr.screen_area.dialog import ScreenDialog
from sr.screen_area.screen_normal_world import ScreenNormalWorld
Expand Down Expand Up @@ -241,3 +246,22 @@ def _wait_after_confirm(self) -> OperationOneRoundResult:
return Operation.round_success()
else:
return Operation.round_retry('未在大世界画面', wait=1)


class ChooseTeamInWorld(StateOperation):

def __init__(self, ctx: Context, team_num: int):
"""
在大世界中 根据队伍编号选择配队 选择后再返回大世界页面
:param ctx: 上下文
:param team_num: 队伍编号 从1开始
"""
nodes = [
StateOperationNode('返回大世界', op=BackToNormalWorldPlus(ctx)),
StateOperationNode('菜单', op=OpenPhoneMenu(ctx)),
StateOperationNode('编队', op=ClickPhoneMenuItem(ctx, phone_menu_const.TEAM_SETUP)),
StateOperationNode('选择组队', op=ChooseTeam(ctx, team_num, on=True)),
StateOperationNode('返回', op=BackToNormalWorldPlus(ctx)),
]
super().__init__(ctx, op_name=gt('选择配队', 'ui'),
nodes=nodes)

0 comments on commit ea6e204

Please sign in to comment.