Exemplo n.º 1
0
        private object InnerLoadAnimationData(Wz_Node node)
        {
            if (node != null)
            {
                while (node.Value is Wz_Uol)
                {
                    node = ((Wz_Uol)node.Value).HandleUol(node);
                }

                if (node.Value is Wz_Png) //单帧动画
                {
                    var aniData = new FrameAnimationData();
                    var frame   = LoadFrame(node);
                    aniData.Frames.Add(frame);
                    return(aniData);
                }
                else if (node.Value == null && node.Nodes.Count > 0) //分析目录
                {
                    string spine = node.Nodes["spine"].GetValueEx <string>(null);
                    if (spine != null) //读取spine动画
                    {
                        var loader    = new SpineTextureLoader(this, node);
                        var atlasNode = node.Nodes[spine + ".atlas"];
                        var aniData   = SpineAnimationData.CreateFromNode(atlasNode, null, loader);
                        return(aniData);
                    }
                    else //读取序列帧动画
                    {
                        var     frames = new List <Frame>();
                        Wz_Node frameNode;
                        for (int i = 0; (frameNode = node.Nodes[i.ToString()]) != null; i++)
                        {
                            var frame = LoadFrame(frameNode);
                            frames.Add(frame);
                        }
                        var repeat = node.Nodes["repeat"].GetValueEx <bool>();
                        return(new RepeatableFrameAnimationData(frames)
                        {
                            Repeat = repeat
                        });
                    }
                }
            }
            return(null);
        }
Exemplo n.º 2
0
 public void ShowAnimation(FrameAnimationData data)
 {
     this.ShowAnimation(new FrameAnimator(data));
 }
Exemplo n.º 3
0
 public FrameAnimationData LoadFrameAnimation(Wz_Node node)
 {
     return(FrameAnimationData.CreateFromNode(node, this.GraphicsDevice, PluginBase.PluginManager.FindWz));
 }