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

69 lines
2.0 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using ET;
using ET.EventType;
using FairyGUI;
using UnityEngine;
namespace ET
{
public class ClickOtherPlayerEvent: AEvent<ET.EventType.ClickOtherPlayer>
{
private PopupMenu menu;
public override async ETTask Run(ClickOtherPlayer args)
{
var zoneScene = args.zoneScene;
2021-04-08 20:09:59 +08:00
//显示菜单项
if(menu == null)
{
menu = new PopupMenu(FUI_PvpPopupMenu.URL);
menu.AddItem("窥探", context =>
{
zoneScene.GetComponent<GlobalVariable>().IsMineCharacter = false;
2021-04-08 20:09:59 +08:00
Game.EventSystem.Publish(new ET.EventType.OpenCharacterUI
{
2021-05-13 20:14:23 +08:00
zoneScene = zoneScene
2021-04-08 20:09:59 +08:00
}).Coroutine();
});
menu.AddItem("私聊", context =>
{
MainUI.PrivateChat(zoneScene.GetComponent<GlobalVariable>().SelectUnitId);
2021-04-08 20:09:59 +08:00
});
menu.AddItem("添加好友", context =>
{
FriendUI.AddFriend(zoneScene,zoneScene.GetComponent<GlobalVariable>().SelectUnitId).Coroutine();
2021-04-08 20:09:59 +08:00
});
menu.AddItem("邀请组队", context =>
{
TeamHelper.InviteTeam(zoneScene).Coroutine();
2021-04-08 20:09:59 +08:00
});
menu.AddItem("申请入队", context =>
{
TeamHelper.RequestTeam(zoneScene).Coroutine();
2021-04-08 20:09:59 +08:00
});
menu.AddItem("交易", context =>
{
GButton item = (GButton)context.data;
Debug.Log(item.name);
});
menu.AddItem("PK",async context =>
{
M2C_StartPKFight ret =await zoneScene.GetComponent<SessionComponent>().Call<M2C_StartPKFight>(new C2M_StartPKFight { TargetId = zoneScene.GetComponent<GlobalVariable>().SelectUnitId });
2021-04-08 20:09:59 +08:00
if (!ret.Message.IsNullOrEmpty())
{
Game.EventSystem.Publish(new ET.EventType.ShowTipUI
{
tip =ret.Message
}).Coroutine();
}
});
menu.AddItem("家族邀请", context =>
{
GButton item = (GButton)context.data;
Debug.Log(item.name);
});
}
menu.Show();
}
}
}