示例#1
0
 public void Write(LispWriter writer)
 {
     writer.StartList("background");
     writer.Write("image", this.image);
     writer.Write("speed", this.speed);
     writer.EndList("background");
 }
示例#2
0
 private void WriteTileImages(LispWriter writer, string ListName, ArrayList ImagesList)
 {
     if (ImagesList.Count > 0)
     {
         writer.StartList(ListName);
         foreach (ImageRegion region in ImagesList)
         {
             if (region.Region.Width != 0)
             {
                 writer.WriteVerbatimLine(
                     String.Format("(region \"{0}\" {1} {2} {3} {4})",
                                   region.ImageFile, region.Region.Left,
                                   region.Region.Top, region.Region.Width,
                                   region.Region.Height));
             }
             else
             {
                 writer.WriteVerbatimLine(
                     "\"" + region.ImageFile + "\"");
             }
         }
         writer.EndList(ListName);
     }
     else
     {
         Console.WriteLine("no images on tile " + ID);
     }
 }
 public void Write(LispWriter writer)
 {
     writer.StartList("background");
     writer.Write("image", this.image);
     writer.Write("speed", this.speed);
     writer.EndList("background");
 }
示例#4
0
    public void Write(string filename)
    {
        FileStream fs = new FileStream(filename, FileMode.Create);

        TextWriter tw     = new StreamWriter(fs);
        LispWriter writer = new LispWriter(tw);

        writer.WriteComment("Generated by tiler");
        writer.StartList("supertux-tiles");
        foreach (TileGroup tilegroup in TileGroups)
        {
            tilegroup.Write(writer);
        }
        foreach (Tile tile in Tiles)
        {
            if (tile == null)
            {
                continue;
            }
            if (tile.ID >= 0)
            {
                tile.Write(writer);
            }
        }
        writer.EndList("supertux-tiles");
        tw.Close();
        fs.Close();
    }
示例#5
0
    public void Write(LispWriter writer) {
        writer.StartList("tilegroup");

        writer.Write("name", Name);
        writer.Write("tiles", Tiles);

        writer.EndList("tilegroup");
    }
示例#6
0
 public void Write(LispWriter writer)
 {
     writer.StartList("node");
     writer.Write("x", x);
     writer.Write("y", y);
     writer.Write("time", time);
     writer.EndList("node");
 }
示例#7
0
    public void Write(LispWriter writer)
    {
        writer.StartList("tilegroup");

        writer.Write("name", Name);
        writer.Write("tiles", Tiles);

        writer.EndList("tilegroup");
    }
示例#8
0
文件: Sector.cs 项目: SuperTux/cobble
 public void Write(LispWriter writer)
 {
     writer.StartList("sector");
     writer.Write("name", this.name);
     writer.Write("music", this.music);
     writer.Write("gravity", this.gravity);
     foreach (Tilemap tilemap in this.tilemaps)
     {
         tilemap.Write(writer);
     }
     background.Write(writer);
     writer.StartList("camera");
     writer.Write("mode", "normal");
     writer.EndList("camera");
     foreach (GameObject gameObject in this.gameObjects)
     {
         gameObject.Write(writer);
     }
     writer.EndList("sector");
 }
示例#9
0
 public void Write(LispWriter writer)
 {
     writer.StartList("tilemap");
     writer.Write("layer", this.layer);
     writer.Write("solid", this.solid);
     writer.Write("speed", this.speed);
     writer.Write("width", this.width);
     writer.Write("height", this.height);
     writer.Write("tiles", this.tiles);
     writer.EndList("tilemap");
 }
示例#10
0
        public void Write(string filename)
        {
            FileStream fs = new FileStream(filename, FileMode.Create);

            TextWriter tw     = new StreamWriter(fs);
            LispWriter writer = new LispWriter(tw);

            writer.WriteComment("Created with Cobble");
            writer.StartList("supertux-level");
            writer.Write("version", this.version);
            writer.StartList("name"); writer.Write("_", this.name); writer.EndList("name");
            writer.Write("author", this.author);
            foreach (Sector sector in this.sectors)
            {
                sector.Write(writer);
            }
            writer.EndList("supertux-level");
            tw.Close();
            fs.Close();
        }
示例#11
0
    public void Write(string filename) {
        FileStream fs = new FileStream(filename, FileMode.Create);

        TextWriter tw = new StreamWriter(fs);
        LispWriter writer = new LispWriter(tw);

        writer.WriteComment("Generated by tiler");
        writer.StartList("supertux-tiles");
        foreach(TileGroup tilegroup in TileGroups) {
            tilegroup.Write(writer);
        }
        foreach(Tile tile in Tiles) {
            if(tile == null)
                continue;
            if(tile.ID >= 0)
                tile.Write(writer);
        }
        writer.EndList("supertux-tiles");
        tw.Close();
        fs.Close();
    }
