static void Main(string[] args) { var path = "C:\\Users\\Corstiaan\\Desktop\\barricade_normaal.bar"; if (File.Exists(path)) { BarricadePersistence bp = new BarricadePersistence(path); bp.ParseBarFile(); Cell[,] map = bp.Map; for (int i = 0; i < map.GetLength(0); i++) { string tmp = ""; bool village = false; bool protectedrow = true; for (int j = 0; j < map.GetLength(1); j++) { Cell c = map[i, j]; if (c == null) tmp += " "; else { tmp += c.TextualRepresentation; village = c.ShouldEntityMoveToForestWhenHit; protectedrow = c.IsOccupiableByBarricade; } } if (protectedrow) tmp = "N " + tmp; else tmp = "B " + tmp; if (village) tmp = "1" + tmp; else tmp = "1" + tmp; System.Console.WriteLine(tmp); } } System.Console.ReadLine(); }
internal void StartGame(string filename) { BarricadePersistence persistence = new BarricadePersistence(filename); persistence.ParseBarFile(); _cellsInternal = new ObservableCollection<CellViewModel>(CellToCellViewModelConverter.ConvertToCellViewModels(persistence.Map)); foreach (CellViewModel vm in _cellsInternal) { vm.GameWon += vm_GameWon; } this.Cells = new ReadOnlyObservableCollection<CellViewModel>(_cellsInternal); this.GameStateManager = persistence.StateManager; this.GameStateManager.DiceThrowEvent += GameStateManager_DiceThrowEvent; RaisePropertyChanged(() => GameStateManager); GameStateManager.toNextPlayer(); IsDiceThrowable = true; }