static public int ClearKeyListen(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         Ballance2.UI.Utils.KeyListener self = (Ballance2.UI.Utils.KeyListener)checkSelf(l);
         self.ClearKeyListen();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Exemple #2
0
        /// <summary>
        /// 从 指定 GameObject 创建键事件侦听器
        /// </summary>
        /// <param name="go">指定 GameObject</param>
        /// <returns></returns>
        static public KeyListener Get(GameObject go)
        {
            KeyListener listener = go.GetComponent <KeyListener>();

            if (listener == null)
            {
                listener = go.AddComponent <KeyListener>();
            }
            return(listener);
        }
 static public int AddKeyListen(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 3)
         {
             Ballance2.UI.Utils.KeyListener self = (Ballance2.UI.Utils.KeyListener)checkSelf(l);
             UnityEngine.KeyCode            a1;
             a1 = (UnityEngine.KeyCode)LuaDLL.luaL_checkinteger(l, 2);
             Ballance2.UI.Utils.KeyListener.KeyDelegate a2;
             checkDelegate(l, 3, out a2);
             self.AddKeyListen(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 4)
         {
             Ballance2.UI.Utils.KeyListener self = (Ballance2.UI.Utils.KeyListener)checkSelf(l);
             UnityEngine.KeyCode            a1;
             a1 = (UnityEngine.KeyCode)LuaDLL.luaL_checkinteger(l, 2);
             UnityEngine.KeyCode a2;
             a2 = (UnityEngine.KeyCode)LuaDLL.luaL_checkinteger(l, 3);
             Ballance2.UI.Utils.KeyListener.KeyDelegate a3;
             checkDelegate(l, 4, out a3);
             self.AddKeyListen(a1, a2, a3);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function AddKeyListen to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }