示例#1
0
        void AddEvent(PropertyType propertyType, List <float> timeTbl, StringGridRow row)
        {
            for (int i = 0; i < row.Strings.Length; ++i)
            {
                if (i == 0)
                {
                    continue;
                }
                if (row.IsEmptyCell(i))
                {
                    continue;
                }

                //キーの追加
                AnimationEvent e = new AnimationEvent();
                // AnimationCurveの生成.
                switch (propertyType)
                {
                case PropertyType.Texture:
                {
                    string value;
                    if (!row.TryParseCell <string>(i, out value))
                    {
                        continue;
                    }
                    e.functionName    = "ChangePattern";
                    e.stringParameter = value;
                    e.time            = timeTbl[i - 1];
                    break;
                }

                case PropertyType.Pattern:
                {
                    string value;
                    if (!row.TryParseCell <string>(i, out value))
                    {
                        continue;
                    }
                    e.functionName    = "ChangePatternAnimation";
                    e.stringParameter = value;
                    e.time            = timeTbl[i - 1];
                    break;
                }
                }
                if (Application.isPlaying)
                {
                    Clip.AddEvent(e);
                }
                else
                {
#if UNITY_EDITOR
//					UnityEditor.AnimationUtility. Clip.AddEvent(e);
#endif
                }
            }
        }
示例#2
0
 private void AddEvent(PropertyType propertyType, List <float> timeTbl, StringGridRow row)
 {
     for (int i = 0; i < row.Strings.Length; i++)
     {
         if ((i != 0) && !row.IsEmptyCell(i))
         {
             AnimationEvent event2 = new AnimationEvent();
             if (propertyType == PropertyType.Texture)
             {
                 string str;
                 if (!row.TryParseCell <string>(i, out str))
                 {
                     continue;
                 }
                 event2.set_functionName("ChangePattern");
                 event2.set_stringParameter(str);
                 event2.set_time(timeTbl[i - 1]);
             }
             if (Application.get_isPlaying())
             {
                 this.Clip.AddEvent(event2);
             }
         }
     }
 }
示例#3
0
        AnimationCurve ParseCurve(List <float> timeTbl, StringGridRow row)
        {
            // AnimationCurveの生成.
            AnimationCurve curve = new AnimationCurve();

            for (int i = 0; i < row.Strings.Length; ++i)
            {
                if (i == 0)
                {
                    continue;
                }
                if (row.IsEmptyCell(i))
                {
                    continue;
                }

                float value;
                if (!row.TryParseCell <float>(i, out value))
                {
                    continue;
                }
                //キーの追加
//				Debug.Log("AddKey " + timeTbl[i - 1] + " " + value);
                curve.AddKey(new Keyframe(timeTbl[i - 1], value));
            }
            if (curve.keys.Length <= 1)
            {
//				Debug.LogError(row.ToErrorString("Need more than 2 key data"));
            }
            return(curve);
        }
示例#4
0
        private List <float> ParseTimeTbl(StringGridRow row)
        {
            List <float> list = new List <float>();

            for (int i = 1; i < row.Strings.Length; i++)
            {
                float num2;
                if (!row.TryParseCell <float>(i, out num2))
                {
                    Debug.LogError(row.ToErrorString("TimeTbl pase error"));
                }
                list.Add(num2);
            }
            return(list);
        }
示例#5
0
        List <float> ParseTimeTbl(StringGridRow row)
        {
            List <float> timeTbl = new List <float>();

            for (int i = 1; i < row.Strings.Length; ++i)
            {
                float time;
                if (!row.TryParseCell <float>(i, out time))
                {
                    Debug.LogError(row.ToErrorString("TimeTbl pase error"));
                }
                timeTbl.Add(time);
            }
            return(timeTbl);
        }
示例#6
0
        private AnimationCurve ParseCurve(List <float> timeTbl, StringGridRow row)
        {
            AnimationCurve curve = new AnimationCurve();

            for (int i = 0; i < row.Strings.Length; i++)
            {
                float num2;
                if (((i != 0) && !row.IsEmptyCell(i)) && row.TryParseCell <float>(i, out num2))
                {
                    curve.AddKey(new Keyframe(timeTbl[i - 1], num2));
                }
            }
            if (curve.get_keys().Length <= 1)
            {
            }
            return(curve);
        }
示例#7
0
 //指定の名前のセルを、型Tとして解析・取得(データがなかったらfalse)
 public static bool TryParseCell <T>(StringGridRow row, AdvColumnName name, out T val)
 {
     return(row.TryParseCell <T>(Localize(name), out val));
 }