using ET; using System; using System.Collections.Generic; namespace ET { public class HideUnitComponentAwakeSystem : AwakeSystem { public override void Awake(HideUnitComponent self) { self.Awake(); } } public class HideUnitComponent : Entity { private static HideUnitComponent inst; private bool disOther; internal void Awake() { inst = this; } public static void SetDisOther() { inst.disOther = !inst.disOther; if (inst.ZoneScene().GetComponent().MyUnit.IsFight) { Game.EventSystem.Publish(new ET.EventType.ShowTipUI { tip = "战斗中不要点击此按钮" }).Coroutine(); } if (inst.disOther) { Game.EventSystem.Publish_Sync(new ET.EventType.HideOthersUnit { isExcludeNPC = true }); } else { Game.EventSystem.Publish_Sync(new ET.EventType.ShowOthersUnit { }); } } public static bool GetIsDisOther => inst.disOther; public static bool Add(Unit unit) { if (inst.Children.ContainsKey(unit.Id)) return false; inst.Children.Add(unit.Id,unit); return true; } public static IEnumerable GetAll() { return inst.Children.Values; } public static bool Remove(Unit unit) { return inst.Children.Remove(unit.Id); } } }