Oprava spawnování monster, optimalizace v CommandProcessor a EventProcessor. Přesunutí některých tříd do vlastních namespaců, pročištění kódu, úpravy formátování, odstranění nepoužívaných souborů a zakomentovaného kódu
This commit is contained in:
parent
e5d746d597
commit
243f071a43
62 changed files with 873 additions and 1217 deletions
|
|
@ -1,44 +1,44 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using GlobalClassLib;
|
||||
using LiteNetLib.Utils;
|
||||
|
||||
namespace PacketLib;
|
||||
|
||||
#nullable disable
|
||||
public struct GameEvent : INetSerializable{
|
||||
public static GameEvent PLAYER_JOIN(int pid) => new(){ID = 0, Args = [pid] };
|
||||
public static GameEvent PLAYER_LEAVE(int pid) => new(){ID = 1, Args = [pid] };
|
||||
public static GameEvent SWITCH_CAM(int pid, int id) => new(){ID = 2, Args = [pid, id] };
|
||||
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 TOGGLE_DOOR_REMOTE(int pid, (int, int) doorId, bool state) => new(){ID = 5, Args = [pid, doorId.Item1, doorId.Item2, state ? 1 : 0]};
|
||||
public static GameEvent PLAYER_JOIN(int pid) => new(){Id = 0, Args = [pid] };
|
||||
public static GameEvent PLAYER_LEAVE(int pid) => new(){Id = 1, Args = [pid] };
|
||||
public static GameEvent SWITCH_CAM(int pid, int id) => new(){Id = 2, Args = [pid, id] };
|
||||
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 TOGGLE_DOOR_REMOTE(int pid, (int, int) doorId, bool state) => new(){Id = 5, Args = [pid, doorId.Item1, doorId.Item2, state ? 1 : 0]};
|
||||
|
||||
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 ENEMY_SPAWN(EnemyType enemyTypeId, int enemyId, int difficulty, int camId) => new(){ Id = 6, Args = [(int)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] };
|
||||
public static GameEvent SPOT_SET_ACTIVE(int enemyId, bool state) => new(){ Id = 10, Args = [enemyId, state ? 1 : 0] };
|
||||
|
||||
public static GameEvent PLAYER_WIN(int pid) => new(){ID = 11, Args = [pid]};
|
||||
public static GameEvent GAME_START() => new(){ID = 12};
|
||||
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]};
|
||||
public static GameEvent TOGGLE_LIGHT(int pid, int camId, bool state) => new(){ID = 15, Args = [pid, camId, state ? 1 : 0]};
|
||||
public static GameEvent NEKO_ANGERED(int pid, int enemyId) => new(){ID = 16, Args = [pid, enemyId]};
|
||||
public static GameEvent VENT_USED() => new(){ID = 17};
|
||||
public static GameEvent NEXT_PHASE() => new(){ID = 18};
|
||||
public static GameEvent PLAYER_WIN(int pid) => new(){Id = 11, Args = [pid]};
|
||||
public static GameEvent GAME_START() => new(){Id = 12};
|
||||
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]};
|
||||
public static GameEvent TOGGLE_LIGHT(int pid, int camId, bool state) => new(){Id = 15, Args = [pid, camId, state ? 1 : 0]};
|
||||
public static GameEvent NEKO_ANGERED(int pid, int enemyId) => new(){Id = 16, Args = [pid, enemyId]};
|
||||
public static GameEvent VENT_USED() => new(){Id = 17};
|
||||
public static GameEvent NEXT_PHASE() => new(){Id = 18};
|
||||
|
||||
public int ID{ get; set; }
|
||||
public bool Hideable => ID < 0;
|
||||
public int Id{ get; set; }
|
||||
public int[] Args{ get; private set; }
|
||||
|
||||
public void Serialize(NetDataWriter writer) {
|
||||
writer.Put(ID);
|
||||
writer.Put(Id);
|
||||
writer.PutArray(Args);
|
||||
}
|
||||
|
||||
public void Deserialize(NetDataReader reader) {
|
||||
ID = reader.GetInt();
|
||||
Id = reader.GetInt();
|
||||
Args = reader.GetIntArray();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue