public static void DrawWorkBoxFor(Vector2 topLeft, Pawn p, WorkTypeDef wType)
        {
            if (p.story == null || p.workSettings == null || p.story.WorkTypeIsDisabled(wType))
            {
                return;
            }
            Rect rect = new Rect(topLeft.x, topLeft.y, 25f, 25f);

            WidgetsWork.DrawWorkBoxBackground(rect, p, wType);
            if (Find.PlaySettings.useWorkPriorities)
            {
                int    priority = p.workSettings.GetPriority(wType);
                string label;
                if (priority > 0)
                {
                    label = priority.ToString();
                }
                else
                {
                    label = string.Empty;
                }
                Text.Anchor = TextAnchor.MiddleCenter;
                GUI.color   = WidgetsWork.ColorOfPriority(priority, p.skills.MaxPassionOfRelevantSkillsFor(wType));
                Rect rect2 = rect.ContractedBy(-3f);
                Widgets.Label(rect2, label);
                GUI.color   = Color.white;
                Text.Anchor = TextAnchor.UpperLeft;
                if (Event.current.type == EventType.MouseDown && Mouse.IsOver(rect))
                {
                    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();
                    }
                    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();
                    }
                    Event.current.Use();
                }
            }
            else
            {
                int priority2 = p.workSettings.GetPriority(wType);
                if (priority2 > 0)
                {
                    GUI.DrawTexture(rect, WidgetsWork.WorkBoxCheckTex);
                }
                if (Widgets.InvisibleButton(rect))
                {
                    if (p.workSettings.GetPriority(wType) > 0)
                    {
                        p.workSettings.SetPriority(wType, 0);
                        SoundDefOf.CheckboxTurnedOff.PlayOneShotOnCamera();
                    }
                    else
                    {
                        p.workSettings.SetPriority(wType, 3);
                        SoundDefOf.CheckboxTurnedOn.PlayOneShotOnCamera();
                    }
                }
            }
        }