static int AddClickCallback(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); GameFramework.UGUIEventListener obj = (GameFramework.UGUIEventListener)ToLua.CheckObject <GameFramework.UGUIEventListener>(L, 1); System.Action <UnityEngine.GameObject> arg0 = (System.Action <UnityEngine.GameObject>)ToLua.CheckDelegate <System.Action <UnityEngine.GameObject> >(L, 2); bool arg1 = LuaDLL.luaL_checkboolean(L, 3); obj.AddClickCallback(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 使用该种方式添加的点击,不会广播事件。 /// 同时这种监听方式可以设置为不受UI按钮限制的控制,可以作为新手引导的按钮点击方式。 /// </summary> public static void AddButtonClick(GameObject _obj, System.Action <GameObject> _cb, bool _nolimit = false) { if (Utility.isNull(_obj)) { return; } UGUIEventListener _lis = _obj.GetComponent <UGUIEventListener>(); if (_lis == null) { _lis = _obj.AddComponent <UGUIEventListener>(); } else { if (_lis.GetType() != typeof(UGUIEventListener)) { Utility.LogError("已经有其他更高层的监听器,无法继续添加底层监听器"); return; } } _lis.AddClickCallback(_cb, !_nolimit); }