public override void DoCell(Rect rect, Pawn pawn, PawnTable table)
 {
     if (!pawn.Dead && pawn.workSettings != null && pawn.workSettings.EverWork)
     {
         Text.Font = GameFont.Medium;
         float x         = rect.x + (rect.width - 25f) / 2f;
         float y         = rect.y + 2.5f;
         bool  incapable = this.IsIncapableOfWholeWorkType(pawn, this.def.workType);
         WidgetsWork.DrawWorkBoxFor(x, y, pawn, this.def.workType, incapable);
         Rect rect2 = new Rect(x, y, 25f, 25f);
         TooltipHandler.TipRegion(rect2, () => WidgetsWork.TipForPawnWorker(pawn, this.def.workType, incapable), pawn.thingIDNumber ^ this.def.workType.GetHashCode());
         Text.Font = GameFont.Small;
     }
 }
Пример #2
0
 public static void DrawWorkBoxFor(float x, float y, Pawn p, WorkTypeDef wType, bool incapableBecauseOfCapacities)
 {
     if (p.story != null && !p.story.WorkTypeIsDisabled(wType))
     {
         Rect rect = new Rect(x, y, 25f, 25f);
         Profiler.BeginSample("DrawWorkBoxFor - Background");
         if (incapableBecauseOfCapacities)
         {
             GUI.color = new Color(1f, 0.3f, 0.3f);
         }
         WidgetsWork.DrawWorkBoxBackground(rect, p, wType);
         GUI.color = Color.white;
         Profiler.EndSample();
         if (Find.PlaySettings.useWorkPriorities)
         {
             int priority = p.workSettings.GetPriority(wType);
             if (priority > 0)
             {
                 Text.Anchor = TextAnchor.MiddleCenter;
                 GUI.color   = WidgetsWork.ColorOfPriority(priority);
                 Rect rect2 = rect.ContractedBy(-3f);
                 Widgets.Label(rect2, priority.ToStringCached());
                 GUI.color   = Color.white;
                 Text.Anchor = TextAnchor.UpperLeft;
             }
             if (Event.current.type == EventType.MouseDown && Mouse.IsOver(rect))
             {
                 bool flag = p.workSettings.WorkIsActive(wType);
                 if (Event.current.button == 0)
                 {
                     int num = p.workSettings.GetPriority(wType) - 1;
                     if (num < 0)
                     {
                         num = 4;
                     }
                     p.workSettings.SetPriority(wType, num);
                     SoundDefOf.AmountIncrement.PlayOneShotOnCamera(null);
                 }
                 if (Event.current.button == 1)
                 {
                     int num2 = p.workSettings.GetPriority(wType) + 1;
                     if (num2 > 4)
                     {
                         num2 = 0;
                     }
                     p.workSettings.SetPriority(wType, num2);
                     SoundDefOf.AmountDecrement.PlayOneShotOnCamera(null);
                 }
                 if (!flag && p.workSettings.WorkIsActive(wType) && wType.relevantSkills.Any <SkillDef>() && p.skills.AverageOfRelevantSkillsFor(wType) <= 2f)
                 {
                     SoundDefOf.Crunch.PlayOneShotOnCamera(null);
                 }
                 Event.current.Use();
                 PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.WorkTab, KnowledgeAmount.SpecificInteraction);
                 PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.ManualWorkPriorities, KnowledgeAmount.SmallInteraction);
             }
         }
         else
         {
             int priority2 = p.workSettings.GetPriority(wType);
             if (priority2 > 0)
             {
                 GUI.DrawTexture(rect, WidgetsWork.WorkBoxCheckTex);
             }
             if (Widgets.ButtonInvisible(rect, false))
             {
                 if (p.workSettings.GetPriority(wType) > 0)
                 {
                     p.workSettings.SetPriority(wType, 0);
                     SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera(null);
                 }
                 else
                 {
                     p.workSettings.SetPriority(wType, 3);
                     SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera(null);
                     if (wType.relevantSkills.Any <SkillDef>() && p.skills.AverageOfRelevantSkillsFor(wType) <= 2f)
                     {
                         SoundDefOf.Crunch.PlayOneShotOnCamera(null);
                     }
                 }
                 PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.WorkTab, KnowledgeAmount.SpecificInteraction);
             }
         }
     }
 }
 internal string <> m__0()
 {
     return(WidgetsWork.TipForPawnWorker(this.pawn, this.$this.def.workType, this.incapable));
 }