예제 #1
0
                                                 > generateKeyFramePool(com.discobeard.spriter.dom.SpriterData data, com.discobeard.spriter.dom.Entity
                                                                        entity)
 {
     System.Collections.Generic.IList <com.brashmonkey.spriter.animation.SpriterAnimation
                                       > spriterAnimations = new System.Collections.Generic.List <com.brashmonkey.spriter.animation.SpriterAnimation
                                                                                                  >();
     System.Collections.Generic.IList <com.discobeard.spriter.dom.Animation> animations
         = entity.getAnimation();
     com.brashmonkey.spriter.mergers.SpriterAnimationBuilder frameBuilder = new com.brashmonkey.spriter.mergers.SpriterAnimationBuilder
                                                                                ();
     foreach (com.discobeard.spriter.dom.Animation anim in animations)
     {
         com.brashmonkey.spriter.animation.SpriterAnimation spriterAnimation = frameBuilder
                                                                               .buildAnimation(anim);
         bool found = false;
         foreach (com.brashmonkey.spriter.animation.SpriterKeyFrame key in spriterAnimation
                  .frames)
         {
             if (!found)
             {
                 found = key.getTime() == anim.getLength();
             }
             sort(key.getObjects());
             foreach (com.brashmonkey.spriter.objects.SpriterBone bone in key.getBones())
             {
                 foreach (com.brashmonkey.spriter.objects.SpriterBone bone2 in key.getBones())
                 {
                     if (bone2.hasParent())
                     {
                         if (!bone2.equals(bone) && bone2.getParentId() == bone.getId())
                         {
                             bone.addChildBone(bone2);
                         }
                     }
                 }
                 foreach (com.brashmonkey.spriter.objects.SpriterObject @object in key.getObjects(
                              ))
                 {
                     com.brashmonkey.spriter.file.Reference @ref = @object.getRef();
                     com.discobeard.spriter.dom.File        f    = data.getFolder()[@ref.folder].getFile()[@ref.
                                                                                                           file];
                     @ref.dimensions = new com.brashmonkey.spriter.SpriterRectangle(0, f.getHeight(),
                                                                                    f.getWidth(), 0f);
                     if (bone.getId() == @object.getParentId())
                     {
                         bone.addChildObject(@object);
                     }
                 }
             }
         }
         spriterAnimations.Add(spriterAnimation);
     }
     return(spriterAnimations);
 }
예제 #2
0
 private static void loadAnimations(List <XmlNode
                                          > animations, com.discobeard.spriter.dom.Entity entity)
 {
     for (int i = 0; i < animations.Count; i++)
     {
         XmlNode a = animations[i];
         com.discobeard.spriter.dom.Animation animation = new com.discobeard.spriter.dom.Animation
                                                              ();
         animation.setId(XmlReader.getInt(a, "id"));
         animation.setName(XmlReader.getAttribute(a, "name"));
         animation.setLength(XmlReader.getInt(a, "length"));
         animation.setLooping(XmlReader.getBool(a, "looping"));
         entity.getAnimation().Add(animation);
         loadMainline(XmlReader.getChildByName(a, "mainline"), animation);
         loadTimelines(XmlReader.getChildrenByName(a, "timeline"), animation);
     }
 }