public void Clear() { int x, y; x = theMap.Tiles.GetLength(0); y = theMap.Tiles.GetLength(1); theMap = new AMap(); theMap.Tiles = MapCreator.CreateMap(x, y); theMap.TheTheseus = null; theMap.TheMinotaur = null; }
//string allMaps) public void ParseMap() { string[] newMap, temp; temp = fileContents.Split(new char[] { '$' }, StringSplitOptions.RemoveEmptyEntries); foreach (string str in temp) { AMap newEntry = new AMap(); newMap = str.Split(new char[] { '%' }); newEntry.Name = newMap[0]; newEntry.Map = ToStringArray(newMap[1]); originalMaps.Add(newEntry); } }
internal void Init(AMap newMap) { /*** * Initialise map variables - width & height * */ theMap = newMap; int length; mapArray = theMap.Map; length = mapArray[0].Length; x = (length - 1) / 4; y = (mapArray.Length - 1) / 2; Console.WriteLine("x = {0}, y = {1}", x, y); newMap.Tiles = MapCreator.CreateMap(x, y); }
public bool TestCompressedL1(string theFile) { string newFile = LoadTextFile(theFile); string[] strArray; if (decompressor == null) { decompressor = new Decompressor(); } decompressor.SetCompressed(newFile); try { decompressor.SeparateToArrays(); } catch (IndexOutOfRangeException) { return false; } try { decompressor.DecompressLevel1(); } catch (Exception) { return false; } try { decompressor.SetCharacters(); } catch (Exception) { return false; } strArray = decompressor.GetLevel1Result(); AMap newMap = new AMap(); if (bridger == null) { bridger = new Bridger(); } bridger.Init(newMap); if (!bridger.IsValid()) { return false; } try { bridger.Convert(newMap); } catch (IndexOutOfRangeException) { return false; } return true; }
public bool TestCompressedLevel2(string theFile) { string newFile = LoadTextFile(theFile); string[] strArray; if (decompressor == null) { decompressor = new Decompressor(); } try { strArray = decompressor.GetTheMap(newFile); } catch (Exception) { return false; } AMap newMap = new AMap(); if (bridger == null) { bridger = new Bridger(); } bridger.Init(newMap); if (!bridger.IsValid()) { return false; } try { bridger.Convert(newMap); } catch (IndexOutOfRangeException) { return false; } return true; }
public AMap LoadUserMap(string path) { if (decompressor == null) { decompressor = new Decompressor(); } AMap newMap = new AMap(); string compressed; newMap.Name = Path.GetFileNameWithoutExtension(path); compressed = File.ReadAllText(path); //Console.WriteLine("{0}, {1}", newMap.Name, compressed); newMap.Map = decompressor.GetTheMap(compressed); return newMap; }
public void SetMap(int theList, string mapName) { var m = (from map in allMaps[theList] where map.Name == mapName select map).Single(); //theMap = m; if (bridger == null) { bridger = new Bridger(); } theMap = bridger.Convert(m); }
public void LoadUserMap(AMap theMap) { builder = new LevelBuilder(); mediaPath = Painter.SetMediaPath(); builder.LoadUserMap(theMap); tbxMapName.Text = theMap.Name; //Painter.SetPanelSize( //SetPanelSize(); Draw(); //RenderCharacters(); }
public void LoadOriginalMaps() { if (decompressor == null) { decompressor = new Decompressor(); } originalMaps = new List<AMap> { }; List<string[]> uncompressedMaps; loader = new Loader(); loader.LoadMultiple(originalMapsLocation); uncompressedMaps = loader.ParseMap2(); foreach (string[] map in uncompressedMaps) { AMap newEntry = new AMap(); newEntry.Name = map[0]; newEntry.Map = decompressor.GetTheMap(map[1]); originalMaps.Add(newEntry); } /*foreach (AMap map in originalMaps) { Console.WriteLine("name: {0}\n", map.Name); foreach (string str in map.Map) { Console.WriteLine(str); } }*/ }
public void LoadUserMap(AMap userMap) { theMap = userMap; theseus = userMap.TheTheseus; minotaur = userMap.TheMinotaur; mapName = userMap.Name; horizontal = userMap.Tiles.GetLength(0) - 1; vertical = userMap.Tiles.GetLength(1) - 1; }
public AMap Convert(AMap theMap) { Init(theMap); ObjectifyMap(); return theMap; }
public bool TestCompressedLevel2(string theFile) { string newFile = LoadTextFile(theFile); string[] strArray = loader.ParseSingleMap(newFile); foreach (string s in strArray) { Console.WriteLine(s + "."); } string[] mapArray; if (decompressor == null) { decompressor = new Decompressor(); } try { decompressor.GetTheMap(strArray[1]); } catch (Exception) { Console.WriteLine("1"); return false; } AMap newMap = new AMap(); newMap.Name = strArray[0]; newMap.Map = decompressor.GetTheMap(strArray[1]); if (bridger == null) { bridger = new Bridger(); } try { bridger.Convert(newMap); //bridger.Init(newMap); } catch (Exception) { Console.WriteLine("2"); return false; } return true; }
//(int newHorizontal, int newVertical) public void Init(Point newDimensions) { theMap = new AMap(); horizontal = (newDimensions.X) - 1; vertical = (newDimensions.Y) - 1; theMap.Tiles = MapCreator.CreateMap(newDimensions.X, newDimensions.Y); }
public bool TestCompressedL1(string theFile) { string newFile = LoadTextFile(theFile); string[] strArray; if (decompressor == null) { decompressor = new Decompressor(); } decompressor.SetCompressed(newFile); try { decompressor.SeparateToArrays(); } catch (Exception) { Console.WriteLine("1"); return false; } try { decompressor.DecompressLevel1(); } catch (Exception) { Console.WriteLine("2"); return false; } try { decompressor.SetCharacters(); } catch (Exception) { Console.WriteLine("3"); return false; } strArray = decompressor.GetLevel1Result(); AMap newMap = new AMap(); newMap.Map = strArray; if (bridger == null) { bridger = new Bridger(); } try { bridger.Convert(newMap); //bridger.Init(newMap); } catch (Exception) { Console.WriteLine("4"); return false; } return true; }
public AMap ReturnImportedMap(string theFile) { AMap newMap = new AMap(); if (bridger == null) { bridger = new Bridger(); } if (TestCompressedLevel2(theFile)) { string[] temp = loader.ParseSingleMap(LoadTextFile(theFile)); newMap.Name = temp[0]; newMap.Map = decompressor.GetTheMap(temp[1]); newMap = bridger.Convert(newMap); return newMap; } else if (TestCompressedL1(theFile)) { decompressor.SetCompressed(LoadTextFile(theFile)); decompressor.SeparateToArrays(); decompressor.DecompressLevel1(); decompressor.SetCharacters(); newMap.Map = decompressor.GetLevel1Result(); newMap = bridger.Convert(newMap); return newMap; } else { newMap.Map = loader.ToStringArray(LoadTextFile(theFile)); newMap = bridger.Convert(newMap); return newMap; } }
public void SetMap(AMap newMap) { mapName = newMap.Name; theMap = newMap.Map; }
public bool TestUncompressed(string theFile) { string str = LoadTextFile(theFile); string[] strArray; if (loader == null) { loader = new Loader(); } strArray = loader.ToStringArray(str); AMap newMap = new AMap(); if (bridger == null) { bridger = new Bridger(); } bridger.Init(newMap); if (!bridger.IsValid()) { return false; } try { bridger.Convert(newMap); } catch (IndexOutOfRangeException) { return false; } return true; }
public void LoadUserMap(AMap theMap) { builder = new LevelBuilder(); mediaPath = @"H:\2015\semester 2\PR 283 C#\Theseus\TheseusFormed - Test\media"; builder.LoadUserMap(theMap); tbxMapName.Text = theMap.Name; //Painter.SetPanelSize( //SetPanelSize(); Draw(); //RenderCharacters(); }
public void SetMap() { currentMap = theFiler.GetMap(); theMap = currentMap.Tiles; SetTheseus(); SetMinotaur(); SetTiles(); }
public bool TestCompressedL1(string theFile) { string newFile = LoadTextFile(theFile); string[] strArray; if (decompressor == null) { decompressor = new Decompressor(); } decompressor.SetCompressed(newFile); try { decompressor.SeparateToArrays(); } catch (Exception) { Console.WriteLine("1"); return(false); } try { decompressor.DecompressLevel1(); } catch (Exception) { Console.WriteLine("2"); return(false); } try { decompressor.SetCharacters(); } catch (Exception) { Console.WriteLine("3"); return(false); } strArray = decompressor.GetLevel1Result(); AMap newMap = new AMap(); newMap.Map = strArray; if (bridger == null) { bridger = new Bridger(); } try { bridger.Convert(newMap); //bridger.Init(newMap); } catch (Exception) { Console.WriteLine("4"); return(false); } return(true); }
public void SetMap(AMap newMap) { theMap = newMap; theTiles = theMap.Tiles; theseus = theMap.TheTheseus; checkedTiles = new List<Tile>(); possibleTiles = new List<Tile>(); //checkedTiles.Add(theTiles[theseus.Coordinate.X, theseus.Coordinate.Y]); }
public void SetMap(AMap newMap) { theMap = newMap; }
public void OpenExistingBuilder(AMap theMap) { this.KeyPreview = true; //if (frmBuilder == null) //{ frmBuilder = new FrmDesigner(); frmBuilder.MdiParent = this; frmBuilder.SetParentForm(this); frmBuilder.LoadUserMap(theMap); SetFormProperties(frmBuilder); SetSizeManually(frmBuilder, frmBuilder.GetSize()); frmBuilder.Show(); frmBuilder.BringToFront(); }