Пример #1
0
        //反序列化
        public override void Deserialize(IoBuffer stream)
        {
            enType t = (enType)stream.ReadByte();

            SetType(t);
            if (_type == enType.Bool)
            {
                _value = stream.ReadBool();
            }
            else if (_type == enType.Byte)
            {
                _value = stream.ReadByte();
            }
            else if (_type == enType.Short)
            {
                _value = stream.ReadInt16();
            }
            else if (_type == enType.Int)
            {
                _value = stream.ReadInt32();
            }
            else if (_type == enType.Long)
            {
                _value = stream.ReadInt64();
            }
            else if (_type == enType.Float)
            {
                _value = stream.ReadFloat();
            }
            else if (_type == enType.Double)
            {
                _value = stream.ReadDouble();
            }
            else if (_type == enType.String)
            {
                _value = stream.ReadStr();
            }
            else
            {
                Debuger.LogError("未知的类型");
            }
#if SERIALIZE_DEBUG
            SerializeUtil.AddLog(this);
#endif
        }