Beispiel #1
0
		public static void OnPlayerLeave(GameSession player, GameRoom room){
            if (player.Name == null || player.Name.StartsWith("[AI]")) return;
            using (PacketWriter writer=new PacketWriter(2)){
				writer.Write((byte)RoomMessage.PlayerLeave);
				writer.WriteUnicode(player.Name, 20);
				writer.WriteUnicode(room.Config.Name, 20);
				Send(writer.Content);
			}
		}
Beispiel #2
0
		public static void OnPlayerEnter(GameSession player, GameRoom room){
            if (player.Name==null||player.Name.StartsWith("[AI]")) return;
			using(PacketWriter writer=new PacketWriter(2)){
				writer.Write((byte)RoomMessage.PlayerEnter);
				writer.WriteUnicode(player.Name, 20);
				writer.WriteUnicode(room.Config.Name, 20);
				Send(writer.Content);
			}
			string tip = Messages.RandomMessage();
			if(!string.IsNullOrEmpty(tip))
				player.ServerMessage(Messages.RandomMessage());
		}
Beispiel #3
0
		public static CtosMessage Handler(GameSession player, params GameClientPacket[] packets){
			CtosMessage firstmsg = CtosMessage.Unknown;
			if(packets == null || packets.Length == 0) 
				return firstmsg;
			foreach(GameClientPacket packet in packets){
				//			Parse(player, packet);
				if(packet.Length==0){
					continue;
				}
				CtosMessage msg = packet.ReadCtos();
				if(firstmsg == CtosMessage.Unknown){
					firstmsg = msg;
				}
				if(msg == CtosMessage.CreateGame || msg == CtosMessage.JoinGame || msg == CtosMessage.PlayerInfo){
					
				}else{
					if(!player.IsAuthentified){
						Logger.Warn("auth error:"+player.Name);
						player.CloseAsync();
						break;
					}
					if(player.Type == (int)PlayerType.Undefined){
						Logger.Warn("player type error:"+player.Name);
						player.CloseAsync();
						break;
					}
				}
				if(player.Game!=null){
					lock(player.Game.AsyncRoot){
						EventHandler.Do((ushort)msg, player, packet);
					}
				}else{
					EventHandler.Do((ushort)msg, player, packet);
				}
				packet.Close();
			}
			return firstmsg;
		}
Beispiel #4
0
		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);
				}
			}
		}
Beispiel #5
0
		public static void OnTpResult(GameSession client, GameClientPacket packet){
			bool tp = packet.ReadByte() != 0;
			if(client.Game!=null)
				client.Game.TpResult(client, tp);
		}
Beispiel #6
0
		public static void OnLeaveGame(GameSession client, GameClientPacket packet){
            client.CloseAsync();
		}
Beispiel #7
0
        public void MoveToDuelist(GameSession player)
        {
            if (State != GameState.Lobby)
                return;
            int pos = GetAvailablePlayerPos();
            if (pos == -1)
                return;
            if (player.Type != (int)PlayerType.Observer)
            {
                if (!IsTag || IsReady[player.Type])
                    return;

                pos = (player.Type + 1) % 4;
                while (Players[pos] != null)
                    pos = (pos + 1) % 4;

                using (GameServerPacket change = new GameServerPacket(StocMessage.HsPlayerChange))
                {
                    change.Write((byte)((player.Type << 4) + pos));
                    SendToAll(change);
                }
                Players[player.Type] = null;
                Players[pos] = player;
                player.Type = pos;
                player.SendTypeChange();
            }
            else
            {
                lock (Observers)
                    Observers.Remove(player);
                Players[pos] = player;
                player.Type = pos;

                using (GameServerPacket enter = new GameServerPacket(StocMessage.HsPlayerEnter))
                {
                    enter.WriteUnicode(player.Name, 20);
                    enter.Write((byte)pos);
                    SendToAll(enter);
                }

                using (GameServerPacket nwatch = new GameServerPacket(StocMessage.HsWatchChange))
                {
                    nwatch.Write((short)Observers.Count);
                    SendToAll(nwatch);
                }

                player.SendTypeChange();
            }
        }
