增加游戏开始判定

This commit is contained in:
yuexin 2020-12-11 17:34:36 +08:00
parent 73a85c1d0d
commit e8fcc8b34d

View File

@ -21,10 +21,12 @@ export class BattleHandler {
_room: Room;
private _cardusing: boolean;
private _sktime: number;
private _gamestart: boolean = false;
public init(cs: CardGameState, room: Room){
this._cs = cs;
this._room = room;
this._gamestart = false;
};
public addPlayer(aplayer: Player): PlayerHandler{
@ -350,6 +352,9 @@ export class BattleHandler {
* @param dropcards : 获得的牌组
*/
public onCardGetted(aplayer: Player, getcards: Card[], fromplayer?: Player){
if(!this._gamestart){
return;
}
let ph = this.getPlayer(aplayer);
let fromph = this.getPlayer(fromplayer);
ph && ph.onCardGetted(getcards, fromph);
@ -360,6 +365,9 @@ export class BattleHandler {
* @param aplayer
*/
public onPlayerRoundStart(aplayer: Player){
if(!this._gamestart){
this._gamestart = true;
}
let ph = this.getPlayer(aplayer);
ph && ph.onRoundStart();
};