赞
踩
这是错误的写法
- ...
- btn.onClick.Add(btnClick);
- //btn.onClick.Set(btnClick);
- ...
- private void btnClick(EventContext context)
- {
- Debug.Log("btnClick name:id:" + context.type+ "/data:" + context.data+ "/sender:" + context.sender);//没有报错显示结果//btnClick name:id:onClick/data:FairyGUI.InputEvent/sender:FairyGUI.GButton
-
- //GButton item = (GButton)context.data;
- //Debug.Log("btnClick item:" + item.id);//TargetException: Object of type 'FairyGUI.InputEvent' doesn't match target type 'FairyGUI.GO
- //context.sender.GObject
- //GObject item = (GObject)context as GObject;//报错
- //Debug.Log("btnClick item1:" + item.id);
- }
- ...
- ...
- btn.onClick.Add(() => {
- click(btn);
- });
- ...
- private void click(GButton gb)
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。