fix(framework): kick_server 终止不重连(对齐真实客户端)

收到 kick_server 时 emit kicked 并 stop(),不再 onClose→重连→重踢空转。
kick 处理移出登录门控,登录态内外一致。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-28 20:37:16 +08:00
co-authored by Claude Opus 4.8
parent ad661707ec
commit 883335f656
2 changed files with 20 additions and 2 deletions
@@ -114,14 +114,14 @@ export class NetClient {
const msg = r.message;
if (msg.rpc === 'submit_error') return; // docs §3.2-9
// 服务器踢人:发事件并终止,**不自动重连**(对齐真实客户端 kick 弹窗停住;否则会空转重踢)。
if (msg.rpc === 'kick_server') { this.bus.emit('kicked', msg.data); this.stop(); return; }
if (this.isSendLoginState) { // docs §3.2-10 登录态门控
if (msg.rpc === 'player_login') {
this.isSendLoginState = false; this.isLogin = true;
if (this.loginGuard != null) { this.clock.clearTimeout(this.loginGuard); this.loginGuard = null; }
this.policy.reset();
this.bus.emit('login', msg.data);
} else if (msg.rpc === 'kick_server') {
this.bus.emit('kicked', msg.data);
}
return; // 其它一律丢弃
}