static int Close(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         GameFramework.ByteBuffer obj = (GameFramework.ByteBuffer)ToLua.CheckObject <GameFramework.ByteBuffer>(L, 1);
         obj.Close();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #2
0
        /// <summary>
        /// 发送消息
        /// </summary>
        public virtual void Send(ByteBuffer buffer)
        {
            if (!isConnected)
            {
                //服务器暂未链接,压入请求队列
                sendQueue.Enqueue(buffer);
                if (!dealSendQueue)
                {
                    Connect();
                    dealSendQueueID = Utility.CreateTimer(DealSendQueue, -1, -1, 0);
                    dealSendQueue   = true;
                }
                return;
            }

            byte[] _array = protocol.Set(buffer);

            SessionSend(_array);
            buffer.Close();
        }