Beispiel #8
0
        private void InitNewSpectator(GameSession player, int pos = -1)
        {
            if (m_duel == null)
            {
                return;
            }
            int deck1 = m_duel.QueryFieldCount(0, CardLocation.Deck);
            int deck2 = m_duel.QueryFieldCount(1, CardLocation.Deck);

            int hand1 = m_duel.QueryFieldCount(0, CardLocation.Hand);
            int hand2 = m_duel.QueryFieldCount(1, CardLocation.Hand);

            using (GameServerPacket packet = new GameServerPacket(GameMessage.Start))
            {
                if (pos < 0)
                {
                    packet.Write((byte)(m_swapped ? 0x11 : 0x10));
                }
                else {
                    packet.Write((byte)pos);
                }
                packet.Write(LifePoints[0]);
                packet.Write(LifePoints[1]);
                packet.Write((short)(deck1 + hand1));
                packet.Write((short)m_duel.QueryFieldCount(0, CardLocation.Extra));
                packet.Write((short)(deck2 + hand2));
                packet.Write((short)m_duel.QueryFieldCount(1, CardLocation.Extra));
                player.Send(packet);
            }
            using (GameServerPacket draw = new GameServerPacket(GameMessage.Draw))
            {
                draw.Write((byte)0);
                draw.Write((byte)hand1);
                for (int i = 0; i < hand1; i++)
                    draw.Write(0);
                player.Send(draw, false);
            }
            using (GameServerPacket draw = new GameServerPacket(GameMessage.Draw))
            {
                draw.Write((byte)1);
                draw.Write((byte)hand2);
                for (int i = 0; i < hand2; i++)
                    draw.Write(0);
                player.Send(draw);
            }
            //回合数
            using (GameServerPacket turn0 = new GameServerPacket(GameMessage.NewTurn))
            {
                turn0.Write((byte)0);
                using (GameServerPacket turn1 = new GameServerPacket(GameMessage.NewTurn))
                {
                    turn1.Write((byte)1);
                    for (int i = 0; i < TurnCount; i++)
                    {
                        if (i % 2 == 0)
                        {
                            player.Send(turn0, false);
                        }
                        else {
                            player.Send(turn1, false);
                        }
                    }
                }
            }
            //			if (CurrentPlayer == 1)
            //			{
            //				GameServerPacket turn = new GameServerPacket(GameMessage.NewTurn);
            //				turn.Write((byte)0);
            //				player.Send(turn);
            //			}
            player.PeekSend();
            InitSpectatorLocation(player, CardLocation.MonsterZone);
            InitSpectatorLocation(player, CardLocation.SpellZone);
            InitSpectatorLocation(player, CardLocation.Grave);
            InitSpectatorLocation(player, CardLocation.Removed);
        }
Beispiel #9
0
		public static void OnMoveToDeulList(GameSession client, GameClientPacket packet){
			if (!client.IsAuthentified){
				return;
			}
			if(client.Game!=null)
				client.Game.MoveToDuelist(client);
		}
