Пример #1
0
        public static ElBoneAnimationPart Parse(ElData data)
        {
            var rt = new ElBoneAnimationPart
            {
                baseData = data,
            };

            foreach (var i in data.Children)
            {
                switch (i.Name)
                {
                case "NodeName":
                    rt.NodeName = i.Values.First().Trim('"');

                    break;

                case "TransitionTime":
                    rt.TransitionTime = int.Parse(i.Values.First());

                    break;

                case "InterpolationType":
                    rt.InterpolationType = Util.ParseEnum <ElInterpolationType>(i.Values.First().Trim('"'));

                    break;

                case "TimeKeys":
                    rt.TimeKeys = i.Children.Select(_ => float.Parse(_.Values.First())).ToList();

                    break;

                case "TransKeys":
                    rt.TransKeys = i.Children.Select(_ => _.Values.Select(float.Parse).ToArray()).ToList();

                    break;

                case "RotateKeys":
                    rt.RotateKeys = i.Children.Select(_ => _.Values.Select(float.Parse).ToArray()).ToList();

                    break;

                case "ScaleKeys":
                    rt.ScaleKeys = i.Children.Select(_ => _.Values.Select(float.Parse).ToArray()).ToList();

                    break;
                }
            }

            return(rt);
        }
Пример #2
0
        public static ElBoneAnimationPart Parse(ElData data)
        {
            var rt = new ElBoneAnimationPart
            {
                baseData = data,
            };

            foreach (var i in data.Children)
                switch (i.Name)
                {
                    case "NodeName":
                        rt.NodeName = i.Values.First().Trim('"');

                        break;
                    case "TransitionTime":
                        rt.TransitionTime = int.Parse(i.Values.First());

                        break;
                    case "InterpolationType":
                        rt.InterpolationType = Util.ParseEnum<ElInterpolationType>(i.Values.First().Trim('"'));

                        break;
                    case "TimeKeys":
                        rt.TimeKeys = i.Children.Select(_ => float.Parse(_.Values.First())).ToList();

                        break;
                    case "TransKeys":
                        rt.TransKeys = i.Children.Select(_ => _.Values.Select(float.Parse).ToArray()).ToList();

                        break;
                    case "RotateKeys":
                        rt.RotateKeys = i.Children.Select(_ => _.Values.Select(float.Parse).ToArray()).ToList();

                        break;
                    case "ScaleKeys":
                        rt.ScaleKeys = i.Children.Select(_ => _.Values.Select(float.Parse).ToArray()).ToList();

                        break;
                }

            return rt;
        }