CTT/Unity/Assets/Hotfix/Logic/Behaviour/Game/Event/Other/ClickBattleTargetEvent.cs

43 lines
1.6 KiB
C#

using ET;
using ET.EventType;
namespace ET
{
public class ClickBattleTargetEvent: AEvent<ClickBattleTarget>
{
public override async ETTask Run(ClickBattleTarget args)
{
var zoneScene = args.zoneScene;
switch (args.unitType)
{
case UnitType.Enermy:
{
M2C_SelectEnermy ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_SelectEnermy>(new C2M_SelectEnermy { Id = zoneScene.GetComponent<GlobalVariable>().SelectBattleUnitId });
if (!ret.Message.IsNullOrEmpty())
{
Game.EventSystem.Publish(new ET.EventType.ShowTipUI
{
tip = ret.Message
}).Coroutine();
return;
}
}
break;
case UnitType.TeamMember:
{
M2C_SelectTeamMember ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_SelectTeamMember>(new C2M_SelectTeamMember { Id = zoneScene.GetComponent<GlobalVariable>().SelectBattleUnitId });
if (!ret.Message.IsNullOrEmpty())
{
Game.EventSystem.Publish(new ET.EventType.ShowTipUI
{
tip = ret.Message
}).Coroutine();
return;
}
}
break;
}
}
}
}