Пример #1
0
        public Dialog_MessageBox(TaggedString text, string buttonAText = null, Action buttonAAction = null, string buttonBText = null, Action buttonBAction = null, string title = null, bool buttonADestructive = false, Action acceptAction = null, Action cancelAction = null)
        {
            this.text               = text;
            this.buttonAText        = buttonAText;
            this.buttonAAction      = buttonAAction;
            this.buttonADestructive = buttonADestructive;
            this.buttonBText        = buttonBText;
            this.buttonBAction      = buttonBAction;
            this.title              = title;
            this.acceptAction       = acceptAction;
            this.cancelAction       = cancelAction;
            if (buttonAText.NullOrEmpty())
            {
                this.buttonAText = "OK".Translate();
            }
            forcePause = true;
            absorbInputAroundWindow = true;
            creationRealTime        = RealTime.LastRealTime;
            onlyOneOfTypeAllowed    = false;
            bool flag = buttonAAction == null && buttonBAction == null && buttonCAction == null;

            forceCatchAcceptAndCancelEventEvenIfUnfocused = acceptAction != null || cancelAction != null || flag;
            closeOnAccept = flag;
            closeOnCancel = flag;
        }
Пример #2
0
        public virtual void CheckForMouseOverTextAt(float topY)
        {
            float num = (float)UI.screenWidth - 38f - 12f;

            if (!Mouse.IsOver(new Rect(num, topY, 38f, 30f)))
            {
                return;
            }
            Find.LetterStack.Notify_LetterMouseover(this);
            TaggedString mouseoverText = GetMouseoverText();

            if (!mouseoverText.RawText.NullOrEmpty())
            {
                Text.Font   = GameFont.Small;
                Text.Anchor = TextAnchor.UpperLeft;
                float num2 = Text.CalcHeight(mouseoverText, 310f);
                num2 += 20f;
                float x        = num - 330f - 10f;
                Rect  infoRect = new Rect(x, topY - num2 / 2f, 330f, num2);
                Find.WindowStack.ImmediateWindow(2768333, infoRect, WindowLayer.Super, delegate
                {
                    Text.Font     = GameFont.Small;
                    Rect position = infoRect.AtZero().ContractedBy(10f);
                    GUI.BeginGroup(position);
                    Widgets.Label(new Rect(0f, 0f, position.width, position.height), mouseoverText.Resolve());
                    GUI.EndGroup();
                });
            }
        }
Пример #3
0
        protected DiaOption Option_ViewInQuestsTab(string labelKey = "ViewRelatedQuest", bool postpone = false)
        {
            TaggedString taggedString = labelKey.Translate();

            if (title != quest.name)
            {
                taggedString += ": " + quest.name;
            }
            DiaOption diaOption = new DiaOption(taggedString);

            diaOption.action = delegate
            {
                if (quest != null)
                {
                    Find.MainTabsRoot.SetCurrentTab(MainButtonDefOf.Quests);
                    ((MainTabWindow_Quests)MainButtonDefOf.Quests.TabWindow).Select(quest);
                    if (!postpone)
                    {
                        Find.LetterStack.RemoveLetter(this);
                    }
                }
            };
            diaOption.resolveTree = true;
            if (quest == null)
            {
                diaOption.Disable(null);
            }
            return(diaOption);
        }
Пример #4
0
        public static ChoiceLetter MakeLetter(TaggedString label, TaggedString text, LetterDef def, LookTargets lookTargets, Faction relatedFaction = null, Quest quest = null, List <ThingDef> hyperlinkThingDefs = null)
        {
            ChoiceLetter choiceLetter = MakeLetter(label, text, def);

            choiceLetter.lookTargets        = lookTargets;
            choiceLetter.relatedFaction     = relatedFaction;
            choiceLetter.quest              = quest;
            choiceLetter.hyperlinkThingDefs = hyperlinkThingDefs;
            return(choiceLetter);
        }
Пример #5
0
 public static TaggedString TranslateWithBackup(this string key, TaggedString backupKey)
 {
     if (key.TryTranslate(out var result))
     {
         return(result);
     }
     if (TryTranslate(backupKey, out result))
     {
         return(result);
     }
     return(key.Translate());
 }
Пример #6
0
 public TipSignal(TaggedString text)
 {
     if ((string)text == null)
     {
         text = "";
     }
     this.text  = text.Resolve();
     textGetter = null;
     uniqueId   = text.GetHashCode();
     priority   = TooltipPriority.Default;
     delay      = 0.45f;
 }
Пример #7
0
        public static ChoiceLetter MakeLetter(TaggedString label, TaggedString text, LetterDef def, Faction relatedFaction = null, Quest quest = null)
        {
            if (!typeof(ChoiceLetter).IsAssignableFrom(def.letterClass))
            {
                Log.Error(string.Concat(def, " is not a choice letter."));
                return(null);
            }
            ChoiceLetter obj = (ChoiceLetter)MakeLetter(def);

            obj.label          = label;
            obj.text           = text;
            obj.relatedFaction = relatedFaction;
            obj.quest          = quest;
            return(obj);
        }
Пример #8
0
 public DiaNode(DiaNodeMold newDef)
 {
     def      = newDef;
     def.used = true;
     text     = def.texts.RandomElement();
     if (def.optionList.Count > 0)
     {
         foreach (DiaOptionMold option in def.optionList)
         {
             options.Add(new DiaOption(option));
         }
     }
     else
     {
         options.Add(new DiaOption("OK".Translate()));
     }
 }
