Example #1
0
        public void OnAfterDeserialize(object self)
        {
            if (string.IsNullOrEmpty(typeName))
            {
                refType_ = null;
#if UNITY_EDITOR
                instance = null;
#endif
                return;
            }

            if (refType_ == null || refType_.Instance == null || refType_.FullName != typeName)
            {
                refType_ = new RefType(typeName);
            }

#if !CloseNested
            if (anyValue != null && !string.IsNullOrEmpty(anyValue.dataKey))
            {
                // 数据因为预置体嵌套被修改了,不完整了,使用TypeSerialize数据来初始化
                MonoSerialize.MergeFrom(refType_.Instance, anyValue);
            }
            else
            {
#endif
            MonoSerialize.MergeFrom(refType_.Instance, bytes, objs);
#if !CloseNested
        }
#endif
            refType_.TrySetProperty("csObj", self);

#if UNITY_EDITOR
            instance = refType_.Instance;
#endif
        }
Example #2
0
        public void OnAfterDeserialize(object self)
        {
            if (string.IsNullOrEmpty(typeName))
            {
                return;
            }

            refType_ = new RefType(typeName, self);
            MonoSerialize.MergeFrom(refType_.Instance, bytes, objs);
        }
Example #3
0
        public void BytesToAnyValue()
        {
            if (string.IsNullOrEmpty(typeName))
            {
                return;
            }

            var rt = new RefType(typeName);

            MonoSerialize.MergeFrom(rt.Instance, bytes, objs);

            anyValue = MonoSerialize.WriteToTS(rt.Instance);
        }
Example #4
0
        public void SaveToTS()
        {
            if (string.IsNullOrEmpty(typeName))
            {
                return;
            }

            var rt = new RefType(typeName);

            MonoSerialize.MergeFrom(rt.Instance, bytes, objs);
            anyValue    = MonoSerialize.WriteToTS(rt.Instance);
            bytesCrc32  = Crc32.To(bytes);
            bytesLength = bytes.Length;
        }
Example #5
0
        public void AnyValueToBytes()
        {
            if (string.IsNullOrEmpty(typeName))
            {
                return;
            }

            var rt = new RefType(typeName);

            MonoSerialize.MergeFrom(rt.Instance, anyValue);

            var ms = MonoSerialize.WriteTo(rt.Instance);

            bytes = ms.GetBytes();
            objs  = ms.objs;
        }
Example #6
0
        void Init()
        {
            if (string.IsNullOrEmpty(typeName))
            {
                return;
            }

            if (refType == null)
            {
                refType = new RefType(typeName, this);
            }
            MonoSerialize.MergeFrom(refType.Instance, bytes, objs);

#if UNITY_EDITOR
            instance = refType.Instance;
#endif
        }
Example #7
0
        public void OnAfterDeserialize(object self)
        {
            if (string.IsNullOrEmpty(typeName))
            {
                refType_ = null;
                return;
            }

            if (refType_ == null || refType_.Instance == null || refType_.FullName != typeName)
            {
                refType_ = new RefType(typeName);
            }
            MonoSerialize.MergeFrom(refType_.Instance, bytes, objs);
            refType_.TrySetProperty("csObj", self);

#if UNITY_EDITOR
            instance = refType_.Instance;
#endif
        }