Přidaný command a event pro otevírání a zavírání dveří
This commit is contained in:
parent
b968b12090
commit
952aae10de
7 changed files with 87 additions and 30 deletions
|
|
@ -9,6 +9,9 @@ public struct GameEvent : INetSerializable{
|
|||
public static GameEvent PLAYER_LEAVE(int pid) => new(){ID = 1, Args = [pid] };
|
||||
public static GameEvent SWITCH_CAM(int pid, int camId) => new(){ID = 2, Args = [pid, camId] };
|
||||
public static GameEvent TOGGLE_MONITOR(int pid, bool state) => new(){ID = 3, Args = [pid, state ? 1 : 0]};
|
||||
public static GameEvent TOGGLE_DOOR_OFFICE(int pid, int doorId, bool state) => new(){ID = 4, Args = [pid, doorId, state ? 1 : 0]};
|
||||
|
||||
|
||||
|
||||
public static GameEvent ENEMY_MOVEMENT(int enemyId, int camId) => new(){ID = -1, Args = [enemyId, camId]};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace PacketLib;
|
|||
public struct PlayerCommand : INetSerializable {
|
||||
public static PlayerCommand SWITCH_CAM(int camId) => new(){ID = 0, Args = [camId] };
|
||||
public static PlayerCommand TOGGLE_MONITOR() => new(){ID = 1, Args = []};
|
||||
|
||||
public static PlayerCommand TOGGLE_DOOR_OFFICE(int doorId) => new(){ID = 2, Args = [doorId]};
|
||||
public int ID{ get; set; }
|
||||
public bool Hideable => ID < 0;
|
||||
public int[] Args{ get; private set; }
|
||||
|
|
|
|||
|
|
@ -4,20 +4,25 @@ using LiteNetLib.Utils;
|
|||
namespace PacketLib;
|
||||
|
||||
public struct PlayerState : INetSerializable {
|
||||
public uint pid;
|
||||
public int pid;
|
||||
public int camera;
|
||||
public bool monitorUp;
|
||||
|
||||
public bool[] doorStates;
|
||||
|
||||
|
||||
public void Serialize(NetDataWriter writer) {
|
||||
writer.Put(pid);
|
||||
writer.Put(camera);
|
||||
writer.Put(monitorUp);
|
||||
writer.PutArray(doorStates);
|
||||
}
|
||||
|
||||
public void Deserialize(NetDataReader reader) {
|
||||
pid = reader.GetUInt();
|
||||
pid = reader.GetInt();
|
||||
camera = reader.GetInt();
|
||||
monitorUp = reader.GetBool();
|
||||
doorStates = reader.GetBoolArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue