コード例 #1
0
ファイル: SCMLReader.cs プロジェクト: Trixt0r/SpriterXNATest
 private static void loadTimelineKeys(List<XmlNode> keys, 
     TimeLine timeline)
 {
     for (int i = 0; i < keys.Count; i++)
     {
         XmlNode k = keys[i];
         XmlNode obj = XmlReader.getChildByName(k, "bone");
         Key key = new 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)
         {
             Bone bone = new Bone();
             bone.setAngle(XmlReader.getFloat(obj,"angle", 0f ));
             bone.setX(XmlReader.getFloat(obj,"x", 0f ));
             bone.setY(XmlReader.getFloat(obj,"y", 0f ));
             bone.setScaleX(XmlReader.getFloat(obj,"scale_x", 1f ));
             bone.setScaleY(XmlReader.getFloat(obj,"scale_y", 1f ));
             key.setBone(bone);
         }
         else
         {
             AnimationObject @object = new AnimationObject
                 ();
             obj = XmlReader.getChildByName(k, "object");
             @object.setAngle(XmlReader.getFloat(obj,"angle", 0f ));
             @object.setX(XmlReader.getFloat(obj,"x", 0f ));
             @object.setY(XmlReader.getFloat(obj,"y", 0f ));
             @object.setScaleX(XmlReader.getFloat(obj,"scale_x", 1f ));
             @object.setScaleY(XmlReader.getFloat(obj,"scale_y", 1f ));
             @object.setFolder(XmlReader.getInt(obj,"folder" ));
             @object.setFile(XmlReader.getInt(obj,"file" ));
             File f = data.getFolder()[@object.getFolder()].getFile
                 ()[@object.getFile()];
             @object.setPivotX(XmlReader.getFloat(obj,"pivot_x", f.getPivotX()));
             @object.setPivotY(XmlReader.getFloat(obj,"pivot_y", f.getPivotY()));
             key.getObject().Add(@object);
         }
         timeline.getKey().Add(key);
     }
 }
コード例 #2
0
ファイル: SCMLReader.cs プロジェクト: Trixt0r/SpriterXNATest
        private static void loadMainlineKeys(List<XmlNode
			> keys, MainLine main)
        {
            for (int i = 0; i < keys.Count; i++)
            {
                XmlNode k = keys[i];
                Key key = new 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);
            }
        }