68 lines
1.7 KiB
C#
68 lines
1.7 KiB
C#
using ET;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace ET
|
|
{
|
|
public class HideUnitComponentAwakeSystem : AwakeSystem<HideUnitComponent>
|
|
{
|
|
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 (UnitComponent.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<Entity> GetAll()
|
|
{
|
|
return inst.Children.Values;
|
|
}
|
|
public static bool Remove(Unit unit)
|
|
{
|
|
return inst.Children.Remove(unit.Id);
|
|
}
|
|
|
|
}
|
|
}
|