예제 #1
0
        public override void SendPosition(Client sender, bool fromServer = false)
        {
            if(!fromServer)
                Server.NotifyClientPosition(this, sender);

            var packet = sender.GetDataPacket();
            packet.Origin = sender.Id;
            SendPacketToAll(packet);
        }
예제 #2
0
        public override void AddClient(Client client)
        {
            // -- We assume the Client is a GameJolt or the Client's password is correct and no one is using the Client's name.

            if (IsGameJoltIdUsed(client as P3DPlayer))
            {
                client.Kick("You are already on server!");
                return;
            }
            SavePlayerGJ(client as P3DPlayer);


            ClientUpdate(client, true);


            // Send to player his Id
            client.SendPacket(new CreatePlayerPacket { Origin = -1, PlayerId = client.Id });
            // Send to player all Players Id
            foreach (var aClient in Server.GetAllClients())
            {
                client.SendPacket(new CreatePlayerPacket { Origin = -1, PlayerId = aClient.Id });
                var packet = aClient.GetDataPacket();
                packet.Origin = aClient.Id;
                client.SendPacket(packet);
            }
            // Send to Players player Id
            SendPacketToAll(new CreatePlayerPacket { Origin = -1, PlayerId = client.Id });
            var p = client.GetDataPacket();
            p.Origin = client.Id;
            SendPacketToAll(p);


            ClientConnected(client);


            base.AddClient(client);
        }
예제 #3
0
 public override void ClientConnected(Client client)
 {
     SendPacketToAll(new CreatePlayerPacket { Origin = -1, PlayerId = client.Id });
     var packet = client.GetDataPacket();
     packet.Origin = client.Id;
     SendPacketToAll(packet);
     SendPacketToAll(new ChatMessageGlobalPacket { Origin = -1, Message = $"Player {client.Name} joined the game!" });
 }
예제 #4
0
        public override void SendPosition(Client sender, bool fromServer = false)
        {
            if (!fromServer)
                Server.NotifyClientPosition(this, sender);

            if (sender is PokeDPlayer)
                return;
            else
            {
                var posData = sender.GetDataPacket();
                SendPacketToAll(new PositionPacket() { Position = posData.GetPosition(posData.DecimalSeparator) });
            }
        }