Пример #9
0
        public override void OpenLetter()
        {
            Pawn         targetPawn   = lookTargets.TryGetPrimaryTarget().Thing as Pawn;
            TaggedString taggedString = base.text;
            string       text         = (from entry in (from entry in Find.BattleLog.Battles.Where((Battle battle) => battle.Concerns(targetPawn)).SelectMany((Battle battle) => battle.Entries.Where((LogEntry entry) => entry.Concerns(targetPawn) && entry.ShowInCompactView()))
                                                        orderby entry.Age
                                                        select entry).Take(5).Reverse()
                                         select "  " + entry.ToGameStringFromPOV(null)).ToLineList();

            if (text.Length > 0)
            {
                taggedString = string.Format("{0}\n\n{1}\n{2}", taggedString, "LastEventsInLife".Translate(targetPawn.LabelDefinite(), targetPawn.Named("PAWN")).Resolve() + ":", text);
            }
            DiaNode diaNode = new DiaNode(taggedString);

            diaNode.options.AddRange(Choices);
            Find.WindowStack.Add(new Dialog_NodeTreeWithFactionInfo(diaNode, relatedFaction, delayInteractivity: false, radioMode, title));
        }
 public bool TryGetTextFromKey(string key, out TaggedString translated)
 {
     if (!dataIsLoaded)
     {
         LoadData();
     }
     if (key == null)
     {
         translated = key;
         return(false);
     }
     if (!keyedReplacements.TryGetValue(key, out var value) || value.isPlaceholder)
     {
         translated = key;
         return(false);
     }
     translated = value.value;
     return(true);
 }
Пример #11
0
 public static bool TryTranslate(this string key, out TaggedString result)
 {
     if (key.NullOrEmpty())
     {
         result = key;
         return(false);
     }
     if (LanguageDatabase.activeLanguage == null)
     {
         Log.Error("No active language! Cannot translate from key " + key + ".");
         result = key;
         return(true);
     }
     if (LanguageDatabase.activeLanguage.TryGetTextFromKey(key, out result))
     {
         return(true);
     }
     result = key;
     return(false);
 }
        private static string GetRoomRoleLabel(Room room)
        {
            Pawn pawn  = null;
            Pawn pawn2 = null;

            foreach (Pawn owner in room.Owners)
            {
                if (pawn == null)
                {
                    pawn = owner;
                }
                else
                {
                    pawn2 = owner;
                }
            }
            TaggedString taggedString = ((pawn == null) ? room.Role.LabelCap : ((pawn2 != null) ? "CouplesRoom".Translate(pawn.LabelShort, pawn2.LabelShort, room.Role.label, pawn.Named("PAWN1"), pawn2.Named("PAWN2")) : "SomeonesRoom".Translate(pawn.LabelShort, room.Role.label, pawn.Named("PAWN"))));

            return(taggedString);
        }
Пример #13
0
 public static TaggedString Truncate(this TaggedString str, float width, Dictionary <string, TaggedString> cache = null)
 {
     if (cache != null && cache.TryGetValue(str.RawText, out TaggedString value))
     {
         return(value);
     }
     if (Text.CalcSize(str.RawText.StripTags()).x < width)
     {
         cache?.Add(str.RawText, str);
         return(str);
     }
     value = str;
     do
     {
         value = value.RawText.Substring(0, value.RawText.Length - 1);
     }while (value.RawText.StripTags().Length > 0 && Text.CalcSize(value.RawText.StripTags() + "...").x > width);
     value += "...";
     cache?.Add(str.RawText, str);
     return(value);
 }
        public void NotifyPlayerOfKilled(DamageInfo?dinfo, Hediff hediff, Caravan caravan)
        {
            TaggedString taggedString = "";

            taggedString = (dinfo.HasValue ? dinfo.Value.Def.deathMessage.Formatted(pawn.LabelShortCap, pawn.Named("PAWN")) : ((hediff == null) ? "PawnDied".Translate(pawn.LabelShortCap, pawn.Named("PAWN")) : "PawnDiedBecauseOf".Translate(pawn.LabelShortCap, hediff.def.LabelCap, pawn.Named("PAWN"))));
            Quest quest = null;

            if (pawn.IsBorrowedByAnyFaction())
            {
                foreach (QuestPart_LendColonistsToFaction item in QuestUtility.GetAllQuestPartsOfType <QuestPart_LendColonistsToFaction>())
                {
                    if (item.LentColonistsListForReading.Contains(pawn))
                    {
                        taggedString += "\n\n" + "LentColonistDied".Translate(pawn.Named("PAWN"), item.lendColonistsToFaction.Named("FACTION"));
                        quest         = item.quest;
                        break;
                    }
                }
            }
            taggedString = taggedString.AdjustedFor(pawn);
            if (pawn.Faction == Faction.OfPlayer)
            {
                TaggedString label = "Death".Translate() + ": " + pawn.LabelShortCap;
                if (caravan != null)
                {
                    Messages.Message("MessageCaravanDeathCorpseAddedToInventory".Translate(pawn.Named("PAWN")), caravan, MessageTypeDefOf.PawnDeath);
                }
                if (pawn.Name != null && !pawn.Name.Numerical && pawn.RaceProps.Animal)
                {
                    label += " (" + pawn.KindLabel + ")";
                }
                pawn.relations.CheckAppendBondedAnimalDiedInfo(ref taggedString, ref label);
                Find.LetterStack.ReceiveLetter(label, taggedString, LetterDefOf.Death, pawn, null, quest);
            }
            else
            {
                Messages.Message(taggedString, pawn, MessageTypeDefOf.PawnDeath);
            }
        }
