private List <NetPack> DecodeBuffer(byte[] buffer, int bufSize)
    {
        List <NetPack> packs = new List <NetPack>();

        try
        {
            int offset    = 0;
            int restCount = bufSize;// 剩余缓存大小

            while (restCount > 0)
            {
                if (curPack == null)
                {
                    curPack = new NetPack();
                }

                if (curPack.FillPack(buffer, ref offset, ref restCount))
                {
                    CBuffer cBuffer = curPack.Assembly();
                    packs.Add(curPack);
                    curPack = null;
                }
            }
        }
        catch (System.Exception ex)
        {
            Debug.LogErrorFormat("Decode pack error. {1}", ex.ToString());
        }
        return(packs);
    }
    public void SendPack(NetPack pack)
    {
        var data = pack.Assembly();

        SendPack(data.Bytes, data.BufSize);
    }