public void buildTilesetForOgmo1() //string LevelFile, string Tiles { //push width / height to flxg.levelheight; Dictionary <string, string> w = FlxXMLReader.readAttributesFromOelFile("Lemonade/levels/slf/level1.oel", "level/width"); FlxG.levelWidth = Convert.ToInt32(w["width"]); Dictionary <string, string> h = FlxXMLReader.readAttributesFromOelFile("Lemonade/levels/slf/level1.oel", "level/height"); FlxG.levelHeight = Convert.ToInt32(h["height"]); Console.WriteLine("FlxG.lw = {0} {1}", FlxG.levelWidth, FlxG.levelHeight); // ------------------------------------------ List <Dictionary <string, string> > bgString = FlxXMLReader.readNodesFromOel1File("Lemonade/levels/slf/level" + FlxG.level + ".oel", "level/solids"); foreach (Dictionary <string, string> nodes in bgString) { FlxTileblock ta = new FlxTileblock(Convert.ToInt32(nodes["x"]), Convert.ToInt32(nodes["y"]), Convert.ToInt32(nodes["w"]), Convert.ToInt32(nodes["h"])); ta.loadTiles(FlxG.Content.Load <Texture2D>("Lemonade/slf1/level1/level1_tiles"), 10, 10, 0); ta.auto = FlxTileblock.AUTO; collidableTileblocks.add(ta); } }
public void loadOgmo() { Console.WriteLine("Ogmo Loading level {0}", Globals.hole); Dictionary <string, string> ogmo = FlxXMLReader.readAttributesFromOelFile("putt/ogmo/hole" + Globals.hole.ToString() + ".oel", "level/roll"); rollTiles = new FlxTilemap(); rollTiles.loadMap(ogmo["roll"], FlxG.Content.Load <Texture2D>("putt/rollIndicators"), 8, 8); rollTiles.color = new Color(1, 1, 1, 0.8f); //add(rollTiles); // ------------------------------------ string[] cols; string[] rows = ogmo["roll"].Split('\n'); int heightInTiles = rows.Length; int r = 0; //int c; foreach (var item in rows) { int l = 0; cols = rows[r].Split(','); foreach (var x in cols) { if (x != "-1" && x != "-1\r") { //Console.WriteLine("Roll: {0}", x); RollIndicator roll = new RollIndicator(l * 8, r * 8, Convert.ToInt32(x)); add(roll); } l++; } r++; } List <Dictionary <string, string> > levelNodes = FlxXMLReader.readNodesFromOelFile("putt/ogmo/hole" + Globals.hole.ToString() + ".oel", "level/bg"); foreach (Dictionary <string, string> nodes in levelNodes) { //foreach (KeyValuePair<string, string> kvp in nodes) //{ // Console.Write("Key = {0}, Value = {1}, ", // kvp.Key, kvp.Value); //} //Console.Write("\r\n"); if (nodes["Name"] == "hole") { hole.reset(Convert.ToInt32(nodes["x"]), Convert.ToInt32(nodes["y"])); } } }