/// <summary> /// Call to the Engine to Start the First Round /// </summary> // Start a round, clear lists public void StartRound() { BattleEngine.StartRound(); FightingMonsters.Clear(); foreach (var data in BattleEngine.MonsterList) { FightingMonsters.Add(new Monster(data)); } }
// Command that Loads the Data private async Task ExecuteLoadDataCommand() { if (IsBusy) { return; } IsBusy = true; try { // SelectedCharacters, no need to change them. // Reload the Character List from the Character View Moel AvailableCharacters.Clear(); var availableCharacters = CharactersViewModel.Instance.Dataset; foreach (var data in availableCharacters) { AvailableCharacters.Add(data); } //for refreshing characters and monsters on battle main page SelectedCharacters.Clear(); var selectedChars = BattleEngine.CharacterList; foreach (var data in selectedChars) { SelectedCharacters.Add(data); } FightingMonsters.Clear(); var fightingMonsters = BattleEngine.MonsterList; foreach (var data in fightingMonsters) { FightingMonsters.Add(data); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
// Used to sync observables to actual public void SyncMonsterAndCharacterLists() { FightingMonsters.Clear(); // Add monsters to battle foreach (var monster in BattleEngine.MonsterList) { FightingMonsters.Add(monster); } SelectedCharacters.Clear(); // Add characters to battle foreach (var character in BattleEngine.CharacterList) { SelectedCharacters.Add(character); } return; }