private IRace RandomRace() { var random = new Random(); int index = random.Next(IRace.allRaces.Count); return(IRace.FactoryMethod(IRace.allRaces[index].Name)); }
private void RaceSpecs(object sender, RoutedEventArgs e) { if (lCharacterRace.SelectedValue is null) { return; } string item = (string)lCharacterRace.SelectedValue; IRace selectedRace = IRace.FactoryMethod(item); MessageBox.Show(selectedRace.ToString()); }
private void RaceChange(object sender, SelectionChangedEventArgs e) { if (lCharacterRace.SelectedValue.Equals(null)) { UpdateEnabledClassSkillsComboBoxes(); } else if (!lCharacterRace.SelectedValue.Equals(null)) { selectedRace = IRace.FactoryMethod(lCharacterRace.SelectedValue.ToString()); UpdateEnabledClassSkillsComboBoxes(); if (selectedRace is BaseDwarf) { ArtisanToolsLabel.Visibility = Visibility.Visible; ArtisanTools.IsEnabled = true; ArtisanTools.Visibility = Visibility.Visible; ExtraLanguageLabel.Visibility = Visibility.Hidden; ExtraLanguage.IsEnabled = false; ExtraLanguage.Visibility = Visibility.Hidden; ExtraLanguage.SelectedIndex = -1; RaceProfLabel.Visibility = Visibility.Hidden; RaceProf1.IsEnabled = false; RaceProf2.IsEnabled = false; RaceProf1.Visibility = Visibility.Hidden; RaceProf2.Visibility = Visibility.Hidden; RaceProf1.SelectedIndex = -1; RaceProf2.SelectedIndex = -1; selectedRaceProfs.Clear(); } else if (selectedRace is HighElf || selectedRace is BaseHuman) { ArtisanToolsLabel.Visibility = Visibility.Hidden; ArtisanTools.IsEnabled = false; ArtisanTools.Visibility = Visibility.Hidden; ArtisanTools.SelectedIndex = -1; ExtraLanguageLabel.Visibility = Visibility.Visible; ExtraLanguage.IsEnabled = true; ExtraLanguage.Visibility = Visibility.Visible; ExtraLanguage.ItemsSource = CharacterController.allLanguages.Except(selectedRace.RaceLanguages); RaceProfLabel.Visibility = Visibility.Hidden; RaceProf1.IsEnabled = false; RaceProf2.IsEnabled = false; RaceProf1.Visibility = Visibility.Hidden; RaceProf2.Visibility = Visibility.Hidden; RaceProf1.SelectedIndex = -1; RaceProf2.SelectedIndex = -1; selectedRaceProfs.Clear(); } else if (selectedRace is HalfElf) { ArtisanToolsLabel.Visibility = Visibility.Hidden; ArtisanTools.IsEnabled = false; ArtisanTools.Visibility = Visibility.Hidden; ArtisanTools.SelectedIndex = -1; ExtraLanguageLabel.Visibility = Visibility.Hidden; ExtraLanguage.IsEnabled = false; ExtraLanguage.Visibility = Visibility.Hidden; ExtraLanguage.SelectedIndex = -1; RaceProfLabel.Visibility = Visibility.Visible; RaceProf1.IsEnabled = true; RaceProf2.IsEnabled = true; RaceProf1.ItemsSource = CharacterController.allSkills.Except(selectedRace.RaceProficiencies); RaceProf2.ItemsSource = RaceProf1.ItemsSource; RaceProf1.Visibility = Visibility.Visible; RaceProf2.Visibility = Visibility.Visible; } else { ArtisanToolsLabel.Visibility = Visibility.Hidden; ArtisanTools.IsEnabled = false; ArtisanTools.Visibility = Visibility.Hidden; ArtisanTools.SelectedIndex = -1; ExtraLanguageLabel.Visibility = Visibility.Hidden; ExtraLanguage.IsEnabled = false; ExtraLanguage.Visibility = Visibility.Hidden; ExtraLanguage.SelectedIndex = -1; RaceProfLabel.Visibility = Visibility.Hidden; RaceProf1.IsEnabled = false; RaceProf2.IsEnabled = false; RaceProf1.Visibility = Visibility.Hidden; RaceProf2.Visibility = Visibility.Hidden; RaceProf1.SelectedIndex = -1; RaceProf2.SelectedIndex = -1; selectedRaceProfs.Clear(); } } }