Пример #15
0
        private static void DrawLongEventWindowContents(Rect rect)
        {
            if (currentEvent == null)
            {
                return;
            }
            if (Event.current.type == EventType.Repaint)
            {
                currentEvent.alreadyDisplayed = true;
            }
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleCenter;
            float num = 0f;

            if (levelLoadOp != null)
            {
                float f = 1f;
                if (!levelLoadOp.isDone)
                {
                    f = levelLoadOp.progress;
                }
                TaggedString taggedString = "LoadingAssets".Translate() + " " + f.ToStringPercent();
                num = Text.CalcSize(taggedString).x;
                Widgets.Label(rect, taggedString);
            }
            else
            {
                lock (CurrentEventTextLock)
                {
                    num = Text.CalcSize(currentEvent.eventText).x;
                    Widgets.Label(rect, currentEvent.eventText);
                }
            }
            Text.Anchor = TextAnchor.MiddleLeft;
            rect.xMin   = rect.center.x + num / 2f;
            Widgets.Label(rect, (!currentEvent.UseAnimatedDots) ? "..." : GenText.MarchingEllipsis());
            Text.Anchor = TextAnchor.UpperLeft;
        }
        private static void DrawContents(Rect rect)
        {
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            float num  = 0f;
            float num2 = 17f;
            float itemListInnerMargin = 8f;
            float num3  = num2 + 4f;
            Rect  rect2 = new Rect(rect.x + num2, rect.y, rect.width - num2 * 2f, 0f);
            Rect  rect3 = rect;

            rect3.x += num3;
            rect3.y += 10f;
            Widgets.Label(rect3, "OfficialContent".Translate());
            num += 10f + Text.LineHeight + 4f;
            Rect rect4 = rect2;

            rect4.y     += num;
            rect4.height = 94f;
            Widgets.DrawBoxSolid(rect4, ModInfoListBackground);
            num += 104f;
            List <GenUI.AnonymousStackElement> list = new List <GenUI.AnonymousStackElement>();

            Text.Anchor = TextAnchor.MiddleLeft;
            for (int i = 0; i < ModLister.AllExpansions.Count; i++)
            {
                ExpansionDef exp = ModLister.AllExpansions[i];
                list.Add(new GenUI.AnonymousStackElement
                {
                    drawer = delegate(Rect r)
                    {
                        bool flag = exp.Status == ExpansionStatus.Active;
                        Widgets.DrawBoxSolid(r, flag ? ModInfoListItemBackground : ModInfoListItemBackgroundDisabled);
                        Widgets.DrawHighlightIfMouseover(r);
                        if (!exp.isCore && !exp.StoreURL.NullOrEmpty() && Widgets.ButtonInvisible(r))
                        {
                            SteamUtility.OpenUrl(exp.StoreURL);
                        }
                        GUI.color         = (flag ? Color.white : DisabledIconTint);
                        Material material = (flag ? null : TexUI.GrayscaleGUI);
                        Rect rect9        = new Rect(r.x + itemListInnerMargin, r.y + 2f, 32f, 32f);
                        float num4        = 42f;
                        GenUI.DrawTextureWithMaterial(rect9, exp.Icon, material);
                        GUI.color   = (flag ? Color.white : Color.grey);
                        Rect rect10 = new Rect(r.x + itemListInnerMargin + num4, r.y, r.width - num4, r.height);
                        if (exp.Status != 0)
                        {
                            TaggedString t = ((exp.Status == ExpansionStatus.Installed) ? "DisabledLower" : "ContentNotInstalled").Translate().ToLower();
                            Widgets.Label(rect10, exp.label + " (" + t + ")");
                        }
                        else
                        {
                            Widgets.Label(rect10, exp.label);
                        }
                        GUI.color = Color.white;
                        if (Mouse.IsOver(r))
                        {
                            string description2 = exp.label + "\n" + exp.StatusDescription + "\n\n" + exp.description.StripTags();
                            TooltipHandler.TipRegion(tip: new TipSignal(() => description2, exp.GetHashCode() * 37), rect: r);
                        }
                    }
                });
            }
            GenUI.DrawElementStackVertical(new Rect(rect4.x + itemListInnerMargin, rect4.y + itemListInnerMargin, rect4.width - itemListInnerMargin * 2f, 94f), ListElementSize.y, list, delegate(Rect r, GenUI.AnonymousStackElement obj)
            {
                obj.drawer(r);
            }, (GenUI.AnonymousStackElement obj) => ListElementSize.x, 6f);
            list.Clear();
            Rect rect5 = rect;

            rect5.x    += num3;
            rect5.y    += num;
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.Label(rect5, "Mods".Translate());
            num += Text.LineHeight + 4f;
            Rect rect6 = rect2;

            rect6.y     += num;
            rect6.height = (AnyMods ? 224f : 40f);
            Widgets.DrawBoxSolid(rect6, ModInfoListBackground);
            if (AnyMods)
            {
                Text.Anchor = TextAnchor.MiddleLeft;
                foreach (ModMetaData mod in ModLister.AllInstalledMods.Where((ModMetaData m) => !m.Official && m.Active))
                {
                    list.Add(new GenUI.AnonymousStackElement
                    {
                        drawer = delegate(Rect r)
                        {
                            Widgets.DrawBoxSolid(r, mod.VersionCompatible ? ModInfoListItemBackground : ModInfoListItemBackgroundIncompatible);
                            Widgets.DrawHighlightIfMouseover(r);
                            if (mod.OnSteamWorkshop && mod.GetPublishedFileId() != PublishedFileId_t.Invalid && Widgets.ButtonInvisible(r))
                            {
                                SteamUtility.OpenWorkshopPage(mod.GetPublishedFileId());
                            }
                            Rect rect8   = new Rect(r.x + itemListInnerMargin, r.y, r.width, r.height);
                            string label = mod.Name.Truncate(rect8.width - itemListInnerMargin - 4f);
                            Widgets.Label(rect8, label);
                            if (Mouse.IsOver(r))
                            {
                                string description = mod.Name + "\n\n" + mod.Description.StripTags();
                                if (!mod.VersionCompatible)
                                {
                                    description = description + "\n\n" + "ModNotMadeForThisVersionShort".Translate().RawText.Colorize(Color.yellow);
                                }
                                TooltipHandler.TipRegion(tip: new TipSignal(() => description, mod.GetHashCode() * 37), rect: r);
                            }
                            GUI.color = Color.white;
                        }
                    });
                }
                Widgets.BeginScrollView(rect6, ref modListScrollPos, new Rect(0f, 0f, rect6.width - 16f, modListLastHeight + itemListInnerMargin * 2f));
                modListLastHeight = GenUI.DrawElementStack(new Rect(itemListInnerMargin, itemListInnerMargin, rect6.width - itemListInnerMargin * 2f, 99999f), ListElementSize.y, list, delegate(Rect r, GenUI.AnonymousStackElement obj)
                {
                    obj.drawer(r);
                }, (GenUI.AnonymousStackElement obj) => ListElementSize.x, 6f).height;
                Widgets.EndScrollView();
            }
            else
            {
                Text.Anchor = TextAnchor.UpperLeft;
                Rect rect7 = rect6;
                rect7.x  += itemListInnerMargin;
                rect7.y  += itemListInnerMargin;
                GUI.color = Color.gray;
                Widgets.Label(rect7, "None".Translate());
                GUI.color = Color.white;
            }
            Text.Anchor = TextAnchor.UpperLeft;
        }
