Esempio n. 1
0
        static int _m_Connect(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Utopia.GameNet gen_to_be_invoked = (Utopia.GameNet)translator.FastGetCSObj(L, 1);



                {
                    string __host = LuaAPI.lua_tostring(L, 2);
                    int    __port = LuaAPI.xlua_tointeger(L, 3);

                    ulong gen_ret = gen_to_be_invoked.Connect(__host, __port);
                    LuaAPI.lua_pushuint64(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 2
0
        static int _m_SetCallbacks(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Utopia.GameNet gen_to_be_invoked = (Utopia.GameNet)translator.FastGetCSObj(L, 1);



                {
                    System.Action <bool>                  _openCb      = translator.GetDelegate <System.Action <bool> >(L, 2);
                    System.Action <int, string>           _closeCb     = translator.GetDelegate <System.Action <int, string> >(L, 3);
                    System.Action <int, byte[], int, int> _onRecvMsgCb = translator.GetDelegate <System.Action <int, byte[], int, int> >(L, 4);

                    gen_to_be_invoked.SetCallbacks(_openCb, _closeCb, _onRecvMsgCb);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 3
0
        static int _m_OnRecvMsg(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Utopia.GameNet gen_to_be_invoked = (Utopia.GameNet)translator.FastGetCSObj(L, 1);



                {
                    int    _protocolId = LuaAPI.xlua_tointeger(L, 2);
                    byte[] _data       = LuaAPI.lua_tobytes(L, 3);
                    int    _dataBegin  = LuaAPI.xlua_tointeger(L, 4);
                    int    _dataLen    = LuaAPI.xlua_tointeger(L, 5);

                    gen_to_be_invoked.OnRecvMsg(_protocolId, _data, _dataBegin, _dataLen);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 4
0
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 1)
                {
                    Utopia.GameNet gen_ret = new Utopia.GameNet();
                    translator.Push(L, gen_ret);

                    return(1);
                }
            }
            catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to Utopia.GameNet constructor!"));
        }
Esempio n. 5
0
        static int _m_Close(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Utopia.GameNet gen_to_be_invoked = (Utopia.GameNet)translator.FastGetCSObj(L, 1);



                {
                    gen_to_be_invoked.Close(  );



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 6
0
        static int _m_GetErrorMsg(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Utopia.GameNet gen_to_be_invoked = (Utopia.GameNet)translator.FastGetCSObj(L, 1);



                {
                    string gen_ret = gen_to_be_invoked.GetErrorMsg(  );
                    LuaAPI.lua_pushstring(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 7
0
        static int _m_OnOpen(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Utopia.GameNet gen_to_be_invoked = (Utopia.GameNet)translator.FastGetCSObj(L, 1);



                {
                    bool _isSucc = LuaAPI.lua_toboolean(L, 2);

                    gen_to_be_invoked.OnOpen(_isSucc);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 8
0
        static int _m_OnClose(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Utopia.GameNet gen_to_be_invoked = (Utopia.GameNet)translator.FastGetCSObj(L, 1);



                {
                    int    _errno  = LuaAPI.xlua_tointeger(L, 2);
                    string _errMsg = LuaAPI.lua_tostring(L, 3);

                    gen_to_be_invoked.OnClose(_errno, _errMsg);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 9
0
        static int _m_OnRemoveNetAgent(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Utopia.GameNet gen_to_be_invoked = (Utopia.GameNet)translator.FastGetCSObj(L, 1);



                {
                    string _evString = LuaAPI.lua_tostring(L, 2);
                    Utopia.NetAgentBase _netAgent = (Utopia.NetAgentBase)translator.GetObject(L, 3, typeof(Utopia.NetAgentBase));

                    gen_to_be_invoked.OnRemoveNetAgent(_evString, _netAgent);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 10
0
        static int _m_Send(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Utopia.GameNet gen_to_be_invoked = (Utopia.GameNet)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
                {
                    int _protocolId = LuaAPI.xlua_tointeger(L, 2);

                    bool gen_ret = gen_to_be_invoked.Send(_protocolId);
                    LuaAPI.lua_pushboolean(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 5 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5))
                {
                    int    _protocolId = LuaAPI.xlua_tointeger(L, 2);
                    byte[] _data       = LuaAPI.lua_tobytes(L, 3);
                    int    _offset     = LuaAPI.xlua_tointeger(L, 4);
                    int    _len        = LuaAPI.xlua_tointeger(L, 5);

                    bool gen_ret = gen_to_be_invoked.Send(_protocolId, _data, _offset, _len);
                    LuaAPI.lua_pushboolean(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4))
                {
                    int    _protocolId = LuaAPI.xlua_tointeger(L, 2);
                    byte[] _data       = LuaAPI.lua_tobytes(L, 3);
                    int    _offset     = LuaAPI.xlua_tointeger(L, 4);

                    bool gen_ret = gen_to_be_invoked.Send(_protocolId, _data, _offset);
                    LuaAPI.lua_pushboolean(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING))
                {
                    int    _protocolId = LuaAPI.xlua_tointeger(L, 2);
                    byte[] _data       = LuaAPI.lua_tobytes(L, 3);

                    bool gen_ret = gen_to_be_invoked.Send(_protocolId, _data);
                    LuaAPI.lua_pushboolean(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to Utopia.GameNet.Send!"));
        }