89 lines
3.2 KiB
C#
89 lines
3.2 KiB
C#
using ET;
|
|
using ET.EventType;
|
|
using System;
|
|
using System.Text;
|
|
|
|
namespace ET
|
|
{
|
|
public class OnClickMonsterEvent : AEvent<OnClickMonster>
|
|
{
|
|
public override async ETTask Run(OnClickMonster args)
|
|
{
|
|
await ETTask.CompletedTask;
|
|
var zoneScene = args.zoneScene;
|
|
MonsterInfo monsterInfo = args.monsterInfo;
|
|
if (monsterInfo == null) return;
|
|
switch (monsterInfo.UnitSceneType)
|
|
{
|
|
case UnitSceneType.MainStory:
|
|
int region = monsterInfo.Region;
|
|
OnClickMainstory(zoneScene,region).Coroutine();
|
|
break;
|
|
case UnitSceneType.Trial:
|
|
OnClickTrialCopy(zoneScene).Coroutine();
|
|
break;
|
|
case UnitSceneType.Boss:
|
|
OnClickBoss(zoneScene).Coroutine();
|
|
break;
|
|
case UnitSceneType.ManulEquip:
|
|
OnClickManulEquip().Coroutine();
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
private async ETVoid OnClickMainstory(Scene zoneScene,int region)
|
|
{
|
|
M2C_StartMainStoryFight ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_StartMainStoryFight>(new C2M_StartMainStoryFight() { Region = region });
|
|
if (!ret.Message.IsNullOrEmpty())
|
|
{
|
|
Game.EventSystem.Publish(new ET.EventType.ShowTipUI
|
|
{
|
|
tip = ret.Message
|
|
}).Coroutine();
|
|
return;
|
|
}
|
|
}
|
|
private async ETVoid OnClickTrialCopy(Scene zoneScene)
|
|
{
|
|
M2C_StartTrialCopyFight ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_StartTrialCopyFight>(new C2M_StartTrialCopyFight());
|
|
if (!ret.Message.IsNullOrEmpty())
|
|
{
|
|
Game.EventSystem.Publish(new ET.EventType.ShowTipUI
|
|
{
|
|
tip = ret.Message
|
|
}).Coroutine();
|
|
return;
|
|
}
|
|
zoneScene.GetComponent<TrialCopyMonsterTeamComponent>().RemoveAll();
|
|
}
|
|
private async ETVoid OnClickBoss(Scene zoneScene)
|
|
{
|
|
M2C_StartBossFightRequest ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_StartBossFightRequest>(new C2M_StartBossFightRequest());
|
|
if (!ret.Message.IsNullOrEmpty())
|
|
{
|
|
Game.EventSystem.Publish(new ET.EventType.ShowTipUI
|
|
{
|
|
tip = ret.Message
|
|
}).Coroutine();
|
|
return;
|
|
}
|
|
byte[] bytes = BitConverter.GetBytes(ret.Key + DateTime.UtcNow.Year);
|
|
GameKeyComponent keyComponent = GameKeyComponent.Instance;
|
|
Utility.Encryption.GetSelfXorBytes(bytes, keyComponent.xorKey);
|
|
//bytes = SecurityUtil.Xor(bytes);
|
|
long key = BitConverter.ToInt64(bytes, 0);
|
|
|
|
Game.EventSystem.Publish(new ET.EventType.ClickBoss_ShowAttackUI
|
|
{
|
|
zoneScene = zoneScene,
|
|
key = key
|
|
}).Coroutine();
|
|
}
|
|
private async ETVoid OnClickManulEquip()
|
|
{
|
|
|
|
|
|
}
|
|
}
|
|
} |