Пример #17
0
 public DiaNode(TaggedString text)
 {
     this.text = text;
 }
 public static TaggedString Formatted(this TaggedString str, NamedArgument arg1, NamedArgument arg2, NamedArgument arg3, NamedArgument arg4, NamedArgument arg5)
 {
     return(str.RawText.Formatted(arg1, arg2, arg3, arg4, arg5));
 }
Пример #19
0
 public static Dialog_MessageBox CreateConfirmation(TaggedString text, Action confirmedAct, bool destructive = false, string title = null)
 {
     return(new Dialog_MessageBox(text, "Confirm".Translate(), confirmedAct, "GoBack".Translate(), null, title, destructive, confirmedAct, delegate
     {
     }));
 }
Пример #20
0
        private static bool TryResolveSymbol(object obj, string subSymbol, string symbolArgs, out TaggedString resolvedStr, string fullStringForReference)
        {
            Pawn pawn = obj as Pawn;

            if (pawn != null)
            {
                switch (subSymbol)
                {
                case "":
                    resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.Name.ToStringShort, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelIndefinite()));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "nameFull":
                    resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.Name.ToStringFull, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelIndefinite()));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "nameFullDef":
                    resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.Name.ToStringFull, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelDefinite()));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "label":
                    resolvedStr = pawn.LabelNoCountColored;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "labelShort":
                    resolvedStr = ((pawn.Name != null) ? pawn.Name.ToStringShort.ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabel));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "definite":
                    resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.Name.ToStringShort, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelDefinite()));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "nameDef":
                    resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.Name.ToStringShort, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelDefinite()));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "indefinite":
                    resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.Name.ToStringShort, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelIndefinite()));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "nameIndef":
                    resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.Name.ToStringShort, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelIndefinite()));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "pronoun":
                    resolvedStr = pawn.gender.GetPronoun();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "possessive":
                    resolvedStr = pawn.gender.GetPossessive();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "objective":
                    resolvedStr = pawn.gender.GetObjective();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "factionName":
                    resolvedStr = ((pawn.Faction != null) ? pawn.Faction.Name.ApplyTag(pawn.Faction) : ((TaggedString)""));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "factionPawnSingular":
                    resolvedStr = ((pawn.Faction != null) ? pawn.Faction.def.pawnSingular : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "factionPawnSingularDef":
                    resolvedStr = ((pawn.Faction != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.Faction.def.pawnSingular) : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "factionPawnSingularIndef":
                    resolvedStr = ((pawn.Faction != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.Faction.def.pawnSingular) : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "factionPawnsPlural":
                    resolvedStr = ((pawn.Faction != null) ? pawn.Faction.def.pawnsPlural : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "factionPawnsPluralDef":
                    resolvedStr = ((pawn.Faction != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.Faction.def.pawnsPlural, LanguageDatabase.activeLanguage.ResolveGender(pawn.Faction.def.pawnsPlural, pawn.Faction.def.pawnSingular), plural: true) : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "factionPawnsPluralIndef":
                    resolvedStr = ((pawn.Faction != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.Faction.def.pawnsPlural, LanguageDatabase.activeLanguage.ResolveGender(pawn.Faction.def.pawnsPlural, pawn.Faction.def.pawnSingular), plural: true) : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "factionRoyalFavorLabel":
                    resolvedStr = ((pawn.Faction != null) ? pawn.Faction.def.royalFavorLabel : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "kind":
                    resolvedStr = pawn.KindLabel;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "kindDef":
                    resolvedStr = pawn.KindLabelDefinite();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "kindIndef":
                    resolvedStr = pawn.KindLabelIndefinite();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "kindPlural":
                    resolvedStr = pawn.GetKindLabelPlural();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "kindPluralDef":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.GetKindLabelPlural(), pawn.gender, plural: true);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "kindPluralIndef":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.GetKindLabelPlural(), pawn.gender, plural: true);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "kindBase":
                    resolvedStr = pawn.kindDef.label;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "kindBaseDef":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.kindDef.label);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "kindBaseIndef":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.kindDef.label);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "kindBasePlural":
                    resolvedStr = pawn.kindDef.GetLabelPlural();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "kindBasePluralDef":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.kindDef.GetLabelPlural(), LanguageDatabase.activeLanguage.ResolveGender(pawn.kindDef.GetLabelPlural(), pawn.kindDef.label), plural: true);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "kindBasePluralIndef":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.kindDef.GetLabelPlural(), LanguageDatabase.activeLanguage.ResolveGender(pawn.kindDef.GetLabelPlural(), pawn.kindDef.label), plural: true);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "race":
                    resolvedStr = pawn.def.label;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "raceDef":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.def.label);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "raceIndef":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.def.label);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "lifeStage":
                    resolvedStr = pawn.ageTracker.CurLifeStage.label;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "lifeStageDef":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.ageTracker.CurLifeStage.label, pawn.gender);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "lifeStageIndef":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.ageTracker.CurLifeStage.label, pawn.gender);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "lifeStageAdjective":
                    resolvedStr = pawn.ageTracker.CurLifeStage.Adjective;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "title":
                    resolvedStr = ((pawn.story != null) ? pawn.story.Title : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "titleDef":
                    resolvedStr = ((pawn.story != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.story.Title, pawn.gender) : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "titleIndef":
                    resolvedStr = ((pawn.story != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.story.Title, pawn.gender) : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "bestRoyalTitle":
                    resolvedStr = PawnResolveBestRoyalTitle(pawn);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "bestRoyalTitleIndef":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(PawnResolveBestRoyalTitle(pawn));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "bestRoyalTitleDef":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(PawnResolveBestRoyalTitle(pawn));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "royalTitleInCurrentFaction":
                    resolvedStr = PawnResolveRoyalTitleInCurrentFaction(pawn);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "royalTitleInCurrentFactionIndef":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(PawnResolveRoyalTitleInCurrentFaction(pawn));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "royalTitleInCurrentFactionDef":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(PawnResolveRoyalTitleInCurrentFaction(pawn));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "age":
                    resolvedStr = pawn.ageTracker.AgeBiologicalYears.ToString();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "chronologicalAge":
                    resolvedStr = pawn.ageTracker.AgeChronologicalYears.ToString();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "ageFull":
                    resolvedStr = pawn.ageTracker.AgeNumberString;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "relationInfo":
                {
                    resolvedStr = "";
                    TaggedString text = resolvedStr;
                    PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, pawn);
                    resolvedStr = text.RawText;
                    return(true);
                }

                case "relationInfoInParentheses":
                    resolvedStr = "";
                    PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref resolvedStr, pawn);
                    if (!resolvedStr.NullOrEmpty())
                    {
                        resolvedStr = "(" + resolvedStr + ")";
                    }
                    return(true);

                case "gender":
                    resolvedStr = ResolveGenderSymbol(pawn.gender, pawn.RaceProps.Animal, symbolArgs, fullStringForReference);
                    return(true);

                case "humanlike":
                    resolvedStr = ResolveHumanlikeSymbol(pawn.RaceProps.Humanlike, symbolArgs, fullStringForReference);
                    return(true);

                default:
                    resolvedStr = "";
                    return(false);
                }
            }
            Thing thing = obj as Thing;

            if (thing != null)
            {
                switch (subSymbol)
                {
                case "":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(thing.Label);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "label":
                    resolvedStr = thing.Label;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "labelPlural":
                    resolvedStr = Find.ActiveLanguageWorker.Pluralize(thing.LabelNoCount);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "labelPluralDef":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(Find.ActiveLanguageWorker.Pluralize(thing.LabelNoCount), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(thing.LabelNoCount), thing.LabelNoCount), plural: true);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "labelPluralIndef":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(Find.ActiveLanguageWorker.Pluralize(thing.LabelNoCount), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(thing.LabelNoCount), thing.LabelNoCount), plural: true);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "labelShort":
                    resolvedStr = thing.LabelShort;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "definite":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(thing.Label);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "indefinite":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(thing.Label);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "pronoun":
                    resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(thing.LabelNoCount).GetPronoun();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "possessive":
                    resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(thing.LabelNoCount).GetPossessive();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "objective":
                    resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(thing.LabelNoCount).GetObjective();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "factionName":
                    resolvedStr = ((thing.Faction != null) ? thing.Faction.Name : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "gender":
                    resolvedStr = ResolveGenderSymbol(LanguageDatabase.activeLanguage.ResolveGender(thing.LabelNoCount), animal: false, symbolArgs, fullStringForReference);
                    return(true);

                default:
                    resolvedStr = "";
                    return(false);
                }
            }
            Hediff hediff = obj as Hediff;

            if (hediff != null)
            {
                if (subSymbol == "label")
                {
                    resolvedStr = hediff.Label;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);
                }
                if (subSymbol == "labelNoun")
                {
                    resolvedStr = ((!hediff.def.labelNoun.NullOrEmpty()) ? hediff.def.labelNoun : hediff.Label);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);
                }
            }
            WorldObject worldObject = obj as WorldObject;

            if (worldObject != null)
            {
                switch (subSymbol)
                {
                case "":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(worldObject.Label, plural: false, worldObject.HasName);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "label":
                    resolvedStr = worldObject.Label;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "labelPlural":
                    resolvedStr = Find.ActiveLanguageWorker.Pluralize(worldObject.Label);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "labelPluralDef":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(Find.ActiveLanguageWorker.Pluralize(worldObject.Label), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(worldObject.Label), worldObject.Label), plural: true, worldObject.HasName);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "labelPluralIndef":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(Find.ActiveLanguageWorker.Pluralize(worldObject.Label), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(worldObject.Label), worldObject.Label), plural: true, worldObject.HasName);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "definite":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(worldObject.Label, plural: false, worldObject.HasName);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "indefinite":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(worldObject.Label, plural: false, worldObject.HasName);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "pronoun":
                    resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(worldObject.Label).GetPronoun();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "possessive":
                    resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(worldObject.Label).GetPossessive();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "objective":
                    resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(worldObject.Label).GetObjective();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "factionName":
                    resolvedStr = ((worldObject.Faction != null) ? worldObject.Faction.Name.ApplyTag(worldObject.Faction) : ((TaggedString)""));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "gender":
                    resolvedStr = ResolveGenderSymbol(LanguageDatabase.activeLanguage.ResolveGender(worldObject.Label), animal: false, symbolArgs, fullStringForReference);
                    return(true);

                default:
                    resolvedStr = "";
                    return(false);
                }
            }
            Faction faction = obj as Faction;

            if (faction != null)
            {
                switch (subSymbol)
                {
                case "":
                    resolvedStr = faction.Name.ApplyTag(faction);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "name":
                    resolvedStr = faction.Name.ApplyTag(faction);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "pawnSingular":
                    resolvedStr = faction.def.pawnSingular;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "pawnSingularDef":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(faction.def.pawnSingular);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "pawnSingularIndef":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(faction.def.pawnSingular);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "pawnsPlural":
                    resolvedStr = faction.def.pawnsPlural;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "pawnsPluralDef":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(faction.def.pawnsPlural, LanguageDatabase.activeLanguage.ResolveGender(faction.def.pawnsPlural, faction.def.pawnSingular), plural: true);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "pawnsPluralIndef":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(faction.def.pawnsPlural, LanguageDatabase.activeLanguage.ResolveGender(faction.def.pawnsPlural, faction.def.pawnSingular), plural: true);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "royalFavorLabel":
                    resolvedStr = faction.def.royalFavorLabel;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "leaderNameDef":
                    resolvedStr = ((faction.leader != null && faction.leader.Name != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(faction.leader.Name.ToStringShort, faction.leader.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)""));
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "leaderPossessive":
                    resolvedStr = ((faction.leader != null) ? faction.leader.gender.GetPossessive() : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "leaderObjective":
                    resolvedStr = ((faction.leader != null) ? faction.leader.gender.GetObjective() : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "leaderPronoun":
                    resolvedStr = ((faction.leader != null) ? faction.leader.gender.GetPronoun() : "");
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                default:
                    resolvedStr = "";
                    return(false);
                }
            }
            Def def = obj as Def;

            if (def != null)
            {
                PawnKindDef pawnKindDef = def as PawnKindDef;
                if (pawnKindDef != null)
                {
                    switch (subSymbol)
                    {
                    case "labelPlural":
                        resolvedStr = pawnKindDef.GetLabelPlural();
                        EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                        return(true);

                    case "labelPluralDef":
                        resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(pawnKindDef.GetLabelPlural(), LanguageDatabase.activeLanguage.ResolveGender(pawnKindDef.GetLabelPlural(), pawnKindDef.label), plural: true);
                        EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                        return(true);

                    case "labelPluralIndef":
                        resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(pawnKindDef.GetLabelPlural(), LanguageDatabase.activeLanguage.ResolveGender(pawnKindDef.GetLabelPlural(), pawnKindDef.label), plural: true);
                        EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                        return(true);
                    }
                }
                switch (subSymbol)
                {
                case "":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(def.label);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "label":
                    resolvedStr = def.label;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "labelPlural":
                    resolvedStr = Find.ActiveLanguageWorker.Pluralize(def.label);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "labelPluralDef":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(Find.ActiveLanguageWorker.Pluralize(def.label), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(def.label), def.label), plural: true);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "labelPluralIndef":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(Find.ActiveLanguageWorker.Pluralize(def.label), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(def.label), def.label), plural: true);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "definite":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(def.label);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "indefinite":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(def.label);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "pronoun":
                    resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(def.label).GetPronoun();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "possessive":
                    resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(def.label).GetPossessive();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "objective":
                    resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(def.label).GetObjective();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "gender":
                    resolvedStr = ResolveGenderSymbol(LanguageDatabase.activeLanguage.ResolveGender(def.label), animal: false, symbolArgs, fullStringForReference);
                    return(true);

                default:
                    resolvedStr = "";
                    return(false);
                }
            }
            RoyalTitle royalTitle = obj as RoyalTitle;

            if (royalTitle != null)
            {
                if (subSymbol == null || subSymbol.Length != 0)
                {
                    if (!(subSymbol == "label"))
                    {
                        if (subSymbol == "indefinite")
                        {
                            resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticlePostProcessed(royalTitle.Label);
                            EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                            return(true);
                        }
                        resolvedStr = "";
                        return(false);
                    }
                    resolvedStr = royalTitle.Label;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);
                }
                resolvedStr = royalTitle.Label;
                EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                return(true);
            }
            string text2 = obj as string;

            if (text2 != null)
            {
                switch (subSymbol)
                {
                case "":
                    resolvedStr = text2;
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "plural":
                    resolvedStr = Find.ActiveLanguageWorker.Pluralize(text2);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "pluralDef":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(Find.ActiveLanguageWorker.Pluralize(text2), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(text2), text2), plural: true);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "pluralIndef":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(Find.ActiveLanguageWorker.Pluralize(text2), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(text2), text2), plural: true);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "definite":
                    resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(text2);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "indefinite":
                    resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(text2);
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "pronoun":
                    resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(text2).GetPronoun();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "possessive":
                    resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(text2).GetPossessive();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "objective":
                    resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(text2).GetObjective();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);

                case "gender":
                    resolvedStr = ResolveGenderSymbol(LanguageDatabase.activeLanguage.ResolveGender(text2), animal: false, symbolArgs, fullStringForReference);
                    return(true);

                default:
                    resolvedStr = "";
                    return(false);
                }
            }
            if (obj is int || obj is long)
            {
                int num = (int)((obj is int) ? ((int)obj) : ((long)obj));
                if (subSymbol == null || subSymbol.Length != 0)
                {
                    if (!(subSymbol == "ordinal"))
                    {
                        if (subSymbol == "multiple")
                        {
                            resolvedStr = ResolveMultipleSymbol(num, symbolArgs, fullStringForReference);
                            return(true);
                        }
                        resolvedStr = "";
                        return(false);
                    }
                    resolvedStr = Find.ActiveLanguageWorker.OrdinalNumber(num).ToString();
                    EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                    return(true);
                }
                resolvedStr = num.ToString();
                EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                return(true);
            }
            if (obj is TaggedString)
            {
                EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                resolvedStr = ((TaggedString)obj).RawText;
            }
            if (subSymbol.NullOrEmpty())
            {
                EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference);
                if (obj == null)
                {
                    resolvedStr = "";
                }
                else
                {
                    resolvedStr = obj.ToString();
                }
                return(true);
            }
            resolvedStr = "";
            return(false);
        }
Пример #21
0
 public Rect Label(TaggedString label, float maxHeight = -1f, string tooltip = null)
 {
     return(Label(label.Resolve(), maxHeight, tooltip));
 }
Пример #22
0
 public virtual void ClearCachedData()
 {
     cachedLabelCap = null;
 }
        public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth)
        {
            Room room = Room;

            if (room == null)
            {
                return(new GizmoResult(GizmoState.Clear));
            }
            Rect rect = new Rect(topLeft.x, topLeft.y, GetWidth(maxWidth), 75f);

            Widgets.DrawWindowBackground(rect);
            Text.WordWrap = false;
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero().ContractedBy(10f);

            Text.Font = GameFont.Small;
            Rect  rect3 = new Rect(rect2.x, rect2.y - 2f, rect2.width, 100f);
            float stat  = room.GetStat(RoomStatDefOf.Impressiveness);
            RoomStatScoreStage scoreStage = RoomStatDefOf.Impressiveness.GetScoreStage(stat);
            TaggedString       str        = room.Role.LabelCap + ", " + scoreStage.label + " (" + RoomStatDefOf.Impressiveness.ScoreToString(stat) + ")";

            Widgets.Label(rect3, str.Truncate(rect3.width));
            float num = rect2.y + Text.LineHeight + Text.SpaceBetweenLines + 7f;

            GUI.color = RoomStatsColor;
            Text.Font = GameFont.Tiny;
            List <RoomStatDef> allDefsListForReading = DefDatabase <RoomStatDef> .AllDefsListForReading;
            int num2 = 0;

            for (int i = 0; i < allDefsListForReading.Count; i++)
            {
                if (!allDefsListForReading[i].isHidden && allDefsListForReading[i] != RoomStatDefOf.Impressiveness)
                {
                    float stat2 = room.GetStat(allDefsListForReading[i]);
                    RoomStatScoreStage scoreStage2 = allDefsListForReading[i].GetScoreStage(stat2);
                    Rect   rect4 = ((num2 % 2 == 0) ? new Rect(rect2.x, num, rect2.width / 2f, 100f) : new Rect(rect2.x + rect2.width / 2f, num, rect2.width / 2f, 100f));
                    string str2  = scoreStage2.label.CapitalizeFirst() + " (" + allDefsListForReading[i].ScoreToString(stat2) + ")";
                    Widgets.Label(rect4, str2.Truncate(rect4.width));
                    if (num2 % 2 == 1)
                    {
                        num += Text.LineHeight + Text.SpaceBetweenLines;
                    }
                    num2++;
                }
            }
            GUI.color = Color.white;
            Text.Font = GameFont.Small;
            GUI.EndGroup();
            Text.WordWrap = true;
            GenUI.AbsorbClicksInRect(rect);
            if (Mouse.IsOver(rect))
            {
                Rect windowRect = EnvironmentStatsDrawer.GetWindowRect(shouldShowBeauty: false, shouldShowRoomStats: true);
                Find.WindowStack.ImmediateWindow(74975, windowRect, WindowLayer.Super, delegate
                {
                    float curY = 12f;
                    EnvironmentStatsDrawer.DoRoomInfo(room, ref curY, windowRect);
                });
                return(new GizmoResult(GizmoState.Mouseover));
            }
            return(new GizmoResult(GizmoState.Clear));
        }
