public void UncompressMap(string data) { if (_cellsInit) { return; } try { this.mMatrix = new Cell[this.Map.Width, this.Map.Height]; Dictionary <int, Cell> cells = new Dictionary <int, Cell>(); int loc11 = data.Length; int loc13 = 0; int loc14 = 0; while (loc14 < loc11) { try { Cell loc12 = UncompressCell(data.Substring(loc14, 10), loc13); cells.Add(loc13, loc12); if (loc12.layerObject2Num != 0 && loc12.layerObject2Interactive == 1)//If a interactive object { var ioObj = new World.Game.IO.InteractiveObject (this.Map, (Enums.InteractiveObjectEnum)loc12.layerObject2Num, loc12.ID, World.Game.IO.InteractiveObjectState.FULL, true); this.InteractiveObjects.Add(loc12.ID, ioObj); } } catch (Exception e) { //Utilities.ConsoleStyle.Error("Can't decompress cell : " + e.ToString()); } loc14 += 10; loc13 += 1; } this.Cells = cells; } catch (Exception e) { Utilities.ConsoleStyle.Error("Cant decompress map id '" + this.Map.ID + "' because : " + e.ToString()); } finally { this._cellsInit = true; } try { this.Spawner.GenerateAllGroups(); }catch (Exception e) { Utilities.ConsoleStyle.Error("Cant init spawner in map id '" + this.Map.ID + "' because : " + e.ToString()); } try { //this.SetupAStartPathfinding(); } catch (Exception e) { Utilities.ConsoleStyle.Error("Cant init pathfinding astar engine : " + e.ToString()); } }
public void UncompressMap(string data) { if (_cellsInit) return; try { this.mMatrix = new Cell[this.Map.Width, this.Map.Height]; Dictionary<int, Cell> cells = new Dictionary<int, Cell>(); int loc11 = data.Length; int loc13 = 0; int loc14 = 0; while (loc14 < loc11) { try { Cell loc12 = UncompressCell(data.Substring(loc14, 10), loc13); cells.Add(loc13, loc12); if (loc12.layerObject2Num != 0 && loc12.layerObject2Interactive == 1)//If a interactive object { var ioObj = new World.Game.IO.InteractiveObject (this.Map, (Enums.InteractiveObjectEnum)loc12.layerObject2Num, loc12.ID, World.Game.IO.InteractiveObjectState.FULL, true); this.InteractiveObjects.Add(loc12.ID, ioObj); } } catch (Exception e) { //Utilities.ConsoleStyle.Error("Can't decompress cell : " + e.ToString()); } loc14 += 10; loc13 += 1; } this.Cells = cells; } catch (Exception e) { Utilities.ConsoleStyle.Error("Cant decompress map id '" + this.Map.ID + "' because : " + e.ToString()); } finally { this._cellsInit = true; } try { this.Spawner.GenerateAllGroups(); }catch(Exception e) { Utilities.ConsoleStyle.Error("Cant init spawner in map id '" + this.Map.ID + "' because : " + e.ToString()); } try { //this.SetupAStartPathfinding(); } catch (Exception e) { Utilities.ConsoleStyle.Error("Cant init pathfinding astar engine : " + e.ToString()); } }