Beispiel #10
0
        public void AddPlayer(GameSession player)
        {
            //			if(IsJoin(player)){
            ////				/玩家已经在游戏
            //				player.LobbyError(Messages.MSG_PLAYER_INGAME);
            //				return;
            //			}
            Logger.Debug("add " + player.Name + " to " + Name);
            if (State != GameState.Lobby)
            {
                if (State == GameState.End)
                    return;
                player.Type = (int)PlayerType.Observer;
                SendJoinGame(player);
                player.SendTypeChange();
                player.Send(GameServerPacket.EmtryMessage(StocMessage.DuelStart));
                lock (Observers)
                    Observers.Add(player);
                if (State == GameState.Duel)
                {
                    //中途观战
                    InitNewSpectator(player);
                }
                else if (State == GameState.Side)
                {
                    player.ServerMessage(Messages.MSG_WATCH_SIDE);
                }
                ServerApi.OnPlayerEnter(player, this);
                return;
            }
            if (HostPlayer == null)
                HostPlayer = player;
            int pos = GetAvailablePlayerPos();
            if (pos != -1)
            {
                Players[pos] = player;
                IsReady[pos] = false;

                player.Type = pos;
                using (GameServerPacket enter = new GameServerPacket(StocMessage.HsPlayerEnter))
                {
                    enter.WriteUnicode(player.Name, 20);
                    enter.Write((byte)pos);
                    SendToAll(enter);
                }
                //	Server.OnPlayEvent(PlayerStatu.PlayerReady, player);
            }
            else
            {
                using (GameServerPacket watch = new GameServerPacket(StocMessage.HsWatchChange))
                {
                    watch.Write((short)(Observers.Count + 1));
                    SendToAll(watch);
                }
                player.Type = (int)PlayerType.Observer;
                lock (Observers)
                    Observers.Add(player);
                //				if(player.IsAuthentified){
                //					ServerMessage("[Server] "+player.Name+" watch game.", PlayerType.White);
                //				}
            }
            SendJoinGame(player);
            player.SendTypeChange();

            for (int i = 0; i < Players.Length; i++)
            {
                if (Players[i] != null)
                {
                    using (GameServerPacket enter = new GameServerPacket(StocMessage.HsPlayerEnter))
                    {
                        enter.WriteUnicode(Players[i].Name, 20);
                        enter.Write((byte)i);
                        player.Send(enter, false);
                    }
                    if (IsReady[i])
                    {
                        using (GameServerPacket change = new GameServerPacket(StocMessage.HsPlayerChange))
                        {
                            change.Write((byte)((i << 4) + (int)PlayerChange.Ready));
                            player.Send(change, false);
                        }
                    }
                }
            }
            bool _watch = false;
            lock (Observers)
            {
                _watch = Observers.Count > 0;
            }
            if (_watch)
            {
                using (GameServerPacket nwatch = new GameServerPacket(StocMessage.HsWatchChange))
                {
                    nwatch.Write((short)Observers.Count);
                    player.Send(nwatch, false);
                }
            }
            player.PeekSend();
            ServerApi.OnPlayerEnter(player, this);
        }
Beispiel #11
0
		public static void OnSurrender(GameSession client, GameClientPacket packet){
			if(client.Game!=null)
				client.Game.Surrender(client, 0);
		}
Beispiel #12
0
 public void SendToAllBut(GameServerPacket packet, GameSession except, bool isNow = true)
 {
     foreach (GameSession player in Players)
         if (player != null && !player.Equals(except))
             player.Send(packet, isNow);
     lock (Observers)
     {
         foreach (GameSession player in Observers)
             if (!player.Equals(except))
                 player.Send(packet, isNow);
     }
 }
Beispiel #13
0
 private void SendJoinGame(GameSession player)
 {
     using (GameServerPacket join = new GameServerPacket(StocMessage.JoinGame))
     {
         join.Write(Banlist == null ? 0U : Banlist.Hash);
         join.Write((byte)Config.Rule);
         join.Write((byte)Config.Mode);
         join.Write(Config.EnablePriority);
         join.Write(Config.NoCheckDeck);
         join.Write(Config.NoShuffleDeck);
         // C++ padding: 5 bytes + 3 bytes = 8 bytes
         for (int i = 0; i < 3; i++)
             join.Write((byte)0);
         join.Write(Config.StartLp);
         join.Write((byte)Config.StartHand);
         join.Write((byte)Config.DrawCount);
         join.Write((short)Config.GameTimer);
         player.Send(join);
     }
     if (State != GameState.Lobby)
         SendDuelingPlayers(player);
 }
