internal Layer(World world, System.Xml.XmlElement la, int tilewidth, int tileheight, SFML.Graphics.Image image) { Name = la.GetAttributeString("name"); width = la.GetAttributeInt("width"); height = la.GetAttributeInt("height"); this.tilewidth = tilewidth; this.tileheight = tileheight; tiles = new int[width * height]; var data = la.FirstElement("data"); int index = 0; foreach (var tile in data.ElementsNamed("tile")) { var gid = tile.GetAttributeInt("gid"); tiles[index] = gid; ++index; } foreach (var o in ObjectDatas) { if (o.gid != 0) { var sp = Tiles.CreateSprite(image, o.gid, tilewidth, tileheight); sp.Position = o.pos; sprites.Add(sp); } } }
private void add(AutoVarData avd, string type, System.Xml.XmlElement x) { if (type == "projectfolder") { add(x.GetAttributeString("target"), avd.ProjectFolder); } else if (type == "installfolder") { add(x.GetAttributeString("target"), avd.InstallFolder); } else if (type == "enviroment") { add(x.GetAttributeString("target"), Environment.GetEnvironmentVariable(x.GetFirstText())); } else if (type == "version") { addVersion(avd, x.GetAttributeString("for"), x.GetAttributeString("version").ToLower()); } else if (type == "external") { add(avd.externals.get(x.GetAttributeString("ui"), x.GetAttributeString("target"), x.GetAttributeString("description"))); } else { throw new Exception("unknwon autovar " + type); } }