public static void SendMessageUser(this ChessPlayer chessPlayer, IActorMessage message) { if (chessPlayer.IsAI) { return; } if (chessPlayer.User != null) { chessPlayer.User.SendSessionClientActor(message); } }
public static async Task <ChessPlayer> Create(MatchPlayerInfo matchPlayerInfo, GameRoom gameRoom) { try { ChessPlayer player = ComponentFactory.Create <ChessPlayer>(); await player.AddComponent <MailBoxComponent>().AddLocation(); return(player); } catch (System.Exception ex) { Log.Error(ex); throw; } }
public static ChessPlayer CopySerialize(ChessPlayer player) { ChessPlayer newPlayer; if (_playerPool.Count > 0) { newPlayer = _playerPool[0]; _playerPool.RemoveAt(0); } else { newPlayer = ComponentFactory.Create <ChessPlayer>(); } newPlayer.SeatIndex = player.SeatIndex; newPlayer.User = player.User; newPlayer.PlayCards = player.PlayCards; newPlayer.OperateInfos = player.OperateInfos; newPlayer.HandCards = player.HandCards; newPlayer.NowHP = player.NowHP; newPlayer.WinCount = player.WinCount; newPlayer.DefeatCount = player.DefeatCount; return(newPlayer); }
public static void DisposeSerializePlayer(ChessPlayer player) { _playerPool.Add(player); }
public static void StartGame(this ChessPlayer chessPlayer, Actor_StartGame actor_StartGame) { chessPlayer.SendGateStartGame(); chessPlayer.SendMessageUser(actor_StartGame); }
public static void SendGateStartGame(this ChessPlayer chessPlayer) { chessPlayer.SendMessageUser(new Actor_UserStartGame { SessionActorId = chessPlayer.Id }); }