Ejemplo n.º 1
0
    static int RegisterNetMsg(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 3);
            int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
            int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
            Launch.CTLNet.NetMsgHander arg2 = null;
            LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

            if (funcType3 != LuaTypes.LUA_TFUNCTION)
            {
                arg2 = (Launch.CTLNet.NetMsgHander)ToLua.CheckObject(L, 3, typeof(Launch.CTLNet.NetMsgHander));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 3);
                arg2 = DelegateFactory.CreateDelegate(typeof(Launch.CTLNet.NetMsgHander), func) as Launch.CTLNet.NetMsgHander;
            }

            Launch.CTLNet.RegisterNetMsg(arg0, arg1, arg2);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    public static Delegate Launch_CTLNet_NetMsgHander(LuaFunction func, LuaTable self, bool flag)
    {
        if (func == null)
        {
            Launch.CTLNet.NetMsgHander fn = delegate(int param0, int param1, LuaInterface.LuaByteBuffer param2) { };
            return(fn);
        }

        if (!flag)
        {
            Launch_CTLNet_NetMsgHander_Event target = new Launch_CTLNet_NetMsgHander_Event(func);
            Launch.CTLNet.NetMsgHander       d      = target.Call;
            target.method = d.Method;
            return(d);
        }
        else
        {
            Launch_CTLNet_NetMsgHander_Event target = new Launch_CTLNet_NetMsgHander_Event(func, self);
            Launch.CTLNet.NetMsgHander       d      = target.CallWithSelf;
            target.method = d.Method;
            return(d);
        }
    }