Example #1
0
        public void SendMatchChangeNotificationToPlayers(MatchNotificationType kind, ServerCharacterInfo targetPlayer, string text, bool synchClientGameObject)
        {
            PacketMatchNotification p = new PacketMatchNotification();

            p.PacketTypeID = (int)LobbyPacketType.MatchNotification;
            p.Kind         = kind;
            p.TheGame      = synchClientGameObject? Game : null;
            p.TheGameID    = Game.GameID;
            if (targetPlayer != null)
            {
                p.TargetPlayer = targetPlayer.CharacterInfo;
            }
            p.ReplyCode    = ReplyType.OK;
            p.ReplyMessage = text;

            /*
             * if (p.Kind == MatchNotificationType.MatchEnded)
             * {
             *  // add this particular message to the PFX queue, to make sure that the EndMessage/Disconnect&Transfer happen in the property order
             *  Task t = new Task((state) =>
             *  {
             *      BroadcastToPlayersInGame(p, true);
             *  }, "BroadcastToPlayersInGame: Match Ended", TaskCreationOptions.LongRunning);
             *  m_NetQ.AddTask(t);
             * }
             * else */
            {
                BroadcastToPlayersInGame(p, true);
            }
        }
Example #2
0
        public override bool DeSerialize(byte[] data, Pointer p)
        {
            base.DeSerialize(data, p);
            IsRefresh      = BitPacker.GetBool(data, p);
            IsServerPacket = BitPacker.GetBool(data, p);
            int num = BitPacker.GetInt(data, p);

            for (int i = 0; i < num; i++)
            {
                if (!IsRefresh)
                {
                    MatchNotificationType kind = (MatchNotificationType)BitPacker.GetInt(data, p);
                    Kinds.Add(kind);
                }

                Game theGame = BitPacker.GetComponent(data, p, IsServerPacket) as Game;

                TheGames.Add(theGame);
                bool hasTargetPlayer = BitPacker.GetBool(data, p);
                if (!IsRefresh && hasTargetPlayer)
                {
                    TargetPlayers.Add(BitPacker.GetComponent(data, p, false) as ICharacterInfo);
                }
            }
            return(true);
        }
Example #3
0
        public void SendMatchChangeNotificationToPlayer(ServerCharacterInfo toon, MatchNotificationType kind, ServerCharacterInfo targetPlayer, string text, bool synchClientGameObject)
        {
            PacketMatchNotification p = new PacketMatchNotification();

            p.PacketTypeID = (int)LobbyPacketType.MatchNotification;
            p.Kind         = kind;
            p.TheGame      = synchClientGameObject ? Game : null;
            p.TheGameID    = Game.GameID;
            if (targetPlayer != null)
            {
                p.TargetPlayer = targetPlayer.CharacterInfo;
            }
            p.ReplyCode    = ReplyType.OK;
            p.ReplyMessage = text;

            SendPacketToPlayer(toon, p);
        }
Example #4
0
        public void SendMatchChangeNotificationToPlayers(MatchNotificationType kind, GameServerGame theGame, ServerCharacterInfo targetPlayer)
        {
            string text = "";

            switch (kind)
            {
            case MatchNotificationType.PlayerRemoved:
                text = "Goodbye, " + targetPlayer.CharacterName;
                break;

            case MatchNotificationType.PlayerAdded:
                text = "Welcome, " + targetPlayer.CharacterName;
                break;

            case MatchNotificationType.MatchEnded:
                text = "Game '" + theGame.Name + "' ended.";
                break;
            }

            theGame.SendMatchChangeNotificationToPlayers(kind, targetPlayer, text, false);
        }
Example #5
0
        public void SendMatchChangeNotificationToPlayers(MatchNotificationType kind, GameServerGame theGame, ServerCharacterInfo targetPlayer)
        {
            string text = "";
            switch (kind)
            {
                case MatchNotificationType.PlayerRemoved:
                    text = "Goodbye, " + targetPlayer.CharacterName;
                    break;
                case MatchNotificationType.PlayerAdded:
                    text = "Welcome, " + targetPlayer.CharacterName;
                    break;
                case MatchNotificationType.MatchEnded:
                    text = "Game '" + theGame.Name + "' ended.";
                    break;
            }

            theGame.SendMatchChangeNotificationToPlayers(kind, targetPlayer, text, false);
        }