fix(okww): 为账号切换前添加游戏窗口与可执行登录态就绪轮询判定,兼容低性能设备启动延迟 - #512
Conversation
审查者指南本次修改通过两阶段轮询提升 OK-WW 账号切换对慢速启动的兼容性:先等待 UnrealWindow 出现,再等待登录页或已登录主菜单等可执行态;超时后复用原有返回登录流程,并在错误截图场景使用即时窗口枚举避免重复等待。 两阶段 OK-WW 账号切换就绪流程的时序图sequenceDiagram
participant Switch as AccountSwitch
participant Window as UnrealWindow
participant Game as GameUI
Switch->>Window: _find_game_hwnd(wait=True)
loop Up to _GAME_WINDOW_WAIT_SECONDS
Switch->>Window: EnumWindows()
alt Window found
Window-->>Switch: hwnd
else Window not ready
Switch->>Switch: sleep(_WINDOW_POLL_INTERVAL)
end
end
Switch->>Game: _wait_for_actionable_state(hwnd, on_log)
loop Up to _SWITCH_STABILIZE_SECONDS
Switch->>Game: _on_login_page(hwnd)
Switch->>Game: _on_logged_in_menu(hwnd)
alt Login page or logged-in menu detected
Game-->>Switch: actionable state
else Transition frame or unknown state
Switch->>Switch: sleep(1)
end
end
alt Login page
Switch->>Game: _select_and_login(hwnd, suffix, on_log)
else Logged-in menu
Switch->>Game: _logout_from_menu(hwnd, on_log)
else Stabilization timeout
Switch->>Game: _return_to_login(hwnd, on_log)
end
延迟发现游戏窗口和捕获错误的流程图flowchart TD
A[Account switching starts] --> B["_find_game_hwnd(wait=True)"]
B --> C{UnrealWindow found?}
C -- No, within 60s --> D["sleep(_WINDOW_POLL_INTERVAL)"]
D --> B
C -- Yes --> E["_switch_to_login(hwnd, on_log)"]
C -- No, timeout --> F[Raise window-not-found error]
E --> G{Account switching fails?}
G -- No --> H[Continue]
G -- Yes --> I["_find_game_hwnd(wait=False)"]
I --> J["_save_error_screenshot(hwnd)"]
文件级变更
提示与命令与 Sourcery 交互
自定义你的使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's Guide本次修改通过两阶段轮询提升 OK-WW 账号切换对慢速启动的兼容性:先等待 UnrealWindow 出现,再等待登录页或已登录主菜单等可执行态;超时后复用原有返回登录流程,并在错误截图场景使用即时窗口枚举避免重复等待。 Sequence diagram for the two-stage OK-WW account switching readiness flowsequenceDiagram
participant Switch as AccountSwitch
participant Window as UnrealWindow
participant Game as GameUI
Switch->>Window: _find_game_hwnd(wait=True)
loop Up to _GAME_WINDOW_WAIT_SECONDS
Switch->>Window: EnumWindows()
alt Window found
Window-->>Switch: hwnd
else Window not ready
Switch->>Switch: sleep(_WINDOW_POLL_INTERVAL)
end
end
Switch->>Game: _wait_for_actionable_state(hwnd, on_log)
loop Up to _SWITCH_STABILIZE_SECONDS
Switch->>Game: _on_login_page(hwnd)
Switch->>Game: _on_logged_in_menu(hwnd)
alt Login page or logged-in menu detected
Game-->>Switch: actionable state
else Transition frame or unknown state
Switch->>Switch: sleep(1)
end
end
alt Login page
Switch->>Game: _select_and_login(hwnd, suffix, on_log)
else Logged-in menu
Switch->>Game: _logout_from_menu(hwnd, on_log)
else Stabilization timeout
Switch->>Game: _return_to_login(hwnd, on_log)
end
Flow diagram for delayed game-window discovery and error captureflowchart TD
A[Account switching starts] --> B["_find_game_hwnd(wait=True)"]
B --> C{UnrealWindow found?}
C -- No, within 60s --> D["sleep(_WINDOW_POLL_INTERVAL)"]
D --> B
C -- Yes --> E["_switch_to_login(hwnd, on_log)"]
C -- No, timeout --> F[Raise window-not-found error]
E --> G{Account switching fails?}
G -- No --> H[Continue]
G -- Yes --> I["_find_game_hwnd(wait=False)"]
I --> J["_save_error_screenshot(hwnd)"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
嘿——我已经审阅了你的更改,看起来很棒!
Sourcery 评估
需要人工审阅。 如果轮询或屏幕状态检测有误,自动化流程可能会不必要地等待,或者在游戏处于意外的过渡状态时发送注销/返回登录操作,从而中断当前会话或需要手动重试。回滚可以防止未来出现错误分类,并且由此产生的会话状态是受限且可恢复的,而不是不可逆的数据或访问权限变更。
帮助我变得更有用!请对每条评论点击 👍 或 👎,我会利用反馈来改进评审。
Original comment in English
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If the polling or screen-state detection is wrong, the automation could wait unnecessarily or send the logout/return-to-login actions while the game is in an unexpected transition state, disrupting the current session or requiring a manual retry. Reverting prevents future misclassification, and the resulting session state is bounded and recoverable rather than an irreversible data or access change.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…h-wait-window # Conflicts: # res/version.json
…tch-wait-window # Conflicts: # res/version.json
改动摘要
UnrealWindow窗口往往延迟创建/亮相,账号切换紧随脚本配置的定长WaitTime之后立即执行,单次窗口枚举赶不上启动进度,导致误报「未找到鸣潮游戏窗口」。_find_game_hwnd在_GAME_WINDOW_WAIT_SECONDS=60s内按 1s 间隔轮询等待窗口就绪,未就绪不直接报错;_switch_to_login先轮询等待界面进入「登录页」或「已登录主菜单」之一的可执行态,未知态不再盲目按 ESC,超时才落回原有「ESC→终端→返回登录」兜底(覆盖已直接进入主场景的情形)。_find_game_hwnd(wait=False)单次枚举,避免失败后空等宽限期。验证
Sourcery 摘要
增强 OK-WW 账号切换功能,使其能够适应较慢设备上延迟创建游戏窗口和启动画面切换的情况。
错误修复:
功能增强:
杂项:
Original summary in English
Sourcery 总结
提升 OK-WW 账号切换对慢速设备启动延迟和过渡界面的兼容性。
修复:
增强:
杂项:
Original summary in English
Sourcery 摘要
提升 OK-WW 账号切换对慢速设备启动延迟和过渡界面的兼容性。
错误修复:
功能增强:
维护事项:
Original summary in English
Sourcery 摘要
使 OK-WW 账号切换能够适应较慢设备上游戏窗口延迟创建和启动界面转换的情况。
错误修复:
改进:
杂项:
Original summary in English
Summary by Sourcery
Make OK-WW account switching resilient to delayed game-window creation and startup-screen transitions on slower devices.
Bug Fixes:
Enhancements:
Chores: