private static void DrawPawnSituationLabel(Pawn pawn, Rect rect, Pawn selPawnForSocialInfo) { GUI.color = Color.gray; string label = SocialCardUtility.GetPawnSituationLabel(pawn, selPawnForSocialInfo).Truncate(rect.width, null); Widgets.Label(rect, label); }
private static string GetPawnRowTooltip(SocialCardUtility.CachedSocialTabEntry entry, Pawn selPawnForSocialInfo) { StringBuilder stringBuilder = new StringBuilder(); if (entry.otherPawn.RaceProps.Humanlike && selPawnForSocialInfo.RaceProps.Humanlike) { stringBuilder.AppendLine(selPawnForSocialInfo.relations.OpinionExplanation(entry.otherPawn)); stringBuilder.AppendLine(); stringBuilder.Append("SomeonesOpinionOfMe".Translate(new object[] { entry.otherPawn.LabelShort })); stringBuilder.Append(": "); stringBuilder.Append(entry.opinionOfMe.ToStringWithSign()); } else { stringBuilder.AppendLine(entry.otherPawn.LabelCapNoCount); string pawnSituationLabel = SocialCardUtility.GetPawnSituationLabel(entry.otherPawn, selPawnForSocialInfo); if (!pawnSituationLabel.NullOrEmpty()) { stringBuilder.AppendLine(pawnSituationLabel); } stringBuilder.AppendLine("--------------"); stringBuilder.Append(SocialCardUtility.GetRelationsString(entry, selPawnForSocialInfo)); } if (Prefs.DevMode) { stringBuilder.AppendLine(); stringBuilder.AppendLine("(debug) Compatibility: " + selPawnForSocialInfo.relations.CompatibilityWith(entry.otherPawn).ToString("F2")); stringBuilder.Append("(debug) RomanceChanceFactor: " + selPawnForSocialInfo.relations.SecondaryRomanceChanceFactor(entry.otherPawn).ToString("F2")); } return(stringBuilder.ToString()); }
public string OpinionExplanation(Pawn other) { if (other.RaceProps.Humanlike && this.pawn != other) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("OpinionOf".Translate(other.LabelShort) + ": " + this.OpinionOf(other).ToStringWithSign()); string pawnSituationLabel = SocialCardUtility.GetPawnSituationLabel(other, this.pawn); if (!pawnSituationLabel.NullOrEmpty()) { stringBuilder.AppendLine(pawnSituationLabel); } stringBuilder.AppendLine("--------------"); bool flag = false; if (this.pawn.Dead) { stringBuilder.AppendLine("IAmDead".Translate()); flag = true; } else { IEnumerable <PawnRelationDef> relations = this.pawn.GetRelations(other); foreach (PawnRelationDef item in relations) { stringBuilder.AppendLine(item.GetGenderSpecificLabelCap(other) + ": " + item.opinionOffset.ToStringWithSign()); flag = true; } if (this.pawn.RaceProps.Humanlike) { ThoughtHandler thoughts = this.pawn.needs.mood.thoughts; thoughts.GetDistinctSocialThoughtGroups(other, Pawn_RelationsTracker.tmpSocialThoughts); for (int i = 0; i < Pawn_RelationsTracker.tmpSocialThoughts.Count; i++) { ISocialThought socialThought = Pawn_RelationsTracker.tmpSocialThoughts[i]; int num = 1; Thought thought = (Thought)socialThought; if (thought.def.IsMemory) { num = thoughts.memories.NumMemoriesInGroup((Thought_MemorySocial)socialThought); } stringBuilder.Append(thought.LabelCapSocial); if (num != 1) { stringBuilder.Append(" x" + num); } stringBuilder.AppendLine(": " + thoughts.OpinionOffsetOfGroup(socialThought, other).ToStringWithSign()); flag = true; } } List <Hediff> hediffs = this.pawn.health.hediffSet.hediffs; for (int j = 0; j < hediffs.Count; j++) { HediffStage curStage = hediffs[j].CurStage; if (curStage != null && curStage.opinionOfOthersFactor != 1.0) { stringBuilder.Append(hediffs[j].LabelBase.CapitalizeFirst()); if (curStage.opinionOfOthersFactor != 0.0) { stringBuilder.AppendLine(": x" + curStage.opinionOfOthersFactor.ToStringPercent()); } else { stringBuilder.AppendLine(); } flag = true; } } if (this.pawn.HostileTo(other)) { stringBuilder.AppendLine("Hostile".Translate()); flag = true; } } if (!flag) { stringBuilder.AppendLine("NoneBrackets".Translate()); } return(stringBuilder.ToString().TrimEndNewlines()); } return(string.Empty); }