コード例 #1
0
    static int ReadBuffer(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                GameFramework.ByteBuffer   obj = (GameFramework.ByteBuffer)ToLua.CheckObject <GameFramework.ByteBuffer>(L, 1);
                LuaInterface.LuaByteBuffer o   = obj.ReadBuffer();
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2)
            {
                GameFramework.ByteBuffer obj = (GameFramework.ByteBuffer)ToLua.CheckObject <GameFramework.ByteBuffer>(L, 1);
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                LuaInterface.LuaByteBuffer o = obj.ReadBuffer(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: GameFramework.ByteBuffer.ReadBuffer"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #2
0
 /// <summary>
 /// pbc/pblua函数回调
 /// </summary>
 /// <param name="func"></param>
 public static void OnCallLuaFunc(LuaInterface.LuaByteBuffer data, LuaFunction func)
 {
     if (func != null)
     {
         func.Call(data);
     }
     Debug.LogWarning("OnCallLuaFunc length:>>" + data.buffer.Length);
 }
コード例 #3
0
 public void Call(int param0, int param1, LuaInterface.LuaByteBuffer param2)
 {
     func.BeginPCall();
     func.Push(param0);
     func.Push(param1);
     func.Push(param2);
     func.PCall();
     func.EndPCall();
 }
コード例 #4
0
 static int set_data(IntPtr L)
 {
     try
     {
         LuaByteBuffer arg0 = new LuaByteBuffer(ToLua.CheckByteBuffer(L, 2));
         TestProtol.data = arg0;
         return 0;
     }
     catch(Exception e)
     {
         return LuaDLL.toluaL_exception(L, e);
     }
 }
コード例 #5
0
 static int GetVoiceData(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 0);
         LuaInterface.LuaByteBuffer o = MicroPhoneInput.GetVoiceData();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #6
0
ファイル: ByteBufferWrap.cs プロジェクト: moto2002/ARPG
 static int ReadBuffer(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         ByteBuffer obj = (ByteBuffer)ToLua.CheckObject(L, 1, typeof(ByteBuffer));
         LuaInterface.LuaByteBuffer o = obj.ReadBuffer();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #7
0
 static int GetClipData(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         MicroPhoneInput            obj = (MicroPhoneInput)ToLua.CheckObject(L, 1, typeof(MicroPhoneInput));
         LuaInterface.LuaByteBuffer o   = obj.GetClipData();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #8
0
 static int GetBuffer(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         byte[] arg0 = ToLua.CheckByteBuffer(L, 1);
         LuaInterface.LuaByteBuffer o = ByteArray.GetBuffer(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #9
0
 static int ReadOneDataConfigForLua(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         string arg0 = ToLua.CheckString(L, 1);
         LuaInterface.LuaByteBuffer o = ProtobufDataConfig.ProtobufDataConfigMgr.ReadOneDataConfigForLua(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #10
0
 static int ReadPbBuffer(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         LuaFramework.ByteBuffer    obj = (LuaFramework.ByteBuffer)ToLua.CheckObject <LuaFramework.ByteBuffer>(L, 1);
         LuaInterface.LuaByteBuffer o   = obj.ReadPbBuffer();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #11
0
 static int FilterNoMsgBase(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         LuaFramework.ByteBuffer    arg0 = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1, typeof(LuaFramework.ByteBuffer));
         LuaInterface.LuaByteBuffer o    = LuaFramework.Util.FilterNoMsgBase(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #12
0
 static int checkLua(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         ByteArray     obj            = (ByteArray)ToLua.CheckObject <ByteArray>(L, 1);
         LuaByteBuffer arg0           = new LuaByteBuffer(ToLua.CheckByteBuffer(L, 2));
         LuaInterface.LuaByteBuffer o = obj.checkLua(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #13
0
 static int LoadLuaFileBytes(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         GameFramework.AssetLoadRecord obj = (GameFramework.AssetLoadRecord)ToLua.CheckObject <GameFramework.AssetLoadRecord>(L, 1);
         string arg0 = ToLua.CheckString(L, 2);
         LuaInterface.LuaByteBuffer o = obj.LoadLuaFileBytes(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #14
0
 static int LuaReadDataConfig(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         MapManager obj  = (MapManager)ToLua.CheckObject <MapManager>(L, 1);
         string     arg0 = ToLua.CheckString(L, 2);
         LuaInterface.LuaByteBuffer o = obj.LuaReadDataConfig(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #15
0
    static int ReadBuffer(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("Framework.LuaBuffer.ReadBuffer");
#endif
        try
        {
            ToLua.CheckArgsCount(L, 1);
            Framework.LuaBuffer        obj = (Framework.LuaBuffer)ToLua.CheckObject <Framework.LuaBuffer>(L, 1);
            LuaInterface.LuaByteBuffer o   = obj.ReadBuffer();
            ToLua.Push(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #16
0
 public void Push(LuaByteBuffer buffer)
 {
     luaState.Push(buffer);
     ++argCount;
 }
コード例 #17
0
ファイル: ToLua.cs プロジェクト: Avatarchik/UnityHello
        /*static void PushNull(IntPtr L)
         * {
         *  LuaDLL.tolua_pushudata(L, 1);
         * }*/

        //PushVarObject
        public static void Push(IntPtr L, object obj)
        {
            if (obj == null)
            {
                LuaDLL.lua_pushnil(L);
                return;
            }

            Type t = obj.GetType();

            if (t.IsValueType)
            {
                if (t == typeof(bool))
                {
                    bool b = (bool)obj;
                    LuaDLL.lua_pushboolean(L, b);
                }
                else if (t.IsEnum)
                {
                    Push(L, (System.Enum)obj);
                }
                else if (t.IsPrimitive)
                {
                    double d = LuaMisc.ToDouble(obj);
                    LuaDLL.lua_pushnumber(L, d);
                }
                else if (t == typeof(Vector3))
                {
                    Push(L, (Vector3)obj);
                }
                else if (t == typeof(Quaternion))
                {
                    Push(L, (Quaternion)obj);
                }
                else if (t == typeof(Vector2))
                {
                    Push(L, (Vector2)obj);
                }
                else if (t == typeof(Vector4))
                {
                    Push(L, (Vector4)obj);
                }
                else if (t == typeof(Color))
                {
                    Push(L, (Color)obj);
                }
                else if (t == typeof(RaycastHit))
                {
                    Push(L, (RaycastHit)obj);
                }
                else if (t == typeof(Touch))
                {
                    Push(L, (Touch)obj);
                }
                else if (t == typeof(Ray))
                {
                    Push(L, (Ray)obj);
                }
                else if (t == typeof(Bounds))
                {
                    Push(L, (Bounds)obj);
                }
                else if (t == typeof(LayerMask))
                {
                    Push(L, (LayerMask)obj);
                }
                else
                {
                    PushValue(L, (ValueType)obj);
                }
            }
            else
            {
                if (t.IsArray)
                {
                    Push(L, (Array)obj);
                }
                else if (t == typeof(string))
                {
                    LuaDLL.lua_pushstring(L, (string)obj);
                }
                else if (t.IsSubclassOf(typeof(LuaBaseRef)))
                {
                    Push(L, (LuaBaseRef)obj);
                }
                else if (t.IsSubclassOf(typeof(UnityEngine.Object)))
                {
                    Push(L, (UnityEngine.Object)obj);
                }
                else if (t.IsSubclassOf(typeof(UnityEngine.TrackedReference)))
                {
                    Push(L, (UnityEngine.TrackedReference)obj);
                }
                else if (t == typeof(LuaByteBuffer))
                {
                    LuaByteBuffer lbb = (LuaByteBuffer)obj;
                    LuaDLL.lua_pushlstring(L, lbb.buffer, lbb.buffer.Length);
                }
                else if (t.IsSubclassOf(typeof(Delegate)))
                {
                    Push(L, (Delegate)obj);
                }
                else if (obj is System.Collections.IEnumerator)
                {
                    Push(L, (IEnumerator)obj);
                }
                else if (t == typeof(EventObject))
                {
                    Push(L, (EventObject)obj);
                }
                else if (t == monoType)
                {
                    Push(L, (Type)obj);
                }
                else
                {
                    PushObject(L, obj);
                }
            }
        }
コード例 #18
0
ファイル: LuaFunction.cs プロジェクト: woshihuo12/UnityHello
 public void Push(LuaByteBuffer buffer)
 {
     try
     {
         luaState.Push(buffer);
         ++argCount;
     }
     catch (Exception e)
     {
         EndPCall();
         throw e;
     }
 }
コード例 #19
0
 static int OnCallLuaFunc(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         LuaByteBuffer arg0 = new LuaByteBuffer(ToLua.CheckByteBuffer(L, 1));
         LuaFunction arg1 = ToLua.CheckLuaFunction(L, 2);
         LuaFramework.LuaHelper.OnCallLuaFunc(arg0, arg1);
         return 0;
     }
     catch(Exception e)
     {
         return LuaDLL.toluaL_exception(L, e);
     }
 }
コード例 #20
0
ファイル: ByteBuffer.cs プロジェクト: woshihuo12/UnityHello
 public void WriteBuffer(LuaByteBuffer strBuffer)
 {
     WriteBytes(strBuffer.buffer);
 }
コード例 #21
0
	static int WriteBuffer(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 2);
			ByteBuffer obj = (ByteBuffer)ToLua.CheckObject(L, 1, typeof(ByteBuffer));
			LuaByteBuffer arg0 = new LuaByteBuffer(ToLua.CheckByteBuffer(L, 2));
			obj.WriteBuffer(arg0);
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
コード例 #22
0
ファイル: TestProtolWrap.cs プロジェクト: benbon/tolua
	static int set_data(IntPtr L)
	{
		LuaByteBuffer arg0 = new LuaByteBuffer(ToLua.CheckByteBuffer(L, 2));
		TestProtol.data = arg0;
		return 0;
	}
コード例 #23
0
 public void Push(LuaByteBuffer buffer)
 {
     luaState.Push(buffer);
     ++argCount;
 }
コード例 #24
0
ファイル: LuaHelper.cs プロジェクト: RuYi51/LuaFramework_NGUI
 /// <summary>
 /// pbc/pblua函数回调
 /// </summary>
 /// <param name="func"></param>
 public static void OnCallLuaFunc(LuaByteBuffer data, LuaFunction func) {
     if (func != null) func.Call(data);
     Debug.LogWarning("OnCallLuaFunc length:>>" + data.buffer.Length);
 }
コード例 #25
0
 public void sendProtoMsg(LuaByteBuffer buf, string msgName)
 {
     Zeus.inst.sendToGateway(msgName, buf.buffer);
 }
コード例 #26
0
ファイル: ToLua.cs プロジェクト: Avatarchik/UnityHello
 public static void Push(IntPtr L, LuaByteBuffer bb)
 {
     LuaDLL.lua_pushlstring(L, bb.buffer, bb.buffer.Length);
 }
コード例 #27
0
ファイル: ToLua.cs プロジェクト: unseen-code/tianqi_src
        public static void Push(IntPtr L, object obj)
        {
            if (obj == null)
            {
                LuaDLL.lua_pushnil(L);
                return;
            }
            Type type = obj.GetType();

            if (type.get_IsValueType())
            {
                if (type == typeof(bool))
                {
                    bool value = (bool)obj;
                    LuaDLL.lua_pushboolean(L, value);
                }
                else if (type.get_IsEnum())
                {
                    ToLua.Push(L, (Enum)obj);
                }
                else if (type.get_IsPrimitive())
                {
                    double number = LuaMisc.ToDouble(obj);
                    LuaDLL.lua_pushnumber(L, number);
                }
                else if (type == typeof(Vector3))
                {
                    ToLua.Push(L, (Vector3)obj);
                }
                else if (type == typeof(Quaternion))
                {
                    ToLua.Push(L, (Quaternion)obj);
                }
                else if (type == typeof(Vector2))
                {
                    ToLua.Push(L, (Vector2)obj);
                }
                else if (type == typeof(Vector4))
                {
                    ToLua.Push(L, (Vector4)obj);
                }
                else if (type == typeof(Color))
                {
                    ToLua.Push(L, (Color)obj);
                }
                else if (type == typeof(RaycastHit))
                {
                    ToLua.Push(L, (RaycastHit)obj);
                }
                else if (type == typeof(Touch))
                {
                    ToLua.Push(L, (Touch)obj);
                }
                else if (type == typeof(Ray))
                {
                    ToLua.Push(L, (Ray)obj);
                }
                else if (type == typeof(Bounds))
                {
                    ToLua.Push(L, (Bounds)obj);
                }
                else if (type == typeof(LayerMask))
                {
                    ToLua.PushLayerMask(L, (LayerMask)obj);
                }
                else
                {
                    ToLua.PushValue(L, (ValueType)obj);
                }
            }
            else if (type.get_IsArray())
            {
                ToLua.Push(L, (Array)obj);
            }
            else if (type == typeof(string))
            {
                LuaDLL.lua_pushstring(L, (string)obj);
            }
            else if (type.IsSubclassOf(typeof(LuaBaseRef)))
            {
                ToLua.Push(L, (LuaBaseRef)obj);
            }
            else if (type.IsSubclassOf(typeof(Object)))
            {
                ToLua.Push(L, (Object)obj);
            }
            else if (type.IsSubclassOf(typeof(TrackedReference)))
            {
                ToLua.Push(L, (TrackedReference)obj);
            }
            else if (type == typeof(LuaByteBuffer))
            {
                LuaByteBuffer luaByteBuffer = (LuaByteBuffer)obj;
                LuaDLL.lua_pushlstring(L, luaByteBuffer.buffer, luaByteBuffer.buffer.Length);
            }
            else if (type.IsSubclassOf(typeof(Delegate)))
            {
                ToLua.Push(L, (Delegate)obj);
            }
            else if (obj is IEnumerator)
            {
                ToLua.Push(L, (IEnumerator)obj);
            }
            else if (type == typeof(EventObject))
            {
                ToLua.Push(L, (EventObject)obj);
            }
            else if (type == ToLua.monoType)
            {
                ToLua.Push(L, (Type)obj);
            }
            else
            {
                ToLua.PushObject(L, obj);
            }
        }
コード例 #28
0
 public Packet(int header, LuaInterface.LuaByteBuffer obj)
 {
     m_header = header;
     m_object = obj;
 }