public override void ReadInto <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule)obj; string propertyName; while ((propertyName = reader.ReadPropertyName()) != null) { switch (propertyName) { case "enabled": instance.enabled = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "limitX": instance.limitX = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "limitXMultiplier": instance.limitXMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "limitY": instance.limitY = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "limitYMultiplier": instance.limitYMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "limitZ": instance.limitZ = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "limitZMultiplier": instance.limitZMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "limit": instance.limit = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "limitMultiplier": instance.limitMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "dampen": instance.dampen = reader.Read <System.Single>(ES3Type_float.Instance); break; case "separateAxes": instance.separateAxes = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "space": instance.space = reader.Read <UnityEngine.ParticleSystemSimulationSpace>(); break; default: reader.Skip(); break; } } }
protected override void ReadUnityObject <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.Mesh)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { #if UNITY_2017_3 case "indexFormat": instance.indexFormat = reader.Read <UnityEngine.Rendering.IndexFormat>(); break; #endif case "bounds": instance.bounds = reader.Read <UnityEngine.Bounds>(ES3Type_Bounds.Instance); break; case "boneWeights": instance.boneWeights = reader.Read <UnityEngine.BoneWeight[]>(ES3Type_BoneWeightArray.Instance); break; case "bindposes": instance.bindposes = reader.Read <UnityEngine.Matrix4x4[]>(ES3Type_Matrix4x4Array.Instance); break; case "vertices": instance.vertices = reader.Read <UnityEngine.Vector3[]>(ES3Type_Vector3Array.Instance); break; case "normals": instance.normals = reader.Read <UnityEngine.Vector3[]>(ES3Type_Vector3Array.Instance); break; case "tangents": instance.tangents = reader.Read <UnityEngine.Vector4[]>(ES3Type_Vector4Array.Instance); break; case "uv": instance.uv = reader.Read <UnityEngine.Vector2[]>(ES3Type_Vector2Array.Instance); break; case "uv2": instance.uv2 = reader.Read <UnityEngine.Vector2[]>(ES3Type_Vector2Array.Instance); break; case "uv3": instance.uv3 = reader.Read <UnityEngine.Vector2[]>(ES3Type_Vector2Array.Instance); break; case "uv4": instance.uv4 = reader.Read <UnityEngine.Vector2[]>(ES3Type_Vector2Array.Instance); break; case "colors32": instance.colors32 = reader.Read <UnityEngine.Color32[]>(ES3Type_Color32Array.Instance); break; case "triangles": instance.triangles = reader.Read <System.Int32[]>(ES3Type_intArray.Instance); break; case "subMeshCount": instance.subMeshCount = reader.Read <System.Int32>(ES3Type_int.Instance); for (int i = 0; i < instance.subMeshCount; i++) { instance.SetTriangles(reader.ReadProperty <int[]>(ES3Type_intArray.Instance), i); } break; default: reader.Skip(); break; } } }
public override void ReadInto <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.ParticleSystem.MainModule)obj; string propertyName; while ((propertyName = reader.ReadPropertyName()) != null) { switch (propertyName) { case "duration": instance.duration = reader.Read <System.Single>(ES3Type_float.Instance); break; case "loop": instance.loop = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "prewarm": instance.prewarm = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "startDelay": instance.startDelay = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "startDelayMultiplier": instance.startDelayMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "startLifetime": instance.startLifetime = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "startLifetimeMultiplier": instance.startLifetimeMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "startSpeed": instance.startSpeed = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "startSpeedMultiplier": instance.startSpeedMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "startSize3D": instance.startSize3D = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "startSize": instance.startSize = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "startSizeMultiplier": instance.startSizeMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "startSizeX": instance.startSizeX = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "startSizeXMultiplier": instance.startSizeXMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "startSizeY": instance.startSizeY = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "startSizeYMultiplier": instance.startSizeYMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "startSizeZ": instance.startSizeZ = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "startSizeZMultiplier": instance.startSizeZMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "startRotation3D": instance.startRotation3D = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "startRotation": instance.startRotation = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "startRotationMultiplier": instance.startRotationMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "startRotationX": instance.startRotationX = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "startRotationXMultiplier": instance.startRotationXMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "startRotationY": instance.startRotationY = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "startRotationYMultiplier": instance.startRotationYMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "startRotationZ": instance.startRotationZ = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "startRotationZMultiplier": instance.startRotationZMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; #if UNITY_2018_1_OR_NEWER case "flipRotation": instance.flipRotation = reader.Read <System.Single>(ES3Type_float.Instance); break; case "randomizeRotationDirection": instance.flipRotation = reader.Read <System.Single>(ES3Type_float.Instance); break; #else case "randomizeRotationDirection": instance.randomizeRotationDirection = reader.Read <System.Single>(ES3Type_float.Instance); break; #endif case "startColor": instance.startColor = reader.Read <UnityEngine.ParticleSystem.MinMaxGradient>(ES3Type_MinMaxGradient.Instance); break; case "gravityModifier": instance.gravityModifier = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "gravityModifierMultiplier": instance.gravityModifierMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "simulationSpace": instance.simulationSpace = reader.Read <UnityEngine.ParticleSystemSimulationSpace>(); break; case "customSimulationSpace": instance.customSimulationSpace = reader.Read <UnityEngine.Transform>(ES3Type_Transform.Instance); break; case "simulationSpeed": instance.simulationSpeed = reader.Read <System.Single>(ES3Type_float.Instance); break; case "scalingMode": instance.scalingMode = reader.Read <UnityEngine.ParticleSystemScalingMode>(); break; case "playOnAwake": instance.playOnAwake = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "maxParticles": instance.maxParticles = reader.Read <System.Int32>(ES3Type_int.Instance); break; default: reader.Skip(); break; } } }
protected override void ReadComponent <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.RectTransform)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { case "anchorMin": instance.anchorMin = reader.Read <UnityEngine.Vector2>(ES3Type_Vector2.Instance); break; case "anchorMax": instance.anchorMax = reader.Read <UnityEngine.Vector2>(ES3Type_Vector2.Instance); break; case "anchoredPosition": instance.anchoredPosition = reader.Read <UnityEngine.Vector2>(ES3Type_Vector2.Instance); break; case "sizeDelta": instance.sizeDelta = reader.Read <UnityEngine.Vector2>(ES3Type_Vector2.Instance); break; case "pivot": instance.pivot = reader.Read <UnityEngine.Vector2>(ES3Type_Vector2.Instance); break; case "offsetMin": instance.offsetMin = reader.Read <UnityEngine.Vector2>(ES3Type_Vector2.Instance); break; case "offsetMax": instance.offsetMax = reader.Read <UnityEngine.Vector2>(ES3Type_Vector2.Instance); break; case "localPosition": instance.localPosition = reader.Read <UnityEngine.Vector3>(ES3Type_Vector3.Instance); break; case "localRotation": instance.localRotation = reader.Read <UnityEngine.Quaternion>(ES3Type_Quaternion.Instance); break; case "localScale": instance.localScale = reader.Read <UnityEngine.Vector3>(ES3Type_Vector3.Instance); break; case "parent": instance.SetParent(reader.Read <UnityEngine.Transform>(ES3Type_Transform.Instance)); break; case "hierarchyCapacity": instance.hierarchyCapacity = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "hideFlags": instance.hideFlags = reader.Read <UnityEngine.HideFlags>(); break; default: reader.Skip(); break; } } }
public override void ReadInto <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.ParticleSystem.SizeBySpeedModule)obj; string propertyName; while ((propertyName = reader.ReadPropertyName()) != null) { switch (propertyName) { case "enabled": instance.enabled = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "size": instance.size = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "sizeMultiplier": instance.sizeMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "x": instance.x = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "xMultiplier": instance.xMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "y": instance.y = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "yMultiplier": instance.yMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "z": instance.z = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "zMultiplier": instance.zMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "separateAxes": instance.separateAxes = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "range": instance.range = reader.Read <UnityEngine.Vector2>(ES3Type_Vector2.Instance); break; default: reader.Skip(); break; } } }
public override void ReadInto <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.ParticleSystem.TextureSheetAnimationModule)obj; string propertyName; while ((propertyName = reader.ReadPropertyName()) != null) { switch (propertyName) { case "enabled": instance.enabled = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "numTilesX": instance.numTilesX = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "numTilesY": instance.numTilesY = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "animation": instance.animation = reader.Read <UnityEngine.ParticleSystemAnimationType>(); break; case "useRandomRow": instance.useRandomRow = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "frameOverTime": instance.frameOverTime = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "frameOverTimeMultiplier": instance.frameOverTimeMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "startFrame": instance.startFrame = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "startFrameMultiplier": instance.startFrameMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "cycleCount": instance.cycleCount = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "rowIndex": instance.rowIndex = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "uvChannelMask": instance.uvChannelMask = reader.Read <UnityEngine.Rendering.UVChannelFlags>(); break; case "flipU": instance.flipU = reader.Read <System.Single>(ES3Type_float.Instance); break; case "flipV": instance.flipV = reader.Read <System.Single>(ES3Type_float.Instance); break; default: reader.Skip(); break; } } }
protected override object ReadObject <T>(ES3Reader reader) { UnityEngine.Object obj = null; var refMgr = ES3ReferenceMgrBase.Current; long id = 0; // Read the intial properties regarding the instance we're loading. while (true) { if (refMgr == null) { reader.Skip(); continue; } var propertyName = ReadPropertyName(reader); if (propertyName == ES3Type.typeFieldName) { return(ES3TypeMgr.GetOrCreateES3Type(reader.ReadType()).Read <T>(reader)); } else if (propertyName == ES3ReferenceMgrBase.referencePropertyName) { if (refMgr == null) { reader.Skip(); continue; } id = reader.Read_ref(); obj = refMgr.Get(id, true); } else if (propertyName == transformPropertyName) { if (refMgr == null) { reader.Skip(); continue; } // Now load the Transform's ID and assign it to the Transform of our object. long transformID = reader.Read_ref(); if (obj == null) { obj = CreateNewGameObject(refMgr, id); } refMgr.Add(((GameObject)obj).transform, transformID); } else if (propertyName == prefabPropertyName) { if (obj != null || ES3ReferenceMgrBase.Current == null) { reader.Skip(); } else { obj = reader.Read <GameObject>(ES3Type_ES3PrefabInternal.Instance); ES3ReferenceMgrBase.Current.Add(obj, id); } } else if (propertyName == null) { if (obj == null) { return(CreateNewGameObject(refMgr, id)); } return(obj); } else { reader.overridePropertiesName = propertyName; break; } } if (obj == null) { obj = CreateNewGameObject(refMgr, id); } ReadInto <T>(reader, obj); return(obj); }
public override void ReadInto <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.ParticleSystem.NoiseModule)obj; string propertyName; while ((propertyName = reader.ReadPropertyName()) != null) { switch (propertyName) { case "enabled": instance.enabled = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "separateAxes": instance.separateAxes = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "strength": instance.strength = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "strengthMultiplier": instance.strengthMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "strengthX": instance.strengthX = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "strengthXMultiplier": instance.strengthXMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "strengthY": instance.strengthY = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "strengthYMultiplier": instance.strengthYMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "strengthZ": instance.strengthZ = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "strengthZMultiplier": instance.strengthZMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "frequency": instance.frequency = reader.Read <System.Single>(ES3Type_float.Instance); break; case "damping": instance.damping = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "octaveCount": instance.octaveCount = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "octaveMultiplier": instance.octaveMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "octaveScale": instance.octaveScale = reader.Read <System.Single>(ES3Type_float.Instance); break; case "quality": instance.quality = reader.Read <UnityEngine.ParticleSystemNoiseQuality>(); break; case "scrollSpeed": instance.scrollSpeed = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "scrollSpeedMultiplier": instance.scrollSpeedMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "remapEnabled": instance.remapEnabled = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "remap": instance.remap = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "remapMultiplier": instance.remapMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "remapX": instance.remapX = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "remapXMultiplier": instance.remapXMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "remapY": instance.remapY = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "remapYMultiplier": instance.remapYMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "remapZ": instance.remapZ = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "remapZMultiplier": instance.remapZMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; default: reader.Skip(); break; } } }
protected object ReadProperties(ES3Reader reader, object obj) { // Iterate through each property in the file and try to load it using the appropriate // ES3Member in the members array. foreach (string propertyName in reader.Properties) { // Find the property. ES3Member property = null; for (int i = 0; i < members.Length; i++) { if (members[i].name == propertyName) { property = members[i]; break; } } // If this is a class which derives directly from a Collection, we need to load it's dictionary first. if (propertyName == "_Values") { var baseType = ES3TypeMgr.GetOrCreateES3Type(ES3Reflection.BaseType(obj.GetType())); if (baseType.isDictionary) { var dict = (IDictionary)obj; var loaded = (IDictionary)baseType.Read <IDictionary>(reader); foreach (DictionaryEntry kvp in loaded) { dict[kvp.Key] = kvp.Value; } } else if (baseType.isCollection) { var loaded = (IEnumerable)baseType.Read <IEnumerable>(reader); var type = baseType.GetType(); if (type == typeof(ES3ListType)) { foreach (var item in loaded) { ((IList)obj).Add(item); } } else if (type == typeof(ES3QueueType)) { var method = baseType.type.GetMethod("Enqueue"); foreach (var item in loaded) { method.Invoke(obj, new object[] { item }); } } else if (type == typeof(ES3StackType)) { var method = baseType.type.GetMethod("Push"); foreach (var item in loaded) { method.Invoke(obj, new object[] { item }); } } else if (type == typeof(ES3HashSetType)) { var method = baseType.type.GetMethod("Add"); foreach (var item in loaded) { method.Invoke(obj, new object[] { item }); } } } } if (property == null) { reader.Skip(); } else { var type = ES3TypeMgr.GetOrCreateES3Type(property.type); if (ES3Reflection.IsAssignableFrom(typeof(ES3DictionaryType), type.GetType())) { property.reflectedMember.SetValue(obj, ((ES3DictionaryType)type).Read(reader)); } else if (ES3Reflection.IsAssignableFrom(typeof(ES3CollectionType), type.GetType())) { property.reflectedMember.SetValue(obj, ((ES3CollectionType)type).Read(reader)); } else { object readObj = reader.Read <object>(type); property.reflectedMember.SetValue(obj, readObj); } } } return(obj); }
protected override void ReadComponent <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.Light)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { case "type": instance.type = reader.Read <UnityEngine.LightType>(); break; case "color": instance.color = reader.Read <UnityEngine.Color>(ES3Type_Color.Instance); break; case "intensity": instance.intensity = reader.Read <System.Single>(ES3Type_float.Instance); break; case "bounceIntensity": instance.bounceIntensity = reader.Read <System.Single>(ES3Type_float.Instance); break; case "shadows": instance.shadows = reader.Read <UnityEngine.LightShadows>(); break; case "shadowStrength": instance.shadowStrength = reader.Read <System.Single>(ES3Type_float.Instance); break; case "shadowResolution": instance.shadowResolution = reader.Read <UnityEngine.Rendering.LightShadowResolution>(); break; case "shadowCustomResolution": instance.shadowCustomResolution = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "shadowBias": instance.shadowBias = reader.Read <System.Single>(ES3Type_float.Instance); break; case "shadowNormalBias": instance.shadowNormalBias = reader.Read <System.Single>(ES3Type_float.Instance); break; case "shadowNearPlane": instance.shadowNearPlane = reader.Read <System.Single>(ES3Type_float.Instance); break; case "range": instance.range = reader.Read <System.Single>(ES3Type_float.Instance); break; case "spotAngle": instance.spotAngle = reader.Read <System.Single>(ES3Type_float.Instance); break; case "cookieSize": instance.cookieSize = reader.Read <System.Single>(ES3Type_float.Instance); break; case "cookie": instance.cookie = reader.Read <UnityEngine.Texture>(); break; case "flare": instance.flare = reader.Read <UnityEngine.Flare>(); break; case "renderMode": instance.renderMode = reader.Read <UnityEngine.LightRenderMode>(); break; case "cullingMask": instance.cullingMask = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "enabled": instance.enabled = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "hideFlags": instance.hideFlags = reader.Read <UnityEngine.HideFlags>(); break; default: reader.Skip(); break; } } }
protected override void ReadComponent <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.Animator)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { case "rootPosition": instance.rootPosition = reader.Read <UnityEngine.Vector3>(ES3Type_Vector3.Instance); break; case "rootRotation": instance.rootRotation = reader.Read <UnityEngine.Quaternion>(ES3Type_Quaternion.Instance); break; case "applyRootMotion": instance.applyRootMotion = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "updateMode": instance.updateMode = reader.Read <UnityEngine.AnimatorUpdateMode>(); break; case "allowConstantClipSamplingOptimization": reader.SetPrivateProperty("allowConstantClipSamplingOptimization", reader.Read <System.Boolean>(), instance); break; case "bodyPosition": instance.bodyPosition = reader.Read <UnityEngine.Vector3>(ES3Type_Vector3.Instance); break; case "bodyPositionInternal": reader.SetPrivateProperty("bodyPositionInternal", reader.Read <UnityEngine.Vector3>(), instance); break; case "bodyRotation": instance.bodyRotation = reader.Read <UnityEngine.Quaternion>(ES3Type_Quaternion.Instance); break; case "bodyRotationInternal": reader.SetPrivateProperty("bodyRotationInternal", reader.Read <UnityEngine.Quaternion>(), instance); break; case "stabilizeFeet": instance.stabilizeFeet = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "feetPivotActive": instance.feetPivotActive = reader.Read <System.Single>(ES3Type_float.Instance); break; case "speed": instance.speed = reader.Read <System.Single>(ES3Type_float.Instance); break; case "cullingMode": instance.cullingMode = reader.Read <UnityEngine.AnimatorCullingMode>(); break; case "playbackTime": instance.playbackTime = reader.Read <System.Single>(ES3Type_float.Instance); break; case "recorderStartTime": instance.recorderStartTime = reader.Read <System.Single>(ES3Type_float.Instance); break; case "recorderStopTime": instance.recorderStopTime = reader.Read <System.Single>(ES3Type_float.Instance); break; case "layersAffectMassCenter": instance.layersAffectMassCenter = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "logWarnings": instance.logWarnings = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "fireEvents": instance.fireEvents = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "keepAnimatorControllerStateOnDisable": instance.keepAnimatorControllerStateOnDisable = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "enabled": instance.enabled = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; default: reader.Skip(); break; } } }
public override void ReadInto <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.ParticleSystem.LightsModule)obj; string propertyName; while ((propertyName = reader.ReadPropertyName()) != null) { switch (propertyName) { case "enabled": instance.enabled = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "ratio": instance.ratio = reader.Read <System.Single>(ES3Type_float.Instance); break; case "useRandomDistribution": instance.useRandomDistribution = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "light": instance.light = reader.Read <UnityEngine.Light>(ES3Type_Light.Instance); break; case "useParticleColor": instance.useParticleColor = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "sizeAffectsRange": instance.sizeAffectsRange = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "alphaAffectsIntensity": instance.alphaAffectsIntensity = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "range": instance.range = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "rangeMultiplier": instance.rangeMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "intensity": instance.intensity = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "intensityMultiplier": instance.intensityMultiplier = reader.Read <System.Single>(ES3Type_float.Instance); break; case "maxLights": instance.maxLights = reader.Read <System.Int32>(ES3Type_int.Instance); break; default: reader.Skip(); break; } } }
public override object Read <T>(ES3Reader reader) { reader.ReadPropertyName(); return(new DateTime(reader.Read <long>(ES3Type_long.Instance))); }
protected override void ReadComponent <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.SkinnedMeshRenderer)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { case "bones": instance.bones = reader.Read <UnityEngine.Transform[]>(); break; case "rootBone": instance.rootBone = reader.Read <UnityEngine.Transform>(ES3Type_Transform.Instance); break; case "quality": instance.quality = reader.Read <UnityEngine.SkinQuality>(); break; case "sharedMesh": instance.sharedMesh = reader.Read <UnityEngine.Mesh>(ES3Type_Mesh.Instance); break; case "updateWhenOffscreen": instance.updateWhenOffscreen = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "skinnedMotionVectors": instance.skinnedMotionVectors = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "localBounds": instance.localBounds = reader.Read <UnityEngine.Bounds>(ES3Type_Bounds.Instance); break; case "enabled": instance.enabled = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "shadowCastingMode": instance.shadowCastingMode = reader.Read <UnityEngine.Rendering.ShadowCastingMode>(); break; case "receiveShadows": instance.receiveShadows = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "sharedMaterials": instance.sharedMaterials = reader.Read <UnityEngine.Material[]>(); break; case "lightmapIndex": instance.lightmapIndex = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "realtimeLightmapIndex": instance.realtimeLightmapIndex = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "lightmapScaleOffset": instance.lightmapScaleOffset = reader.Read <UnityEngine.Vector4>(ES3Type_Vector4.Instance); break; case "motionVectorGenerationMode": instance.motionVectorGenerationMode = reader.Read <UnityEngine.MotionVectorGenerationMode>(); break; case "realtimeLightmapScaleOffset": instance.realtimeLightmapScaleOffset = reader.Read <UnityEngine.Vector4>(ES3Type_Vector4.Instance); break; case "lightProbeUsage": instance.lightProbeUsage = reader.Read <UnityEngine.Rendering.LightProbeUsage>(); break; case "lightProbeProxyVolumeOverride": instance.lightProbeProxyVolumeOverride = reader.Read <UnityEngine.GameObject>(ES3Type_GameObject.Instance); break; case "probeAnchor": instance.probeAnchor = reader.Read <UnityEngine.Transform>(ES3Type_Transform.Instance); break; case "reflectionProbeUsage": instance.reflectionProbeUsage = reader.Read <UnityEngine.Rendering.ReflectionProbeUsage>(); break; case "sortingLayerName": instance.sortingLayerName = reader.Read <System.String>(ES3Type_string.Instance); break; case "sortingLayerID": instance.sortingLayerID = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "sortingOrder": instance.sortingOrder = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "blendShapeWeights": var blendShapeWeights = reader.Read <System.Single[]>(ES3Type_floatArray.Instance); if (instance.sharedMesh == null) { break; } if (blendShapeWeights.Length != instance.sharedMesh.blendShapeCount) { ES3Internal.ES3Debug.LogError("The number of blend shape weights we are loading does not match the number of blend shapes in this SkinnedMeshRenderer's Mesh"); } for (int i = 0; i < blendShapeWeights.Length; i++) { instance.SetBlendShapeWeight(i, blendShapeWeights[i]); } break; default: reader.Skip(); break; } } }
protected override void ReadComponent <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.UI.RawImage)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { case "texture": instance.texture = reader.Read <UnityEngine.Texture>(ES3Type_Texture.Instance); break; case "uvRect": instance.uvRect = reader.Read <UnityEngine.Rect>(ES3Type_Rect.Instance); break; case "onCullStateChanged": instance.onCullStateChanged = reader.Read <UnityEngine.UI.MaskableGraphic.CullStateChangedEvent>(); break; case "maskable": instance.maskable = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "color": instance.color = reader.Read <UnityEngine.Color>(ES3Type_Color.Instance); break; case "raycastTarget": instance.raycastTarget = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "useLegacyMeshGeneration": reader.SetPrivateProperty("useLegacyMeshGeneration", reader.Read <System.Boolean>(), instance); break; case "material": instance.material = reader.Read <UnityEngine.Material>(ES3Type_Material.Instance); break; case "useGUILayout": instance.useGUILayout = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "enabled": instance.enabled = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "hideFlags": instance.hideFlags = reader.Read <UnityEngine.HideFlags>(); break; default: reader.Skip(); break; } } }
protected override void ReadUnityObject <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.Mesh)obj; if (instance == null) { return; } if (!instance.isReadable) { Debug.LogWarning("Easy Save cannot load the vertices for this Mesh because it is not marked as readable, so it will be loaded by reference. To load the vertex data for this Mesh, check the 'Read/Write Enabled' checkbox in its Import Settings.", instance); } foreach (string propertyName in reader.Properties) { // If this Mesh isn't readable, we should skip past all of its properties. if (!instance.isReadable) { reader.Skip(); continue; } switch (propertyName) { #if UNITY_2017_3 case "indexFormat": instance.indexFormat = reader.Read <UnityEngine.Rendering.IndexFormat>(); break; #endif case "bounds": instance.bounds = reader.Read <UnityEngine.Bounds>(ES3Type_Bounds.Instance); break; case "boneWeights": instance.boneWeights = reader.Read <UnityEngine.BoneWeight[]>(ES3Type_BoneWeightArray.Instance); break; case "bindposes": instance.bindposes = reader.Read <UnityEngine.Matrix4x4[]>(ES3Type_Matrix4x4Array.Instance); break; case "vertices": instance.vertices = reader.Read <UnityEngine.Vector3[]>(ES3Type_Vector3Array.Instance); break; case "normals": instance.normals = reader.Read <UnityEngine.Vector3[]>(ES3Type_Vector3Array.Instance); break; case "tangents": instance.tangents = reader.Read <UnityEngine.Vector4[]>(ES3Type_Vector4Array.Instance); break; case "uv": instance.uv = reader.Read <UnityEngine.Vector2[]>(ES3Type_Vector2Array.Instance); break; case "uv2": instance.uv2 = reader.Read <UnityEngine.Vector2[]>(ES3Type_Vector2Array.Instance); break; case "uv3": instance.uv3 = reader.Read <UnityEngine.Vector2[]>(ES3Type_Vector2Array.Instance); break; case "uv4": instance.uv4 = reader.Read <UnityEngine.Vector2[]>(ES3Type_Vector2Array.Instance); break; case "colors32": instance.colors32 = reader.Read <UnityEngine.Color32[]>(ES3Type_Color32Array.Instance); break; case "triangles": instance.triangles = reader.Read <System.Int32[]>(ES3Type_intArray.Instance); break; case "subMeshCount": instance.subMeshCount = reader.Read <System.Int32>(ES3Type_int.Instance); for (int i = 0; i < instance.subMeshCount; i++) { instance.SetTriangles(reader.ReadProperty <int[]>(ES3Type_intArray.Instance), i); } break; default: reader.Skip(); break; } } }
protected override void ReadUnityObject <T>(ES3Reader reader, object obj) { if (obj.GetType() == typeof(RenderTexture)) { ES3Type_RenderTexture.Instance.ReadInto <T>(reader, obj); return; } var instance = (UnityEngine.Texture2D)obj; if (!IsReadable(instance)) { ES3Internal.ES3Debug.LogWarning("Easy Save cannot load the properties or pixels for this Texture because it is not read/write enabled, so it will be loaded by reference. To load the properties and pixels for this Texture, check the 'Read/Write Enabled' checkbox in its Import Settings.", instance); } foreach (string propertyName in reader.Properties) { // If this Texture isn't readable, we should skip past all of its properties. if (!IsReadable(instance)) { reader.Skip(); continue; } switch (propertyName) { case "filterMode": instance.filterMode = reader.Read <UnityEngine.FilterMode>(); break; case "anisoLevel": instance.anisoLevel = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "wrapMode": instance.wrapMode = reader.Read <UnityEngine.TextureWrapMode>(); break; case "mipMapBias": instance.mipMapBias = reader.Read <System.Single>(ES3Type_float.Instance); break; case "rawTextureData": // LoadRawTextureData requires that the correct width, height, TextureFormat and mipMaps are set before being called. // If an error occurs here, it's likely that we're using LoadInto to load into a Texture which differs in these values. // In this case, LoadInto should be avoided and Load should be used instead. if (!IsReadable(instance)) { ES3Internal.ES3Debug.LogWarning("Easy Save cannot load the pixels of this Texture because it is not read/write enabled, so Easy Save will ignore the pixel data. To load the pixel data, check the 'Read/Write Enabled' checkbox in the Texture's import settings. Clicking this warning will take you to the Texture, assuming it is not generated at runtime.", instance); reader.Skip(); } else { try { instance.LoadRawTextureData(reader.Read <byte[]>(ES3Type_byteArray.Instance)); instance.Apply(); } catch (Exception e) { ES3Internal.ES3Debug.LogError("Easy Save encountered an error when trying to load this Texture, please see the end of this messasge for the error. This is most likely because the Texture format of the instance we are loading into is different to the Texture we saved.\n" + e.ToString(), instance); } } break; default: reader.Skip(); break; } } }
protected override void ReadComponent <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.Rigidbody)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { case "velocity": instance.velocity = reader.Read <UnityEngine.Vector3>(ES3Type_Vector3.Instance); break; case "angularVelocity": instance.angularVelocity = reader.Read <UnityEngine.Vector3>(ES3Type_Vector3.Instance); break; case "drag": instance.drag = reader.Read <System.Single>(ES3Type_float.Instance); break; case "angularDrag": instance.angularDrag = reader.Read <System.Single>(ES3Type_float.Instance); break; case "mass": instance.mass = reader.Read <System.Single>(ES3Type_float.Instance); break; case "useGravity": instance.useGravity = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "maxDepenetrationVelocity": instance.maxDepenetrationVelocity = reader.Read <System.Single>(ES3Type_float.Instance); break; case "isKinematic": instance.isKinematic = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "freezeRotation": instance.freezeRotation = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "constraints": instance.constraints = reader.Read <UnityEngine.RigidbodyConstraints>(); break; case "collisionDetectionMode": instance.collisionDetectionMode = reader.Read <UnityEngine.CollisionDetectionMode>(); break; case "centerOfMass": instance.centerOfMass = reader.Read <UnityEngine.Vector3>(ES3Type_Vector3.Instance); break; case "inertiaTensorRotation": instance.inertiaTensorRotation = reader.Read <UnityEngine.Quaternion>(ES3Type_Quaternion.Instance); break; case "inertiaTensor": instance.inertiaTensor = reader.Read <UnityEngine.Vector3>(ES3Type_Vector3.Instance); break; case "detectCollisions": instance.detectCollisions = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "position": instance.position = reader.Read <UnityEngine.Vector3>(ES3Type_Vector3.Instance); break; case "rotation": instance.rotation = reader.Read <UnityEngine.Quaternion>(ES3Type_Quaternion.Instance); break; case "interpolation": instance.interpolation = reader.Read <UnityEngine.RigidbodyInterpolation>(); break; case "solverIterations": instance.solverIterations = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "sleepThreshold": instance.sleepThreshold = reader.Read <System.Single>(ES3Type_float.Instance); break; case "maxAngularVelocity": instance.maxAngularVelocity = reader.Read <System.Single>(ES3Type_float.Instance); break; case "solverVelocityIterations": instance.solverVelocityIterations = reader.Read <System.Int32>(ES3Type_int.Instance); break; default: reader.Skip(); break; } } }
public override void ReadInto <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.ParticleSystem.CollisionModule)obj; string propertyName; while ((propertyName = reader.ReadPropertyName()) != null) { switch (propertyName) { case "enabled": instance.enabled = reader.Read <System.Boolean>(); break; case "type": instance.type = reader.Read <UnityEngine.ParticleSystemCollisionType>(); break; case "mode": instance.mode = reader.Read <UnityEngine.ParticleSystemCollisionMode>(); break; case "dampen": instance.dampen = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "dampenMultiplier": instance.dampenMultiplier = reader.Read <System.Single>(); break; case "bounce": instance.bounce = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "bounceMultiplier": instance.bounceMultiplier = reader.Read <System.Single>(); break; case "lifetimeLoss": instance.lifetimeLoss = reader.Read <UnityEngine.ParticleSystem.MinMaxCurve>(ES3Type_MinMaxCurve.Instance); break; case "lifetimeLossMultiplier": instance.lifetimeLossMultiplier = reader.Read <System.Single>(); break; case "minKillSpeed": instance.minKillSpeed = reader.Read <System.Single>(); break; case "maxKillSpeed": instance.maxKillSpeed = reader.Read <System.Single>(); break; case "collidesWith": instance.collidesWith = reader.Read <UnityEngine.LayerMask>(); break; case "enableDynamicColliders": instance.enableDynamicColliders = reader.Read <System.Boolean>(); break; case "maxCollisionShapes": instance.maxCollisionShapes = reader.Read <System.Int32>(); break; case "quality": instance.quality = reader.Read <UnityEngine.ParticleSystemCollisionQuality>(); break; case "voxelSize": instance.voxelSize = reader.Read <System.Single>(); break; case "radiusScale": instance.radiusScale = reader.Read <System.Single>(); break; case "sendCollisionMessages": instance.sendCollisionMessages = reader.Read <System.Boolean>(); break; default: reader.Skip(); break; } } }
protected override void ReadComponent <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.UI.Text)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { case "m_FontData": reader.SetPrivateField("m_FontData", reader.Read <UnityEngine.UI.FontData>(), instance); break; case "m_LastTrackedFont": reader.SetPrivateField("m_LastTrackedFont", reader.Read <UnityEngine.Font>(), instance); break; case "m_Text": reader.SetPrivateField("m_Text", reader.Read <System.String>(), instance); break; case "m_TextCache": reader.SetPrivateField("m_TextCache", reader.Read <UnityEngine.TextGenerator>(), instance); break; case "m_TextCacheForLayout": reader.SetPrivateField("m_TextCacheForLayout", reader.Read <UnityEngine.TextGenerator>(), instance); break; case "m_Material": reader.SetPrivateField("m_Material", reader.Read <UnityEngine.Material>(), instance); break; case "font": instance.font = reader.Read <UnityEngine.Font>(); break; case "text": instance.text = reader.Read <System.String>(); break; case "supportRichText": instance.supportRichText = reader.Read <System.Boolean>(); break; case "resizeTextForBestFit": instance.resizeTextForBestFit = reader.Read <System.Boolean>(); break; case "resizeTextMinSize": instance.resizeTextMinSize = reader.Read <System.Int32>(); break; case "resizeTextMaxSize": instance.resizeTextMaxSize = reader.Read <System.Int32>(); break; case "alignment": instance.alignment = reader.Read <UnityEngine.TextAnchor>(); break; case "alignByGeometry": instance.alignByGeometry = reader.Read <System.Boolean>(); break; case "fontSize": instance.fontSize = reader.Read <System.Int32>(); break; case "horizontalOverflow": instance.horizontalOverflow = reader.Read <UnityEngine.HorizontalWrapMode>(); break; case "verticalOverflow": instance.verticalOverflow = reader.Read <UnityEngine.VerticalWrapMode>(); break; case "lineSpacing": instance.lineSpacing = reader.Read <System.Single>(); break; case "fontStyle": instance.fontStyle = reader.Read <UnityEngine.FontStyle>(); break; case "onCullStateChanged": instance.onCullStateChanged = reader.Read <UnityEngine.UI.MaskableGraphic.CullStateChangedEvent>(); break; case "maskable": instance.maskable = reader.Read <System.Boolean>(); break; case "color": instance.color = reader.Read <UnityEngine.Color>(); break; case "raycastTarget": instance.raycastTarget = reader.Read <System.Boolean>(); break; case "material": instance.material = reader.Read <UnityEngine.Material>(); break; case "useGUILayout": instance.useGUILayout = reader.Read <System.Boolean>(); break; case "enabled": instance.enabled = reader.Read <System.Boolean>(); break; case "hideFlags": instance.hideFlags = reader.Read <UnityEngine.HideFlags>(); break; default: reader.Skip(); break; } } }
protected override void ReadComponent <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.SpriteRenderer)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { case "sprite": instance.sprite = reader.Read <UnityEngine.Sprite>(ES3Type_Sprite.Instance); break; case "color": instance.color = reader.Read <UnityEngine.Color>(ES3Type_Color.Instance); break; case "flipX": instance.flipX = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "flipY": instance.flipY = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "enabled": instance.enabled = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "shadowCastingMode": instance.shadowCastingMode = reader.Read <UnityEngine.Rendering.ShadowCastingMode>(); break; case "receiveShadows": instance.receiveShadows = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "sharedMaterials": instance.sharedMaterials = reader.Read <UnityEngine.Material[]>(); break; case "lightmapIndex": instance.lightmapIndex = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "realtimeLightmapIndex": instance.realtimeLightmapIndex = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "lightmapScaleOffset": instance.lightmapScaleOffset = reader.Read <UnityEngine.Vector4>(ES3Type_Vector4.Instance); break; case "motionVectorGenerationMode": instance.motionVectorGenerationMode = reader.Read <UnityEngine.MotionVectorGenerationMode>(); break; case "realtimeLightmapScaleOffset": instance.realtimeLightmapScaleOffset = reader.Read <UnityEngine.Vector4>(ES3Type_Vector4.Instance); break; case "lightProbeUsage": instance.lightProbeUsage = reader.Read <UnityEngine.Rendering.LightProbeUsage>(); break; case "lightProbeProxyVolumeOverride": instance.lightProbeProxyVolumeOverride = reader.Read <UnityEngine.GameObject>(ES3Type_GameObject.Instance); break; case "probeAnchor": instance.probeAnchor = reader.Read <UnityEngine.Transform>(ES3Type_Transform.Instance); break; case "reflectionProbeUsage": instance.reflectionProbeUsage = reader.Read <UnityEngine.Rendering.ReflectionProbeUsage>(); break; case "sortingLayerName": instance.sortingLayerName = reader.Read <System.String>(ES3Type_string.Instance); break; case "sortingLayerID": instance.sortingLayerID = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "sortingOrder": instance.sortingOrder = reader.Read <System.Int32>(ES3Type_int.Instance); break; default: reader.Skip(); break; } } }
protected override void ReadObject <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.RenderTexture)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { case "width": instance.width = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "height": instance.height = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "dimension": instance.dimension = reader.Read <UnityEngine.Rendering.TextureDimension>(); break; case "useMipMap": instance.useMipMap = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "memorylessMode": instance.memorylessMode = reader.Read <UnityEngine.RenderTextureMemoryless>(); break; case "format": instance.format = reader.Read <UnityEngine.RenderTextureFormat>(); break; case "autoGenerateMips": instance.autoGenerateMips = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "volumeDepth": instance.volumeDepth = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "antiAliasing": instance.antiAliasing = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "enableRandomWrite": instance.enableRandomWrite = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "isPowerOfTwo": instance.isPowerOfTwo = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "depth": instance.depth = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "descriptor": instance.descriptor = reader.Read <UnityEngine.RenderTextureDescriptor>(); break; case "masterTextureLimit": UnityEngine.RenderTexture.masterTextureLimit = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "anisotropicFiltering": UnityEngine.RenderTexture.anisotropicFiltering = reader.Read <UnityEngine.AnisotropicFiltering>(); break; case "wrapMode": instance.wrapMode = reader.Read <UnityEngine.TextureWrapMode>(); break; case "wrapModeU": instance.wrapModeU = reader.Read <UnityEngine.TextureWrapMode>(); break; case "wrapModeV": instance.wrapModeV = reader.Read <UnityEngine.TextureWrapMode>(); break; case "wrapModeW": instance.wrapModeW = reader.Read <UnityEngine.TextureWrapMode>(); break; case "filterMode": instance.filterMode = reader.Read <UnityEngine.FilterMode>(); break; case "anisoLevel": instance.anisoLevel = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "mipMapBias": instance.mipMapBias = reader.Read <System.Single>(ES3Type_float.Instance); break; case "name": instance.name = reader.Read <System.String>(ES3Type_string.Instance); break; #if UNITY_2020_1_OR_NEWER case "vrUsage": instance.vrUsage = reader.Read <UnityEngine.VRTextureUsage>(); break; case "graphicsFormat": instance.graphicsFormat = reader.Read <UnityEngine.Experimental.Rendering.GraphicsFormat>(); break; case "stencilFormat": instance.stencilFormat = reader.Read <UnityEngine.Experimental.Rendering.GraphicsFormat>(); break; case "bindTextureMS": instance.bindTextureMS = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "useDynamicScale": instance.useDynamicScale = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "streamingTextureForceLoadAll": UnityEngine.RenderTexture.streamingTextureForceLoadAll = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "streamingTextureDiscardUnusedMips": UnityEngine.RenderTexture.streamingTextureDiscardUnusedMips = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "allowThreadedTextureCreation": UnityEngine.RenderTexture.allowThreadedTextureCreation = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; #endif default: reader.Skip(); break; } } }
protected override void ReadComponent <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.ParticleSystem)obj; // Stop particle system as some properties require it to not be playing to be set. instance.Stop(); foreach (string propertyName in reader.Properties) { switch (propertyName) { case "time": instance.time = reader.Read <System.Single>(); break; case "hideFlags": instance.hideFlags = reader.Read <UnityEngine.HideFlags>(); break; case "collision": reader.ReadInto <UnityEngine.ParticleSystem.CollisionModule>(instance.collision, ES3Type_CollisionModule.Instance); break; case "colorBySpeed": reader.ReadInto <UnityEngine.ParticleSystem.ColorBySpeedModule>(instance.colorBySpeed, ES3Type_ColorBySpeedModule.Instance); break; case "colorOverLifetime": reader.ReadInto <UnityEngine.ParticleSystem.ColorOverLifetimeModule>(instance.colorOverLifetime, ES3Type_ColorOverLifetimeModule.Instance); break; case "emission": reader.ReadInto <UnityEngine.ParticleSystem.EmissionModule>(instance.emission, ES3Type_EmissionModule.Instance); break; case "externalForces": reader.ReadInto <UnityEngine.ParticleSystem.ExternalForcesModule>(instance.externalForces, ES3Type_ExternalForcesModule.Instance); break; case "forceOverLifetime": reader.ReadInto <UnityEngine.ParticleSystem.ForceOverLifetimeModule>(instance.forceOverLifetime, ES3Type_ForceOverLifetimeModule.Instance); break; case "inheritVelocity": reader.ReadInto <UnityEngine.ParticleSystem.InheritVelocityModule>(instance.inheritVelocity, ES3Type_InheritVelocityModule.Instance); break; case "lights": reader.ReadInto <UnityEngine.ParticleSystem.LightsModule>(instance.lights, ES3Type_LightsModule.Instance); break; case "limitVelocityOverLifetime": reader.ReadInto <UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule>(instance.limitVelocityOverLifetime, ES3Type_LimitVelocityOverLifetimeModule.Instance); break; case "main": reader.ReadInto <UnityEngine.ParticleSystem.MainModule>(instance.main, ES3Type_MainModule.Instance); break; case "noise": reader.ReadInto <UnityEngine.ParticleSystem.NoiseModule>(instance.noise, ES3Type_NoiseModule.Instance); break; case "rotationBySpeed": reader.ReadInto <UnityEngine.ParticleSystem.RotationBySpeedModule>(instance.rotationBySpeed, ES3Type_RotationBySpeedModule.Instance); break; case "rotationOverLifetime": reader.ReadInto <UnityEngine.ParticleSystem.RotationOverLifetimeModule>(instance.rotationOverLifetime, ES3Type_RotationOverLifetimeModule.Instance); break; case "subEmitters": reader.ReadInto <UnityEngine.ParticleSystem.SubEmittersModule>(instance.subEmitters, ES3Type_SubEmittersModule.Instance); break; case "textureSheetAnimation": reader.ReadInto <UnityEngine.ParticleSystem.TextureSheetAnimationModule>(instance.textureSheetAnimation, ES3Type_TextureSheetAnimationModule.Instance); break; case "trails": reader.ReadInto <UnityEngine.ParticleSystem.TrailModule>(instance.trails, ES3Type_TrailModule.Instance); break; case "trigger": reader.ReadInto <UnityEngine.ParticleSystem.TriggerModule>(instance.trigger, ES3Type_TriggerModule.Instance); break; case "useAutoRandomSeed": instance.useAutoRandomSeed = reader.Read <bool>(ES3Type_bool.Instance); break; case "velocityOverLifetime": reader.ReadInto <UnityEngine.ParticleSystem.VelocityOverLifetimeModule>(instance.velocityOverLifetime, ES3Type_VelocityOverLifetimeModule.Instance); break; case "isPaused": if (reader.Read <bool>(ES3Type_bool.Instance)) { instance.Pause(); } break; case "isPlaying": if (reader.Read <bool>(ES3Type_bool.Instance)) { instance.Play(); } break; case "isStopped": if (reader.Read <bool>(ES3Type_bool.Instance)) { instance.Stop(); } break; default: reader.Skip(); break; } } }
protected override void ReadComponent <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.Camera)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { case "fieldOfView": instance.fieldOfView = reader.Read <System.Single>(); break; case "nearClipPlane": instance.nearClipPlane = reader.Read <System.Single>(); break; case "farClipPlane": instance.farClipPlane = reader.Read <System.Single>(); break; case "renderingPath": instance.renderingPath = reader.Read <UnityEngine.RenderingPath>(); break; #if UNITY_5_6_OR_NEWER case "allowHDR": instance.allowHDR = reader.Read <System.Boolean>(); break; #endif case "orthographicSize": instance.orthographicSize = reader.Read <System.Single>(); break; case "orthographic": instance.orthographic = reader.Read <System.Boolean>(); break; case "opaqueSortMode": instance.opaqueSortMode = reader.Read <UnityEngine.Rendering.OpaqueSortMode>(); break; case "transparencySortMode": instance.transparencySortMode = reader.Read <UnityEngine.TransparencySortMode>(); break; case "depth": instance.depth = reader.Read <System.Single>(); break; case "aspect": instance.aspect = reader.Read <System.Single>(); break; case "cullingMask": instance.cullingMask = reader.Read <System.Int32>(); break; case "eventMask": instance.eventMask = reader.Read <System.Int32>(); break; case "backgroundColor": instance.backgroundColor = reader.Read <UnityEngine.Color>(); break; case "rect": instance.rect = reader.Read <UnityEngine.Rect>(); break; case "pixelRect": instance.pixelRect = reader.Read <UnityEngine.Rect>(); break; case "worldToCameraMatrix": instance.worldToCameraMatrix = reader.Read <UnityEngine.Matrix4x4>(); break; case "projectionMatrix": instance.projectionMatrix = reader.Read <UnityEngine.Matrix4x4>(); break; case "nonJitteredProjectionMatrix": instance.nonJitteredProjectionMatrix = reader.Read <UnityEngine.Matrix4x4>(); break; case "useJitteredProjectionMatrixForTransparentRendering": instance.useJitteredProjectionMatrixForTransparentRendering = reader.Read <System.Boolean>(); break; case "clearFlags": instance.clearFlags = reader.Read <UnityEngine.CameraClearFlags>(); break; case "stereoSeparation": instance.stereoSeparation = reader.Read <System.Single>(); break; case "stereoConvergence": instance.stereoConvergence = reader.Read <System.Single>(); break; case "cameraType": instance.cameraType = reader.Read <UnityEngine.CameraType>(); break; case "stereoTargetEye": instance.stereoTargetEye = reader.Read <UnityEngine.StereoTargetEyeMask>(); break; case "targetDisplay": instance.targetDisplay = reader.Read <System.Int32>(); break; case "useOcclusionCulling": instance.useOcclusionCulling = reader.Read <System.Boolean>(); break; case "cullingMatrix": instance.cullingMatrix = reader.Read <UnityEngine.Matrix4x4>(); break; case "layerCullSpherical": instance.layerCullSpherical = reader.Read <System.Boolean>(); break; case "depthTextureMode": instance.depthTextureMode = reader.Read <UnityEngine.DepthTextureMode>(); break; case "clearStencilAfterLightingPass": instance.clearStencilAfterLightingPass = reader.Read <System.Boolean>(); break; case "enabled": instance.enabled = reader.Read <System.Boolean>(); break; case "hideFlags": instance.hideFlags = reader.Read <UnityEngine.HideFlags>(); break; default: reader.Skip(); break; } } }
protected override void ReadComponent <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.UI.Image)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { case "sprite": instance.sprite = reader.Read <UnityEngine.Sprite>(ES3Type_Sprite.Instance); break; case "overrideSprite": instance.overrideSprite = reader.Read <UnityEngine.Sprite>(ES3Type_Sprite.Instance); break; case "type": instance.type = reader.Read <UnityEngine.UI.Image.Type>(); break; case "preserveAspect": instance.preserveAspect = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "fillCenter": instance.fillCenter = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "fillMethod": instance.fillMethod = reader.Read <UnityEngine.UI.Image.FillMethod>(); break; case "fillAmount": instance.fillAmount = reader.Read <System.Single>(ES3Type_float.Instance); break; case "fillClockwise": instance.fillClockwise = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "fillOrigin": instance.fillOrigin = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "alphaHitTestMinimumThreshold": instance.alphaHitTestMinimumThreshold = reader.Read <System.Single>(ES3Type_float.Instance); break; #if UNITY_2019_1_OR_NEWER case "useSpriteMesh": instance.useSpriteMesh = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; #endif case "material": instance.material = reader.Read <UnityEngine.Material>(ES3Type_Material.Instance); break; case "onCullStateChanged": instance.onCullStateChanged = reader.Read <UnityEngine.UI.MaskableGraphic.CullStateChangedEvent>(); break; case "maskable": instance.maskable = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "color": instance.color = reader.Read <UnityEngine.Color>(ES3Type_Color.Instance); break; case "raycastTarget": instance.raycastTarget = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "useLegacyMeshGeneration": reader.SetPrivateProperty("useLegacyMeshGeneration", reader.Read <System.Boolean>(), instance); break; case "useGUILayout": instance.useGUILayout = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "enabled": instance.enabled = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "hideFlags": instance.hideFlags = reader.Read <UnityEngine.HideFlags>(ES3Type_enum.Instance); break; default: reader.Skip(); break; } } }
protected override void ReadComponent <T>(ES3Reader reader, object obj) { var instance = (BattleSystem.Enemy)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { case "enemyId": instance.enemyId = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "originalExperience": instance.originalExperience = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "characterName": instance.characterName = reader.Read <System.String>(ES3Type_string.Instance); break; case "health": instance.health = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "maxHealth": instance.maxHealth = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "attackPower": instance.attackPower = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "defensePower": instance.defensePower = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "energyPoints": instance.energyPoints = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "maxEnergyPoints": instance.maxEnergyPoints = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "abilitiesList": instance.abilitiesList = reader.Read <System.Collections.Generic.List <System.String> >(); break; case "level": instance.level = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "experience": instance.experience = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "equipment": instance.equipment = reader.Read <Item[]>(ES3Type_ItemArray.Instance); break; case "originalMaxHealth": instance.originalMaxHealth = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "originalMaxEP": instance.originalMaxEP = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "originalAttackPower": instance.originalAttackPower = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "originalDefensePower": instance.originalDefensePower = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "upgradePointsDictionary": instance.upgradePointsDictionary = reader.Read <System.Collections.Generic.Dictionary <System.String, System.Int32> >(); break; default: reader.Skip(); break; } } }
public override object Read <T>(ES3Reader reader) { UnityEngine.Object obj = null; // Read the intial properties regarding the instance we're loading. while (true) { var refMgr = ES3ReferenceMgrBase.Current; if (refMgr == null) { reader.Skip(); continue; } var propertyName = ReadPropertyName(reader); if (propertyName == ES3Type.typeFieldName) { return(ES3TypeMgr.GetOrCreateES3Type(reader.ReadType()).Read <T>(reader)); } else if (propertyName == ES3ReferenceMgrBase.referencePropertyName) { if (refMgr == null) { reader.Skip(); continue; } long id = reader.Read <long>(ES3Type_long.Instance); obj = refMgr.Get(id); if (obj == null) { // If an instance isn't already registered for this object, create an instance and register the reference. obj = new GameObject(); refMgr.Add(obj, id); } else if (!ES3Reflection.IsAssignableFrom(typeof(T), obj.GetType())) { throw new MissingReferenceException("The instance with ID \"" + id + "\" is a different type than expected. Expected \"" + typeof(T) + "\", found \"" + obj.GetType() + "\""); } } else if (propertyName == transformPropertyName) { if (refMgr == null) { reader.Skip(); continue; } // Now load the Transform's ID and assign it to the Transform of our object. long transformID = reader.Read <long>(ES3Type_long.Instance); refMgr.Add(((GameObject)obj).transform, transformID); } else if (propertyName == prefabPropertyName) { if (ES3ReferenceMgrBase.Current == null) { reader.Skip(); } else { obj = reader.Read <GameObject>(ES3Type_ES3PrefabInternal.Instance); } } else if (propertyName == null) { return(obj); } else { reader.overridePropertiesName = propertyName; break; } } if (obj == null) { obj = new GameObject(); } ReadInto <T>(reader, obj); return(obj); }
public override void ReadInto <T>(ES3Reader reader, object obj) { var instance = (UnityEngine.ParticleSystem.ShapeModule)obj; string propertyName; while ((propertyName = reader.ReadPropertyName()) != null) { switch (propertyName) { case "enabled": instance.enabled = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "shapeType": instance.shapeType = reader.Read <UnityEngine.ParticleSystemShapeType>(); break; case "randomDirectionAmount": instance.randomDirectionAmount = reader.Read <System.Single>(ES3Type_float.Instance); break; case "sphericalDirectionAmount": instance.sphericalDirectionAmount = reader.Read <System.Single>(ES3Type_float.Instance); break; case "alignToDirection": instance.alignToDirection = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "radius": instance.radius = reader.Read <System.Single>(ES3Type_float.Instance); break; case "angle": instance.angle = reader.Read <System.Single>(ES3Type_float.Instance); break; case "length": instance.length = reader.Read <System.Single>(ES3Type_float.Instance); break; #if UNITY_5 case "box": instance.box = reader.Read <UnityEngine.Vector3>(ES3Type_Vector3.Instance); break; case "meshScale": instance.meshScale = reader.Read <System.Single>(ES3Type_float.Instance); break; #else case "scale": instance.scale = reader.Read <UnityEngine.Vector3>(ES3Type_Vector3.Instance); break; #endif case "meshShapeType": instance.meshShapeType = reader.Read <UnityEngine.ParticleSystemMeshShapeType>(); break; case "mesh": instance.mesh = reader.Read <UnityEngine.Mesh>(); break; case "meshRenderer": instance.meshRenderer = reader.Read <UnityEngine.MeshRenderer>(); break; case "skinnedMeshRenderer": instance.skinnedMeshRenderer = reader.Read <UnityEngine.SkinnedMeshRenderer>(); break; case "useMeshMaterialIndex": instance.useMeshMaterialIndex = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "meshMaterialIndex": instance.meshMaterialIndex = reader.Read <System.Int32>(ES3Type_int.Instance); break; case "useMeshColors": instance.useMeshColors = reader.Read <System.Boolean>(ES3Type_bool.Instance); break; case "normalOffset": instance.normalOffset = reader.Read <System.Single>(ES3Type_float.Instance); break; case "arc": instance.arc = reader.Read <System.Single>(ES3Type_float.Instance); break; default: reader.Skip(); break; } } }
protected override object ReadObject <T>(ES3Reader reader) { UnityEngine.Object obj = null; var refMgr = ES3ReferenceMgrBase.Current; long id = 0; // Read the intial properties regarding the instance we're loading. while (true) { if (refMgr == null) { throw new InvalidOperationException("An Easy Save 3 Manager is required to load references. To add one to your scene, exit playmode and go to Assets > Easy Save 3 > Add Manager to Scene"); } var propertyName = ReadPropertyName(reader); if (propertyName == ES3Type.typeFieldName) { return(ES3TypeMgr.GetOrCreateES3Type(reader.ReadType()).Read <T>(reader)); } else if (propertyName == ES3ReferenceMgrBase.referencePropertyName) { id = reader.Read_ref(); obj = refMgr.Get(id, true); } else if (propertyName == transformPropertyName) { // Now load the Transform's ID and assign it to the Transform of our object. long transformID = reader.Read_ref(); if (obj == null) { obj = CreateNewGameObject(refMgr, id); } refMgr.Add(((GameObject)obj).transform, transformID); } else if (propertyName == prefabPropertyName) { if (obj != null || ES3ReferenceMgrBase.Current == null) { reader.Skip(); } else { obj = reader.Read <GameObject>(ES3Type_ES3PrefabInternal.Instance); ES3ReferenceMgrBase.Current.Add(obj, id); } } else if (propertyName == null) { if (obj == null) { return(CreateNewGameObject(refMgr, id)); } return(obj); } else { reader.overridePropertiesName = propertyName; break; } } if (obj == null) { obj = CreateNewGameObject(refMgr, id); } ReadInto <T>(reader, obj); return(obj); }
protected override void ReadObject <T>(ES3Reader reader, object obj) { var instance = (Assets.Scripts.Entities.Stats)obj; foreach (string propertyName in reader.Properties) { switch (propertyName) { case "_maxHealth": reader.SetPrivateField("_maxHealth", reader.Read <System.Int32>(), instance); break; case "_currentHealth": reader.SetPrivateField("_currentHealth", reader.Read <System.Int32>(), instance); break; case "_maxEnergy": reader.SetPrivateField("_maxEnergy", reader.Read <System.Int32>(), instance); break; case "_currentEnergy": reader.SetPrivateField("_currentEnergy", reader.Read <System.Int32>(), instance); break; case "_maxMorale": reader.SetPrivateField("_maxMorale", reader.Read <System.Int32>(), instance); break; case "_currentMorale": reader.SetPrivateField("_currentMorale", reader.Read <System.Int32>(), instance); break; case "_maxActionPoints": reader.SetPrivateField("_maxActionPoints", reader.Read <System.Int32>(), instance); break; case "_currentActionPoints": reader.SetPrivateField("_currentActionPoints", reader.Read <System.Int32>(), instance); break; case "<Initiative>k__BackingField": reader.SetPrivateField("<Initiative>k__BackingField", reader.Read <System.Int32>(), instance); break; case "<Armor>k__BackingField": reader.SetPrivateField("<Armor>k__BackingField", reader.Read <System.Int32>(), instance); break; case "<Critical>k__BackingField": reader.SetPrivateField("<Critical>k__BackingField", reader.Read <System.Int32>(), instance); break; default: reader.Skip(); break; } } }