CTT/Unity/Assets/HotfixView/Event/ClickOtherPlayerEvent.cs

69 lines
2.0 KiB
C#

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;
//显示菜单项
if(menu == null)
{
menu = new PopupMenu(FUI_PvpPopupMenu.URL);
menu.AddItem("窥探", context =>
{
zoneScene.GetComponent<GlobalVariable>().IsMineCharacter = false;
Game.EventSystem.Publish(new ET.EventType.OpenCharacterUI
{
zoneScene = zoneScene
}).Coroutine();
});
menu.AddItem("私聊", context =>
{
MainUI.PrivateChat(zoneScene.GetComponent<GlobalVariable>().SelectUnitId);
});
menu.AddItem("添加好友", context =>
{
FriendUI.AddFriend(zoneScene,zoneScene.GetComponent<GlobalVariable>().SelectUnitId).Coroutine();
});
menu.AddItem("邀请组队", context =>
{
TeamHelper.InviteTeam(zoneScene).Coroutine();
});
menu.AddItem("申请入队", context =>
{
TeamHelper.RequestTeam(zoneScene).Coroutine();
});
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 });
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();
}
}
}