示例#1
0
        public void Serialize(MemoryEndianBinaryWriter writer)
        {
            FieldMark fm = new FieldMark(1);

            fm.Mark(name != null && name.Length() > 0);
            fm.Mark(id != 0);
            fm.Mark(itemInsts != null && itemInsts.Length > 0);
            fm.Mark(true);
            writer.Write(fm.getData());
            if (fm.IsMarked(0))
            {
                writer.WriteUTF(name);
            }
            if (fm.IsMarked(1))
            {
                writer.WriteInt8(id);
            }
            if (fm.IsMarked(2))
            {
                SerializationUtil.WriteVariableLength(writer, itemInsts.Length);
                for (int i = 0; i < itemInsts.Length; i++)
                {
                    itemInsts[i].Serialize(writer);
                }
            }
            if (fm.IsMarked(3))
            {
                position.Serialize(writer);
            }
        }
示例#2
0
        public void Serialize(MemoryEndianBinaryWriter writer)
        {
            FieldMark fm = new FieldMark(1);

            fm.Mark(id != 0);
            fm.Mark(name != null && name.Length() > 0);
            writer.Write(fm.getData());
            if (fm.IsMarked(0))
            {
                writer.WriteInt8(id);
            }
            if (fm.IsMarked(1))
            {
                writer.WriteUTF(name);
            }
        }
示例#3
0
        public void Serialize(MemoryEndianBinaryWriter writer)
        {
            FieldMark fm = new FieldMark(1);

            fm.Mark(x != 0);
            fm.Mark(z != 0);
            writer.Write(fm.GetData());
            if (fm.IsMarked(0))
            {
                writer.WriteSingle(x);
            }
            if (fm.IsMarked(1))
            {
                writer.WriteSingle(z);
            }
        }
示例#4
0
        public void Serialize(MemoryEndianBinaryWriter writer)
        {
            FieldMark fm = new FieldMark(1);

            fm.Mark(timestamp != 0);
            fm.Mark(items != null && items.Length > 0);
            writer.Write(fm.GetData());
            if (fm.IsMarked(0))
            {
                writer.WriteUInt32(timestamp);
            }
            if (fm.IsMarked(1))
            {
                SerializationUtil.WriteVariableLength(writer, items.Length);
                for (int i = 0; i < items.Length; i++)
                {
                    items[i].Serialize(writer);
                }
            }
        }
示例#5
0
文件: ItemInst.cs 项目: newcl/talky
        public void Serialize(MemoryEndianBinaryWriter writer)
        {
            FieldMark fm = new FieldMark(1);

            fm.Mark(seq != 0);
            fm.Mark(itemId != 0);
            fm.Mark(count != 0);
            writer.Write(fm.getData());
            if (fm.IsMarked(0))
            {
                writer.WriteInt8(seq);
            }
            if (fm.IsMarked(1))
            {
                writer.WriteInt8(itemId);
            }
            if (fm.IsMarked(2))
            {
                writer.WriteInt8(count);
            }
        }
示例#6
0
        public void Serialize(MemoryEndianBinaryWriter writer)
        {
            FieldMark fm = new FieldMark(1);

            fm.Mark(byteArray != null && byteArray.Length > 0);
            fm.Mark(shortArray != null && shortArray.Length > 0);
            fm.Mark(intArray != null && intArray.Length > 0);
            fm.Mark(longArray != null && longArray.Length > 0);
            fm.Mark(floatArray != null && floatArray.Length > 0);
            fm.Mark(doubleArray != null && doubleArray.Length > 0);
            writer.Write(fm.getData());
            if (fm.IsMarked(0))
            {
                SerializationUtil.WriteVariableLength(writer, byteArray.Length);
                for (int i = 0; i < byteArray.Length; i++)
                {
                    writer.WriteInt8(byteArray[i]);
                }
            }
            if (fm.IsMarked(1))
            {
                SerializationUtil.WriteVariableLength(writer, shortArray.Length);
                for (int i = 0; i < shortArray.Length; i++)
                {
                    writer.WriteInt16(shortArray[i]);
                }
            }
            if (fm.IsMarked(2))
            {
                SerializationUtil.WriteVariableLength(writer, intArray.Length);
                for (int i = 0; i < intArray.Length; i++)
                {
                    writer.WriteInt32(intArray[i]);
                }
            }
            if (fm.IsMarked(3))
            {
                SerializationUtil.WriteVariableLength(writer, longArray.Length);
                for (int i = 0; i < longArray.Length; i++)
                {
                    writer.WriteInt64(longArray[i]);
                }
            }
            if (fm.IsMarked(4))
            {
                SerializationUtil.WriteVariableLength(writer, floatArray.Length);
                for (int i = 0; i < floatArray.Length; i++)
                {
                    writer.WriteSingle(floatArray[i]);
                }
            }
            if (fm.IsMarked(5))
            {
                SerializationUtil.WriteVariableLength(writer, doubleArray.Length);
                for (int i = 0; i < doubleArray.Length; i++)
                {
                    writer.WriteDouble(doubleArray[i]);
                }
            }
        }
示例#7
0
        public void Serialize(MemoryEndianBinaryWriter writer)
        {
            FieldMark fm = new FieldMark(1);

            fm.Mark(entityId != 0);
            fm.Mark(timestamp != 0);
            fm.Mark(idleTime != 0);
            fm.Mark(fields != null && fields.Length > 0);
            fm.Mark(values != null && values.Length > 0);
            writer.Write(fm.GetData());
            if (fm.IsMarked(0))
            {
                writer.WriteUInt32(entityId);
            }
            if (fm.IsMarked(1))
            {
                writer.WriteUInt32(timestamp);
            }
            if (fm.IsMarked(2))
            {
                writer.WriteUInt16(idleTime);
            }
            if (fm.IsMarked(3))
            {
                SerializationUtil.WriteVariableLength(writer, fields.Length);
                for (int i = 0; i < fields.Length; i++)
                {
                    writer.WriteUInt32(fields[i]);
                }
            }
            if (fm.IsMarked(4))
            {
                SerializationUtil.WriteVariableLength(writer, values.Length);
                for (int i = 0; i < values.Length; i++)
                {
                    writer.WriteSingle(values[i]);
                }
            }
        }