示例#1
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Text      = reader.ReadString();
            Anchor    = (TextAnchor)reader.ReadInt16();
            Alignment = (TextAlignment)reader.ReadInt16();
            if (IsReadPixelOffset(reader.Version))
            {
                PixelOffset.Read(reader);
            }
            LineSpacing = reader.ReadSingle();
            TabSize     = reader.ReadSingle();
            Font.Read(reader);
            Material.Read(reader);
            if (IsReadFontSize(reader.Version))
            {
                FontSize  = reader.ReadInt32();
                FontStyle = (FontStyle)reader.ReadInt32();
            }
            if (IsReadColor(reader.Version))
            {
                Color.Read(reader);
            }
            PixelCorrect = reader.ReadBoolean();
            if (IsReadRichText(reader.Version))
            {
                RichText = reader.ReadBoolean();
            }
        }
示例#2
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Text          = reader.ReadString();
            OffsetZ       = reader.ReadSingle();
            CharacterSize = reader.ReadSingle();
            LineSpacing   = reader.ReadSingle();
            Anchor        = (TextAnchor)reader.ReadInt16();
            Alignment     = (TextAlignment)reader.ReadInt16();
            TabSize       = reader.ReadSingle();
            if (IsReadFontSize(reader.Version))
            {
                FontSize  = reader.ReadInt32();
                FontStyle = (FontStyle)reader.ReadInt32();
            }
            if (IsReadRichText(reader.Version))
            {
                RichText = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
            Font.Read(reader);
            if (IsReadColor(reader.Version))
            {
                Color.Read(reader);
            }
        }
示例#3
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            SortingLayerID = reader.ReadInt32();
            SortingLayer   = reader.ReadInt16();
            SortingOrder   = reader.ReadInt16();
            reader.AlignStream();
        }
示例#4
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsSortingLayerIDFirst(reader.Version))
            {
                SortingLayerID = reader.ReadInt32();
            }
            SortingLayer = reader.ReadInt16();
            SortingOrder = reader.ReadInt16();
            if (!IsSortingLayerIDFirst(reader.Version))
            {
                SortingLayerID = reader.ReadInt32();
            }
            reader.AlignStream();
        }
示例#5
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadAlpha(reader.Version))
            {
                Alpha = reader.ReadSingle();
            }
            RenderMode = (RenderMode)reader.ReadInt32();
            Camera.Read(reader);
            if (IsReadNormals(reader.Version))
            {
                Normals     = reader.ReadBoolean();
                PositionUVs = reader.ReadBoolean();
            }

            if (IsReadPlaneDistance(reader.Version))
            {
                PlaneDistance = reader.ReadSingle();
            }
            PixelPerfect = reader.ReadBoolean();

            if (IsReadRecievesEvents(reader.Version))
            {
                RecievesEvents       = reader.ReadBoolean();
                OverrideSorting      = reader.ReadBoolean();
                OverridePixelPerfect = reader.ReadBoolean();
                if (IsReadSortingBucketNormalizedSize(reader.Version))
                {
                    SortingBucketNormalizedSize = reader.ReadSingle();
                }
                if (IsReadAdditionalShaderChannelsFlag(reader.Version))
                {
                    AdditionalShaderChannelsFlag = reader.ReadInt32();
                }
                reader.AlignStream(AlignType.Align4);

                SortingLayerID = reader.ReadInt32();
                SortingOrder   = reader.ReadInt16();
            }
            if (IsReadTargetDisplay(reader.Version))
            {
                TargetDisplay = reader.ReadByte();
            }
        }
示例#6
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (HasDefaultReferences(reader.Version))
            {
                DefaultReferences = new Dictionary <string, PPtr <Object> >();
                DefaultReferences.Read(reader);
            }
            if (HasExecutionOrder(reader.Version))
            {
                ExecutionOrder = reader.ReadInt16();
                reader.AlignStream();

                Icon = reader.ReadAsset <PPtr <Texture2D> >();
            }

            PostRead(reader);
        }