Пример #24
0
        public static TaggedString Formatted(TaggedString str, List <string> argsLabelsArg, List <object> argsObjectsArg)
        {
            if (str.NullOrEmpty())
            {
                return(str);
            }
            bool          flag;
            StringBuilder stringBuilder;
            StringBuilder stringBuilder2;
            StringBuilder stringBuilder3;
            StringBuilder stringBuilder4;
            StringBuilder stringBuilder5;
            List <string> list;
            List <object> list2;

            if (working)
            {
                flag           = false;
                stringBuilder  = new StringBuilder();
                stringBuilder2 = new StringBuilder();
                stringBuilder3 = new StringBuilder();
                stringBuilder4 = new StringBuilder();
                stringBuilder5 = new StringBuilder();
                list           = argsLabelsArg.ToList();
                list2          = argsObjectsArg.ToList();
            }
            else
            {
                flag           = true;
                stringBuilder  = tmpResultBuffer;
                stringBuilder2 = tmpSymbolBuffer;
                stringBuilder3 = tmpSymbolBuffer_objectLabel;
                stringBuilder4 = tmpSymbolBuffer_subSymbol;
                stringBuilder5 = tmpSymbolBuffer_args;
                list           = tmpArgsLabels;
                list.Clear();
                list.AddRange(argsLabelsArg);
                list2 = tmpArgsObjects;
                list2.Clear();
                list2.AddRange(argsObjectsArg);
            }
            if (flag)
            {
                working = true;
            }
            try
            {
                stringBuilder.Length = 0;
                for (int i = 0; i < str.Length; i++)
                {
                    char c = str[i];
                    if (c == '{')
                    {
                        stringBuilder2.Length = 0;
                        stringBuilder3.Length = 0;
                        stringBuilder4.Length = 0;
                        stringBuilder5.Length = 0;
                        bool flag2 = false;
                        bool flag3 = false;
                        bool flag4 = false;
                        i++;
                        bool flag5 = i < str.Length && str[i] == '{';
                        for (; i < str.Length; i++)
                        {
                            char c2 = str[i];
                            if (c2 == '}')
                            {
                                flag2 = true;
                                break;
                            }
                            stringBuilder2.Append(c2);
                            if (c2 == '_' && !flag3)
                            {
                                flag3 = true;
                            }
                            else if (c2 == '?' && !flag4)
                            {
                                flag4 = true;
                            }
                            else if (flag4)
                            {
                                stringBuilder5.Append(c2);
                            }
                            else if (flag3)
                            {
                                stringBuilder4.Append(c2);
                            }
                            else
                            {
                                stringBuilder3.Append(c2);
                            }
                        }
                        if (!flag2)
                        {
                            Log.ErrorOnce("Could not find matching '}' in \"" + str + "\".", str.GetHashCode() ^ 0xB9D492D);
                            continue;
                        }
                        if (flag5)
                        {
                            stringBuilder.Append(stringBuilder2);
                            continue;
                        }
                        if (flag4)
                        {
                            while (stringBuilder4.Length != 0 && stringBuilder4[stringBuilder4.Length - 1] == ' ')
                            {
                                stringBuilder4.Length--;
                            }
                        }
                        string text   = stringBuilder3.ToString();
                        bool   flag6  = false;
                        int    result = -1;
                        if (int.TryParse(text, out result))
                        {
                            if (result >= 0 && result < list2.Count && TryResolveSymbol(list2[result], stringBuilder4.ToString(), stringBuilder5.ToString(), out var resolvedStr, str))
                            {
                                flag6 = true;
                                stringBuilder.Append(resolvedStr.RawText);
                            }
                        }
                        else
                        {
                            for (int j = 0; j < list.Count; j++)
                            {
                                if (list[j] == text)
                                {
                                    if (TryResolveSymbol(list2[j], stringBuilder4.ToString(), stringBuilder5.ToString(), out var resolvedStr2, str))
                                    {
                                        flag6 = true;
                                        stringBuilder.Append(resolvedStr2.RawText);
                                    }
                                    break;
                                }
                            }
                        }
                        if (!flag6)
                        {
                            Log.ErrorOnce(string.Concat("Could not resolve symbol \"", stringBuilder2, "\" for string \"") + str + "\".", str.GetHashCode() ^ stringBuilder2.ToString().GetHashCode() ^ 0x346E76FE);
                        }
                    }
                    else
                    {
                        stringBuilder.Append(c);
                    }
                }
                string translation = GenText.CapitalizeSentences(stringBuilder.ToString(), capitalizeFirstSentence: false);
                translation = Find.ActiveLanguageWorker.PostProcessedKeyedTranslation(translation);
                return(translation);
            }
            finally
            {
                if (flag)
                {
                    working = false;
                }
            }
        }
