public static void OnChat(GameSession client, GameClientPacket packet)
        {
            if (!client.IsAuthentified)
            {
                return;
            }
            string msg = packet.ReadUnicode(256);

            if (client.Game == null)
            {
                return;
            }
            if (!client.OnChatCommand(msg))
            {
                using (GameServerPacket chat = new GameServerPacket(StocMessage.Chat)){
                    chat.Write((short)client.Type);
                    chat.WriteUnicode(msg, msg.Length + 1);
                    client.Game.SendToAllBut(chat, client);
                }
            }
        }
        public static void OnPlayerInfo(GameSession client, GameClientPacket packet)
        {
            if (client.Name != null)
            {
                return;
            }
            string name = packet.ReadUnicode(20);

            Logger.Debug("player name:" + name);
            if (name == "client")
            {
                client.LobbyError("[err]404");
                return;
            }
            if (string.IsNullOrEmpty(name))
            {
                client.LobbyError(Messages.ERR_NO_NAME);
            }
            client.Name           = name;
            client.IsAuthentified = client.CheckAuth(name);
        }
        public static void OnJoinGame(GameSession client, GameClientPacket packet)
        {
            if (string.IsNullOrEmpty(client.Name) || client.Type != (int)PlayerType.Undefined)
            {
                Logger.Debug("join room fail:" + client.Name);
                return;
            }
            int version = packet.ReadInt16();

            if (version < Program.Config.ClientVersion)
            {
                client.LobbyError(Messages.ERR_LOW_VERSION);
                return;
            }
            else if (version > Program.Config.ClientVersion)
            {
                client.ServerMessage(Messages.MSG_HIGH_VERSION);
            }
            int gameid = packet.ReadInt32();            //gameid

            packet.ReadInt16();

            string joinCommand = packet.ReadUnicode(60);

            GameRoom room = null;

            //IsAuthentified = CheckAuth();
            if (!client.IsAuthentified)
            {
                client.LobbyError(Messages.ERR_AUTH_FAIL);
                return;
            }
            if (!RoomManager.CheckRoomPassword(joinCommand))
            {
                client.LobbyError(Messages.ERR_PASSWORD);
                return;
            }
            GameConfig config = GameConfigBuilder.Build(joinCommand);

            room = RoomManager.CreateOrGetGame(config);
            if (room == null)
            {
                client.LobbyError(Messages.MSG_FULL);
                return;
            }
            if (!room.IsOpen)
            {
                client.LobbyError(Messages.MSG_GAMEOVER);
                return;
            }
            if (room != null && room.Config != null)
            {
                if (room.Config.NoCheckDeck)
                {
                    client.ServerMessage(Messages.MSG_NOCHECKDECK);
                }
                if (room.Config.NoShuffleDeck)
                {
                    client.ServerMessage(Messages.MSG_NOSHUFFLEDECK);
                }
                if (room.Config.EnablePriority)
                {
                    client.ServerMessage(Messages.MSG_ENABLE_PROIORITY);
                }
            }
            client.Game = room;
            lock (room.AsyncRoot)
            {
                room.AddPlayer(client);
            }
        }