public static void readBytes(NetIncomingMessage data, ClientSprite cs)
 {
     data.ReadByte();
     cs.ID = data.ReadUInt32();
     cs.SpriteID = (SpriteIDs)data.ReadUInt16();
     cs.Position = new Microsoft.Xna.Framework.Vector2(data.ReadFloat(),data.ReadFloat());
     cs.Rotation = data.ReadFloat();
 }
 public static void writeBytes(NetOutgoingMessage om, ClientSprite cs)
 {
     om.Write((byte)PacketTypes.ClientSprite);
         om.Write((byte)18);
         om.Write(cs.ID);
         om.Write((ushort)cs.SpriteID);
         om.Write(cs.Position.X);
         om.Write(cs.Position.Y);
         om.Write(cs.Rotation);
 }
Beispiel #3
0
 private void readData(NetIncomingMessage msg)
 {
     while (msg.PositionInBytes < msg.LengthBytes)
     {
         switch ((PacketTypes)msg.ReadByte())
         {
             case PacketTypes.ClientSprite:
                 ClientSprite cs = new ClientSprite();
                 ClientSpriteParser.readBytes(msg, cs);
                 if (sprites.ContainsKey(cs.ID))
                 {
                     sprites[cs.ID] = cs;
                 }
                 else
                 {
                     sprites.Add(cs.ID, cs);
                 }
                 break;
             default:
                 msg.ReadBytes(msg.ReadByte());
                 break;
         }
     }
 }