static int OnPointerUp(IntPtr L) { L.ChkArgsCount(2); ZFrame.UGUI.UILongpress obj = (ZFrame.UGUI.UILongpress)L.ChkUnityObjectSelf(1, "ZFrame.UGUI.UILongpress"); UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)L.ChkUserData(2, typeof(UnityEngine.EventSystems.PointerEventData)); obj.OnPointerUp(arg0); return(0); }
private void Update() { if (m_Time < 0) { return; } float lasting = m_Time; m_Time += Time.unscaledDeltaTime; if (lasting < threshold) { // 第一次触发长按 if (m_Time >= threshold) { m_Last = threshold; current = this; if (onAction != null) { onAction.Invoke(this); } // 是否支持反复触发 if (interval == 0) { m_Time = -1; } } } else { // 反复触发 float dura = m_Time - m_Last; int n = Mathf.FloorToInt(dura / interval); if (n > 0) { m_Last += interval * n; current = this; if (onAction != null) { for (int i = 0; i < n; ++i) { onAction.Invoke(this); } } } } }
static int set_onAction(IntPtr L) { object o = L.ToUserData(1); ZFrame.UGUI.UILongpress obj = (ZFrame.UGUI.UILongpress)o; if (obj == null) { LuaTypes types = L.Type(1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name onAction"); } else { LuaDLL.luaL_error(L, "attempt to index onAction on a nil value"); } } LuaTypes funcType = L.Type(3); if (funcType != LuaTypes.LUA_TFUNCTION) { obj.onAction = (UnityEngine.Events.UnityAction <ZFrame.UGUI.UILongpress>)L.ChkUserData(3, typeof(UnityEngine.Events.UnityAction <ZFrame.UGUI.UILongpress>)); } else { LuaFunction func = L.ToLuaFunction(3); obj.onAction = (param0) => { int top = func.BeginPCall(); L.PushLightUserData(param0); func.PCall(top, 1); func.EndPCall(top); }; } return(0); }
static int get_interval(IntPtr L) { object o = L.ToUserData(1); ZFrame.UGUI.UILongpress obj = (ZFrame.UGUI.UILongpress)o; if (obj == null) { LuaTypes types = L.Type(1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name interval"); } else { LuaDLL.luaL_error(L, "attempt to index interval on a nil value"); } } L.PushNumber(obj.interval); return(1); }
static int set_threshold(IntPtr L) { object o = L.ToUserData(1); ZFrame.UGUI.UILongpress obj = (ZFrame.UGUI.UILongpress)o; if (obj == null) { LuaTypes types = L.Type(1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name threshold"); } else { LuaDLL.luaL_error(L, "attempt to index threshold on a nil value"); } } obj.threshold = (float)L.ChkNumber(3); return(0); }
static int get_onAction(IntPtr L) { object o = L.ToUserData(1); ZFrame.UGUI.UILongpress obj = (ZFrame.UGUI.UILongpress)o; if (obj == null) { LuaTypes types = L.Type(1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name onAction"); } else { LuaDLL.luaL_error(L, "attempt to index onAction on a nil value"); } } L.PushUData(obj.onAction); return(1); }