示例#1
0
 static int OnPointerClick(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         GameFramework.UGUIEventListener           obj  = (GameFramework.UGUIEventListener)ToLua.CheckObject <GameFramework.UGUIEventListener>(L, 1);
         UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject <UnityEngine.EventSystems.PointerEventData>(L, 2);
         obj.OnPointerClick(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#2
0
 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));
     }
 }
示例#3
0
    static int set_eventKeyName(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            GameFramework.UGUIEventListener obj = (GameFramework.UGUIEventListener)o;
            string arg0 = ToLua.CheckString(L, 2);
            obj.eventKeyName = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index eventKeyName on a nil value"));
        }
    }
示例#4
0
    static int get_eventKeyName(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            GameFramework.UGUIEventListener obj = (GameFramework.UGUIEventListener)o;
            string ret = obj.eventKeyName;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index eventKeyName on a nil value"));
        }
    }
示例#5
0
        /// <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);
        }