using System; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using UnityEngine; [Serializable] public class AMPropertyTrack : AMTrack { public PropertyInfo propertyInfo { get { if (this.cachedPropertyInfo != null) { return this.cachedPropertyInfo; } if (!this.obj || !this.component || this.propertyName == null) { return null; } this.cachedPropertyInfo = this.component.GetType().GetProperty(this.propertyName); return this.cachedPropertyInfo; } set { if (value != null) { this.propertyName = value.Name; } else { this.propertyName = null; } this.cachedPropertyInfo = value; } } public FieldInfo fieldInfo { get { if (this.cachedFieldInfo != null) { return this.cachedFieldInfo; } if (!this.obj || !this.component || this.fieldName == null) { return null; } this.cachedFieldInfo = this.component.GetType().GetField(this.fieldName); return this.cachedFieldInfo; } set { if (value != null) { this.fieldName = value.Name; } else { this.fieldName = null; } this.cachedFieldInfo = value; } } public MethodInfo methodInfo { get { if (this.cachedMethodInfo != null) { return this.cachedMethodInfo; } if (!this.obj || !this.component || this.methodName == null) { return null; } Type[] array = new Type[this.methodParameterTypes.Length]; for (int i = 0; i < this.methodParameterTypes.Length; i++) { array[i] = Type.GetType(this.methodParameterTypes[i]); } this.cachedMethodInfo = this.component.GetType().GetMethod(this.methodName, array); return this.cachedMethodInfo; } set { if (value != null) { this.methodName = value.Name; } else { this.methodName = null; } this.cachedMethodInfo = value; } } public MethodInfo methodInfoMorphNames { get { if (this.cachedMethodInfoMorphNames != null) { return this.cachedMethodInfoMorphNames; } if (!this.obj || !this.component || this.valueType != 8) { return null; } this.cachedMethodInfoMorphNames = this.component.GetType().GetMethod("GetChannelNames"); return this.cachedMethodInfo; } } public override string getTrackType() { if (this.fieldInfo != null) { return this.fieldInfo.Name; } if (this.propertyInfo != null) { return this.propertyInfo.Name; } if (this.methodInfo != null && this.valueType == 8) { return "Morph"; } return "Not Set"; } public string getMemberInfoTypeName() { if (this.fieldInfo != null) { return "FieldInfo"; } if (this.propertyInfo != null) { return "PropertyInfo"; } if (this.methodInfo != null) { return "MethodInfo"; } return "Undefined"; } public bool isPropertySet() { return this.fieldInfo != null || this.propertyInfo != null || (this.methodInfo != null && this.valueType == 8); } public void addKey(int _frame) { if (AMPropertyTrack.isValueTypeNumeric(this.valueType)) { this.addKey(_frame, this.getPropertyValueNumeric()); } else if (this.valueType == 4) { this.addKey(_frame, this.getPropertyValueVector2()); } else if (this.valueType == 5) { this.addKey(_frame, this.getPropertyValueVector3()); } else if (this.valueType == 6) { this.addKey(_frame, this.getPropertyValueColor()); } else if (this.valueType == 7) { this.addKey(_frame, this.getPropertyValueRect()); } else if (this.valueType == 8) { this.addKeyMegaMorph(_frame, new List()); } else { Debug.LogError("Animator: Invalid ValueType " + this.valueType.ToString()); } } public void addKeyMegaMorph(int _frame, List channels) { foreach (AMKey amkey in this.keys) { AMPropertyKey ampropertyKey = (AMPropertyKey)amkey; if (ampropertyKey.frame == _frame) { ampropertyKey.setValueMegaMorph(channels); this.updateCache(); return; } } AMPropertyKey ampropertyKey2 = ScriptableObject.CreateInstance(); ampropertyKey2.frame = _frame; ampropertyKey2.setValueMegaMorph(channels); ampropertyKey2.easeType = 14; this.keys.Add(ampropertyKey2); this.updateCache(); } public void addKey(int _frame, double val) { foreach (AMKey amkey in this.keys) { AMPropertyKey ampropertyKey = (AMPropertyKey)amkey; if (ampropertyKey.frame == _frame) { ampropertyKey.setValue(val); this.updateCache(); return; } } AMPropertyKey ampropertyKey2 = ScriptableObject.CreateInstance(); ampropertyKey2.frame = _frame; ampropertyKey2.setValue(val); ampropertyKey2.easeType = 21; this.keys.Add(ampropertyKey2); this.updateCache(); } public void addKey(int _frame, Vector2 val) { foreach (AMKey amkey in this.keys) { AMPropertyKey ampropertyKey = (AMPropertyKey)amkey; if (ampropertyKey.frame == _frame) { ampropertyKey.setValue(val); this.updateCache(); return; } } AMPropertyKey ampropertyKey2 = ScriptableObject.CreateInstance(); ampropertyKey2.frame = _frame; ampropertyKey2.setValue(val); ampropertyKey2.easeType = 21; this.keys.Add(ampropertyKey2); this.updateCache(); } public void addKey(int _frame, Vector3 val) { foreach (AMKey amkey in this.keys) { AMPropertyKey ampropertyKey = (AMPropertyKey)amkey; if (ampropertyKey.frame == _frame) { ampropertyKey.setValue(val); this.updateCache(); return; } } AMPropertyKey ampropertyKey2 = ScriptableObject.CreateInstance(); ampropertyKey2.frame = _frame; ampropertyKey2.setValue(val); ampropertyKey2.easeType = 21; this.keys.Add(ampropertyKey2); this.updateCache(); } public void addKey(int _frame, Color val) { foreach (AMKey amkey in this.keys) { AMPropertyKey ampropertyKey = (AMPropertyKey)amkey; if (ampropertyKey.frame == _frame) { ampropertyKey.setValue(val); this.updateCache(); return; } } AMPropertyKey ampropertyKey2 = ScriptableObject.CreateInstance(); ampropertyKey2.frame = _frame; ampropertyKey2.setValue(val); ampropertyKey2.easeType = 21; this.keys.Add(ampropertyKey2); this.updateCache(); } public void addKey(int _frame, Rect val) { foreach (AMKey amkey in this.keys) { AMPropertyKey ampropertyKey = (AMPropertyKey)amkey; if (ampropertyKey.frame == _frame) { ampropertyKey.setValue(val); this.updateCache(); return; } } AMPropertyKey ampropertyKey2 = ScriptableObject.CreateInstance(); ampropertyKey2.frame = _frame; ampropertyKey2.setValue(val); ampropertyKey2.easeType = 21; this.keys.Add(ampropertyKey2); this.updateCache(); } public bool isObjectUnique(GameObject obj) { return this.obj != obj; } public bool changeObject(GameObject obj) { NDebug.Assert(this.componentName != null, "AMPropertyTrackに対象コンポーネント名が設定されていません。"); Component component = obj.GetComponent(this.componentName); string text = this.propertyName; string text2 = this.fieldName; string value = this.methodName; if (component == null) { NDebug.Assert(string.Concat(new string[] { "AMPropertyTrackへ新しいオブジェクトへ置換しようとしましたが、同じ", this.componentName, "コンポーネントが", obj.name, "にはありませんでした。" }), false); } this.setObject(obj); this.setComponent(component); if (!string.IsNullOrEmpty(text)) { PropertyInfo[] properties = component.GetType().GetProperties(); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.PropertyType != typeof(HideFlags)) { if (propertyInfo.CanWrite && AMPropertyTrack.isValidType(propertyInfo.PropertyType) && propertyInfo.Name == text) { this.setPropertyInfo(propertyInfo); break; } } } } if (!string.IsNullOrEmpty(text2)) { FieldInfo[] fields = component.GetType().GetFields(); foreach (FieldInfo fieldInfo in fields) { if (AMPropertyTrack.isValidType(fieldInfo.FieldType)) { if (fieldInfo.Name == text2) { this.setFieldInfo(fieldInfo); break; } } } } if (!string.IsNullOrEmpty(value)) { NDebug.Assert("メソッドの置換(MegaMorph)には対応しておりません。", false); } this.updateCache(); return false; } public bool setObject(GameObject obj) { if (this.obj != obj) { this.obj = obj; this.objName = obj.name; this.fieldInfo = null; this.fieldName = null; this.propertyInfo = null; this.propertyName = null; this.methodInfo = null; this.methodName = null; return true; } return false; } public bool setComponent(Component component) { if (this.component != component) { this.component = component; this.componentName = component.GetType().Name; return true; } return false; } public bool setPropertyInfo(PropertyInfo propertyInfo) { if (this.propertyInfo != propertyInfo) { this.setValueType(propertyInfo.PropertyType); this.propertyInfo = propertyInfo; this.fieldInfo = null; this.fieldName = null; return true; } return false; } public bool setFieldInfo(FieldInfo fieldInfo) { if (this.fieldInfo != fieldInfo) { this.setValueType(fieldInfo.FieldType); this.fieldInfo = fieldInfo; this.propertyInfo = null; this.propertyName = null; return true; } return false; } public bool setMethodInfo(MethodInfo methodInfo, string[] parameterTypes, AMPropertyTrack.ValueType valueType) { if (this.valueType != (int)valueType || this.methodParameterTypes != parameterTypes || this.methodInfo != methodInfo) { this.setValueType((int)valueType); this.methodParameterTypes = parameterTypes; this.methodInfo = methodInfo; this.propertyInfo = null; this.propertyName = null; this.fieldInfo = null; this.fieldName = null; return true; } return false; } public override void updateCache() { this.objName = this.obj.name; this.componentName = this.component.GetType().Name; base.sortKeys(); base.destroyCache(); this.cache = new List(); for (int i = 0; i < this.keys.Count; i++) { AMPropertyAction ampropertyAction = ScriptableObject.CreateInstance(); ampropertyAction.component = this.component; ampropertyAction.componentName = this.component.GetType().Name; ampropertyAction.startFrame = this.keys[i].frame; if (this.keys.Count > i + 1) { ampropertyAction.endFrame = this.keys[i + 1].frame; } else { ampropertyAction.endFrame = -1; } ampropertyAction.valueType = this.valueType; Type type = null; bool flag = true; int num = -1; if (this.fieldInfo != null) { ampropertyAction.fieldInfo = this.fieldInfo; type = this.fieldInfo.FieldType; flag = false; } else if (this.propertyInfo != null) { ampropertyAction.propertyInfo = this.propertyInfo; type = this.propertyInfo.PropertyType; flag = false; } else if (this.methodInfo != null) { ampropertyAction.methodInfo = this.methodInfo; ampropertyAction.methodParameterTypes = this.methodParameterTypes; if (this.valueType == 8) { num = 8; flag = false; } } if (flag) { Debug.LogError("Animator: Fatal Error; fieldInfo, propertyInfo and methodInfo are unset for Value Type " + this.valueType); ampropertyAction.destroy(); return; } if (num == 8) { ampropertyAction.start_morph = new List((this.keys[i] as AMPropertyKey).morph); if (ampropertyAction.endFrame != -1) { ampropertyAction.end_morph = new List((this.keys[i + 1] as AMPropertyKey).morph); } } else if (AMPropertyTrack.isNumeric(type)) { ampropertyAction.start_val = (this.keys[i] as AMPropertyKey).val; if (ampropertyAction.endFrame != -1) { ampropertyAction.end_val = (this.keys[i + 1] as AMPropertyKey).val; } } else if (type == typeof(Vector2)) { ampropertyAction.start_vect2 = (this.keys[i] as AMPropertyKey).vect2; if (ampropertyAction.endFrame != -1) { ampropertyAction.end_vect2 = (this.keys[i + 1] as AMPropertyKey).vect2; } } else if (type == typeof(Vector3)) { ampropertyAction.start_vect3 = (this.keys[i] as AMPropertyKey).vect3; if (ampropertyAction.endFrame != -1) { ampropertyAction.end_vect3 = (this.keys[i + 1] as AMPropertyKey).vect3; } } else if (type == typeof(Color)) { ampropertyAction.start_color = (this.keys[i] as AMPropertyKey).color; if (ampropertyAction.endFrame != -1) { ampropertyAction.end_color = (this.keys[i + 1] as AMPropertyKey).color; } } else { if (type != typeof(Rect)) { Debug.LogError("Animator: Fatal Error, property type '" + type.ToString() + "' not found."); ampropertyAction.destroy(); return; } ampropertyAction.start_rect = (this.keys[i] as AMPropertyKey).rect; if (ampropertyAction.endFrame != -1) { ampropertyAction.end_rect = (this.keys[i + 1] as AMPropertyKey).rect; } } ampropertyAction.easeType = (this.keys[i] as AMPropertyKey).easeType; ampropertyAction.customEase = new List(this.keys[i].customEase); this.cache.Add(ampropertyAction); } base.updateCache(); } public double getPropertyValueNumeric() { if (this.fieldInfo != null) { return Convert.ToDouble(this.fieldInfo.GetValue(this.component)); } return Convert.ToDouble(this.propertyInfo.GetValue(this.component, null)); } public Vector2 getPropertyValueVector2() { if (this.fieldInfo != null) { return (Vector2)this.fieldInfo.GetValue(this.component); } return (Vector2)this.propertyInfo.GetValue(this.component, null); } public Vector3 getPropertyValueVector3() { if (this.fieldInfo != null) { return (Vector3)this.fieldInfo.GetValue(this.component); } return (Vector3)this.propertyInfo.GetValue(this.component, null); } public Color getPropertyValueColor() { if (this.fieldInfo != null) { return (Color)this.fieldInfo.GetValue(this.component); } return (Color)this.propertyInfo.GetValue(this.component, null); } public Rect getPropertyValueRect() { if (this.fieldInfo != null) { return (Rect)this.fieldInfo.GetValue(this.component); } return (Rect)this.propertyInfo.GetValue(this.component, null); } public static bool isNumeric(Type t) { return t == typeof(int) || t == typeof(long) || t == typeof(float) || t == typeof(double); } public static bool isValidType(Type t) { return t == typeof(int) || t == typeof(long) || t == typeof(float) || t == typeof(double) || t == typeof(Vector2) || t == typeof(Vector3) || t == typeof(Color) || t == typeof(Rect); } public void setValueType(int type) { this.valueType = type; } public void setValueType(Type t) { if (t == typeof(int)) { this.valueType = 0; } else if (t == typeof(long)) { this.valueType = 1; } else if (t == typeof(float)) { this.valueType = 2; } else if (t == typeof(double)) { this.valueType = 3; } else if (t == typeof(Vector2)) { this.valueType = 4; } else if (t == typeof(Vector3)) { this.valueType = 5; } else if (t == typeof(Color)) { this.valueType = 6; } else if (t == typeof(Rect)) { this.valueType = 7; } else { this.valueType = -1; Debug.LogWarning("Animator: Value type " + t.ToString() + " is unsupported."); } } public void previewFrame(float frame, bool quickPreview = false) { if (this.cache == null || this.cache.Count <= 0) { return; } if (!this.component || !this.obj) { return; } this.componentName = this.component.GetType().Name; if (string.IsNullOrEmpty(this.objName)) { this.objName = this.obj.name; } int num = 0; if (frame <= (float)this.cache[0].startFrame || (this.cache[0] as AMPropertyAction).endFrame == -1) { if (this.fieldInfo != null) { this.fieldInfo.SetValue(this.component, (this.cache[0] as AMPropertyAction).getStartValue()); this.refreshTransform(); } else if (this.propertyInfo != null) { this.propertyInfo.SetValue(this.component, (this.cache[0] as AMPropertyAction).getStartValue(), null); this.refreshTransform(); } else if (this.methodInfo != null) { try { string[] morphNames = this.getMorphNames(); num = morphNames.Length; } catch { } this.previewMorph((this.cache[0] as AMPropertyAction).start_morph, num); } return; } if (frame >= (float)(this.cache[this.cache.Count - 2] as AMPropertyAction).endFrame) { if (this.fieldInfo != null) { this.fieldInfo.SetValue(this.component, (this.cache[this.cache.Count - 2] as AMPropertyAction).getEndValue()); this.refreshTransform(); } else if (this.propertyInfo != null) { this.propertyInfo.SetValue(this.component, (this.cache[this.cache.Count - 2] as AMPropertyAction).getEndValue(), null); this.refreshTransform(); } else if (this.methodInfo != null) { string[] morphNames2 = this.getMorphNames(); num = morphNames2.Length; this.previewMorph((this.cache[this.cache.Count - 2] as AMPropertyAction).end_morph, num); } return; } foreach (AMAction amaction in this.cache) { AMPropertyAction ampropertyAction = (AMPropertyAction)amaction; if (frame >= (float)ampropertyAction.startFrame && frame <= (float)ampropertyAction.endFrame) { if (quickPreview && !ampropertyAction.targetsAreEqual()) { break; } if (frame == (float)ampropertyAction.startFrame) { if (this.fieldInfo != null) { this.fieldInfo.SetValue(this.component, ampropertyAction.getStartValue()); this.refreshTransform(); } else if (this.propertyInfo != null) { this.propertyInfo.SetValue(this.component, ampropertyAction.getStartValue(), null); this.refreshTransform(); } else if (this.methodInfo != null) { string[] morphNames3 = this.getMorphNames(); num = morphNames3.Length; this.previewMorph(ampropertyAction.start_morph, num); } break; } if (frame == (float)ampropertyAction.endFrame) { if (this.fieldInfo != null) { this.fieldInfo.SetValue(this.component, ampropertyAction.getEndValue()); this.refreshTransform(); } else if (this.propertyInfo != null) { this.propertyInfo.SetValue(this.component, ampropertyAction.getEndValue(), null); this.refreshTransform(); } else if (this.methodInfo != null) { string[] morphNames4 = this.getMorphNames(); num = morphNames4.Length; this.previewMorph(ampropertyAction.end_morph, num); } break; } AnimationCurve curve = null; AMTween.EasingFunction easingFunction; if (ampropertyAction.hasCustomEase()) { if (AMPropertyTrack.<>f__mg$cache0 == null) { AMPropertyTrack.<>f__mg$cache0 = new AMTween.EasingFunction(AMTween.customEase); } easingFunction = AMPropertyTrack.<>f__mg$cache0; curve = ampropertyAction.easeCurve; } else { easingFunction = AMTween.GetEasingFunction((AMTween.EaseType)ampropertyAction.easeType); } float num2 = frame - (float)ampropertyAction.startFrame; if (num2 < 0f) { num2 = 0f; } float value = num2 / (float)ampropertyAction.getNumberOfFrames(); if (ampropertyAction.valueType == 8) { string[] morphNames5 = this.getMorphNames(); num = morphNames5.Length; List list = new List(); for (int i = 0; i < num; i++) { if (ampropertyAction.start_morph.Count <= i || ampropertyAction.end_morph.Count <= i) { break; } list.Add(0f); list[i] = easingFunction(ampropertyAction.start_morph[i], ampropertyAction.end_morph[i], value, curve); } this.previewMorph(list, num); } else if (ampropertyAction.valueType == 0) { float start = Convert.ToSingle(ampropertyAction.start_val); float end = Convert.ToSingle(ampropertyAction.end_val); int num3 = (int)easingFunction(start, end, value, curve); if (this.fieldInfo != null) { this.fieldInfo.SetValue(this.component, num3); } else if (this.propertyInfo != null) { this.propertyInfo.SetValue(this.component, num3, null); } this.refreshTransform(); } else if (ampropertyAction.valueType == 1) { float start2 = Convert.ToSingle(ampropertyAction.start_val); float end2 = Convert.ToSingle(ampropertyAction.end_val); long num4 = (long)easingFunction(start2, end2, value, curve); if (this.fieldInfo != null) { this.fieldInfo.SetValue(this.component, num4); } else if (this.propertyInfo != null) { this.propertyInfo.SetValue(this.component, num4, null); } this.refreshTransform(); } else if (ampropertyAction.valueType == 2) { float start3 = Convert.ToSingle(ampropertyAction.start_val); float end3 = Convert.ToSingle(ampropertyAction.end_val); float num5 = easingFunction(start3, end3, value, curve); if (this.fieldInfo != null) { this.fieldInfo.SetValue(this.component, num5); } else if (this.propertyInfo != null) { this.propertyInfo.SetValue(this.component, num5, null); } this.refreshTransform(); } else if (ampropertyAction.valueType == 3) { float start4 = Convert.ToSingle(ampropertyAction.start_val); float end4 = Convert.ToSingle(ampropertyAction.end_val); double num6 = (double)easingFunction(start4, end4, value, curve); if (this.fieldInfo != null) { this.fieldInfo.SetValue(this.component, num6); } else if (this.propertyInfo != null) { this.propertyInfo.SetValue(this.component, num6, null); } this.refreshTransform(); } else if (ampropertyAction.valueType == 4) { Vector2 start_vect = ampropertyAction.start_vect2; Vector2 end_vect = ampropertyAction.end_vect2; Vector2 vector = default(Vector2); vector.x = easingFunction(start_vect.x, end_vect.x, value, curve); vector.y = easingFunction(start_vect.y, end_vect.y, value, curve); if (this.fieldInfo != null) { this.fieldInfo.SetValue(this.component, vector); } else if (this.propertyInfo != null) { this.propertyInfo.SetValue(this.component, vector, null); } this.refreshTransform(); } else if (ampropertyAction.valueType == 5) { Vector3 start_vect2 = ampropertyAction.start_vect3; Vector3 end_vect2 = ampropertyAction.end_vect3; Vector3 vector2 = default(Vector3); vector2.x = easingFunction(start_vect2.x, end_vect2.x, value, curve); vector2.y = easingFunction(start_vect2.y, end_vect2.y, value, curve); vector2.z = easingFunction(start_vect2.z, end_vect2.z, value, curve); if (this.fieldInfo != null) { this.fieldInfo.SetValue(this.component, vector2); } else if (this.propertyInfo != null) { this.propertyInfo.SetValue(this.component, vector2, null); } this.refreshTransform(); } else if (ampropertyAction.valueType == 6) { Color start_color = ampropertyAction.start_color; Color end_color = ampropertyAction.end_color; Color color = default(Color); color.r = easingFunction(start_color.r, end_color.r, value, curve); color.g = easingFunction(start_color.g, end_color.g, value, curve); color.b = easingFunction(start_color.b, end_color.b, value, curve); color.a = easingFunction(start_color.a, end_color.a, value, curve); if (this.fieldInfo != null) { this.fieldInfo.SetValue(this.component, color); } else if (this.propertyInfo != null) { this.propertyInfo.SetValue(this.component, color, null); } this.refreshTransform(); } else if (ampropertyAction.valueType == 7) { Rect start_rect = ampropertyAction.start_rect; Rect end_rect = ampropertyAction.end_rect; Rect rect = default(Rect); rect.x = easingFunction(start_rect.x, end_rect.x, value, curve); rect.y = easingFunction(start_rect.y, end_rect.y, value, curve); rect.width = easingFunction(start_rect.width, end_rect.width, value, curve); rect.height = easingFunction(start_rect.height, end_rect.height, value, curve); if (this.fieldInfo != null) { this.fieldInfo.SetValue(this.component, rect); } else if (this.propertyInfo != null) { this.propertyInfo.SetValue(this.component, rect, null); } this.refreshTransform(); } else { Debug.LogError("Animator: Invalid ValueType " + this.valueType.ToString()); } break; } } } public void refreshTransform() { if (Application.isPlaying || !this.obj) { return; } this.obj.transform.position = new Vector3(this.obj.transform.position.x, this.obj.transform.position.y, this.obj.transform.position.z); } public void previewMorph(List morph, int count) { if (this.valueType == 8) { this.parentTake.addMorph(this.obj, this.methodInfo, this.component, morph); } } public string getComponentName() { if (this.fieldInfo != null) { return this.fieldInfo.DeclaringType.Name; } if (this.propertyInfo != null) { return this.propertyInfo.DeclaringType.Name; } if (this.methodInfo != null && this.valueType == 8) { return "Morph"; } return "Unknown"; } public string getValueInitialization(int codeLanguage, string varName) { string text = string.Empty; if (this.valueType == 8) { string text2 = text; return string.Concat(new string[] { text2, "AMTween.SetMorph(", varName, ", ", varName, "Property, ", (this.cache[0] as AMPropertyAction).getFloatArrayString(codeLanguage, (this.cache[0] as AMPropertyAction).start_morph), ");" }); } text = text + varName + "Property."; if (this.methodInfo != null) { text = text + "Invoke(" + varName + ", "; if (codeLanguage == 0) { text += "new object[]{"; } else { text += "["; } } else { text = text + "SetValue(" + varName + ", "; } if (this.valueType == 0) { float num = Convert.ToSingle((this.cache[0] as AMPropertyAction).start_val); text += num; } else if (this.valueType == 1) { float num2 = Convert.ToSingle((this.cache[0] as AMPropertyAction).start_val); text += num2; } else if (this.valueType == 2) { float num3 = Convert.ToSingle((this.cache[0] as AMPropertyAction).start_val); text += num3; if (codeLanguage == 0) { text += "f"; } } else if (this.valueType == 3) { float num4 = Convert.ToSingle((this.cache[0] as AMPropertyAction).start_val); text += num4; if (codeLanguage == 0) { text += "f"; } } else if (this.valueType == 4) { Vector2 start_vect = (this.cache[0] as AMPropertyAction).start_vect2; if (codeLanguage == 0) { string text2 = text; text = string.Concat(new object[] { text2, "new Vector2(", start_vect.x, "f, ", start_vect.y, "f)" }); } else { string text2 = text; text = string.Concat(new object[] { text2, "Vector2(", start_vect.x, ", ", start_vect.y, ")" }); } } else if (this.valueType == 5) { Vector3 start_vect2 = (this.cache[0] as AMPropertyAction).start_vect3; if (codeLanguage == 0) { string text2 = text; text = string.Concat(new object[] { text2, "new Vector3(", start_vect2.x, "f, ", start_vect2.y, "f, ", start_vect2.z, "f)" }); } else { string text2 = text; text = string.Concat(new object[] { text2, "Vector3(", start_vect2.x, ", ", start_vect2.y, ", ", start_vect2.z, ")" }); } } else if (this.valueType == 6) { Color start_color = (this.cache[0] as AMPropertyAction).start_color; if (codeLanguage == 0) { string text2 = text; text = string.Concat(new object[] { text2, "new Color(", start_color.r, "f, ", start_color.g, "f, ", start_color.b, "f, ", start_color.a, "f)" }); } else { string text2 = text; text = string.Concat(new object[] { text2, "Color(", start_color.r, ", ", start_color.g, ", ", start_color.b, ", ", start_color.a, ")" }); } } else if (this.valueType == 7) { Rect start_rect = (this.cache[0] as AMPropertyAction).start_rect; if (codeLanguage == 0) { string text2 = text; text = string.Concat(new object[] { text2, "new Rect(", start_rect.x, "f, ", start_rect.y, "f, ", start_rect.width, "f, ", start_rect.height, "f)" }); } else { string text2 = text; text = string.Concat(new object[] { text2, "Rect(", start_rect.x, ", ", start_rect.y, ", ", start_rect.width, ", ", start_rect.height, ")" }); } } if (this.propertyInfo != null) { text += ", null"; } else if (this.methodInfo != null) { if (codeLanguage == 0) { text += "}"; } else { text += "]"; } } return text + ");"; } public static bool isValueTypeNumeric(int valueType) { return valueType == 0 || valueType == 1 || valueType == 2 || valueType == 3; } public bool hasSamePropertyAs(AMPropertyTrack _track) { return _track.obj == this.obj && _track.component == this.component && _track.getTrackType() == this.getTrackType(); } public string[] getMorphNames() { if (!this.component || this.methodInfoMorphNames == null) { return new string[0]; } return (string[])this.methodInfoMorphNames.Invoke(this.component, null); } public override AnimatorTimeline.JSONInit getJSONInit() { if (!this.obj || this.keys.Count <= 0 || this.cache.Count <= 0) { return null; } AnimatorTimeline.JSONInit jsoninit = new AnimatorTimeline.JSONInit(); jsoninit.go = this.obj.gameObject.name; List list = new List(); list.Add(this.component.GetType().Name); if (this.fieldInfo != null) { jsoninit.typeExtra = "fieldinfo"; list.Add(this.fieldInfo.Name); } else if (this.propertyInfo != null) { jsoninit.typeExtra = "propertyinfo"; list.Add(this.propertyInfo.Name); } else if (this.methodInfo != null) { jsoninit.typeExtra = "methodinfo"; list.Add(this.methodInfo.Name); foreach (string item in this.methodParameterTypes) { list.Add(item); } } if (this.valueType == 8) { jsoninit.type = "propertymorph"; jsoninit.floats = (this.cache[0] as AMPropertyAction).start_morph.ToArray(); } else if (this.valueType == 0) { jsoninit.type = "propertyint"; jsoninit._int = Convert.ToInt32((this.cache[0] as AMPropertyAction).start_val); } else if (this.valueType == 1) { jsoninit.type = "propertylong"; jsoninit._long = Convert.ToInt64((this.cache[0] as AMPropertyAction).start_val); } else if (this.valueType == 2) { jsoninit.type = "propertyfloat"; jsoninit.floats = new float[] { Convert.ToSingle((this.cache[0] as AMPropertyAction).start_val) }; } else if (this.valueType == 3) { jsoninit.type = "propertydouble"; jsoninit._double = (this.cache[0] as AMPropertyAction).start_val; } else if (this.valueType == 4) { jsoninit.type = "propertyvect2"; AnimatorTimeline.JSONVector2 jsonvector = new AnimatorTimeline.JSONVector2(); jsonvector.setValue((this.cache[0] as AMPropertyAction).start_vect2); jsoninit._vect2 = jsonvector; } else if (this.valueType == 5) { jsoninit.type = "propertyvect3"; AnimatorTimeline.JSONVector3 jsonvector2 = new AnimatorTimeline.JSONVector3(); jsonvector2.setValue((this.cache[0] as AMPropertyAction).start_vect3); jsoninit.position = jsonvector2; } else if (this.valueType == 6) { jsoninit.type = "propertycolor"; AnimatorTimeline.JSONColor jsoncolor = new AnimatorTimeline.JSONColor(); jsoncolor.setValue((this.cache[0] as AMPropertyAction).start_color); jsoninit._color = jsoncolor; } else { if (this.valueType != 7) { Debug.LogWarning("Animator: Error exporting JSON, unknown Property ValueType " + this.valueType); return null; } jsoninit.type = "propertyrect"; AnimatorTimeline.JSONRect jsonrect = new AnimatorTimeline.JSONRect(); jsonrect.setValue((this.cache[0] as AMPropertyAction).start_rect); jsoninit._rect = jsonrect; } jsoninit.strings = list.ToArray(); return jsoninit; } public override List getDependencies() { List list = new List(); if (this.obj) { list.Add(this.obj); } return list; } public override List updateDependencies(List newReferences, List oldReferences) { List list = new List(); if (!this.obj) { return list; } int i = 0; while (i < oldReferences.Count) { if (oldReferences[i] == this.obj) { string name = this.component.GetType().Name; Component component = newReferences[i].GetComponent(name); if (!component) { Debug.LogWarning(string.Concat(new string[] { "Animator: Property Track component '", name, "' not found on new reference for GameObject '", this.obj.name, "'. Duplicate not replaced." })); list.Add(oldReferences[i]); return list; } if (component.GetType().GetProperty(this.propertyName) == null) { Debug.LogWarning(string.Concat(new string[] { "Animator: Property Track property '", this.propertyName, "' not found on new reference for GameObject '", this.obj.name, "'. Duplicate not replaced." })); list.Add(oldReferences[i]); return list; } this.obj = newReferences[i]; this.component = component; break; } else { i++; } } return list; } public int valueType; public GameObject obj; public string objName; public Component component; public string componentName; public string propertyName; public string fieldName; public string methodName; public string[] methodParameterTypes; private PropertyInfo cachedPropertyInfo; private FieldInfo cachedFieldInfo; private MethodInfo cachedMethodInfo; private MethodInfo cachedMethodInfoMorphNames; [CompilerGenerated] private static AMTween.EasingFunction <>f__mg$cache0; public enum ValueType { Integer, Long, Float, Double, Vector2, Vector3, Color, Rect, MorphChannels, String } }