Beispiel #1
0
    static int Dispatch(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(IInputEventBase)))
            {
                IInputEventBase arg0 = (IInputEventBase)ToLua.ToObject(L, 1);
                InputManager.Dispatch(arg0);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(IInputEventBase)))
            {
                string          arg0 = ToLua.ToString(L, 1);
                IInputEventBase arg1 = (IInputEventBase)ToLua.ToObject(L, 2);
                InputManager.Dispatch(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: InputManager.Dispatch"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Beispiel #2
0
 public void Call(IInputEventBase param0)
 {
     func.BeginPCall();
     func.PushObject(param0);
     func.PCall();
     func.EndPCall();
 }
Beispiel #3
0
 public void Call(string param0, IInputEventBase param1)
 {
     func.BeginPCall();
     func.Push(param0);
     func.PushObject(param1);
     func.PCall();
     func.EndPCall();
 }
Beispiel #4
0
    public static void OnEveryEventCallBack(string eventName, IInputEventBase inputEvent)
    {
        //Dictionary<string, string> tmp = new Dictionary<string, string>();

        //tmp.Add(c_eventNameKey, inputEvent.GetType().Name);
        //tmp.Add(c_serializeInfoKey, inputEvent.Serialize());

        //s_eventStreamSerialize.Add(tmp);
    }
    public static void OnEveryEventCallBack(string eventName, IInputEventBase inputEvent)
    {
        Dictionary <string, object> tmp = HeapObjectPool.GetSODict();

        tmp.Add(c_eventNameKey, inputEvent.GetType().Name);
        tmp.Add(c_serializeInfoKey, inputEvent.Serialize());

        WriteInputEvent(Json.Serialize(tmp));
    }
Beispiel #6
0
 static void LoadEventStream(string[] content)
 {
     s_eventStream = new List <IInputEventBase>();
     for (int i = 0; i < content.Length; i++)
     {
         if (content[i] != "")
         {
             Dictionary <string, object> info = (Deserializer.Deserialize <Dictionary <string, object> > (content[i]));
             IInputEventBase             eTmp = (IInputEventBase)Deserializer.Deserialize(Type.GetType(info[c_eventNameKey].ToString()), info[c_serializeInfoKey].ToString());
             s_eventStream.Add(eTmp);
         }
     }
 }
Beispiel #7
0
 static int Reset(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         IInputEventBase obj = (IInputEventBase)ToLua.CheckObject(L, 1, typeof(IInputEventBase));
         obj.Reset();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #8
0
 protected void AllEventDispatch(string eventName, IInputEventBase inputEvent)
 {
     if (m_OnAllEventDispatch != null)
     {
         try
         {
             m_OnAllEventDispatch(eventName, inputEvent);
         }
         catch (Exception e)
         {
             Debug.LogError(e.ToString());
         }
     }
 }
 protected void AllEventDispatch(string eventName, IInputEventBase inputEvent)
 {
     if (m_OnAllEventDispatch != null)
     {
         try
         {
             m_OnAllEventDispatch(eventName, inputEvent);
         }
         catch (Exception e)
         {
             Debug.LogError(e.ToString());
         }
     }
 }
Beispiel #10
0
 protected void AllEventDispatch(string eventName, IInputEventBase inputEvent)
 {
     if (m_OnAllEventDispatch != null)
     {
         try
         {
             m_OnAllEventDispatch(eventName, inputEvent);
         }
         catch (Exception e)
         {
             Debug.LogError("AllEventDispatch name: " + eventName + " key: " + inputEvent.EventKey + " Exception:" + e.ToString());
         }
     }
 }
    static void LoadEventStream(List <object> content)
    {
        s_eventStream = new List <IInputEventBase>();

        for (int i = 0; i < content.Count; i++)
        {
            Dictionary <string, object> info = (Dictionary <string, object>)(content[i]);

            //Debug.Log(info[c_eventNameKey].ToString());
            //Debug.Log(info[c_eventNameKey].ToString());

            IInputEventBase eTmp = (IInputEventBase)JsonUtility.FromJson(info[c_serializeInfoKey].ToString(), Type.GetType(info[c_eventNameKey].ToString()));
            s_eventStream.Add(eTmp);
        }
    }
    public static void OnEveryEventCallBack(string eventName, IInputEventBase inputEvent)
    {
        Dictionary <string, object> tmp = new Dictionary <string, object>();

        tmp.Add(c_eventNameKey, inputEvent.GetType().Name);
        tmp.Add(c_serializeInfoKey, inputEvent.Serialize());
        try
        {
            WriteInputEvent(Json.Serialize(tmp));
        }
        catch (Exception e)
        {
            Debug.LogError("Write Dev Log Error! : " + e.ToString());
        }
    }
Beispiel #13
0
        public IInputEventBase GetEvent()
        {
            IInputEventBase cmd = m_pool[m_poolIndex];

            cmd.Reset();

            m_poolIndex++;

            if (m_poolIndex >= m_pool.Length)
            {
                m_poolIndex = 0;
            }

            return(cmd);
        }
Beispiel #14
0
 static int Serialize(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         IInputEventBase obj = (IInputEventBase)ToLua.CheckObject(L, 1, typeof(IInputEventBase));
         string          o   = obj.Serialize();
         LuaDLL.lua_pushstring(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #15
0
 static int Analysis(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         IInputEventBase obj  = (IInputEventBase)ToLua.CheckObject(L, 1, typeof(IInputEventBase));
         string          arg0 = ToLua.CheckString(L, 2);
         IInputEventBase o    = obj.Analysis(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #16
0
    static int get_EventKey(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            IInputEventBase obj = (IInputEventBase)o;
            string          ret = obj.EventKey;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index EventKey on a nil value" : e.Message));
        }
    }
Beispiel #17
0
    static int set_m_t(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            IInputEventBase obj  = (IInputEventBase)o;
            float           arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.m_t = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_t on a nil value" : e.Message));
        }
    }
Beispiel #18
0
    static int set_EventKey(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            IInputEventBase obj  = (IInputEventBase)o;
            string          arg0 = ToLua.CheckString(L, 2);
            obj.EventKey = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index EventKey on a nil value" : e.Message));
        }
    }
Beispiel #19
0
    static int get_m_t(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            IInputEventBase obj = (IInputEventBase)o;
            float           ret = obj.m_t;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_t on a nil value" : e.Message));
        }
    }
    protected void AllEventDispatch(string eventName, IInputEventBase inputEvent)
    {
        if (m_OnAllEventDispatch != null)
        {
            Delegate[] eventArray = m_OnAllEventDispatch.GetInvocationList();

            for (int i = 0; i < eventArray.Length; i++)
            {
                try
                {
                    InputEventCallBack callBack = (InputEventCallBack)eventArray[i];
                    callBack(eventName, inputEvent);
                }
                catch (Exception e)
                {
                    Debug.LogError(e.ToString());
                }
            }
        }
    }
 public override void Dispatch(IInputEventBase inputEvent)
 {
     Dispatch((Event)inputEvent);
 }
 protected virtual void ReceviceCustomEvent(IInputEventBase e)
 {
 }
 public static void OnEveryEventCallBack(string eventName, IInputEventBase inputEvent)
 {
     s_eventStream.Add(inputEvent);
 }
Beispiel #24
0
    public static void Dispatch(string eventName, IInputEventBase inputEvent)
    {
        IInputDispatcher dispatcher = GetDispatcher(eventName);

        dispatcher.Dispatch(inputEvent);
    }
Beispiel #25
0
 public abstract void Dispatch(IInputEventBase inputEvent);
 public abstract void Dispatch(IInputEventBase inputEvent);