示例#1
0
        private static void loadFolders(List <XmlNode> folders)
        {
            for (int i = 0; i < folders.Count; i++)
            {
                XmlNode repo   = folders[i];
                Folder  folder = new Folder(
                    );
                folder.setId(XmlReader.getInt(repo, "id"));

                folder.setName(XmlReader.getAttribute(repo, "name"));
                List <XmlNode> files = XmlReader.getChildrenByName(repo, "file");
                for (int j = 0; j < files.Count; j++)
                {
                    XmlNode f    = files[j];
                    File    file = new File();
                    file.setId(XmlReader.getInt(f, "id"));
                    file.setName(XmlReader.getAttribute(f, "name"));
                    file.setWidth(XmlReader.getInt(f, "width"));
                    file.setHeight(XmlReader.getInt(f, "height"));
                    try
                    {
                        file.setPivotX(XmlReader.getFloat(f, "pivot_x"));
                        file.setPivotY(XmlReader.getFloat(f, "pivot_y"));
                    }
                    catch (System.Exception)
                    {
                        file.setPivotX(System.Convert.ToSingle(0));
                        file.setPivotY(System.Convert.ToSingle(1));
                    }
                    folder.getFile().Add(file);
                }
                data.getFolder().Add(folder);
            }
        }
示例#2
0
 private void loadResources()
 {
     for (int folder = 0; folder < spriterData.getFolder().Count; folder++)
     {
         for (int file = 0; file < spriterData.getFolder()[folder].getFile().Count; file++)
         {
             string    folderName = spriterData.getFolder()[folder].getName();
             string    fileName   = spriterData.getFolder()[folder].getFile()[file].getName();
             Reference @ref       = new Reference
                                        (folder, file, folderName, fileName);
             @ref.dimensions = new SpriterRectangle(0, spriterData.getFolder
                                                        ()[folder].getFile()[file].getHeight(), spriterData.getFolder()[folder].getFile(
                                                        )[file].getWidth(), 0);
             @ref.pivotX = spriterData.getFolder()[folder].getFile()[file].getPivotX();
             @ref.pivotY = spriterData.getFolder()[folder].getFile()[file].getPivotY();
             loader.load(@ref, System.IO.Directory.GetParent(this.scmlPath) + "/" + fileName);
         }
     }
     this.loader.finishLoading();
 }