public static void LoadAllBios() { foreach (PawnBio current in DirectXmlLoader.LoadXmlDataInResourcesFolder <PawnBio>("Backstories/Solid")) { current.name.ResolveMissingPieces(null); if (current.childhood == null || current.adulthood == null) { PawnNameDatabaseSolid.AddPlayerContentName(current.name, current.gender); } else { current.PostLoad(); current.ResolveReferences(); foreach (string current2 in current.ConfigErrors()) { Log.Error(current2, false); } SolidBioDatabase.allBios.Add(current); current.childhood.shuffleable = false; current.childhood.slot = BackstorySlot.Childhood; current.adulthood.shuffleable = false; current.adulthood.slot = BackstorySlot.Adulthood; BackstoryHardcodedData.InjectHardcodedData(current); BackstoryDatabase.AddBackstory(current.childhood); BackstoryDatabase.AddBackstory(current.adulthood); } } }
public static void LoadAllBios() { foreach (PawnBio item in DirectXmlLoader.LoadXmlDataInResourcesFolder <PawnBio>("Backstories/Solid")) { item.name.ResolveMissingPieces(null); if (item.childhood == null || item.adulthood == null) { PawnNameDatabaseSolid.AddPlayerContentName(item.name, item.gender); } else { item.PostLoad(); item.ResolveReferences(); foreach (string item2 in item.ConfigErrors()) { Log.Error(item2); } SolidBioDatabase.allBios.Add(item); item.childhood.shuffleable = false; item.childhood.slot = BackstorySlot.Childhood; item.adulthood.shuffleable = false; item.adulthood.slot = BackstorySlot.Adulthood; BackstoryHardcodedData.InjectHardcodedData(item); BackstoryDatabase.AddBackstory(item.childhood); BackstoryDatabase.AddBackstory(item.adulthood); } } }
public static void LoadAllBios() { foreach (PawnBio pawnBio in DirectXmlLoader.LoadXmlDataInResourcesFolder <PawnBio>("Backstories/Solid")) { pawnBio.name.ResolveMissingPieces(null); if (pawnBio.childhood == null || pawnBio.adulthood == null) { PawnNameDatabaseSolid.AddPlayerContentName(pawnBio.name, pawnBio.gender); } else { pawnBio.PostLoad(); pawnBio.ResolveReferences(); foreach (string text in pawnBio.ConfigErrors()) { Log.Error(text, false); } SolidBioDatabase.allBios.Add(pawnBio); pawnBio.childhood.shuffleable = false; pawnBio.childhood.slot = BackstorySlot.Childhood; pawnBio.adulthood.shuffleable = false; pawnBio.adulthood.slot = BackstorySlot.Adulthood; BackstoryHardcodedData.InjectHardcodedData(pawnBio); BackstoryDatabase.AddBackstory(pawnBio.childhood); BackstoryDatabase.AddBackstory(pawnBio.adulthood); } } }
public Dialog_AddPreferredName() { this.doCloseButton = true; this.absorbInputAroundWindow = true; this.cachedNames = (from n in (from b in SolidBioDatabase.allBios select b.name).Concat(PawnNameDatabaseSolid.AllNames()) orderby n.Last descending select n).ToList <NameTriple>(); }
public static NameTriple TryGetRandomUnusedSolidName(Gender gender, string requiredLastName = null) { NameTriple nameTriple = null; if (Rand.Value < 0.5f) { nameTriple = Prefs.RandomPreferredName(); if (nameTriple != null && (nameTriple.UsedThisGame || (requiredLastName != null && nameTriple.Last != requiredLastName))) { nameTriple = null; } } List <NameTriple> listForGender = PawnNameDatabaseSolid.GetListForGender(GenderPossibility.Either); List <NameTriple> list = (gender != Gender.Male) ? PawnNameDatabaseSolid.GetListForGender(GenderPossibility.Female) : PawnNameDatabaseSolid.GetListForGender(GenderPossibility.Male); float num = ((float)listForGender.Count + 0.1f) / ((float)(listForGender.Count + list.Count) + 0.1f); List <NameTriple> list2; if (Rand.Value < num) { list2 = listForGender; } else { list2 = list; } NameTriple result; if (list2.Count == 0) { Log.Error("Empty solid pawn name list for gender: " + gender + ".", false); result = null; } else if (nameTriple != null && list2.Contains(nameTriple)) { result = nameTriple; } else { list2.Shuffle <NameTriple>(); NameTriple nameTriple2 = (from name in list2 where (requiredLastName == null || !(name.Last != requiredLastName)) && !name.UsedThisGame select name).FirstOrDefault <NameTriple>(); result = nameTriple2; } return(result); }
public static NameTriple TryGetRandomUnusedSolidName(Gender gender, string requiredLastName = null) { NameTriple nameTriple = null; if (Rand.Value < 0.5f) { nameTriple = Prefs.RandomPreferredName(); if (nameTriple != null && (nameTriple.UsedThisGame || (requiredLastName != null && nameTriple.Last != requiredLastName))) { nameTriple = null; } } List <NameTriple> listForGender = PawnNameDatabaseSolid.GetListForGender(GenderPossibility.Either); List <NameTriple> list = (gender != Gender.Male) ? PawnNameDatabaseSolid.GetListForGender(GenderPossibility.Female) : PawnNameDatabaseSolid.GetListForGender(GenderPossibility.Male); float num = ((float)listForGender.Count + 0.1f) / ((float)(listForGender.Count + list.Count) + 0.1f); List <NameTriple> list2 = (!(Rand.Value < num)) ? list : listForGender; if (list2.Count == 0) { Log.Error("Empty solid pawn name list for gender: " + gender + "."); return(null); } if (nameTriple != null && list2.Contains(nameTriple)) { return(nameTriple); } list2.Shuffle(); return(list2.Where(delegate(NameTriple name) { if (requiredLastName != null && name.Last != requiredLastName) { return false; } if (name.UsedThisGame) { return false; } return true; }).FirstOrDefault()); }
public static NameTriple TryGetRandomUnusedSolidName(Gender gender, string requiredLastName = null) { List <NameTriple> listForGender = PawnNameDatabaseSolid.GetListForGender(GenderPossibility.Either); List <NameTriple> list = ((gender == Gender.Male) ? PawnNameDatabaseSolid.GetListForGender(GenderPossibility.Male) : PawnNameDatabaseSolid.GetListForGender(GenderPossibility.Female)); float num = ((float)listForGender.Count + 0.1f) / ((float)(listForGender.Count + list.Count) + 0.1f); List <NameTriple> list2 = ((!(Rand.Value < num)) ? list : listForGender); if (list2.Count == 0) { Log.Error(string.Concat("Empty solid pawn name list for gender: ", gender, ".")); return(null); } if (Rand.Value < 0.5f) { tmpNames.Clear(); tmpNames.AddRange(Prefs.PreferredNames); tmpNames.Shuffle(); foreach (string tmpName in tmpNames) { NameTriple nameTriple = NameTriple.FromString(tmpName); if (list2.Contains(nameTriple) && !nameTriple.UsedThisGame && (requiredLastName == null || !(nameTriple.Last != requiredLastName))) { return(nameTriple); } } } list2.Shuffle(); return(list2.Where(delegate(NameTriple name) { if (requiredLastName != null && name.Last != requiredLastName) { return false; } return (!name.UsedThisGame) ? true : false; }).FirstOrDefault()); }
public Dialog_AddPreferredName() { doCloseButton = true; absorbInputAroundWindow = true; cachedNames = (from n in SolidBioDatabase.allBios.Select((PawnBio b) => b.name).Concat(PawnNameDatabaseSolid.AllNames()) orderby n.Last descending select n).ToList(); }