コード例 #1
0
 public static void SendMessageUser(this ChessPlayer chessPlayer, IActorMessage message)
 {
     if (chessPlayer.IsAI)
     {
         return;
     }
     if (chessPlayer.User != null)
     {
         chessPlayer.User.SendSessionClientActor(message);
     }
 }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public static void DisposeSerializePlayer(ChessPlayer player)
 {
     _playerPool.Add(player);
 }
コード例 #5
0
 public static void StartGame(this ChessPlayer chessPlayer, Actor_StartGame actor_StartGame)
 {
     chessPlayer.SendGateStartGame();
     chessPlayer.SendMessageUser(actor_StartGame);
 }
コード例 #6
0
 public static void SendGateStartGame(this ChessPlayer chessPlayer)
 {
     chessPlayer.SendMessageUser(new Actor_UserStartGame {
         SessionActorId = chessPlayer.Id
     });
 }