Beispiel #1
0
 /// <summary>Sends a player controls snapshot to the server</summary>
 /// <param name="c">The controls snapshot</param>
 internal void SendKeys(Net.Control c)
 {
     NetPacket.Factory data = new NetPacket.Factory(9);
     data.WriteFloat(c.X);
     data.WriteFloat(c.Y);
     data.WriteByte(Net.Pack(c.Keys));
     Net.SecureOut(client, data.GetPacket(NetServer.Packets.Controls), epS);
 }
Beispiel #2
0
 /// <summary>Constructs and broadcasts a list of all connected players in the lobby</summary>
 internal void SendPlrList()
 {
     NetPacket.Factory data = new NetPacket.Factory(ccount * 5 + 1);
     data.WriteByte(ccount);
     for (byte i = 0; i < ccount; ++i)
     {
         data.WriteUInt(PaintKiller.P[i].ID);
         if (PaintKiller.P[i] is GPOrc) data.WriteByte(0);
         else if (PaintKiller.P[i] is GPMage) data.WriteByte(1);
         else data.WriteByte(2);
     }
     Broadcast(data.GetPacket(NetClient.Packets.LobbyJoin));
 }
Beispiel #3
0
 /// <summary>Constructs and broadcasts a list of all active game objects along with players and their scores</summary>
 /// <param name="objs">Game objects list snapshot</param>
 internal void SendObjs(List<GameObj> objs)
 {
     NetPacket.Factory data = new NetPacket.Factory(objs.Count * 70 + 20);
     data.WriteUInt(GameObj.id);
     data.WriteInt(objs.Count);
     foreach (GameObj go in objs) WriteData(data, go);
     data.WriteByte(ccount);
     for (byte i = 0; i < ccount; ++i)
     {
         data.WriteUInt(PaintKiller.P[i].ID);
         data.WriteInt(PaintKiller.P[i].score);
     }
     Broadcast(data.GetPacket(NetClient.Packets.EntList));
 }