public override float GetPriority(Pawn pawn) { if (pawn.workSettings == null || !pawn.workSettings.EverWork) { return(0f); } TimeAssignmentDef timeAssignmentDef = (pawn.timetable != null) ? pawn.timetable.CurrentAssignment : TimeAssignmentDefOf.Anything; if (timeAssignmentDef == TimeAssignmentDefOf.Anything) { return(5.5f); } if (timeAssignmentDef == TimeAssignmentDefOf.Work) { return(9f); } if (timeAssignmentDef == TimeAssignmentDefOf.Sleep) { return(2f); } if (timeAssignmentDef == TimeAssignmentDefOf.Joy) { return(2f); } throw new NotImplementedException(); }
private void DoTimeAssignment(Rect rect, Pawn p, int hour) { rect = rect.ContractedBy(1f); bool mouseButton = Input.GetMouseButton(0); TimeAssignmentDef assignment = p.timetable.GetAssignment(hour); GUI.DrawTexture(rect, assignment.ColorTexture); if (!mouseButton) { MouseoverSounds.DoRegion(rect); } if (!Mouse.IsOver(rect)) { return; } Widgets.DrawBox(rect, 2); if (mouseButton && assignment != TimeAssignmentSelector.selectedAssignment && TimeAssignmentSelector.selectedAssignment != null) { SoundDefOf.Designate_DragStandard_Changed.PlayOneShotOnCamera(); p.timetable.SetAssignment(hour, TimeAssignmentSelector.selectedAssignment); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.TimeAssignments, KnowledgeAmount.SmallInteraction); if (TimeAssignmentSelector.selectedAssignment == TimeAssignmentDefOf.Meditate) { PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.MeditationSchedule, KnowledgeAmount.Total); } } }
private static void DrawTimeAssignmentSelectorFor(Rect rect, TimeAssignmentDef ta) { rect = rect.ContractedBy(2f); GUI.DrawTexture(rect, ta.ColorTexture); if (Widgets.ButtonInvisible(rect)) { selectedAssignment = ta; SoundDefOf.Tick_High.PlayOneShotOnCamera(); } GUI.color = Color.white; if (Mouse.IsOver(rect)) { Widgets.DrawHighlight(rect); } Text.Font = GameFont.Small; Text.Anchor = TextAnchor.MiddleCenter; GUI.color = Color.white; Widgets.Label(rect, ta.LabelCap); Text.Anchor = TextAnchor.UpperLeft; if (selectedAssignment == ta) { Widgets.DrawBox(rect, 2); } else { UIHighlighter.HighlightOpportunity(rect, ta.cachedHighlightNotSelectedTag); } }
public override float GetPriority(Pawn pawn) { float result; if (pawn.workSettings == null || !pawn.workSettings.EverWork) { result = 0f; } else { TimeAssignmentDef timeAssignmentDef = (pawn.timetable != null) ? pawn.timetable.CurrentAssignment : TimeAssignmentDefOf.Anything; if (timeAssignmentDef == TimeAssignmentDefOf.Anything) { result = 5.5f; } else if (timeAssignmentDef == TimeAssignmentDefOf.Work) { result = 9f; } else if (timeAssignmentDef == TimeAssignmentDefOf.Sleep) { result = 2f; } else { if (timeAssignmentDef != TimeAssignmentDefOf.Joy) { throw new NotImplementedException(); } result = 2f; } } return(result); }
public Pawn_TimetableTracker(Pawn pawn) { this.pawn = pawn; times = new List <TimeAssignmentDef>(24); for (int i = 0; i < 24; i++) { TimeAssignmentDef item = (i > 5 && i <= 21) ? TimeAssignmentDefOf.Anything : TimeAssignmentDefOf.Sleep; times.Add(item); } }
public static bool TimetablePreventsGettingJoy(Pawn pawn) { TimeAssignmentDef timeAssignmentDef = (pawn.timetable != null) ? pawn.timetable.CurrentAssignment : TimeAssignmentDefOf.Anything; if (!timeAssignmentDef.allowJoy) { return(true); } return(false); }
public override float GetPriority(Pawn pawn) { if (pawn.needs.joy == null) { return(0f); } if (Find.TickManager.TicksGame < 5000) { return(0f); } if (JoyUtility.LordPreventsGettingJoy(pawn)) { return(0f); } float curLevel = pawn.needs.joy.CurLevel; TimeAssignmentDef timeAssignmentDef = (pawn.timetable == null) ? TimeAssignmentDefOf.Anything : pawn.timetable.CurrentAssignment; if (!timeAssignmentDef.allowJoy) { return(0f); } if (timeAssignmentDef == TimeAssignmentDefOf.Anything) { if (curLevel < 0.35f) { return(6f); } return(0f); } if (timeAssignmentDef == TimeAssignmentDefOf.Joy) { if (curLevel < 0.95f) { return(7f); } return(0f); } if (timeAssignmentDef == TimeAssignmentDefOf.Sleep) { if (curLevel < 0.95f) { return(2f); } return(0f); } if (timeAssignmentDef == TimeAssignmentDefOf.Meditate) { return(0f); } throw new NotImplementedException(); }
private void DoTimeAssignment(Rect rect, Pawn p, int hour) { rect = rect.ContractedBy(1f); TimeAssignmentDef assignment = p.timetable.GetAssignment(hour); GUI.DrawTexture(rect, assignment.ColorTexture); if (Mouse.IsOver(rect)) { Widgets.DrawBox(rect, 2); if (assignment != TimeAssignmentSelector.selectedAssignment && TimeAssignmentSelector.selectedAssignment != null && Input.GetMouseButton(0)) { SoundDefOf.DesignateDragStandardChanged.PlayOneShotOnCamera(null); p.timetable.SetAssignment(hour, TimeAssignmentSelector.selectedAssignment); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.TimeAssignments, KnowledgeAmount.SmallInteraction); } } }
public void SetAssignment(int hour, TimeAssignmentDef ta) { this.times[hour] = ta; }
private static bool <GetValueToCompare> m__0(TimeAssignmentDef x) { return(x == TimeAssignmentDefOf.Work); }
public override float GetPriority(Pawn pawn) { float result; if (pawn.needs.joy == null) { result = 0f; } else if (Find.TickManager.TicksGame < 5000) { result = 0f; } else if (JoyUtility.LordPreventsGettingJoy(pawn)) { result = 0f; } else { float curLevel = pawn.needs.joy.CurLevel; TimeAssignmentDef timeAssignmentDef = (pawn.timetable != null) ? pawn.timetable.CurrentAssignment : TimeAssignmentDefOf.Anything; if (!timeAssignmentDef.allowJoy) { result = 0f; } else if (timeAssignmentDef == TimeAssignmentDefOf.Anything) { if (curLevel < 0.35f) { result = 6f; } else { result = 0f; } } else if (timeAssignmentDef == TimeAssignmentDefOf.Joy) { if (curLevel < 0.95f) { result = 7f; } else { result = 0f; } } else { if (timeAssignmentDef != TimeAssignmentDefOf.Sleep) { throw new NotImplementedException(); } if (curLevel < 0.95f) { result = 2f; } else { result = 0f; } } } return(result); }