using AX.MessageSystem; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class StorageTankSystemUI : ResourceLoadPanel { public Toggle WaterSpraySystemToggle; public Toggle FrothGeneratorToggle; public Button ConfirmButton; private Action EStorageTankSystem; List Data = new List(); void Awake() { WaterSpraySystemToggle.onValueChanged.AddListener(WaterSpraySystem); FrothGeneratorToggle.onValueChanged.AddListener(FrothGenerator); ConfirmButton.onClick.AddListener(Confirm); EStorageTankSystem += () => { foreach (var item in Data) { MessageDispatcher.SendMessage("StorageTankSystemSwitch", item); } }; } private void OnDestroy() { } private void Confirm() { gameObject.SetActive(false); if (Data.Count != 0) { EStorageTankSystem(); } Data.Clear(); } public void Show(OutFireSystem OutFireSystem) { switch (OutFireSystem) { case OutFireSystem.FrothGenerator: FrothGeneratorToggle.isOn = true; break; case OutFireSystem.WaterSpraySystem: WaterSpraySystemToggle.isOn = true; break; default: break; } } StorageTankSystemRecordData WaterSpraySystemdata=new StorageTankSystemRecordData(); private void WaterSpraySystem(bool arg0) { if (!Data.Contains(WaterSpraySystemdata)) Data.Add(WaterSpraySystemdata); WaterSpraySystemdata.OutFireSystem = OutFireSystem.WaterSpraySystem; WaterSpraySystemdata.Switch = arg0; } StorageTankSystemRecordData FrothGeneratordata=new StorageTankSystemRecordData(); private void FrothGenerator(bool arg0) { if (!Data.Contains(FrothGeneratordata)) Data.Add(FrothGeneratordata); FrothGeneratordata.OutFireSystem = OutFireSystem.FrothGenerator; FrothGeneratordata.Switch = arg0; } }