예제 #1
0
 public Spriter(com.discobeard.spriter.dom.SpriterData spriterData, com.brashmonkey.spriter.file.FileLoader loader, java.io.File scmlFile)
 {
     this.scmlFile = scmlFile;
     this.spriterData = spriterData;
     this.loader = loader;
     this.loadResources();
 }
예제 #2
0
 public Spriter(com.discobeard.spriter.dom.SpriterData spriterData, com.brashmonkey.spriter.file.FileLoader loader, java.io.File scmlFile)
 {
     this.scmlFile    = scmlFile;
     this.spriterData = spriterData;
     this.loader      = loader;
     this.loadResources();
 }
예제 #3
0
        public Spriter(string scmlPath, com.brashmonkey.spriter.file.FileLoader loader
			)
        {
            this.scmlFile = new java.io.File(scmlPath);
            this.spriterData = com.brashmonkey.spriter.xml.SCMLReader.load(scmlPath);
            this.loader = loader;
            loadResources();
        }
예제 #4
0
 public Spriter(string scmlPath, com.brashmonkey.spriter.file.FileLoader loader
                )
 {
     this.scmlFile    = new java.io.File(scmlPath);
     this.spriterData = com.brashmonkey.spriter.xml.SCMLReader.load(scmlPath);
     this.loader      = loader;
     loadResources();
 }
예제 #5
0
 private static com.discobeard.spriter.dom.SpriterData load(FileStream stream)
 {
     XmlReader reader = new XmlReader();
     reader.parse(stream);
     XmlNode root = reader.getNode("spriter_data");
     data = new discobeard.spriter.dom.SpriterData();
     loadFolders(XmlReader.getChildrenByName(root, "folder"));
     loadEntities(XmlReader.getChildrenByName(root, "entity"));
     return data;
 }
예제 #6
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);
 }
예제 #7
0
        private static com.discobeard.spriter.dom.SpriterData load(FileStream stream)
        {
            XmlReader reader = new XmlReader();

            reader.parse(stream);
            XmlNode root = reader.getNode("spriter_data");

            data = new discobeard.spriter.dom.SpriterData();
            loadFolders(XmlReader.getChildrenByName(root, "folder"));
            loadEntities(XmlReader.getChildrenByName(root, "entity"));
            return(data);
        }
예제 #8
0
 public SpriterPlayerIK(com.discobeard.spriter.dom.SpriterData data, com.discobeard.spriter.dom.Entity
                        entity, com.brashmonkey.spriter.file.FileLoader loader) : base(data, entity
                                                                                       , loader)
 {
     this.resovling = true;
     this.tolerance = 0.5f;
     this.resolver  = new com.brashmonkey.spriter.player.SpriterCCDResolver(this);
     base.step(0, 0);
     this.updateObjects = false;
     this.ikMap         = new System.Collections.Generic.Dictionary <com.brashmonkey.spriter.objects.SpriterIKObject
                                                                     , com.brashmonkey.spriter.objects.SpriterAbstractObject>();
     this.temp = new com.brashmonkey.spriter.objects.SpriterBone();
 }
예제 #9
0
 /// <summary>Constructs a new SpriterPlayer object which animates the given Spriter entity.
 ///     </summary>
 /// <remarks>Constructs a new SpriterPlayer object which animates the given Spriter entity.
 ///     </remarks>
 /// <param name="data">
 ///
 /// <see cref="com.discobeard.spriter.dom.SpriterData">com.discobeard.spriter.dom.SpriterData
 ///     </see>
 /// which provides a method to load all needed data to animate. See
 /// <see cref="Spriter#getSpriter(String,com.spriter.file.FileLoader)">Spriter#getSpriter(String,com.spriter.file.FileLoader)
 ///     </see>
 /// for mor information.
 /// </param>
 /// <param name="entityIndex">The entity which should be handled by this player.</param>
 /// <param name="loader">The loader which has loaded all necessary sprites for the scml file.
 ///     </param>
 public SpriterPlayer(com.discobeard.spriter.dom.SpriterData data, com.discobeard.spriter.dom.Entity
                      entity, com.brashmonkey.spriter.file.FileLoader loader) : base(loader, null)
 {
     this.entity = entity;
     this.frame  = 0;
     if (!alreadyLoaded(entity))
     {
         this.animations = com.brashmonkey.spriter.SpriterKeyFrameProvider.generateKeyFramePool
                               (data, entity);
         loaded.Add(entity, this);
     }
     else
     {
         this.animations = loaded[entity].animations;
     }
     this.generateData();
     this.animation     = this.animations[0];
     this.firstKeyFrame = this.animation.frames[0];
     this.update(0, 0);
 }
예제 #10
0
 public SpriterPlayerIK(com.discobeard.spriter.dom.SpriterData data, int entityIndex
                        , com.brashmonkey.spriter.file.FileLoader loader) : this(data, data.getEntity
                                                                                     ()[entityIndex], loader)
 {
 }