public static InventoryData Decode(byte[] data) { int[] ints = ByteManipulation.ConvertBytesToInts(data); int selectedItem = ints[0]; int playerId = ints[1]; int[] inv = ints.Skip(2).ToArray(); return(new InventoryData(playerId, selectedItem, inv)); }
public byte[] Encode() { byte[] inv = new byte[sizeof(int) * inventory.Length]; Buffer.BlockCopy(inventory, 0, inv, 0, inv.Length); return(ByteManipulation.WrapWithInt(ByteManipulation.WrapWithInt(inv, playerId), selectItem)); }
public static PlayerEventData Decode(byte[] bytes) { int[] p = ByteManipulation.ConvertBytesToInts(bytes); return(new PlayerEventData(p[0], p[1], (EventType)p[2])); }
public byte[] Encode() { return(ByteManipulation.ConvertIntsToBytes(player, other, (int)type)); }
public static DropItemData Decode(byte[] bytes) { int[] data = ByteManipulation.ConvertBytesToInts(bytes); return(new DropItemData(data[0], data[1])); }
public static AddTileData Decode(byte[] bytes) { int[] data = ByteManipulation.ConvertBytesToInts(bytes); return(new AddTileData(data[0], data[1], (Tile)data[2])); }
public static RespawnPlayerData Decode(byte[] bytes) { int[] data = ByteManipulation.ConvertBytesToInts(bytes); return(new RespawnPlayerData(data[1], data[2], data[0])); }