2025-12-19 17:54:50 +01:00
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
|
using LiteNetLib.Utils;
|
|
|
|
|
|
|
|
|
|
namespace PacketLib;
|
|
|
|
|
|
|
|
|
|
#nullable disable
|
|
|
|
|
public struct GameEvent : INetSerializable{
|
2026-03-12 22:33:35 +01:00
|
|
|
public static GameEvent PLAYER_JOIN(int pid) => new(){ID = 0, Args = [pid] };
|
|
|
|
|
public static GameEvent PLAYER_LEAVE(int pid) => new(){ID = 1, Args = [pid] };
|
2026-02-21 18:42:44 +01:00
|
|
|
public static GameEvent SWITCH_CAM(int pid, int id) => new(){ID = 2, Args = [pid, id] };
|
2025-12-19 17:54:50 +01:00
|
|
|
public static GameEvent TOGGLE_MONITOR(int pid, bool state) => new(){ID = 3, Args = [pid, state ? 1 : 0]};
|
2026-01-25 11:16:54 +01:00
|
|
|
public static GameEvent TOGGLE_DOOR_OFFICE(int pid, int doorId, bool state) => new(){ID = 4, Args = [pid, doorId, state ? 1 : 0]};
|
2026-02-21 18:42:44 +01:00
|
|
|
public static GameEvent TOGGLE_DOOR_REMOTE(int pid, (int, int) doorId, bool state) => new(){ID = 5, Args = [pid, doorId.Item1, doorId.Item2, state ? 1 : 0]};
|
2026-01-25 11:16:54 +01:00
|
|
|
|
2026-03-08 16:55:49 +01:00
|
|
|
public static GameEvent ENEMY_SPAWN(int enemyTypeId, int enemyId, int difficulty, int camId) => new(){ ID = 6, Args = [enemyTypeId, enemyId, difficulty, camId] };
|
|
|
|
|
public static GameEvent ENEMY_MOVEMENT(int enemyId, int camId) => new(){ID = 7, Args = [enemyId, camId]};
|
|
|
|
|
public static GameEvent ENEMY_ATTACK(int enemyId, int pid) => new(){ ID = 8, Args =[enemyId, pid] };
|
|
|
|
|
public static GameEvent ENEMY_RESET(int enemyId, int camId) => new(){ID = 9, Args = [enemyId, camId]};
|
|
|
|
|
|
|
|
|
|
public static GameEvent SPOT_SET_ACTIVE(int enemyId, bool state) => new(){ ID = 10, Args = [enemyId, state ? 1 : 0] };
|
2025-12-19 17:54:50 +01:00
|
|
|
|
2026-03-09 20:05:21 +01:00
|
|
|
public static GameEvent PLAYER_WIN(int pid) => new(){ID = 11, Args = [pid]};
|
2026-03-11 22:35:30 +01:00
|
|
|
public static GameEvent GAME_START() => new(){ID = 12};
|
2026-03-12 22:33:35 +01:00
|
|
|
public static GameEvent POWER_TICK(int pid, int power) => new(){ID = 13, Args = [pid, power]};
|
|
|
|
|
public static GameEvent POWER_OUT(int pid) => new(){ID = 14, Args = [pid]};
|
2026-03-16 20:43:53 +01:00
|
|
|
public static GameEvent TOGGLE_LIGHT(int pid, int camId, bool state) => new(){ID = 15, Args = [pid, camId, state ? 1 : 0]};
|
2026-03-17 20:14:29 +01:00
|
|
|
public static GameEvent NEKO_ANGERED(int pid, int enemyId) => new(){ID = 16, Args = [pid, enemyId]};
|
2026-03-09 20:05:21 +01:00
|
|
|
|
2025-12-19 17:54:50 +01:00
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|