Beispiel #14
0
 private void SendDuelingPlayers(GameSession player, bool isNow = true)
 {
     for (int i = 0; i < Players.Length; i++)
     {
         using (GameServerPacket enter = new GameServerPacket(StocMessage.HsPlayerEnter))
         {
             int id = i;
             if (m_swapped)
             {
                 if (IsTag)
                 {
                     if (i == 0 || id == 1)
                         id = i + 2;
                     else
                         id = i - 2;
                 }
                 else
                     id = 1 - i;
             }
             enter.WriteUnicode(Players[id] == null ? "???" : Players[id].Name, 20);
             enter.Write((byte)i);
             player.Send(enter, isNow);
         }
     }
 }
Beispiel #15
0
 public void RemovePlayer(GameSession player)
 {
     if (player == null)
     {
         return;
     }
     ServerApi.OnPlayerLeave(player, this);
     if (player.Equals(HostPlayer) && State == GameState.Lobby)
     {
         //Logger.WriteLine("HostPlayer is leave", false);
         //主机玩家离开
         if (player.Type != (int)PlayerType.Observer)
         {
             lock (AsyncRoot)
             {
                 Players[player.Type] = null;
                 IsReady[player.Type] = false;
                 HostPlayer = null;
             }
         }
         Close(true);
         return;
     }
     else if (player.Type == (int)PlayerType.Observer)
     {
         lock (Observers)
             Observers.Remove(player);
         if (State == GameState.Lobby)
         {
             using (GameServerPacket nwatch = new GameServerPacket(StocMessage.HsWatchChange))
             {
                 nwatch.Write((short)Observers.Count);
                 SendToAll(nwatch);
             }
         }
         player.Close();
     }
     else if (State == GameState.Lobby)
     {
         if (player.Type > 0 && player.Type != (int)PlayerType.Observer)
         {
             lock (AsyncRoot)
             {
                 Players[player.Type] = null;
                 IsReady[player.Type] = false;
             }
             using (GameServerPacket change = new GameServerPacket(StocMessage.HsPlayerChange))
             {
                 change.Write((byte)((player.Type << 4) + (int)PlayerChange.Leave));
                 SendToAll(change);
             }
         }
         player.Close();
     }
     else {
         if (IsEnd)
         {
             return;
         }
         Surrender(player, 4, true);
     }
     //所有玩家都离开
     foreach (GameSession p in Players)
     {
         if (p != null)
             return;
     }
     lock (Observers)
     {
         if (Observers.Count > 0) return;
     }
     Close(true);
 }
Beispiel #16
0
        private void InitSpectatorLocation(GameSession player, CardLocation loc)
        {
            for (int index = 0; index < 2; index++)
            {
                int flag = loc == CardLocation.MonsterZone ? 0x91fff : 0x81fff;
                byte[] result = m_duel.QueryFieldCard(index, loc, flag, false);

                using (MemoryStream ms = new MemoryStream(result))
                {
                    BinaryReader reader = new BinaryReader(ms);
                    BinaryWriter writer = new BinaryWriter(ms);
                    while (ms.Position < ms.Length)
                    {
                        int len = reader.ReadInt32();
                        if (len == 4)
                            continue;
                        long pos = ms.Position;
                        reader.ReadBytes(len - 4);
                        long endPos = ms.Position;

                        ms.Position = pos;
                        ClientCard card = new ClientCard();
                        card.Update(reader);
                        ms.Position = endPos;

                        bool facedown = ((card.Position & (int)CardPosition.FaceDown) != 0);

                        using (GameServerPacket move = new GameServerPacket(GameMessage.Move))
                        {
                            move.Write(facedown ? 0 : card.Code);
                            move.Write(0);
                            move.Write((byte)card.Controler);
                            move.Write((byte)card.Location);
                            move.Write((byte)card.Sequence);
                            move.Write((byte)card.Position);
                            move.Write(0);
                            player.Send(move, false);
                        }
                        foreach (ClientCard material in card.Overlay)
                        {
                            using (GameServerPacket xyzcreate = new GameServerPacket(GameMessage.Move))
                            {
                                xyzcreate.Write(material.Code);
                                xyzcreate.Write(0);
                                xyzcreate.Write((byte)index);
                                xyzcreate.Write((byte)CardLocation.Grave);
                                xyzcreate.Write((byte)0);
                                xyzcreate.Write((byte)0);
                                xyzcreate.Write(0);
                                player.Send(xyzcreate, false);
                            }

                            using (GameServerPacket xyzmove = new GameServerPacket(GameMessage.Move))
                            {
                                xyzmove.Write(material.Code);
                                xyzmove.Write((byte)index);
                                xyzmove.Write((byte)CardLocation.Grave);
                                xyzmove.Write((byte)0);
                                xyzmove.Write((byte)0);
                                xyzmove.Write((byte)material.Controler);
                                xyzmove.Write((byte)material.Location);
                                xyzmove.Write((byte)material.Sequence);
                                xyzmove.Write((byte)material.Position);
                                xyzmove.Write(0);
                                player.Send(xyzmove, false);
                            }
                        }

                        if (facedown)
                        {
                            ms.Position = pos;
                            writer.Write(new byte[len - 4]);
                        }
                    }
                    writer.Close();
                    reader.Close();
                }
                if (loc == CardLocation.MonsterZone)
                {
                    result = m_duel.QueryFieldCard(index, loc, 0x81fff, false);
                    using (MemoryStream ms = new MemoryStream(result))
                    {
                        BinaryReader reader = new BinaryReader(ms);
                        BinaryWriter writer = new BinaryWriter(ms);
                        while (ms.Position < ms.Length)
                        {
                            int len = reader.ReadInt32();
                            if (len == 4)
                                continue;
                            long pos = ms.Position;
                            byte[] raw = reader.ReadBytes(len - 4);

                            bool facedown = ((raw[11] & (int)CardPosition.FaceDown) != 0);
                            if (facedown)
                            {
                                ms.Position = pos;
                                writer.Write(new byte[len - 4]);
                            }
                        }
                        reader.Close();
                        writer.Close();
                    }
                }
                using (GameServerPacket update = new GameServerPacket(GameMessage.UpdateData))
                {
                    update.Write((byte)index);
                    update.Write((byte)loc);
                    update.Write(result);
                    player.Send(update);
                }
            }
        }
Beispiel #17
0
		public static void OnUpdateDeck(GameSession client, GameClientPacket packet){
			if (client.Game==null||client.Type == (int)PlayerType.Observer||client.Type == (int)PlayerType.Undefined)
				return;
			Deck deck = new Deck();
			int main = packet.ReadInt32();
			int side = packet.ReadInt32();
			for (int i = 0; i < main; i++)
				deck.AddMain(packet.ReadInt32());
			for (int i = 0; i < side; i++)
				deck.AddSide(packet.ReadInt32());
			if (client.Game.State == GameState.Lobby)
			{
				client.Deck = deck;
				client.Game.IsReady[client.Type] = false;
			}
			else if (client.Game.State == GameState.Side)
			{
				if (client.Game.IsReady[client.Type])
					return;
				if (!client.Deck.Check(deck))
				{
					using(GameServerPacket error = new GameServerPacket(StocMessage.ErrorMsg)){
						error.Write((byte)3);
						error.Write(0);
						client.Send(error);
					}
					return;
				}
				client.Deck = deck;
				client.Game.IsReady[client.Type] = true;
				client.Game.ServerMessage(string.Format(Messages.MSG_READY, client.Name));
				client.Send(GameServerPacket.EmtryMessage(StocMessage.DuelStart));
				client.Game.MatchSide();
			}
		}
Beispiel #18
0
		public static void OnStartDuel(GameSession client, GameClientPacket packet){
			if(client.Game!=null){
				client.Game.StartDuel(client);
			}
		}
Beispiel #19
0
		public static void OnResponse(GameSession client, GameClientPacket packet){
			if (client.Game==null||client.Game.State != GameState.Duel)
				return;
			if (client.State != PlayerState.Response)
				return;
			byte[] resp = packet.ReadToEnd();
			if (resp.Length > 64)
				return;
			client.State = PlayerState.None;
			client.Game.SetResponse(resp);
		}
Beispiel #20
0
 public static void OnClose(GameSession client, GameClientPacket packet)
 {
     using (PacketWriter packet_write = new PacketWriter(GameServerPacket.GamePacketByteLength)) {
         packet_write.Write((byte)RoomMessage.STOP_CLIENT);
         client.Send(packet_write.Content);
     }
     client.CloseAsync();
 }
Beispiel #21
0
		public static void OnHandResult(GameSession client, GameClientPacket packet){
			int res = packet.ReadByte();
			if(client.Game!=null)
				client.Game.HandResult(client, res);
		}
Beispiel #22
0
        public void MoveToObserver(GameSession player)
        {
            if (State != GameState.Lobby)
                return;
            if (player.Type == (int)PlayerType.Observer)
                return;
            if (IsReady[player.Type])
                return;
            Players[player.Type] = null;
            IsReady[player.Type] = false;
            lock (Observers)
                Observers.Add(player);

            using (GameServerPacket change = new GameServerPacket(StocMessage.HsPlayerChange))
            {
                change.Write((byte)((player.Type << 4) + (int)PlayerChange.Observe));
                SendToAll(change);
            }

            player.Type = (int)PlayerType.Observer;
            player.SendTypeChange();
        }
Beispiel #23
0
		public static void OnKick(GameSession client, GameClientPacket packet){
			int pos = packet.ReadByte();
			if(client.Game!=null)
				client.Game.KickPlayer(client, pos);
		}
Beispiel #24
0
		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);
		}
Beispiel #25
0
		public static void OnNotReady(GameSession client, GameClientPacket packet){
			if (!client.IsAuthentified){
				return;
			}
			if(client.Game!=null)
				client.Game.SetReady(client, false);
		}
Beispiel #26
0
		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);
            }
		}
Beispiel #27
0
		public static void OnMoveToObserver(GameSession client, GameClientPacket packet){
			if (!client.IsAuthentified){
				return;
			}
			if(client.Game!=null)
				client.Game.MoveToObserver(client);
		}
Beispiel #28
0
		public static void OnCreateGame(GameSession client, GameClientPacket packet){
			if (string.IsNullOrEmpty(client.Name) || client.Type != (int)PlayerType.Undefined)
				return;
			GameRoom room = null;
            byte[] data = packet.ReadBytes(StructTransformer.SizeOf(typeof(CtosCreateGame)));
            CtosCreateGame roomconfig;
            GameConfig config = null;
            try
            {
                roomconfig = (CtosCreateGame)StructTransformer.BytesToStruct(data, typeof(CtosCreateGame));
                config = roomconfig.Build();
            }
            catch(Exception e)
            {
                Logger.Warn(e);
            }
            if (config == null)
            {
                client.CloseAsync();
                return;
            }
			room = RoomManager.CreateOrGetGame(config);

			if (room == null)
			{
				client.LobbyError(Messages.MSG_FULL);
				return;
			}
			client.Game = room;
            lock (room.AsyncRoot)
            {
                room.AddPlayer(client);
            }
			//IsAuthentified = CheckAuth();
			if(!client.IsAuthentified){
				client.LobbyError(Messages.ERR_AUTH_FAIL);
			}
		}
Beispiel #29
0
		public static void OnTimeConfirm(GameSession client, GameClientPacket packet){
			if(client!=null){
				//Logger.Debug("OnTimeConfirm "+client.Name);
			}
		}
Beispiel #30
0
 public bool IsJoin(GameSession player)
 {
     if (player == null || player.Name == null)
     {
         return true;
     }
     for (int i = 0; i < Players.Length; i++)
     {
         if (Players[i] == null)
             continue;
         if (Players[i].Name == player.Name)
         {
             return true;
         }
     }
     return false;
 }