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(); } }
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(); } }
public override void Read(AssetReader reader) { base.Read(reader); Gravity.Read(reader); DefaultMaterial.Read(reader); BounceThreshold = reader.ReadSingle(); if (IsReadSleepThreshold(reader.Version)) { SleepThreshold = reader.ReadSingle(); } else { SleepVelocity = reader.ReadSingle(); SleepAngularVelocity = reader.ReadSingle(); } if (IsReadSleepAngularVelocity(reader.Version)) { MaxAngularVelocity = reader.ReadSingle(); } if (IsReadDefaultContactOffset(reader.Version)) { DefaultContactOffset = reader.ReadSingle(); } else { MinPenetrationForPenalty = reader.ReadSingle(); } DefaultSolverIterations = reader.ReadInt32(); if (IsReadDefaultSolverVelocityIterations(reader.Version)) { DefaultSolverVelocityIterations = reader.ReadInt32(); } if (IsReadQueriesHitBackfaces(reader.Version)) { QueriesHitBackfaces = reader.ReadBoolean(); } if (IsReadQueriesHitTriggers(reader.Version)) { QueriesHitTriggers = reader.ReadBoolean(); } if (IsReadEnableAdaptiveForce(reader.Version)) { EnableAdaptiveForce = reader.ReadBoolean(); } if (IsReadEnablePCM(reader.Version)) { EnablePCM = reader.ReadBoolean(); } if (IsAlign(reader.Version)) { reader.AlignStream(AlignType.Align4); } if (IsReadClothInterCollisionDistance(reader.Version)) { ClothInterCollisionDistance = reader.ReadSingle(); ClothInterCollisionStiffness = reader.ReadSingle(); ContactsGeneration = (ContactsGeneration)reader.ReadInt32(); reader.AlignStream(AlignType.Align4); } if (IsReadLayerCollisionMatrix(reader.Version)) { m_layerCollisionMatrix = reader.ReadUInt32Array(); } if (IsReadAutoSimulation(reader.Version)) { AutoSimulation = reader.ReadBoolean(); } if (IsReadAutoSyncTransforms(reader.Version)) { AutoSyncTransforms = reader.ReadBoolean(); } if (IsReadClothInterCollisionSettingsToggle(reader.Version)) { ClothInterCollisionSettingsToggle = reader.ReadBoolean(); reader.AlignStream(AlignType.Align4); ContactPairsMode = (ContactPairsMode)reader.ReadInt32(); BroadphaseType = (BroadphaseType)reader.ReadInt32(); WorldBounds.Read(reader); WorldSubdivisions = reader.ReadInt32(); } if (IsReadFrictionType(reader.Version)) { FrictionType = (FrictionType)reader.ReadInt32(); EnableEnhancedDeterminism = reader.ReadBoolean(); EnableUnifiedHeightmaps = reader.ReadBoolean(); } }
public override void Read(AssetReader reader) { base.Read(reader); Gravity.Read(reader); DefaultMaterial.Read(reader); VelocityIterations = reader.ReadInt32(); PositionIterations = reader.ReadInt32(); if (IsReadVelocityThreshold(reader.Version)) { VelocityThreshold = reader.ReadSingle(); MaxLinearCorrection = reader.ReadSingle(); MaxAngularCorrection = reader.ReadSingle(); MaxTranslationSpeed = reader.ReadSingle(); MaxRotationSpeed = reader.ReadSingle(); } if (IsReadMinPenetrationForPenalty(reader.Version)) { MinPenetrationForPenalty = reader.ReadSingle(); } if (IsReadBaumgarteScale(reader.Version)) { BaumgarteScale = reader.ReadSingle(); BaumgarteTimeOfImpactScale = reader.ReadSingle(); TimeToSleep = reader.ReadSingle(); LinearSleepTolerance = reader.ReadSingle(); AngularSleepTolerance = reader.ReadSingle(); } if (IsReadDefaultContactOffset(reader.Version)) { DefaultContactOffset = reader.ReadSingle(); } if (IsReadJobOptions(reader.Version)) { JobOptions.Read(reader); } if (IsReadAutoSimulation(reader.Version)) { AutoSimulation = reader.ReadBoolean(); } QueriesHitTriggers = reader.ReadBoolean(); if (IsReadQueriesStartInColliders(reader.Version)) { QueriesStartInColliders = reader.ReadBoolean(); } if (IsReadDeleteStopsCallbacks(reader.Version)) { DeleteStopsCallbacks = reader.ReadBoolean(); } if (IsReadChangeStopsCallbacks(reader.Version)) { ChangeStopsCallbacks = reader.ReadBoolean(); } if (IsReadCallbacksOnDisable(reader.Version)) { CallbacksOnDisable = reader.ReadBoolean(); } if (IsReadAutoSyncTransforms(reader.Version)) { AutoSyncTransforms = reader.ReadBoolean(); } #if UNIVERSAL if (IsReadAlwaysShowColliders(reader.Version, reader.Flags)) { AlwaysShowColliders = reader.ReadBoolean(); ShowColliderSleep = reader.ReadBoolean(); ShowColliderContacts = reader.ReadBoolean(); } if (IsReadShowColliderAABB(reader.Version, reader.Flags)) { ShowColliderAABB = reader.ReadBoolean(); } #endif reader.AlignStream(AlignType.Align4); #if UNIVERSAL if (IsReadContactArrowScale(reader.Version, reader.Flags)) { ContactArrowScale = reader.ReadSingle(); ColliderAwakeColor.Read(reader); ColliderAsleepColor.Read(reader); ColliderContactColor.Read(reader); } if (IsReadColliderAABBColor(reader.Version, reader.Flags)) { ColliderAABBColor.Read(reader); } #endif m_layerCollisionMatrix = reader.ReadUInt32Array(); }