// overload so we can pass in a race or not? public ICivilization GenerateSingle(IRace race) { // TODO: needs shit like "Kingdom" or "Empire" and whatnot to prepend onto these names string civName = ""; switch (race.GetType().Name.ToLower()) { case "humans": civName = Names.SingleName(CoreEnums.Word.HumanMale); break; case "elves": civName = Names.SingleName(CoreEnums.Word.ElfPlace); break; case "dwarves": default: civName = Names.SingleName(CoreEnums.Word.DwarfFemale); break; } ICivilization civilization = new Civilization { Id = Random.Next(0, 676786760), // TODO: this is database related shit Name = civName, Description = "CIVDESCRIPTION", Race = race, RegionsOwned = new List<IRegion>(), PopulationCenters = new List<IPopulationCenters>(), TotalPopulation = new List<IPerson>() }; return civilization; }
private void Next(object sender, RoutedEventArgs e) { string err_msg = "Fill in all empty fields."; if ((selectedClass is null || selectedRace is null) || (selectedRace.GetType() == typeof(IRace) || selectedClass.GetType() == typeof(IClass)) || (ArtisanTools.IsVisible && ArtisanTools.SelectedItem is null) || (ExtraLanguage.IsVisible && ExtraLanguage.SelectedItem is null) || (RaceProf1.IsVisible && (RaceProf1.SelectedItem is null || RaceProf2.SelectedItem is null)) || (ClassSkill1.SelectedItem is null || ClassSkill2.SelectedItem is null) || (ClassSkill3.IsVisible && ClassSkill3.SelectedItem is null) || (ClassSkill4.IsVisible && ClassSkill4.SelectedItem is null)) { MessageBox.Show(err_msg); return; } cc.SetRaceAndClass(selectedRace, selectedClass); cc.AddProficiency(selectedClassProfs.Union(selectedRaceProfs)); if (cc.GetPlayerLevel() > 1) { int ASICount = cc.GreaterLevel(); if (ASICount > 0) { this.NavigationService.Navigate(new CharacterGeneratorASIPage(cc, ASICount)); return; } } // navigate to final screen cc.RollStats(); PlayerSheetWindow playerSheet = new PlayerSheetWindow(cc); playerSheet.Show(); Window window = this.Parent as Window; window.Close(); }
/// <summary> /// 面向抽象编程 /// </summary> /// <param name="race"></param> public void Play(IRace race) { Console.WriteLine("****************************************"); Console.WriteLine($"This is {this.Name} Play War3.{race.GetType().Name}"); }
/// <summary> /// 面向抽象 /// </summary> /// <param name="race"></param> public void PlayWar3(IRace race) { Console.WriteLine("******************************"); Console.WriteLine("This is {0} Play War3.{1}", this.Name, race.GetType().Name); race.ShowKing(); }
private string GetName(IRace race, CoreEnums.Gender gender) { switch (race.GetType().Name.ToLower()) { case "elves": return DiceRollForNames((gender == CoreEnums.Gender.Female) ? CoreEnums.Word.ElfFemale : CoreEnums.Word.ElfMale); case "dwarves": return DiceRollForNames((gender == CoreEnums.Gender.Female) ? CoreEnums.Word.DwarfFemale : CoreEnums.Word.DwarfMale); case "human": default: return DiceRollForNames((gender == CoreEnums.Gender.Female) ? CoreEnums.Word.HumanFemale : CoreEnums.Word.HumanMale); } }
private int DetermineAge(IRace race) { switch(race.GetType().Name.ToLower()) { case "humans": break; case "dwarves": break; default: break; } return 0; }