示例#7
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Enabled = reader.ReadBoolean();
            if (IsAlignEnabled(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            CastShadows    = (ShadowCastingMode)reader.ReadByte();
            ReceiveShadows = reader.ReadByte();
            if (IsReadDynamicOccludee(reader.Version))
            {
                DynamicOccludee = reader.ReadByte();
            }
            if (IsAlignEnabled(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadMotionVector(reader.Version))
            {
                MotionVectors   = (MotionVectorGenerationMode)reader.ReadByte();
                LightProbeUsage = (LightProbeUsage)reader.ReadByte();
            }
            if (IsReadReflectUsage(reader.Version))
            {
                if (IsReadReflectUsageFirst(reader.Version))
                {
                    ReflectionProbeUsage = (ReflectionProbeUsage)reader.ReadByte();
                    reader.AlignStream(AlignType.Align4);
                }
            }

            if (IsReadRenderingLayerMask(reader.Version))
            {
                RenderingLayerMask = reader.ReadUInt32();
            }
            if (IsReadRendererPriority(reader.Version))
            {
                RendererPriority = reader.ReadInt32();
            }

            if (IsReadLightmapIndex(reader.Version, reader.Flags))
            {
                LightmapIndex = IsByteLightIndex(reader.Version) ? reader.ReadByte() : reader.ReadUInt16();
            }

            if (IsReadLightmapIndexDynamic(reader.Version, reader.Flags))
            {
                LightmapIndexDynamic = reader.ReadUInt16();
            }

            if (IsReadMaterialFirst(reader.Version))
            {
                m_materials = reader.ReadAssetArray <PPtr <Material> >();
            }

            if (IsReadLightmapTilingOffset(reader.Version, reader.Flags))
            {
                LightmapTilingOffset.Read(reader);
            }
            if (IsReadLightmapTilingOffsetDynamic(reader.Version, reader.Flags))
            {
                LightmapTilingOffsetDynamic.Read(reader);
            }

            if (!IsReadMaterialFirst(reader.Version))
            {
                m_materials = reader.ReadAssetArray <PPtr <Material> >();
            }

            if (IsReadSubsetIndices(reader.Version))
            {
                m_subsetIndices = reader.ReadUInt32Array();
            }
            if (IsReadStaticBatchInfo(reader.Version))
            {
                StaticBatchInfo.Read(reader);
            }

            if (IsReadStaticBatchRoot(reader.Version))
            {
                StaticBatchRoot.Read(reader);
            }

            if (IsReadUseLight(reader.Version))
            {
                UseLightProbes = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadReflectUsage(reader.Version))
            {
                if (!IsReadReflectUsageFirst(reader.Version))
                {
                    ReflectionProbeUsage = (ReflectionProbeUsage)reader.ReadInt32();
                }
            }

            if (IsReadProbeAnchor(reader.Version))
            {
                ProbeAnchor.Read(reader);
            }
            if (IsReadLightOverride(reader.Version))
            {
                LightProbeVolumeOverride.Read(reader);
            }
#if UNIVERSAL
            if (IsReadScaleInLightmap(reader.Flags))
            {
#warning TODO: separate by version
                ScaleInLightmap = reader.ReadSingle();
                PreserveUVs     = reader.ReadBoolean();
                IgnoreNormalsForChartDetection = reader.ReadBoolean();
                ImportantGI         = reader.ReadBoolean();
                StitchLightmapSeams = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);

                SelectedEditorRenderState = (EditorSelectedRenderState)reader.ReadInt32();
                MinimumChartSize          = reader.ReadInt32();
                AutoUVMaxDistance         = reader.ReadSingle();
                AutoUVMaxAngle            = reader.ReadSingle();
                LightmapParameters.Read(reader);
            }
#endif
            if (IsAlignLightProbe(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadSortingLayerID(reader.Version))
            {
                SortingLayerID = reader.ReadInt32();
            }
            if (IsReadSortingLayer(reader.Version))
            {
                SortingLayer = reader.ReadInt16();
            }
            if (IsReadSortingOrder(reader.Version))
            {
                SortingOrder = reader.ReadInt16();
            }
            if (IsAlignSortingOrder(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }
        }
示例#8
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadFontImpl(reader.Version))
            {
                LineSpacing = reader.ReadSingle();
                DefaultMaterial.Read(reader);
                FontSize = reader.ReadSingle();
                Texture.Read(reader);
                reader.AlignStream(AlignType.Align4);
            }

            if (IsShortAsciiStartOffset(reader.Version))
            {
                AsciiStartOffset = reader.ReadInt16();
                FontCountX       = reader.ReadInt16();
                FontCountY       = reader.ReadInt16();
            }
            else
            {
                AsciiStartOffset = reader.ReadInt32();
                if (IsReadFontCount(reader.Version))
                {
                    FontCountX = reader.ReadInt32();
                    FontCountY = reader.ReadInt32();
                }
            }

            if (IsReadKerning(reader.Version))
            {
                Kerning = reader.ReadSingle();
            }
            if (IsReadTracking(reader.Version))
            {
                Tracking = reader.ReadSingle();
            }

            if (!IsReadFontImpl(reader.Version))
            {
                LineSpacing = reader.ReadSingle();
            }

            if (IsReadCharacterSpacing(reader.Version))
            {
                CharacterSpacing = reader.ReadInt32();
                CharacterPadding = reader.ReadInt32();
            }

            if (IsReadPerCharacterKerning(reader.Version))
            {
                if (IsBytePerCharacterKerning(reader.Version))
                {
                    m_perCharacterKerningByte = reader.ReadTupleByteSingleArray();
                }
                else
                {
                    m_perCharacterKerning = reader.ReadTupleIntFloatArray();
                }
            }

            ConvertCase = reader.ReadInt32();
            if (!IsReadFontImpl(reader.Version))
            {
                DefaultMaterial.Read(reader);
            }
            m_characterRects = reader.ReadArray <CharacterInfo>();
            if (!IsReadFontImpl(reader.Version))
            {
                Texture.Read(reader);
            }

            if (IsReadGridFont(reader.Version))
            {
                if (IsGridFontFirst(reader.Version))
                {
                    GridFont = reader.ReadBoolean();
                }
            }

            if (IsByteKerningValues(reader.Version))
            {
                m_kerningValuesByte = new Dictionary <Tuple <byte, byte>, float>();
                m_kerningValuesByte.Read(reader);
            }
            else
            {
                m_kerningValues.Read(reader);
            }

            if (IsReadPixelScale(reader.Version))
            {
                PixelScale = reader.ReadSingle();
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadGridFont(reader.Version))
            {
                if (!IsGridFontFirst(reader.Version))
                {
                    GridFont = reader.ReadBoolean();
                    if (IsAlign(reader.Version))
                    {
                        reader.AlignStream(AlignType.Align4);
                    }
                }
            }

            if (IsReadFontData(reader.Version))
            {
                m_fontData = reader.ReadByteArray();
                reader.AlignStream(AlignType.Align4);

                if (!IsReadFontImpl(reader.Version))
                {
                    FontSize = reader.ReadSingle();
                }
                Ascent = reader.ReadSingle();
            }
            if (IsReadDescent(reader.Version))
            {
                Descent = reader.ReadSingle();
            }
            if (IsReadDefaultStyle(reader.Version))
            {
                DefaultStyle = (FontStyle)reader.ReadUInt32();
                m_fontNames  = reader.ReadStringArray();
            }

            if (IsReadFallbackFonts(reader.Version))
            {
                m_fallbackFonts = reader.ReadArray <PPtr <Font> >();
                reader.AlignStream(AlignType.Align4);

                FontRenderingMode = (FontRenderingMode)reader.ReadInt32();
            }

            if (IsReadUseLegacyBoundsCalculation(reader.Version))
            {
                UseLegacyBoundsCalculation = reader.ReadBoolean();
            }
            if (IsReadShouldRoundAdvanceValue(reader.Version))
            {
                ShouldRoundAdvanceValue = reader.ReadBoolean();
            }
        }
示例#9
0
        public void Read(AssetReader reader)
        {
            switch (Type.Type)
            {
            case PrimitiveType.Bool:
                if (IsArray)
                {
                    Value = reader.ReadBooleanArray();
                }
                else
                {
                    Value = reader.ReadBoolean();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.Char:
                if (IsArray)
                {
                    Value = reader.ReadCharArray();
                }
                else
                {
                    Value = reader.ReadChar();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.SByte:
                if (IsArray)
                {
                    Value = reader.ReadByteArray();
                }
                else
                {
                    Value = reader.ReadSByte();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.Byte:
                if (IsArray)
                {
                    Value = reader.ReadByteArray();
                }
                else
                {
                    Value = reader.ReadByte();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.Short:
                if (IsArray)
                {
                    Value = reader.ReadInt16Array();
                }
                else
                {
                    Value = reader.ReadInt16();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.UShort:
                if (IsArray)
                {
                    Value = reader.ReadUInt16Array();
                }
                else
                {
                    Value = reader.ReadUInt16();
                }
                reader.AlignStream(AlignType.Align4);
                break;

            case PrimitiveType.Int:
                if (IsArray)
                {
                    Value = reader.ReadInt32Array();
                }
                else
                {
                    Value = reader.ReadInt32();
                }
                break;

            case PrimitiveType.UInt:
                if (IsArray)
                {
                    Value = reader.ReadUInt32Array();
                }
                else
                {
                    Value = reader.ReadUInt32();
                }
                break;

            case PrimitiveType.Long:
                if (IsArray)
                {
                    Value = reader.ReadInt64Array();
                }
                else
                {
                    Value = reader.ReadInt64();
                }
                break;

            case PrimitiveType.ULong:
                if (IsArray)
                {
                    Value = reader.ReadUInt64Array();
                }
                else
                {
                    Value = reader.ReadUInt64();
                }
                break;

            case PrimitiveType.Single:
                if (IsArray)
                {
                    Value = reader.ReadSingleArray();
                }
                else
                {
                    Value = reader.ReadSingle();
                }
                break;

            case PrimitiveType.Double:
                if (IsArray)
                {
                    Value = reader.ReadDoubleArray();
                }
                else
                {
                    Value = reader.ReadDouble();
                }
                break;

            case PrimitiveType.String:
                if (IsArray)
                {
                    Value = reader.ReadStringArray();
                }
                else
                {
                    Value = reader.ReadString();
                }
                break;

            case PrimitiveType.Complex:
                if (IsArray)
                {
                    int count = reader.ReadInt32();
                    IScriptStructure[] structures = new IScriptStructure[count];
                    for (int i = 0; i < count; i++)
                    {
                        IScriptStructure structure = Type.ComplexType.CreateCopy();
                        structure.Read(reader);
                        structures[i] = structure;
                    }
                    Value = structures;
                }
                else
                {
                    IScriptStructure structure = Type.ComplexType.CreateCopy();
                    structure.Read(reader);
                    Value = structure;
                }
                break;

            default:
                throw new NotImplementedException($"Unknown {nameof(PrimitiveType)} '{Type.Type}'");
            }
        }
示例#10
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (HasEnabled(reader.Version))
            {
                Enabled = reader.ReadBoolean();
            }
            if (IsAlign1(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasCastShadows(reader.Version))
            {
                CastShadows    = (ShadowCastingMode)reader.ReadByte();
                ReceiveShadows = reader.ReadByte();
            }
            if (HasDynamicOccludee(reader.Version))
            {
                DynamicOccludee = reader.ReadByte();
            }
            if (HasMotionVector(reader.Version))
            {
                MotionVectors   = (MotionVectorGenerationMode)reader.ReadByte();
                LightProbeUsage = (LightProbeUsage)reader.ReadByte();
            }
            if (HasReflectUsage(reader.Version))
            {
                if (IsReflectUsageFirst(reader.Version))
                {
                    ReflectionProbeUsage = (ReflectionProbeUsage)reader.ReadByte();
                }
            }
            if (IsAlign2(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasRenderingLayerMask(reader.Version))
            {
                RenderingLayerMask = reader.ReadUInt32();
            }
            if (HasRendererPriority(reader.Version))
            {
                RendererPriority = reader.ReadInt32();
            }

            if (HasLightmapIndex(reader.Version, reader.Flags))
            {
                LightmapIndex = IsLightmapIndexShort(reader.Version) ? reader.ReadUInt16() : reader.ReadByte();
            }
            if (HasLightmapIndexDynamic(reader.Version, reader.Flags))
            {
                LightmapIndexDynamic = reader.ReadUInt16();
            }

            if (IsMaterialFirst(reader.Version))
            {
                Materials = reader.ReadAssetArray <PPtr <Material> >();
            }

            if (HasLightmapTilingOffset(reader.Version, reader.Flags))
            {
                LightmapTilingOffset.Read(reader);
            }
            if (HasLightmapTilingOffsetDynamic(reader.Version, reader.Flags))
            {
                LightmapTilingOffsetDynamic.Read(reader);
            }

            if (!IsMaterialFirst(reader.Version))
            {
                Materials = reader.ReadAssetArray <PPtr <Material> >();
            }

            if (HasStaticBatchInfo(reader.Version))
            {
                StaticBatchInfo.Read(reader);
            }
            else if (HasSubsetIndices(reader.Version))
            {
                SubsetIndices = reader.ReadUInt32Array();
            }
            if (HasStaticBatchRoot(reader.Version))
            {
                StaticBatchRoot.Read(reader);
            }

            if (HasUseLight(reader.Version))
            {
                bool UseLightProbes = reader.ReadBoolean();
                LightProbeUsage = UseLightProbes ? LightProbeUsage.BlendProbes : LightProbeUsage.Off;
            }
            if (HasUseReflectionProbes(reader.Version))
            {
                bool UseReflectionProbes = reader.ReadBoolean();
                ReflectionProbeUsage = UseReflectionProbes ? ReflectionProbeUsage.Simple : ReflectionProbeUsage.Off;
            }
            if (HasUseLight(reader.Version))
            {
                reader.AlignStream();
            }
            if (HasReflectUsage(reader.Version))
            {
                if (!IsReflectUsageFirst(reader.Version))
                {
                    ReflectionProbeUsage = (ReflectionProbeUsage)reader.ReadInt32();
                }
            }

            if (HasProbeAnchor(reader.Version))
            {
                ProbeAnchor.Read(reader);
            }
            if (HasLightOverride(reader.Version))
            {
                LightProbeVolumeOverride.Read(reader);
            }
#if UNIVERSAL
            if (HasScaleInLightmap(reader.Version, reader.Flags))
            {
                ScaleInLightmap = reader.ReadSingle();
            }
            if (HasReceiveGI(reader.Version, reader.Flags))
            {
                ReceiveGI = (ReceiveGI)reader.ReadInt32();
            }
            if (HasPreserveUVs(reader.Version, reader.Flags))
            {
                PreserveUVs = reader.ReadBoolean();
            }
            if (HasIgnoreNormalsForChartDetection(reader.Version, reader.Flags))
            {
                IgnoreNormalsForChartDetection = reader.ReadBoolean();
            }
            if (HasImportantGI(reader.Version, reader.Flags))
            {
                ImportantGI = reader.ReadBoolean();
            }
            if (HasSelectedWireframeHidden(reader.Version, reader.Flags))
            {
                SelectedWireframeHidden = reader.ReadBoolean();
            }
            if (HasStitchLightmapSeams(reader.Version, reader.Flags))
            {
                StitchLightmapSeams = reader.ReadBoolean();
                reader.AlignStream();
            }
            if (HasSelectedEditorRenderState(reader.Version, reader.Flags))
            {
                SelectedEditorRenderState = (EditorSelectedRenderState)reader.ReadInt32();
            }
            if (HasMinimumChartSize(reader.Version, reader.Flags))
            {
                MinimumChartSize = reader.ReadInt32();
            }
            if (HasAutoUVMaxDistance(reader.Version, reader.Flags))
            {
                AutoUVMaxDistance = reader.ReadSingle();
                AutoUVMaxAngle    = reader.ReadSingle();
                LightmapParameters.Read(reader);
            }
            if (HasGIBackfaceCull(reader.Version, reader.Flags))
            {
                GIBackfaceCull = reader.ReadBoolean();
                reader.AlignStream();
            }
#endif
            if (IsAlign3(reader.Version))
            {
                reader.AlignStream();
            }

            if (HasSortingLayerID(reader.Version))
            {
                SortingLayerID = reader.ReadInt32();
            }
            if (HasSortingLayer(reader.Version))
            {
                SortingLayer = reader.ReadInt16();
            }
            if (HasSortingOrder(reader.Version))
            {
                SortingOrder = reader.ReadInt16();
            }
            if (IsAlign4(reader.Version))
            {
                reader.AlignStream();
            }
        }
示例#11
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            bool isGrouped = IsFontGrouped(reader.Version);

            if (isGrouped)
            {
                LineSpacing = reader.ReadSingle();
                DefaultMaterial.Read(reader);
                FontSize = reader.ReadSingle();
                Texture.Read(reader);
                reader.AlignStream();
            }

            if (IsShortAsciiStartOffset(reader.Version))
            {
                AsciiStartOffset = reader.ReadInt16();
                FontCountX       = reader.ReadInt16();
                FontCountY       = reader.ReadInt16();
            }
            else
            {
                AsciiStartOffset = reader.ReadInt32();
                if (HasFontCount(reader.Version))
                {
                    FontCountX = reader.ReadInt32();
                    FontCountY = reader.ReadInt32();
                }
            }

            if (HasKerning(reader.Version))
            {
                Kerning = reader.ReadSingle();
            }
            if (HasTracking(reader.Version))
            {
                Tracking = reader.ReadSingle();
            }

            if (!isGrouped)
            {
                LineSpacing = reader.ReadSingle();
            }

            if (HasCharacterSpacing(reader.Version))
            {
                CharacterSpacing = reader.ReadInt32();
                CharacterPadding = reader.ReadInt32();
            }

            if (HasPerCharacterKerning(reader.Version))
            {
                if (IsBytePerCharacterKerning(reader.Version))
                {
                    PerCharacterKerningByte = reader.ReadTupleByteSingleArray();
                }
                else
                {
                    PerCharacterKerning = reader.ReadTupleIntSingleArray();
                }
            }

            ConvertCase = reader.ReadInt32();
            if (!isGrouped)
            {
                DefaultMaterial.Read(reader);
            }
            CharacterRects = reader.ReadAssetArray <CharacterInfo>();
            if (!isGrouped)
            {
                Texture.Read(reader);
            }

            if (HasGridFont(reader.Version))
            {
                if (IsGridFontFirst(reader.Version))
                {
                    GridFont = reader.ReadBoolean();
                }
            }

#warning TODO: create a dictionary with non unique keys
            if (IsByteKerningValues(reader.Version))
            {
                Dictionary <Tuple <byte, byte>, float> kerningValues = new Dictionary <Tuple <byte, byte>, float>();
                kerningValues.ReadSafe(reader);
                foreach (var kvp in kerningValues)
                {
                    Tuple <ushort, ushort> key = new Tuple <ushort, ushort>(kvp.Key.Item1, kvp.Key.Item2);
                    KerningValues.Add(key, kvp.Value);
                }
            }
            else
            {
                KerningValues.ReadSafe(reader);
            }

            if (HasPixelScale(reader.Version))
            {
                PixelScale = reader.ReadSingle();
                reader.AlignStream();
            }

            if (HasGridFont(reader.Version))
            {
                if (!IsGridFontFirst(reader.Version))
                {
                    GridFont = reader.ReadBoolean();
                    if (IsAlign(reader.Version))
                    {
                        reader.AlignStream();
                    }
                }
            }

            if (HasFontData(reader.Version))
            {
                FontData = reader.ReadByteArray();
                reader.AlignStream();

                if (!isGrouped)
                {
                    FontSize = reader.ReadSingle();
                }
                Ascent = reader.ReadSingle();
            }
            if (HasDescent(reader.Version))
            {
                Descent = reader.ReadSingle();
            }
            if (HasDefaultStyle(reader.Version))
            {
                DefaultStyle = (FontStyle)reader.ReadUInt32();
                FontNames    = reader.ReadStringArray();
            }

            if (HasFallbackFonts(reader.Version))
            {
                FallbackFonts = reader.ReadAssetArray <PPtr <Font> >();
                reader.AlignStream();

                FontRenderingMode = (FontRenderingMode)reader.ReadInt32();
            }

            if (HasUseLegacyBoundsCalculation(reader.Version))
            {
                UseLegacyBoundsCalculation = reader.ReadBoolean();
            }
            if (HasShouldRoundAdvanceValue(reader.Version))
            {
                ShouldRoundAdvanceValue = reader.ReadBoolean();
            }
        }
示例#12
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Type = (ReflectionProbeType)reader.ReadInt32();
            Mode = (ReflectionProbeMode)reader.ReadInt32();
            if (IsReadRefreshMode(reader.Version))
            {
                RefreshMode     = (ReflectionProbeRefreshMode)reader.ReadInt32();
                TimeSlicingMode = (ReflectionProbeTimeSlicingMode)reader.ReadInt32();
            }
            Resolution      = reader.ReadInt32();
            UpdateFrequency = reader.ReadInt32();
            if (IsReadImportance(reader.Version))
            {
                if (IsReadImportanceFirst(reader.Version))
                {
                    Importance = reader.ReadInt16();
                }
            }
            BoxSize.Read(reader);
            BoxOffset.Read(reader);
            NearClip       = reader.ReadSingle();
            FarClip        = reader.ReadSingle();
            ShadowDistance = reader.ReadSingle();
            ClearFlags     = (ReflectionProbeClearFlags)reader.ReadUInt32();
            BackGroundColor.Read(reader);
            CullingMask.Read(reader);
            IntensityMultiplier = reader.ReadSingle();
            if (IsReadBlendDistance(reader.Version))
            {
                BlendDistance = reader.ReadSingle();
            }
            if (IsReadBakedRenderPassCount(reader.Version))
            {
                BakedRenderPassCount = reader.ReadUInt32();
                UseMipMap            = reader.ReadBoolean();
            }
            HDR = reader.ReadBoolean();
            if (IsReadBoxProjection(reader.Version))
            {
                BoxProjection        = reader.ReadBoolean();
                RenderDynamicObjects = reader.ReadBoolean();
                UseOcclusionCulling  = reader.ReadBoolean();
            }
            if (IsReadImportance(reader.Version))
            {
                if (!IsReadImportanceFirst(reader.Version))
                {
                    Importance = reader.ReadInt16();
                }
            }
            reader.AlignStream(AlignType.Align4);

            if (IsReadCustomBakedTexture(reader.Version))
            {
                CustomBakedTexture.Read(reader);
            }
            if (IsReadBakedTexture(reader.Version, reader.Flags))
            {
                BakedTextureTexture.Read(reader);
            }
        }