增加玩家离线和在线的状态

This commit is contained in:
zhl 2021-02-05 18:30:55 +08:00
parent 3a3d79b5d7
commit d824206902
2 changed files with 5 additions and 3 deletions

View File

@ -138,7 +138,7 @@ export class GeneralRoom extends Room {
}
this.bUserLeft(client.sessionId);
} else {
this.state.players.get(client.sessionId).state = PlayerStateConst.PLAYER_OFFLINE;
this.state.players.get(client.sessionId).online = false;
let assistClient = this.getAssistClient(client.sessionId);
assistClient.active = true;
try {
@ -148,7 +148,7 @@ export class GeneralRoom extends Room {
await this.allowReconnection(client, 10 * 60);
debugRoom(`${client.sessionId} 重连`);
assistClient.active = false;
this.state.players.get(client.sessionId).state = PlayerStateConst.PLAYER_NORMAL;
this.state.players.get(client.sessionId).online = true;
}
} catch (e) {
debugRoom(`player realy level :${client.sessionId}, try add robot`);

View File

@ -62,10 +62,11 @@ export class Player extends Schema {
* 2: 死亡
* 3: 已换完牌
* 4: 玩家已选择英雄
* 9: 掉线
*/
@type("number")
state: number;
online: boolean = true;
/**
*
*/
@ -128,6 +129,7 @@ export class Player extends Schema {
this.team = team;
this.countTotal = 0;
this.countPresent = 0;
this.online = true;
for (let i = 0; i < new GameEnv().maxPlayerPetCount + 1; i++) {
let pet = new Pet(i);
pet.state = 0;