OneNightDuel/PacketLib/PlayerCommand.cs

25 lines
No EOL
874 B
C#

using GlobalClassLib;
using LiteNetLib.Utils;
namespace PacketLib;
public struct PlayerCommand : INetSerializable {
public static PlayerCommand SWITCH_CAM(int idx, int idy) => new(){ID = 0, Args = [idx, idy] };
public static PlayerCommand TOGGLE_MONITOR() => new(){ID = 1, Args = []};
public static PlayerCommand TOGGLE_DOOR_OFFICE(Direction direction) => new(){ID = 2, Args = [(int)direction]};
public static PlayerCommand TOGGLE_DOOR_REMOTE(int remoteDoorId) => new(){ID = 3, Args = [remoteDoorId]};
public int ID{ get; set; }
public bool Hideable => ID < 0;
public int[] Args{ get; private set; }
public void Serialize(NetDataWriter writer) {
writer.Put(ID);
writer.PutArray(Args);
}
public void Deserialize(NetDataReader reader) {
ID = reader.GetInt();
Args = reader.GetIntArray();
}
}