示例#12
0
        public void Write(string filename)
        {
            FileStream fs = new FileStream(filename, FileMode.Create);

            TextWriter tw = new StreamWriter(fs);
            LispWriter writer = new LispWriter(tw);

            writer.WriteComment("Created with Cobble");
            writer.StartList("supertux-level");
            writer.Write("version", this.version);
            writer.StartList("name"); writer.Write("_", this.name); writer.EndList("name");
            writer.Write("author", this.author);
            foreach (Sector sector in this.sectors) {
                sector.Write(writer);
            }
            writer.EndList("supertux-level");
            tw.Close();
            fs.Close();
        }
示例#13
0
 public void Write(LispWriter writer)
 {
     writer.StartList("sector");
     writer.Write("name", this.name);
     writer.Write("music", this.music);
     writer.Write("gravity", this.gravity);
     foreach (Tilemap tilemap in this.tilemaps) {
         tilemap.Write(writer);
     }
     background.Write(writer);
     writer.StartList("camera");
     writer.Write("mode", "normal");
     writer.EndList("camera");
     foreach (GameObject gameObject in this.gameObjects) {
         gameObject.Write(writer);
     }
     writer.EndList("sector");
 }
示例#14
0
    public void Write(LispWriter writer)
    {
        writer.StartList("tile");
        writer.Write("id", ID);

        if(Images.Count > 0) {
            writer.StartList("images");
            foreach(ImageRegion region in Images) {
                if(region.Region.Width != 0) {
                    writer.WriteVerbatimLine(
                            String.Format("(region \"{0}\" {1} {2} {3} {4})",
                                region.ImageFile, region.Region.Left,
                                region.Region.Top, region.Region.Width,
                                region.Region.Height));
                } else {
                    writer.WriteVerbatimLine(
                            "\"" + region.ImageFile + "\"");
                }
            }
            writer.EndList("images");
        } else {
            Console.WriteLine("no images on tile " + ID);
        }

        if(Solid)
            writer.Write("solid", true);
        if(UniSolid)
            writer.Write("unisolid", true);
        if(Ice)
            writer.Write("ice", true);
        if(Water)
            writer.Write("water", true);
        if(Slope)
            writer.Write("slope-type", Data);
        if(Hurts)
            writer.Write("hurts", true);
        if(Hidden)
            writer.Write("hidden", true);
        if(Coin)
            writer.Write("coin", true);
        if(FullBox)
            writer.Write("fullbox", true);
        if(Brick)
            writer.Write("brick", true);
        if(NextTile >= 0)
            writer.Write("next-tile", NextTile);
        if(Goal)
            writer.Write("goal", true);
        if(EditorImage != null)
            writer.Write("editor-images", EditorImage);
        if(Data != 0)
            writer.Write("data", Data);
        if(Images.Count > 1) {
            if(AnimFps == 1.0)
              AnimFps = 40;
            writer.Write("anim-fps", AnimFps);
        }
        writer.EndList("tile");
    }
示例#15
0
 public void Write(LispWriter writer)
 {
     writer.StartList(this.typename);
     this.WriteProperties(writer);
     writer.EndList(this.typename);
 }
示例#16
0
 public void Write(LispWriter writer)
 {
     writer.StartList("node");
     writer.Write("x", x);
     writer.Write("y", y);
     writer.Write("time", time);
     writer.EndList("node");
 }
示例#17
0
    public void Write(LispWriter writer)
    {
        writer.StartList("tile");
        writer.Write("id", ID);

        WriteTileImages(writer, "images", Images);

        if (HasAttribute(Attribute.SOLID))
        {
            writer.Write("solid", true);
        }
        if (HasAttribute(Attribute.UNISOLID))
        {
            writer.Write("unisolid", true);
        }
        if (HasAttribute(Attribute.ICE))
        {
            writer.Write("ice", true);
        }
        if (HasAttribute(Attribute.WATER))
        {
            writer.Write("water", true);
        }
        if (HasAttribute(Attribute.SLOPE))
        {
            writer.Write("slope-type", Data);
        }
        if (HasAttribute(Attribute.HURTS))
        {
            writer.Write("hurts", true);
        }
        if (HasAttribute(Attribute.FIRE))
        {
            writer.Write("fire", true);
        }
        if (HasAttribute(Attribute.COIN))
        {
            writer.Write("coin", true);
        }
        if (HasAttribute(Attribute.FULLBOX))
        {
            writer.Write("fullbox", true);
        }
        if (HasAttribute(Attribute.BRICK))
        {
            writer.Write("brick", true);
        }
        if (HasAttribute(Attribute.GOAL))
        {
            writer.Write("goal", true);
        }

        if (Hidden)
        {
            writer.Write("hidden", true);
        }
        if (NextTile >= 0)
        {
            writer.Write("next-tile", NextTile);
        }
        if (EditorImages != null)
        {
            WriteTileImages(writer, "editor-images", EditorImages);
        }
        if (Data != 0)
        {
            writer.Write("data", Data);
        }
        if (Images.Count > 1)
        {
            if (AnimFps == 1.0)
            {
                AnimFps = 40;
            }
            writer.Write("anim-fps", AnimFps);
        }
        if (!String.IsNullOrEmpty(OneWayString))
        {
            writer.Write("one-way", OneWayString);
        }
        writer.EndList("tile");
    }
