static bool Prefix(ref Verse.Name __result, Pawn pawn, NameStyle style = NameStyle.Full, string forcedLastName = null) { FemaleNames nameGenF = new FemaleNames(); MaleNames nameGenM = new MaleNames(); NameTriple temp = pawn.Name as NameTriple; if (pawn.RaceProps.Animal && pawn.Name == null) { //這裡就走原生的路線 // __result = new NameTriple("小","動","物") ; return(true); } if (pawn.gender == Gender.Female) { __result = nameGenF.GetChineseFemaleName(pawn); } else { __result = nameGenM.GetChineseMaleName(pawn); } return(false); }
public void SetRandomNewName() { if (Gender == Gender.Female) { Name = FemaleNames.GetRandomName(); } else { Name = MaleNames.GetRandomName(); } }
static bool Prefix(Pawn namer, Pawn namee) { FemaleNames nameGenF = new FemaleNames(); MaleNames nameGenM = new MaleNames(); string value = (namee.Name == null) ? namee.LabelIndefinite() : namee.Name.ToStringFull; NameTriple tempName = namee.gender == Gender.Male ? nameGenM.GetChineseMaleName(namee) : nameGenF.GetChineseFemaleName(namee); namee.Name = new NameSingle(tempName.Nick); if (namer.Faction == Faction.OfPlayer) { Messages.Message("MessageNuzzledPawnGaveNameTo".Translate(namer.Named("NAMER"), value, namee.Name.ToStringFull, namee.Named("NAMEE")), namee, MessageTypeDefOf.NeutralEvent); } return(false); }
static bool Prefix(ref Verse.Name __result, Gender gender, string requiredLastName = null) { FemaleNames nameGenF = new FemaleNames(); MaleNames nameGenM = new MaleNames(); "Harvest".Translate(); if (gender == Gender.Female) { __result = nameGenF.GetChineseFemaleName(null); } else { __result = nameGenM.GetChineseMaleName(null); } // 用Find去找資料 Find.CurrentMap return(false); }
public NameProvider() { var fileData = Task.Run(async() => new { FemaleNames = await ReadLinesAsync(Paths.Names.Female), MaleNames = await ReadLinesAsync(Paths.Names.Male), LastNames = await ReadLinesAsync(Paths.Names.Last) }).Result; FemaleNames = fileData.FemaleNames; MaleNames = fileData.MaleNames; GenderAmbiguousNames = MaleNames.Intersect(FemaleNames).WithComparer(OrdinalIgnoreCase); LastNames = fileData.LastNames; var stratified = from m in MaleNames.Select((name, i) => new { Rank = (double)i / MaleNames.Count, Name = name }) join f in FemaleNames.Select((name, i) => new { Rank = (double)i / FemaleNames.Count, Name = name }) on m.Name equals f.Name group f.Name by f.Rank / m.Rank > 1 ? 'F' : m.Rank / f.Rank > 1 ? 'M' : 'U'; var byLikelyGender = stratified.ToDictionary(strata => strata.Key); MaleNames = MaleNames.Except(byLikelyGender['F']); FemaleNames = FemaleNames.Except(byLikelyGender['M']); }
/// <summary> /// Returns a value indicating whether the provided string corresponds to a common male /// name in the English language. Lookups are performed in a case insensitive manner and /// currently do not respect plurality. /// </summary> /// <param name="text">The Name to lookup</param> /// <returns> /// <c>true</c> if the provided string corresponds to a common male name in the English /// language; otherwise, <c>false</c>. /// </returns> public bool IsMaleFirst(string text) => MaleNames.Contains(text);
/// <summary> /// Determines if provided text is in the set of Female or Male first names. /// </summary> /// <param name="text">The text to check.</param> /// <returns> /// <c>true</c> if the provided text is in the set of Female or Male first names; /// otherwise, <c>false</c>. /// </returns> public bool IsFirstName(string text) => FemaleNames.Count > MaleNames.Count ? MaleNames.Contains(text) || FemaleNames.Contains(text) : FemaleNames.Contains(text) || MaleNames.Contains(text);