// 直接加入即将开始的游戏的队列
if (this.curMatchState == EMatchState.Waiting) {
if (this._willStartList.length === 0) { this._startGameTime = Date.now() + this._matchGameTime;
}
if (this._willStartList.indexOf(pid) < 0) { this._willStartList.push(pid);
let showCountTime = this._startGameTime - Date.now();
for (const roleID of this._willStartList) { this.getClient(roleID).net_resJoinMatchList(this._willStartList, showCountTime);
}
} else { this.getClient(pid).net_resNoticeRoleAction("你已经在匹配队列中了......");
}
}
}
/**响应取消匹配游戏 */
public net_resCancelMatch(player?: Gameplay.Player) {
if (!player) return;
let pid: number = player.getPlayerID();
pid && this.playerCancelOrLeave(pid);
}
/**重新匹配 */
public reqReMatch() { this._willStartList = [];
if (this._waitList.length > 0) { this._willStartList.push(...this._waitList); this._startGameTime = Date.now() + this._matchGameTime;
for (const pid of this._willStartList) { this.getClient(pid).net_resJoinMatchList(this._willStartList, this._matchGameTime);
} this._waitList = [];
} this.curMatchState = EMatchState.Waiting;
}
/**测试修改匹配时间 */
public changeMatchTime(time: number) {
if (isNaN(time)) return;
let newStartTime: number = time * 1000; this._startGameTime = Date.now() + newStartTime;
for (const pid of this._willStartList) { this.getClient(pid).net_resJoinMatchList(this._willStartList, newStartTime);
}
}
}