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/ElectricTask.cs | 82 ++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Client/Assembly-CSharp/ElectricTask.cs (limited to 'Client/Assembly-CSharp/ElectricTask.cs') diff --git a/Client/Assembly-CSharp/ElectricTask.cs b/Client/Assembly-CSharp/ElectricTask.cs new file mode 100644 index 0000000..1480462 --- /dev/null +++ b/Client/Assembly-CSharp/ElectricTask.cs @@ -0,0 +1,82 @@ +using System; +using System.Linq; +using System.Text; +using UnityEngine; + +public class ElectricTask : SabotageTask +{ + public override int TaskStep + { + get + { + if (!this.isComplete) + { + return 0; + } + return 1; + } + } + + public override bool IsComplete + { + get + { + return this.isComplete; + } + } + + private bool isComplete; + + private SwitchSystem system; + + private bool even; + + public override void Initialize() + { + ShipStatus instance = ShipStatus.Instance; + this.system = (SwitchSystem)instance.Systems[SystemTypes.Electrical]; + base.SetupArrows(); + } + + private void FixedUpdate() + { + if (this.isComplete) + { + return; + } + if (this.system.ExpectedSwitches == this.system.ActualSwitches) + { + this.Complete(); + } + } + + public override bool ValidConsole(global::Console console) + { + return console.TaskTypes.Contains(TaskTypes.FixLights); + } + + public override void Complete() + { + this.isComplete = true; + PlayerControl.LocalPlayer.RemoveTask(this); + if (this.didContribute) + { + StatsManager instance = StatsManager.Instance; + uint sabsFixed = instance.SabsFixed; + instance.SabsFixed = sabsFixed + 1U; + } + } + + public override void AppendTaskText(StringBuilder sb) + { + this.even = !this.even; + Color color = this.even ? Color.yellow : Color.red; + sb.Append(color.ToTextColor()); + sb.Append(DestroyableSingleton.Instance.GetString(TaskTypes.FixLights)); + sb.AppendLine(" (%" + (int)(this.system.Level * 100f) + ")[]"); + for (int i = 0; i < this.Arrows.Length; i++) + { + this.Arrows[i].image.color = color; + } + } +} -- cgit v1.1-26-g67d0