diff options
Diffstat (limited to 'Client/Assembly-CSharp/SecurityCameraSystemType.cs')
-rw-r--r-- | Client/Assembly-CSharp/SecurityCameraSystemType.cs | 78 |
1 files changed, 78 insertions, 0 deletions
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<byte> PlayersUsing = new HashSet<byte>(); + + 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(); + } +} |