예제 #1
0
 public static void Message(string text, LookTargets lookTargets, MessageTypeDef def, bool historical = true)
 {
     if (AcceptsMessage(text, lookTargets))
     {
         Message(new Message(text.CapitalizeFirst(), def, lookTargets), historical);
     }
 }
예제 #2
0
        public static bool SameTargets(LookTargets a, LookTargets b)
        {
            bool result;

            if (a == null)
            {
                result = (b == null || !b.Any);
            }
            else if (b == null)
            {
                result = (a == null || !a.Any);
            }
            else if (a.targets.Count != b.targets.Count)
            {
                result = false;
            }
            else
            {
                for (int i = 0; i < a.targets.Count; i++)
                {
                    if (a.targets[i] != b.targets[i])
                    {
                        return(false);
                    }
                }
                result = true;
            }
            return(result);
        }
예제 #3
0
 public static bool SameTargets(LookTargets a, LookTargets b)
 {
     if (a == null)
     {
         if (b != null)
         {
             return(!b.Any);
         }
         return(true);
     }
     if (b == null)
     {
         if (a != null)
         {
             return(!a.Any);
         }
         return(true);
     }
     if (a.targets.Count != b.targets.Count)
     {
         return(false);
     }
     for (int i = 0; i < a.targets.Count; i++)
     {
         if (a.targets[i] != b.targets[i])
         {
             return(false);
         }
     }
     return(true);
 }
 public static void TryHighlight(this LookTargets lookTargets, bool arrow = true, bool colonistBar = true, bool circleOverlay = false)
 {
     if (lookTargets != null)
     {
         lookTargets.Highlight(arrow, colonistBar, circleOverlay);
     }
 }
 public static GlobalTargetInfo TryGetPrimaryTarget(this LookTargets lookTargets)
 {
     if (lookTargets == null)
     {
         return(GlobalTargetInfo.Invalid);
     }
     return(lookTargets.PrimaryTarget);
 }
예제 #6
0
 public static void Message(string text, LookTargets lookTargets, MessageTypeDef def, bool historical = true)
 {
     if (Messages.AcceptsMessage(text, lookTargets))
     {
         Message msg = new Message(text, def, lookTargets);
         Messages.Message(msg, historical);
     }
 }
        public static GlobalTargetInfo TryGetPrimaryTarget(this LookTargets lookTargets)
        {
            GlobalTargetInfo result;

            if (lookTargets == null)
            {
                result = GlobalTargetInfo.Invalid;
            }
            else
            {
                result = lookTargets.PrimaryTarget;
            }
            return(result);
        }
예제 #8
0
 private static bool AcceptsMessage(string text, LookTargets lookTargets)
 {
     if (text.NullOrEmpty())
     {
         return(false);
     }
     for (int i = 0; i < liveMessages.Count; i++)
     {
         if (liveMessages[i].text == text && liveMessages[i].startingFrame == RealTime.frameCount && LookTargets.SameTargets(liveMessages[i].lookTargets, lookTargets))
         {
             return(false);
         }
     }
     return(true);
 }
예제 #9
0
        private static bool AcceptsMessage(string text, LookTargets lookTargets)
        {
            bool result;

            if (text.NullOrEmpty())
            {
                result = false;
            }
            else
            {
                for (int i = 0; i < Messages.liveMessages.Count; i++)
                {
                    if (Messages.liveMessages[i].text == text && Messages.liveMessages[i].startingFrame == RealTime.frameCount && LookTargets.SameTargets(Messages.liveMessages[i].lookTargets, lookTargets))
                    {
                        return(false);
                    }
                }
                result = true;
            }
            return(result);
        }
예제 #10
0
 public Message(string text, MessageTypeDef def, LookTargets lookTargets, Quest quest)
     : this(text, def, lookTargets)
 {
     this.quest = quest;
 }
예제 #11
0
 public Message(string text, MessageTypeDef def, LookTargets lookTargets)
     : this(text, def)
 {
     this.lookTargets = lookTargets;
 }
 public static bool IsValid(this LookTargets lookTargets)
 {
     return(lookTargets?.IsValid ?? false);
 }
        public void ReceiveLetter(string label, string text, LetterDef textLetterDef, LookTargets lookTargets, Faction relatedFaction = null, string debugInfo = null)
        {
            ChoiceLetter let = LetterMaker.MakeLetter(label, text, textLetterDef, lookTargets, relatedFaction);

            this.ReceiveLetter(let, debugInfo);
        }
예제 #14
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);
        }
예제 #15
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);
        }
예제 #16
0
        public static ChoiceLetter MakeLetter(string label, string text, LetterDef def, LookTargets lookTargets, Faction relatedFaction = null)
        {
            ChoiceLetter choiceLetter = LetterMaker.MakeLetter(label, text, def);

            choiceLetter.lookTargets    = lookTargets;
            choiceLetter.relatedFaction = relatedFaction;
            return(choiceLetter);
        }
 public static bool IsValid(this LookTargets lookTargets)
 {
     return(lookTargets != null && lookTargets.IsValid);
 }
 public static GlobalTargetInfo TryGetPrimaryTarget(this LookTargets lookTargets)
 {
     return(lookTargets?.PrimaryTarget ?? GlobalTargetInfo.Invalid);
 }