Exemple #1
0
        internal static EditCurveInfo[] GetCurves(object obj)
        {
            List <EditCurveInfo> curves = new List <EditCurveInfo>();

            FieldInfo[] fields  = obj.GetType().GetFields();
            System.Type attType = typeof(Skill.Framework.CurveEditorAttribute);

            foreach (FieldInfo info in fields)
            {
                if (info.FieldType == typeof(AnimationCurve))
                {
                    object[] attributes = info.GetCustomAttributes(true);
                    Skill.Framework.CurveEditorAttribute curveEditorAttribute = null;
                    foreach (object att in attributes)
                    {
                        if (att.GetType() == attType)
                        {
                            curveEditorAttribute = (Skill.Framework.CurveEditorAttribute)att;
                            break;
                        }
                    }

                    if (curveEditorAttribute == null)
                    {
                        curveEditorAttribute = new Skill.Framework.CurveEditorAttribute(1.0f, 0.8f, 0.8f, info.Name);
                    }

                    EditCurveInfo ci = new EditCurveInfo(obj, info, curveEditorAttribute);
                    curves.Add(ci);
                }
            }
            return(curves.ToArray());
        }
Exemple #2
0
 public EditCurveInfo(object component, FieldInfo field, Skill.Framework.CurveEditorAttribute attribute)
 {
     this.Component = component;
     this.Field     = field;
     this.Attribute = attribute;
 }