예제 #1
0
        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;
                }
            }
        }
예제 #2
0
 internal bool TryParse(StringGridRow row, int index)
 {
     try
     {
         this.DataList.Clear();
         while ((index + 1) < row.Strings.Length)
         {
             if (row.IsEmptyCell(index) && row.IsEmptyCell((int)(index + 1)))
             {
                 break;
             }
             string name     = row.ParseCell <string>(index++);
             float  duration = row.ParseCell <float>(index++);
             this.DataList.Add(new Data(duration, name));
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #3
0
 internal bool TryParse(StringGridRow row, int index)
 {
     try
     {
         DataList.Clear();
         while (index + 1 < row.Strings.Length)
         {
             if (row.IsEmptyCell(index) && row.IsEmptyCell(index + 1))
             {
                 break;
             }
             string str  = row.ParseCell <string>(index++);
             float  time = row.ParseCell <float>(index++);
             DataList.Add(new Data(time, str));
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #4
0
 //指定の名前のセルを、型Tとして解析・取得(データがなかったらエラーメッセージを出す)
 public static T ParseCell <T>(StringGridRow row, AdvColumnName name)
 {
     return(row.ParseCell <T>(Localize(name)));
 }
예제 #5
0
 private void ParseHeader(StringGridRow row)
 {
     this.Clip.set_name(row.ParseCell <string>(0).Substring(1));
     this.Clip.set_wrapMode(row.ParseCellOptional <WrapMode>(1, 0));
 }
예제 #6
0
 private bool IsHeader(StringGridRow row)
 {
     return(row.ParseCell <string>(0)[0] == '*');
 }
예제 #7
0
 void ParseHeader(StringGridRow row)
 {
     Clip.name     = row.ParseCell <string>(0).Substring(1);
     Clip.wrapMode = row.ParseCellOptional <WrapMode>(1, WrapMode.Default);
 }
예제 #8
0
        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));
                }
            }
        }