Пример #25
0
        public void ReceiveLetter(TaggedString label, TaggedString text, LetterDef textLetterDef, LookTargets lookTargets, Faction relatedFaction = null, Quest quest = null, List <ThingDef> hyperlinkThingDefs = null, string debugInfo = null)
        {
            ChoiceLetter let = LetterMaker.MakeLetter(label, text, textLetterDef, lookTargets, relatedFaction, quest, hyperlinkThingDefs);

            ReceiveLetter(let, debugInfo);
        }
Пример #26
0
        public static string Resolve(TaggedString taggedStr)
        {
            if ((string)taggedStr == null)
            {
                return(null);
            }
            string rawText = taggedStr.RawText;

            if (rawText.NullOrEmpty())
            {
                return(rawText);
            }
            if (cache.TryGetValue(rawText, out var value))
            {
                return(value);
            }
            resultBuffer.Length = 0;
            if (rawText.IndexOf("(*") < 0)
            {
                resultBuffer.Append(rawText);
            }
            else
            {
                for (int i = 0; i < rawText.Length; i++)
                {
                    char c = rawText[i];
                    if (c == '(' && i < rawText.Length - 1 && rawText[i + 1] == '*' && rawText.IndexOf(')', i) > i + 1)
                    {
                        bool flag = false;
                        int  num  = i;
                        tagBuffer.Length = 0;
                        argBuffer.Length = 0;
                        capStage         = CaptureStage.Tag;
                        for (i += 2; i < rawText.Length; i++)
                        {
                            char c2 = rawText[i];
                            if (c2 == ')')
                            {
                                capStage = CaptureStage.Result;
                                if (flag)
                                {
                                    string value2 = rawText.Substring(num, i - num + 1).SwapTagWithColor(tagBuffer.ToString(), argBuffer.ToString());
                                    resultBuffer.Append(value2);
                                    break;
                                }
                            }
                            else if (c2 == '/')
                            {
                                flag = true;
                            }
                            if (capStage == CaptureStage.Arg)
                            {
                                argBuffer.Append(c2);
                            }
                            if (!flag && c2 == '=')
                            {
                                capStage = CaptureStage.Arg;
                            }
                            if (capStage == CaptureStage.Tag)
                            {
                                tagBuffer.Append(c2);
                            }
                        }
                        if (!flag)
                        {
                            resultBuffer.Append(c);
                            i = num + 1;
                        }
                    }
                    else
                    {
                        resultBuffer.Append(c);
                    }
                }
            }
            string input = resultBuffer.ToString();

            input = CurrencyRegex.Replace(input, "$&".Colorize(CurrencyColor));
            input = DaysRegex.Replace(input, "$&".Colorize(DateTimeColor));
            input = HoursRegex.Replace(input, "$&".Colorize(DateTimeColor));
            input = SecondsRegex.Replace(input, "$&".Colorize(DateTimeColor));
            input = ColonistCountRegex.Replace(input, "$&".Colorize(ColonistCountColor));
            cache.Add(rawText, input);
            return(input);
        }
 public static TaggedString Formatted(this TaggedString str, NamedArgument arg1)
 {
     return(str.RawText.Formatted(arg1));
 }
 public static TaggedString Formatted(this TaggedString str, params NamedArgument[] args)
 {
     return(str.RawText.Formatted(args));
 }
Пример #29
0
 public static void AppendLineTagged(this StringBuilder sb, TaggedString taggedString)
 {
     sb.AppendLine(taggedString.Resolve());
 }