コード例 #1
0
 private static void AddPiety(Pawn pawn, PietyDef pietyDef, string reason = "")
 {
     if (pietyDef != null)
     {
         pawn.GetReligionComponent().PietyTracker.PietyNeed.Add(new Piety_Memory(pawn, pietyDef, reason));
     }
 }
コード例 #2
0
 public Piety(Pawn pawn, PietyDef def)
 {
     if (Scribe.mode == LoadSaveMode.Inactive)
     {
         this.pawn = pawn;
         this.def  = def;
     }
 }
コード例 #3
0
        private Piety_Situational TryCreatePiety(PietyDef def)
        {
            if (!def.Worker.CurrentState(this.pawn).ActiveFor(def))
            {
                return((Piety_Situational)null);
            }
            Piety_Situational piety = new Piety_Situational(pawn, def);

            piety.RecalculateState();
            return(piety);
        }
コード例 #4
0
        public bool ActiveFor(PietyDef def)
        {
            if (!this.Active)
            {
                return(false);
            }
            int index = this.StageIndexFor(def);

            if (index >= 0)
            {
                return(def.Stages.ElementAt(index) != null);
            }
            return(false);
        }
コード例 #5
0
 private void ColoredRange(Rect r, PietyDef def)
 {
     if (def != null)
     {
         string l = GetRange(def, out Color color);
         GUI.color = color;
         Widgets.Label(r, l);
         GUI.color = Color.white;
     }
     else
     {
         Widgets.Label(r, "-");
     }
 }
コード例 #6
0
 public int StageIndexFor(PietyDef def)
 {
     return(Mathf.Min(this.StageIndex, def.Stages.Count() - 1));
 }
コード例 #7
0
 public Piety_Situational(Pawn pawn, PietyDef def) : base(pawn, def)
 {
 }
コード例 #8
0
 private string GetRange(PietyDef def, out Color color)
 {
     color = def.Stages.First().PietyOffset >= 0 ? Color.green : Color.red;
     return($"{def.Stages.First().PietyOffset} {"Religion_To".Translate()} {def.Stages.Last().PietyOffset}");
 }
コード例 #9
0
 public Piety_Memory(Pawn pawn, PietyDef def, string reason = "") : base(pawn, def)
 {
     this.reason = reason;
 }