private static void AddPiety(Pawn pawn, PietyDef pietyDef, string reason = "") { if (pietyDef != null) { pawn.GetReligionComponent().PietyTracker.PietyNeed.Add(new Piety_Memory(pawn, pietyDef, reason)); } }
public Piety(Pawn pawn, PietyDef def) { if (Scribe.mode == LoadSaveMode.Inactive) { this.pawn = pawn; this.def = def; } }
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); }
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); }
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, "-"); } }
public int StageIndexFor(PietyDef def) { return(Mathf.Min(this.StageIndex, def.Stages.Count() - 1)); }
public Piety_Situational(Pawn pawn, PietyDef def) : base(pawn, def) { }
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}"); }
public Piety_Memory(Pawn pawn, PietyDef def, string reason = "") : base(pawn, def) { this.reason = reason; }