zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/HotfixView/Event/HideOthersUnitEvent.cs

44 lines
1.2 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using ET.EventType;
using ET;
using System;
using System.Collections.Generic;
namespace ET
{
public class ShowOthersUnitEvent : AEvent_Sync<ShowOthersUnit>
{
public override void Run(ShowOthersUnit args)
{
if (HideUnitComponent.GetIsDisOther)
{
return;
}
var list = HideUnitComponent.GetAll();
2021-04-11 19:50:39 +08:00
foreach (Entity item in list)
2021-04-08 20:09:59 +08:00
{
item.GetComponent<UnitView>().gameObject.SetActive(true);
}
}
}
public class HideOthersUnitEvent : AEvent_Sync<HideOthersUnit>
{
public override void Run(HideOthersUnit args)
{
var list = HideUnitComponent.GetAll();
2021-04-11 19:50:39 +08:00
foreach (Entity item in list)
2021-04-08 20:09:59 +08:00
{
try
{
if (args.isExcludeNPC && item.As<Unit>().UnitType == UnitType.NPC)
continue;
item.GetComponent<UnitView>().gameObject.SetActive(false);
}
catch (Exception e)
{
Log.Error(e);
}
}
}
}
}