Beispiel #1
0
 private static void loadTimelineKeys(List <XmlNode> keys,
                                      com.discobeard.spriter.dom.TimeLine timeline)
 {
     for (int i = 0; i < keys.Count; i++)
     {
         XmlNode k   = keys[i];
         XmlNode obj = XmlReader.getChildByName(k, "bone");
         com.discobeard.spriter.dom.Key key = new com.discobeard.spriter.dom.Key();
         key.setId(XmlReader.getInt(k, "id"));
         key.setSpin(XmlReader.getInt(k, "spin", 1));
         key.setTime(System.Convert.ToInt64(XmlReader.getInt(k, "time", 0)));
         string name = XmlReader.getAttribute(k.ParentNode, "name");
         timeline.setName(name);
         if (obj != null)
         {
             com.discobeard.spriter.dom.Bone bone = new com.discobeard.spriter.dom.Bone();
             bone.setAngle(new java.math.BigDecimal(XmlReader.getFloat(obj, "angle", 0f)));
             bone.setX(new java.math.BigDecimal(XmlReader.getFloat(obj, "x", 0f)));
             bone.setY(new java.math.BigDecimal(XmlReader.getFloat(obj, "y", 0f)));
             bone.setScaleX(new java.math.BigDecimal(XmlReader.getFloat(obj, "scale_x", 1f)));
             bone.setScaleY(new java.math.BigDecimal(XmlReader.getFloat(obj, "scale_y", 1f)));
             key.setBone(bone);
         }
         else
         {
             com.discobeard.spriter.dom.AnimationObject @object = new com.discobeard.spriter.dom.AnimationObject
                                                                      ();
             obj = XmlReader.getChildByName(k, "object");
             @object.setAngle(new java.math.BigDecimal(XmlReader.getFloat(obj, "angle", 0f)));
             @object.setX(new java.math.BigDecimal(XmlReader.getFloat(obj, "x", 0f)));
             @object.setY(new java.math.BigDecimal(XmlReader.getFloat(obj, "y", 0f)));
             @object.setScaleX(new java.math.BigDecimal(XmlReader.getFloat(obj, "scale_x", 1f)));
             @object.setScaleY(new java.math.BigDecimal(XmlReader.getFloat(obj, "scale_y", 1f)));
             @object.setFolder(XmlReader.getInt(obj, "folder"));
             @object.setFile(XmlReader.getInt(obj, "file"));
             com.discobeard.spriter.dom.File f = data.getFolder()[@object.getFolder()].getFile
                                                     ()[@object.getFile()];
             @object.setPivotX(new java.math.BigDecimal(XmlReader.getFloat(obj, "pivot_x", f.getPivotX( ))
                                                        ));
             @object.setPivotY(new java.math.BigDecimal(XmlReader.getFloat(obj, "pivot_y", f.getPivotY( ))
                                                        ));
             key.getObject().Add(@object);
         }
         timeline.getKey().Add(key);
     }
 }
Beispiel #2
0
 private static void loadMainlineKeys(List <XmlNode
                                            > keys, com.discobeard.spriter.dom.MainLine main)
 {
     for (int i = 0; i < keys.Count; i++)
     {
         XmlNode k = keys[i];
         com.discobeard.spriter.dom.Key key = new com.discobeard.spriter.dom.Key();
         key.setId(XmlReader.getInt(k, "id"));
         int time = XmlReader.getInt(k, "time", -1);
         if (time == -1)
         {
             key.setTime(0);
         }
         else
         {
             key.setTime(System.Convert.ToInt64(time));
         }
         main.getKey().Add(key);
         loadRefs(XmlReader.getChildrenByName(k, "object_ref"), XmlReader.getChildrenByName(k, "bone_ref"), key);
     }
 }
Beispiel #3
0
 private static void loadTimelineKeys(List<XmlNode> keys, 
     com.discobeard.spriter.dom.TimeLine timeline)
 {
     for (int i = 0; i < keys.Count; i++)
     {
         XmlNode k = keys[i];
         XmlNode obj = XmlReader.getChildByName(k, "bone");
         com.discobeard.spriter.dom.Key key = new com.discobeard.spriter.dom.Key();
         key.setId(XmlReader.getInt(k,"id" ));
         key.setSpin(XmlReader.getInt(k,"spin", 1));
         key.setTime(System.Convert.ToInt64(XmlReader.getInt(k,"time", 0 )));
         string name = XmlReader.getAttribute(k.ParentNode, "name");
         timeline.setName(name);
         if (obj != null)
         {
             com.discobeard.spriter.dom.Bone bone = new com.discobeard.spriter.dom.Bone();
             bone.setAngle(new java.math.BigDecimal(XmlReader.getFloat(obj,"angle", 0f )));
             bone.setX(new java.math.BigDecimal(XmlReader.getFloat(obj,"x", 0f )));
             bone.setY(new java.math.BigDecimal(XmlReader.getFloat(obj,"y", 0f )));
             bone.setScaleX(new java.math.BigDecimal(XmlReader.getFloat(obj,"scale_x", 1f )));
             bone.setScaleY(new java.math.BigDecimal(XmlReader.getFloat(obj,"scale_y", 1f )));
             key.setBone(bone);
         }
         else
         {
             com.discobeard.spriter.dom.AnimationObject @object = new com.discobeard.spriter.dom.AnimationObject
                 ();
             obj = XmlReader.getChildByName(k, "object");
             @object.setAngle(new java.math.BigDecimal(XmlReader.getFloat(obj,"angle", 0f )));
             @object.setX(new java.math.BigDecimal(XmlReader.getFloat(obj,"x", 0f )));
             @object.setY(new java.math.BigDecimal(XmlReader.getFloat(obj,"y", 0f )));
             @object.setScaleX(new java.math.BigDecimal(XmlReader.getFloat(obj,"scale_x", 1f )));
             @object.setScaleY(new java.math.BigDecimal(XmlReader.getFloat(obj,"scale_y", 1f )));
             @object.setFolder(XmlReader.getInt(obj,"folder" ));
             @object.setFile(XmlReader.getInt(obj,"file" ));
             com.discobeard.spriter.dom.File f = data.getFolder()[@object.getFolder()].getFile
                 ()[@object.getFile()];
             @object.setPivotX(new java.math.BigDecimal(XmlReader.getFloat(obj,"pivot_x", f.getPivotX( ))
                 ));
             @object.setPivotY(new java.math.BigDecimal(XmlReader.getFloat(obj,"pivot_y", f.getPivotY( ))
                 ));
             key.getObject().Add(@object);
         }
         timeline.getKey().Add(key);
     }
 }
Beispiel #4
0
        private static void loadMainlineKeys(List<XmlNode
			> keys, com.discobeard.spriter.dom.MainLine main)
        {
            for (int i = 0; i < keys.Count; i++)
            {
                XmlNode k = keys[i];
                com.discobeard.spriter.dom.Key key = new com.discobeard.spriter.dom.Key();
                key.setId(XmlReader.getInt(k,"id" ));
                int time = XmlReader.getInt(k, "time", -1);
                if (time == -1) key.setTime(0);
                else key.setTime(System.Convert.ToInt64(time));
                main.getKey().Add(key);
                loadRefs(XmlReader.getChildrenByName(k, "object_ref"), XmlReader.getChildrenByName(k, "bone_ref"), key);
            }
        }