/// <summary> /// /// </summary> /// <param name="commandId"></param> /// <param name="bytes"></param> public void OnReceiveMessage(int commandId, byte[] bytes) { try { if (bytes == null) { _onReceiveMessageCallback.Call(commandId, 0); } else { ByteBuffer data = new ByteBuffer(bytes); if (_onReceiveMessageCallback != null) { _onReceiveMessageCallback.Call(commandId, data.ReadBuffer()); } data.Close(); } } catch (Exception e) { DebugManager.LogError("Scoket OnReceiveMessage Error:" + commandId.ToString() + "," + e.Message); } }
static int ReadBuffer(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); CFramework.ByteBuffer obj = (CFramework.ByteBuffer)ToLua.CheckObject <CFramework.ByteBuffer>(L, 1); LuaInterface.LuaByteBuffer o = obj.ReadBuffer(); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }