...
using FairyGUI;
...
Stage.inst.onClick.Add(btnClick);//鼠标点击
//Stage.inst.onTouchMove.Add(btnClick);//鼠标悬浮
...
private void btnClick(EventContext context)
{
Debug.Log("click :1:" + (GObject)context.sender);//FairyGUI.Stage
GComponent item = (GComponent)context.data;
//GComponent gc = item.asCom;//Object of type 'FairyGUI.InputEvent' doesn't match target type 'FairyGUI.GObject'
//Debug.Log("click :id:" + item.id+ "/name:" + item.name);//Object of type 'FairyGUI.InputEvent' doesn't match target type 'FairyGUI.GObject'
Debug.Log("click :2:" + (DisplayObject)context.initiator);//FairyGUI.Stage
GObject obj = GRoot.inst.touchTarget;
Debug.Log("click :3:" + obj.id+"/name:"+obj.name);//obj.id每个对象都有(相同组件的相同名字)//obj.name不一定有