public AdvAnimationData(StringGrid grid, ref int index, bool legacy) { this.Clip = new AnimationClip(); this.Clip.set_legacy(legacy); this.ParseHeader(grid.Rows[index++]); List <float> timeTbl = this.ParseTimeTbl(grid.Rows[index++]); if (!this.Clip.get_legacy()) { this.AddDummyCurve(timeTbl); } while (index < grid.Rows.Count) { StringGridRow row = grid.Rows[index]; try { if (row.IsEmptyOrCommantOut) { index++; } else { PropertyType type; if (this.IsHeader(row)) { break; } if (!row.TryParseCellTypeOptional <PropertyType>(0, PropertyType.Custom, out type)) { string str2; string str3; row.ParseCell <string>(0).Separate('.', false, out str2, out str3); Type type2 = Type.GetType(str2); if (type2 == null) { Debug.LogError(str2 + "is not class name"); } this.Clip.SetCurve(string.Empty, type2, str3, this.ParseCurve(timeTbl, row)); } else if (this.IsEvent(type)) { this.AddEvent(type, timeTbl, row); } else { this.AddCurve(type, this.ParseCurve(timeTbl, row)); } index++; } continue; } catch (Exception exception) { Debug.LogError(row.ToErrorString(exception.Message)); continue; } } }
public AdvAnimationData(StringGrid grid, ref int index, bool legacy) { Clip = new AnimationClip(); Clip.legacy = legacy; ParseHeader(grid.Rows[index++]); List <float> timeTbl = ParseTimeTbl(grid.Rows[index++]); if (!Clip.legacy) { AddDummyCurve(timeTbl); } while (index < grid.Rows.Count) { StringGridRow row = grid.Rows[index]; try { if (row.IsEmptyOrCommantOut) { ++index; continue; } if (IsHeader(row)) { break; } PropertyType propertyType; if (!row.TryParseCellTypeOptional <PropertyType>(0, PropertyType.Custom, out propertyType)) { string str = row.ParseCell <string>(0); // Debug.LogError( row.ToErrorString("PropertyType Parse Error") ); string typeName, propertyName; str.Separate('.', false, out typeName, out propertyName); Type type = System.Type.GetType(typeName); if (type == null) { Debug.LogError(typeName + "is not class name"); } Clip.SetCurve("", type, propertyName, ParseCurve(timeTbl, row)); } else { if (IsEvent(propertyType)) { AddEvent(propertyType, timeTbl, row); } else { AddCurve(propertyType, ParseCurve(timeTbl, row)); } } ++index; } catch (System.Exception e) { Debug.LogError(row.ToErrorString(e.Message)); } } }