示例#18
0
    public void Write(LispWriter writer)
    {
        writer.StartList("tile");
        writer.Write("id", ID);

        if (Images.Count > 0)
        {
            writer.StartList("images");
            foreach (ImageRegion region in Images)
            {
                if (region.Region.Width != 0)
                {
                    writer.WriteVerbatimLine(
                        String.Format("(region \"{0}\" {1} {2} {3} {4})",
                                      region.ImageFile, region.Region.Left,
                                      region.Region.Top, region.Region.Width,
                                      region.Region.Height));
                }
                else
                {
                    writer.WriteVerbatimLine(
                        "\"" + region.ImageFile + "\"");
                }
            }
            writer.EndList("images");
        }
        else
        {
            Console.WriteLine("no images on tile " + ID);
        }

        if (Solid)
        {
            writer.Write("solid", true);
        }
        if (UniSolid)
        {
            writer.Write("unisolid", true);
        }
        if (Ice)
        {
            writer.Write("ice", true);
        }
        if (Water)
        {
            writer.Write("water", true);
        }
        if (Slope)
        {
            writer.Write("slope-type", Data);
        }
        if (Hurts)
        {
            writer.Write("hurts", true);
        }
        if (Hidden)
        {
            writer.Write("hidden", true);
        }
        if (Coin)
        {
            writer.Write("coin", true);
        }
        if (FullBox)
        {
            writer.Write("fullbox", true);
        }
        if (Brick)
        {
            writer.Write("brick", true);
        }
        if (NextTile >= 0)
        {
            writer.Write("next-tile", NextTile);
        }
        if (Goal)
        {
            writer.Write("goal", true);
        }
        if (EditorImage != null)
        {
            writer.Write("editor-images", EditorImage);
        }
        if (Data != 0)
        {
            writer.Write("data", Data);
        }
        if (Images.Count > 1)
        {
            if (AnimFps == 1.0)
            {
                AnimFps = 40;
            }
            writer.Write("anim-fps", AnimFps);
        }
        writer.EndList("tile");
    }
示例#19
0
文件: Tile.cs 项目: PhompAng/greantux
    public void Write(LispWriter writer)
    {
        writer.StartList("tile");
        writer.Write("id", ID);

        WriteTileImages(writer, "images", Images);

        if(HasAttribute(Attribute.SOLID))
            writer.Write("solid", true);
        if(HasAttribute(Attribute.UNISOLID))
            writer.Write("unisolid", true);
        if(HasAttribute(Attribute.ICE))
            writer.Write("ice", true);
        if(HasAttribute(Attribute.WATER))
            writer.Write("water", true);
        if(HasAttribute(Attribute.SLOPE))
            writer.Write("slope-type", Data);
        if(HasAttribute(Attribute.HURTS))
            writer.Write("hurts", true);
        if(HasAttribute(Attribute.FIRE))
            writer.Write("fire", true);
        if(HasAttribute(Attribute.COIN))
            writer.Write("coin", true);
        if(HasAttribute(Attribute.FULLBOX))
            writer.Write("fullbox", true);
        if(HasAttribute(Attribute.BRICK))
            writer.Write("brick", true);
        if(HasAttribute(Attribute.GOAL))
            writer.Write("goal", true);

        if(Hidden)
            writer.Write("hidden", true);
        if(NextTile >= 0)
            writer.Write("next-tile", NextTile);
        if(EditorImages != null)
            WriteTileImages(writer, "editor-images", EditorImages);
        if(Data != 0)
            writer.Write("data", Data);
        if(Images.Count > 1) {
            if(AnimFps == 1.0)
              AnimFps = 40;
            writer.Write("anim-fps", AnimFps);
        }
        if(!String.IsNullOrEmpty(OneWayString)) {
        writer.Write("one-way", OneWayString);
        }
        writer.EndList("tile");
    }
示例#20
0
 public void Write(LispWriter writer)
 {
     writer.StartList(this.typename);
     this.WriteProperties(writer);
     writer.EndList(this.typename);
 }
示例#21
0
文件: Tile.cs 项目: PhompAng/greantux
 private void WriteTileImages(LispWriter writer, string ListName, ArrayList ImagesList)
 {
     if(ImagesList.Count > 0) {
         writer.StartList(ListName);
         foreach(ImageRegion region in ImagesList) {
             if(region.Region.Width != 0) {
                 writer.WriteVerbatimLine(
                         String.Format("(region \"{0}\" {1} {2} {3} {4})",
                             region.ImageFile, region.Region.Left,
                             region.Region.Top, region.Region.Width,
                             region.Region.Height));
             } else {
                 writer.WriteVerbatimLine(
                         "\"" + region.ImageFile + "\"");
             }
         }
         writer.EndList(ListName);
     } else {
         Console.WriteLine("no images on tile " + ID);
     }
 }
示例#22
0
 public void Write(LispWriter writer)
 {
     writer.StartList("tilemap");
     writer.Write("layer", this.layer);
     writer.Write("solid", this.solid);
     writer.Write("speed", this.speed);
     writer.Write("width", this.width);
     writer.Write("height", this.height);
     writer.Write("tiles", this.tiles);
     writer.EndList("tilemap");
 }