예제 #1
0
        public void SendRimWarLetter(TaggedString baseLetterLabel, TaggedString baseLetterText, LetterDef baseLetterDef, IncidentParms parms, LookTargets lookTargets, params NamedArgument[] textArgs)
        {
            if (baseLetterLabel.NullOrEmpty() || baseLetterText.NullOrEmpty())
            {
                Log.Error("Sending standard incident letter with no label or text.");
            }
            TaggedString taggedString = baseLetterText.Formatted(textArgs);
            TaggedString text;

            if (parms.customLetterText.NullOrEmpty())
            {
                text = taggedString;
            }
            else
            {
                List <NamedArgument> list = new List <NamedArgument>();
                if (textArgs != null)
                {
                    list.AddRange(textArgs);
                }
                list.Add(taggedString.Named("BASETEXT"));
                text = parms.customLetterText.Formatted(list.ToArray());
            }
            TaggedString taggedString2 = baseLetterLabel.Formatted(textArgs);
            TaggedString label;

            if (parms.customLetterLabel.NullOrEmpty())
            {
                label = taggedString2;
            }
            else
            {
                List <NamedArgument> list2 = new List <NamedArgument>();
                if (textArgs != null)
                {
                    list2.AddRange(textArgs);
                }
                list2.Add(taggedString2.Named("BASELABEL"));
                label = parms.customLetterLabel.Formatted(list2.ToArray());
            }
            ChoiceLetter choiceLetter = LetterMaker.MakeLetter(label, text, parms.customLetterDef ?? baseLetterDef, lookTargets, parms.faction, parms.quest, parms.letterHyperlinkThingDefs);

            //List<HediffDef> list3 = new List<HediffDef>();
            //if (!parms.letterHyperlinkHediffDefs.NullOrEmpty())
            //{
            //    list3.AddRange(parms.letterHyperlinkHediffDefs);
            //}
            //Log.Message("5");
            //if (!def.letterHyperlinkHediffDefs.NullOrEmpty())
            //{
            //    if (list3 == null)
            //    {
            //        list3 = new List<HediffDef>();
            //    }
            //    list3.AddRange(def.letterHyperlinkHediffDefs);
            //}
            //Log.Message("6");
            //choiceLetter.hyperlinkHediffDefs = list3;
            Find.LetterStack.ReceiveLetter(choiceLetter);
        }
예제 #2
0
        protected virtual void SendCrashSiteLetter(WorldObject shotDownBy, MapParent crashSite, TaggedString baseLetterLabel, TaggedString baseLetterText, LetterDef letterDef, LookTargets lookTargets, params NamedArgument[] textArgs)
        {
            if (baseLetterLabel.NullOrEmpty() || baseLetterText.NullOrEmpty())
            {
                Log.Error("Sending standard incident letter with no label or text.");
            }
            ChoiceLetter     choiceLetter = LetterMaker.MakeLetter(baseLetterLabel.Formatted(textArgs), baseLetterText.Formatted(textArgs), letterDef, lookTargets, shotDownBy?.Faction);
            List <HediffDef> list3        = new List <HediffDef>();

            if (!def.letterHyperlinkHediffDefs.NullOrEmpty())
            {
                list3.AddRange(def.letterHyperlinkHediffDefs);
            }
            choiceLetter.hyperlinkHediffDefs = list3;
            Find.LetterStack.ReceiveLetter(choiceLetter, null);
        }
예제 #3
0
 public TaggedString GetFormattedText(TaggedString text)
 {
     if (count == 0)
     {
         return(text.Formatted());
     }
     if (args != null)
     {
         return(text.Formatted(args));
     }
     if (count == 1)
     {
         return(text.Formatted(arg1));
     }
     if (count == 2)
     {
         return(text.Formatted(arg1, arg2));
     }
     if (count == 3)
     {
         return(text.Formatted(arg1, arg2, arg3));
     }
     return(text.Formatted(arg1, arg2, arg3, arg4));
 }