/// <summary> /// 玩家离开座位后事件处理 /// </summary> /// <param name="inningeGame"></param> /// <param name="e"></param> public virtual void AfterPlayerLeave(object inningeGame, EventArgs e) { string playerId = ((PlayerEventArgs)e).Player.Id.ToString(); var roomMessage = WebscoketSendObjs.RoomMessage(0, "有玩家离开了"); NotifyRoomPlayers(roomMessage); }
/// <summary> /// 玩家离开座位后事件处理 /// </summary> /// <param name="inningeGame"></param> /// <param name="e"></param> public virtual void AfterPlayerLeave(object inningeGame, EventArgs e) { int playerId = ((PlayerEventArgs)e).Player.Id; var roomMessage = WebscoketSendObjs.RoomMessage(0, "有玩家离开了"); InningeGame.IRoom.RemovePlayerById(playerId); NotifyRoomPlayers(roomMessage); }
/// <summary> /// 检查能不能开始 /// </summary> /// <param name="innineGame_">本局游戏</param> /// <returns>YN</returns> public virtual bool CheckStart(IInningeGame innineGame_) { int playerOnSeatCopunt = innineGame_.NotEmptySeats().Count; if (playerOnSeatCopunt < innineGame_.IGameProject.PlayerCountLeast || playerOnSeatCopunt > PlayerCountLimit) { Notify?.Invoke(WebscoketSendObjs.RoomMessage(0, "人数不足,不能启动游戏")); return(false); } return(true); }
/// <summary> /// 重置游戏,以便开始新的一局 /// </summary> public virtual void ResetGame(object inningeGame, EventArgs e) { NotifyRoomPlayers(WebscoketSendObjs.ResetGame(0)); }
/// <summary> /// 游戏正常结束 /// </summary> /// <param name="inningeGame">本局游戏</param> /// <param name="e"></param> public virtual void GameOver(object inningeGame, EventArgs e) { NotifyRoomPlayers(WebscoketSendObjs.GameOver(0)); }
/// <summary> /// 游戏异常中断 /// </summary> /// <param name="inningeGame">本局游戏</param> /// <param name="e"></param> public virtual void Stoped(object inningeGame, EventArgs e) { var myE = (GameStopedEventArgs)e; NotifyRoomPlayers(WebscoketSendObjs.Stoped(0, myE.Message)); }
/// <summary> /// 玩家坐下后事件处理 /// </summary> /// <param name="inningeGame"></param> /// <param name="e"></param> public virtual void AfterSitDown(object inningeGame, EventArgs e) { var roomMessage = WebscoketSendObjs.RoomMessage(0, "有玩家进入"); NotifyRoomPlayers(roomMessage); }
/// <summary> /// 开始游戏处理事件 /// </summary> /// <param name="sender">IInngineGame</param> /// <param name="e"></param> public virtual void GameStart(object inngineGame, EventArgs e) { InningeGame = (IInningeGame)inngineGame; NotifyRoomPlayers(WebscoketSendObjs.RoomMessage(0, "游戏开始了!")); }
/// <summary> /// 重置游戏,以便开始新的一局 /// </summary> public virtual void ResetGame(object inningeGame, EventArgs e) { Notify?.Invoke(WebscoketSendObjs.ResetGame(0)); }
/// <summary> /// 游戏正常结束 /// </summary> /// <param name="inningeGame">本局游戏</param> /// <param name="e"></param> public virtual void GameOver(object inningeGame, EventArgs e) { Notify?.Invoke(WebscoketSendObjs.GameOver(0)); }