using Cyber.Items;
using UnityEngine.Networking;
namespace Cyber.Networking.Messages {
///
/// Packet containing an inventory action of a kind.
///
public class InventoryActionPkt : MessageBase {
///
/// The inventory action.
///
public InventoryAction Action;
///
/// The related int list to the
///
public int[] IntList;
///
/// The inventory SyncBaseID this happened in. Only set by server.
///
public int SyncBaseID;
///
/// Creates an inventory action packet for sending.
///
/// The action done.
///
public InventoryActionPkt(InventoryAction action, int[] intList) {
Action = action;
IntList = intList;
}
///
/// Creates an inventory packet containing only one int.
///
///
///
public InventoryActionPkt(InventoryAction action, int relatedInt) {
Action = action;
IntList = new int[1] { relatedInt };
}
///
/// Creates an inventory action packet for deserializing.
///
public InventoryActionPkt() {}
///
/// Deserializes the
///
///
public override void Deserialize(NetworkReader reader) {
Action = (InventoryAction) reader.ReadByte();
IntList = reader.ReadMessage().IntList;
SyncBaseID = reader.ReadInt32();
}
///
/// Serializes the
///
///
public override void Serialize(NetworkWriter writer) {
writer.Write((byte) Action);
writer.Write(new IntListPkt(IntList));
writer.Write(SyncBaseID);
}
}
}