Exemple #1
0
 void ReadBinaryFormatters(Table binaryFormattersTable)
 {
     for (int i = 0, readOffset = (int)binaryFormattersTable.offset; i < binaryFormattersTable.rowCount; i++, readOffset += binaryFormattersTable.rowSize)
     {
         uint ID            = (uint)binaryFormattersTable.ReadField(dbReader.rawDB, readOffset, 0);
         uint trueStringId  = (uint)binaryFormattersTable.ReadField(dbReader.rawDB, readOffset, 1);
         uint falseStringId = (uint)binaryFormattersTable.ReadField(dbReader.rawDB, readOffset, 2);
         BinaryFormatters[ID] = new BinaryDataFormatter(this, ID, falseStringId, trueStringId);
     }
 }
Exemple #2
0
    public override void Deserialize(NetworkReader reader)
    {
        ushort length = reader.ReadUInt16();

        for (int i = 0; i < length; i++)
        {
            string key   = reader.ReadString();
            byte[] bytes = reader.ReadBytesAndSize();
            object value = BinaryDataFormatter.FromBytes(bytes);
            map.Add(key, value);
        }
    }
    public override void Deserialize(NetworkReader reader)
    {
        netId  = reader.ReadPackedUInt32();
        method = reader.ReadString();
        ushort length = reader.ReadUInt16();

        args = new object[length];
        for (int i = 0; i < length; i++)
        {
            byte[] bytes = reader.ReadBytesAndSize();
            args [i] = BinaryDataFormatter.FromBytes(bytes);
        }
    }
Exemple #4
0
    public override void Serialize(NetworkWriter writer)
    {
        ushort count = (ushort)map.Keys.Count;

        writer.Write(count);
        foreach (KeyValuePair <string, object> p in map)
        {
            writer.Write(p.Key);
            byte[] bytes;
            try {
                bytes = BinaryDataFormatter.ToBytes(p.Value);
                writer.WriteBytesFull(bytes);
            } catch (System.Exception se) {
                Debug.LogException(se);
            }
        }
    }
    public override void Serialize(NetworkWriter writer)
    {
        writer.WritePackedUInt32(netId);
        writer.Write(method);
        writer.Write((ushort)args.Length);

        for (int i = 0; i < args.Length; i++)
        {
            byte[] bytes;
            try {
                bytes = BinaryDataFormatter.ToBytes(args [i]);
                writer.WriteBytesFull(bytes);
            } catch (System.Exception se) {
                Debug.LogException(se);
            }
        }
    }