Exemple #1
0
    static int AddEvent(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 3);
            MyFrameWork.ThreadManager obj = (MyFrameWork.ThreadManager)ToLua.CheckObject(L, 1, typeof(MyFrameWork.ThreadManager));
            ThreadEvent arg0 = (ThreadEvent)ToLua.CheckObject(L, 2, typeof(ThreadEvent));
            System.Action <NotiData> arg1 = null;
            LuaTypes funcType3            = LuaDLL.lua_type(L, 3);

            if (funcType3 != LuaTypes.LUA_TFUNCTION)
            {
                arg1 = (System.Action <NotiData>)ToLua.CheckObject(L, 3, typeof(System.Action <NotiData>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 3);
                arg1 = DelegateFactory.CreateDelegate(typeof(System.Action <NotiData>), func) as System.Action <NotiData>;
            }

            obj.AddEvent(arg0, arg1);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemple #2
0
        /// <summary>
        /// 线程下载
        /// </summary>
        void BeginDownload(string url, string file)
        {     //线程下载
            object[] param = new object[2] {
                url, file
            };

            ThreadEvent ev = new ThreadEvent();

            ev.Key = NotiConst.UPDATE_DOWNLOAD;
            ev.evParams.AddRange(param);
            ThreadManager.AddEvent(ev, OnThreadCompleted);   //线程下载
        }