Example #1
0
    private void CallBack_Binary_LoginServer(byte[] _msgData)
    {
        ByteStreamBuff _tmpbuff = new ByteStreamBuff(_msgData);

        Debug.Log(_tmpbuff.Read_Int());
        Debug.Log(_tmpbuff.Read_Float());
        Debug.Log(_tmpbuff.Read_UniCodeString());
        Debug.Log(_tmpbuff.Read_UniCodeString());
        _tmpbuff.Close();
        _tmpbuff = null;
    }
Example #2
0
    public static void GetObjByNetData <T>(byte[] data, out NetError err, out T tData) where T : new()
    {
        ByteStreamBuff _tmpbuff = new ByteStreamBuff(data);
        string         str      = _tmpbuff.Read_String();

        _tmpbuff.Close();
        _tmpbuff = null;

        Debug.Log(str);

        bool isError = str.IndexOf("err") != -1;

        err   = isError ? JsonUtility.FromJson <NetError> (str) : null;
        tData = isError ? new T() : JsonUtility.FromJson <T>(str);
    }