Exemplo n.º 1
0
        public static ElAnimationData Parse(ElData data)
        {
            var rt = new ElAnimationData
            {
                baseData = data,
            };

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

                    break;

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

                    break;

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

                    break;

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

                    break;

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

                    break;

                case "Loop":
                    rt.Loop = bool.Parse(i.Values.First());

                    break;

                case "BoneAnimation":
                    rt.BoneAnimationTimeKeys = i.Child("TimeKeys").Children.Select(_ => float.Parse(_.Values.First())).ToList();
                    rt.BoneAnimation         = i.Children.Where(_ => _.Name == "AnimationPart").Select(ElBoneAnimationPart.Parse).ToList();

                    break;

                case "UVAnimation":
                    rt.UVAnimationTimeKeys = i.Child("TimeKeys").Children.Select(_ => float.Parse(_.Values.First())).ToList();
                    rt.UVAnimation         = i.Children.Where(_ => _.Name == "AnimationPart").Select(ElUVAnimationPart.Parse).ToList();

                    break;
                }
            }

            return(rt);
        }
Exemplo n.º 2
0
        public static ElAnimationData Parse(ElData data)
        {
            var rt = new ElAnimationData
            {
                baseData = data,
            };

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

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

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

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

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

                        break;
                    case "Loop":
                        rt.Loop = bool.Parse(i.Values.First());

                        break;
                    case "BoneAnimation":
                        rt.BoneAnimationTimeKeys = i.Child("TimeKeys").Children.Select(_ => float.Parse(_.Values.First())).ToList();
                        rt.BoneAnimation = i.Children.Where(_ => _.Name == "AnimationPart").Select(ElBoneAnimationPart.Parse).ToList();

                        break;
                    case "UVAnimation":
                        rt.UVAnimationTimeKeys = i.Child("TimeKeys").Children.Select(_ => float.Parse(_.Values.First())).ToList();
                        rt.UVAnimation = i.Children.Where(_ => _.Name == "AnimationPart").Select(ElUVAnimationPart.Parse).ToList();

                        break;
                }

            return rt;
        }