Example #1
0
    static int set_OnEvent(IntPtr L)
    {
        try
        {
            Dpoch.SocketIO.SocketIO obj  = (Dpoch.SocketIO.SocketIO)ToLua.CheckObject(L, 1, typeof(Dpoch.SocketIO.SocketIO));
            EventObject             arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'Dpoch.SocketIO.SocketIO.OnEvent' can only appear on the left hand side of += or -= when used outside of the type 'Dpoch.SocketIO.SocketIO'"));
            }

            if (arg0.op == EventOp.Add)
            {
                System.Action <Dpoch.SocketIO.Packet> ev = (System.Action <Dpoch.SocketIO.Packet>)arg0.func;
                obj.OnEvent += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                System.Action <Dpoch.SocketIO.Packet> ev = (System.Action <Dpoch.SocketIO.Packet>)arg0.func;
                obj.OnEvent -= ev;
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #2
0
    static int Emit(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (TypeChecker.CheckTypes <Dpoch.SocketIO.SocketIO, string, System.Action <Newtonsoft.Json.Linq.JArray> >(L, 1) && TypeChecker.CheckParamsType <object>(L, 4, count - 3))
            {
                Dpoch.SocketIO.SocketIO obj = (Dpoch.SocketIO.SocketIO)ToLua.ToObject(L, 1);
                string arg0 = ToLua.ToString(L, 2);
                System.Action <Newtonsoft.Json.Linq.JArray> arg1 = (System.Action <Newtonsoft.Json.Linq.JArray>)ToLua.ToObject(L, 3);
                object[] arg2 = ToLua.ToParamsObject(L, 4, count - 3);
                obj.Emit(arg0, arg1, arg2);
                return(0);
            }
            else if (TypeChecker.CheckTypes <Dpoch.SocketIO.SocketIO, string>(L, 1) && TypeChecker.CheckParamsType <object>(L, 3, count - 2))
            {
                Dpoch.SocketIO.SocketIO obj = (Dpoch.SocketIO.SocketIO)ToLua.ToObject(L, 1);
                string   arg0 = ToLua.ToString(L, 2);
                object[] arg1 = ToLua.ToParamsObject(L, 3, count - 2);
                obj.Emit(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: Dpoch.SocketIO.SocketIO.Emit"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #3
0
            public static SocketIOEventEmitter Create(SocketIO socket)
            {
                var go = new GameObject("SocketIO Event Emitter");

                DontDestroyOnLoad(go);
                var emitter = go.AddComponent <SocketIOEventEmitter>();

                emitter.socket = socket;
                return(emitter);
            }
Example #4
0
 static int Close(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Dpoch.SocketIO.SocketIO obj = (Dpoch.SocketIO.SocketIO)ToLua.CheckObject <Dpoch.SocketIO.SocketIO>(L, 1);
         obj.Close();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #5
0
 static int Conn(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         SocketUtil obj            = (SocketUtil)ToLua.CheckObject <SocketUtil>(L, 1);
         string     arg0           = ToLua.CheckString(L, 2);
         Dpoch.SocketIO.SocketIO o = obj.Conn(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #6
0
 static int Off(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         Dpoch.SocketIO.SocketIO obj = (Dpoch.SocketIO.SocketIO)ToLua.CheckObject <Dpoch.SocketIO.SocketIO>(L, 1);
         string arg0 = ToLua.CheckString(L, 2);
         System.Action <Dpoch.SocketIO.SocketIOEvent> arg1 = (System.Action <Dpoch.SocketIO.SocketIOEvent>)ToLua.CheckDelegate <System.Action <Dpoch.SocketIO.SocketIOEvent> >(L, 3);
         obj.Off(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #7
0
    static int get_IsAlive(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Dpoch.SocketIO.SocketIO obj = (Dpoch.SocketIO.SocketIO)o;
            bool ret = obj.IsAlive;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index IsAlive on a nil value"));
        }
    }
Example #8
0
    static int _CreateDpoch_SocketIO_SocketIO(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                string arg0 = ToLua.CheckString(L, 1);
                Dpoch.SocketIO.SocketIO obj = new Dpoch.SocketIO.SocketIO(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 2)
            {
                string arg0 = ToLua.CheckString(L, 1);
                int    arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                Dpoch.SocketIO.SocketIO obj = new Dpoch.SocketIO.SocketIO(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 3)
            {
                string arg0 = ToLua.CheckString(L, 1);
                int    arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int    arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                Dpoch.SocketIO.SocketIO obj = new Dpoch.SocketIO.SocketIO(arg0, arg1, arg2);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: Dpoch.SocketIO.SocketIO.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }