From e9ea621b93fbb58d9edfca8375918791637bbd52 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 30 Dec 2020 20:59:04 +0800 Subject: +init --- Client/Assembly-CSharp/SecurityCameraSystemType.cs | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Client/Assembly-CSharp/SecurityCameraSystemType.cs (limited to 'Client/Assembly-CSharp/SecurityCameraSystemType.cs') diff --git a/Client/Assembly-CSharp/SecurityCameraSystemType.cs b/Client/Assembly-CSharp/SecurityCameraSystemType.cs new file mode 100644 index 0000000..f7a90ce --- /dev/null +++ b/Client/Assembly-CSharp/SecurityCameraSystemType.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using Hazel; + +//监控器 +public class SecurityCameraSystemType : ISystemType +{ + public bool InUse + { + get + { + return this.PlayersUsing.Count > 0; + } + } + + public const byte IncrementOp = 1; + + public const byte DecrementOp = 2; + + private HashSet PlayersUsing = new HashSet(); + + public bool Detoriorate(float deltaTime) + { + return false; + } + + public void RepairDamage(PlayerControl player, byte amount) + { + if (amount == 1) + { + this.PlayersUsing.Add(player.PlayerId); + } + else + { + this.PlayersUsing.Remove(player.PlayerId); + } + this.UpdateCameras(); + } + + private void UpdateCameras() + { + for (int i = 0; i < ShipStatus.Instance.AllRooms.Length; i++) + { + ShipRoom shipRoom = ShipStatus.Instance.AllRooms[i]; + if (shipRoom.survCamera) + { + if (this.InUse) + { + shipRoom.survCamera.Image.Play(shipRoom.survCamera.OnAnim, 1f); + } + else + { + shipRoom.survCamera.Image.Play(shipRoom.survCamera.OffAnim, 1f); + } + } + } + } + + public void Serialize(MessageWriter writer, bool initialState) + { + writer.WritePacked(this.PlayersUsing.Count); + foreach (byte value in this.PlayersUsing) + { + writer.Write(value); + } + } + + public void Deserialize(MessageReader reader, bool initialState) + { + this.PlayersUsing.Clear(); + int num = reader.ReadPackedInt32(); + for (int i = 0; i < num; i++) + { + this.PlayersUsing.Add(reader.ReadByte()); + } + this.UpdateCameras(); + } +} -- cgit v1.1-26-g67d0