コード例 #1
0
        protected override void DrawPawnRow(Rect rect, Pawn p)
        {
            float num = 175f;

            Text.Font = GameFont.Medium;
            for (int i = 0; i < MainTabWindow_Work.VisibleWorkTypeDefsInPriorityOrder.Count; i++)
            {
                WorkTypeDef workTypeDef = MainTabWindow_Work.VisibleWorkTypeDefsInPriorityOrder[i];
                Vector2     topLeft     = new Vector2(num, rect.y + 2.5f);
                WidgetsWork.DrawWorkBoxFor(topLeft, p, workTypeDef);
                Rect rect2 = new Rect(topLeft.x, topLeft.y, 25f, 25f);
                TooltipHandler.TipRegion(rect2, WidgetsWork.TipForPawnWorker(p, workTypeDef));
                num += this.workColumnSpacing;
            }
        }
コード例 #2
0
        protected void DrawSquadRow(Rect rect)
        {
            GUI.DrawTexture(rect, MainTabWindow_PawnListWithSquads.SquadRowBackground);
            float num = 175f;

            Text.Font = GameFont.Medium;
            for (int i = 0; i < MainTabWindow_Work.VisibleWorkTypeDefsInPriorityOrder.Count; i++)
            {
                WorkTypeDef wType   = MainTabWindow_Work.VisibleWorkTypeDefsInPriorityOrder[i];
                Vector2     topLeft = new Vector2(num, rect.y + 2.5f);
                WidgetsWork.DrawWorkBoxForSquad(topLeft, wType, this.squadPriorities, this.pawns);
                num += this.workColumnSpacing;
            }
            GUI.BeginGroup(rect);
            GUI.color = new Color(1f, 1f, 1f, 0.2f);
            Widgets.DrawLineHorizontal(0f, 0f, rect.width);
            GUI.color = new Color(1f, 1f, 1f, 0.35f);
            Widgets.DrawLineHorizontal(0f, base.SquadRowHeight - 3f, rect.width);
            Widgets.DrawLineHorizontal(0f, base.SquadRowHeight - 2f, rect.width);
            Text.Font     = GameFont.Small;
            Text.Anchor   = TextAnchor.MiddleLeft;
            Text.WordWrap = false;
            Rect rect2 = new Rect(0f, 0f, 175f, 30f);

            rect2.xMin += 15f;
            GUI.color   = new Color(1f, 1f, 1f, 1f);
            if (base.SquadFilteringEnabled && SquadManager.Instance.SquadFilter != null)
            {
                Widgets.Label(rect2, SquadManager.Instance.SquadFilter.Name);
            }
            else
            {
                Widgets.Label(rect2, "EdB.Squads.AllColonistsSquadName".Translate());
            }
            Text.Anchor   = TextAnchor.UpperLeft;
            Text.WordWrap = true;
            GUI.color     = Color.white;
            GUI.EndGroup();
        }
コード例 #3
0
        public static void DrawWorkBoxForSquad(Vector2 topLeft, WorkTypeDef wType, SquadPriorities priorities, IEnumerable <Pawn> pawns)
        {
            Rect rect = new Rect(topLeft.x, topLeft.y, 25f, 25f);

            WidgetsWork.DrawWorkBoxBackgroundForSquad(rect, wType);
            if (Find.PlaySettings.useWorkPriorities)
            {
                int    priority = priorities.GetPriority(wType);
                string label;
                if (priority > 0)
                {
                    label = priority.ToString();
                }
                else
                {
                    label = string.Empty;
                }
                Text.Anchor = TextAnchor.MiddleCenter;
                GUI.color   = Color.white;
                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 = priorities.GetPriority(wType) - 1;
                        if (num < 0)
                        {
                            num = 4;
                        }
                        priorities.SetPriority(wType, num);
                        WidgetsWork.SetPriorityForPawns(pawns, wType, num);
                        SoundDefOf.AmountIncrement.PlayOneShotOnCamera();
                    }
                    if (Event.current.button == 1)
                    {
                        int num2 = priorities.GetPriority(wType) + 1;
                        if (num2 > 4)
                        {
                            num2 = 0;
                        }
                        priorities.SetPriority(wType, num2);
                        WidgetsWork.SetPriorityForPawns(pawns, wType, num2);
                        SoundDefOf.AmountDecrement.PlayOneShotOnCamera();
                    }
                    Event.current.Use();
                }
            }
            else
            {
                int priority2 = priorities.GetPriority(wType);
                if (priority2 > 0)
                {
                    GUI.DrawTexture(rect, WidgetsWork.WorkBoxCheckTex);
                }
                if (Widgets.InvisibleButton(rect))
                {
                    if (priorities.GetPriority(wType) > 0)
                    {
                        priorities.SetPriority(wType, 0);
                        WidgetsWork.SetPriorityForPawns(pawns, wType, 0);
                        SoundDefOf.CheckboxTurnedOff.PlayOneShotOnCamera();
                    }
                    else
                    {
                        priorities.SetPriority(wType, 3);
                        WidgetsWork.SetPriorityForPawns(pawns, wType, 3);
                        SoundDefOf.CheckboxTurnedOn.PlayOneShotOnCamera();
                    }
                }
            }
        }
コード例 #4
0
        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();
                    }
                }
            }
        }