Ejemplo n.º 1
0
        public override void DoWindowContents(Rect fillRect)
        {
            base.DoWindowContents(fillRect);
            TimeAssignmentSelector.DrawTimeAssignmentSelectorGrid(new Rect(0f, 0f, 191f, 65f));

            // TODO: check if Royalty active (ModsConfig.RoyaltyActive)
            // new code:
            Rect rect = new Rect(191f + 96f, 0f, 191f, 65f);

            rect.xMax = rect.center.x;
            rect.yMax = rect.center.y - 1f;
            DrawTimeAssignmentSelectorFor(rect, CultsDefOf.Cults_TimeAssignment_Worship);
        }
Ejemplo n.º 2
0
        public override void DoWindowContents(Rect rect)
        {
            base.DoWindowContents(rect);
            var hostilityResponseRect = new Rect(rect.x + 20, rect.y + 25, 24, 24);

            HostilityResponseModeUtilityGroup.DrawResponseButton(hostilityResponseRect, this.colonistGroup, true);

            var medicalCareRect = new Rect(rect.x + 50, rect.y + 25, 24, 24);

            MedicalCareUtilityGroup.MedicalCareSelectButton(medicalCareRect, this.colonistGroup);

            if (ModsConfig.IdeologyActive)
            {
                var groupColorRect = new Rect(hostilityResponseRect.x, hostilityResponseRect.yMax + 7, 24, 24);
                GUI.DrawTexture(groupColorRect.ExpandedBy(5), ContentFinder <Texture2D> .Get("Things/Item/Dye/Dye_a"));
                if (Mouse.IsOver(groupColorRect))
                {
                    TooltipHandler.TipRegion(groupColorRect, Strings.GroupColorTooltip);
                    Widgets.DrawHighlight(groupColorRect);
                    if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && Event.current.clickCount == 1)
                    {
                        var colorPicker = new Dialog_ColorPicker(this, colonistGroup, this.windowRect, Textures.DyeMenu);
                        Find.WindowStack.Add(colorPicker);
                        SoundDefOf.Tick_High.PlayOneShotOnCamera();
                    }
                }
            }
            var timeAssignmentSelectorGridRect = new Rect(rect.x + 80, rect.y + 20, 191f, 65f);

            TimeAssignmentSelector.DrawTimeAssignmentSelectorGrid(timeAssignmentSelectorGridRect);
            var timeTableHeaderRect = new Rect(rect.x + 10, rect.y + 85f, rect.width - 20f, 20f);

            DoTimeTableHeader(timeTableHeaderRect);
            var timeTableRect = new Rect(rect.x + 10, rect.y + 105, rect.width - 20f, 30f);

            DoTimeTableCell(timeTableRect);


            var policyButtonWidth = rect.width * 0.45f;
            var areaHeaderRect    = new Rect(rect.x + 10, rect.y + 195f, policyButtonWidth, 20f);

            DoAreaHeader(areaHeaderRect);

            var check = new Vector2(areaHeaderRect.xMax - 25f, areaHeaderRect.yMax - 34);

            Widgets.Checkbox(check, ref this.colonistGroup.groupAreaEnabled);
            var drawBoxRect = new Rect(check, new Vector2(24f, 24f));

            Widgets.DrawBox(drawBoxRect);
            TooltipHandler.TipRegion(drawBoxRect, Strings.GroupAreaTooltip);

            var areaRect = new Rect(rect.x + 10, rect.y + 205, policyButtonWidth, 30f);

            DoAreaCell(areaRect);

            var outfitHeaderRect = new Rect(rect.x + policyButtonWidth + 30, rect.y + 195f, policyButtonWidth, 20f);

            DoOutfitHeader(outfitHeaderRect);

            check = new Vector2(outfitHeaderRect.xMax - 26f, outfitHeaderRect.yMax - 33);
            Widgets.Checkbox(check, ref this.colonistGroup.groupOutfitEnabled);
            drawBoxRect = new Rect(check, new Vector2(24f, 24f));
            Widgets.DrawBox(drawBoxRect);
            TooltipHandler.TipRegion(drawBoxRect, Strings.GroupFoodTooltip);

            var outfitRect = new Rect(rect.x + policyButtonWidth + 30, rect.y + 205, policyButtonWidth, 30f);

            DoOutfitCell(outfitRect);

            var drugPolicyHeaderRect = new Rect(rect.x + 10, rect.y + 305f, policyButtonWidth, 20f);

            DoDrugPolicyHeader(drugPolicyHeaderRect);

            check = new Vector2(drugPolicyHeaderRect.xMax - 25f, drugPolicyHeaderRect.yMax - 33);
            Widgets.Checkbox(check, ref this.colonistGroup.groupDrugPolicyEnabled);
            drawBoxRect = new Rect(check, new Vector2(24f, 24f));
            Widgets.DrawBox(drawBoxRect);
            TooltipHandler.TipRegion(drawBoxRect, Strings.GroupDrugsTooltip);

            var drugPolicyRect = new Rect(rect.x + 10, rect.y + 315, policyButtonWidth, 30f);

            DoDrugPolicyCell(drugPolicyRect);

            var foodHeaderRect = new Rect(rect.x + policyButtonWidth + 30, rect.y + 305f, policyButtonWidth, 20f);

            DoFoodHeader(foodHeaderRect);

            check = new Vector2(foodHeaderRect.xMax - 26f, foodHeaderRect.yMax - 33);
            Widgets.Checkbox(check, ref this.colonistGroup.groupFoodRestrictionEnabled);
            drawBoxRect = new Rect(check, new Vector2(24f, 24f));
            Widgets.DrawBox(drawBoxRect);
            TooltipHandler.TipRegion(drawBoxRect, Strings.GroupFoodTooltip);

            var foodRect = new Rect(rect.x + policyButtonWidth + 30, rect.y + 315, policyButtonWidth, 30f);

            DoFoodCell(foodRect);

            if (!(ModCompatibility.assignManagerSaveCurrentStateMethod is null))
            {
                ModCompatibility.assignManagerSaveCurrentStateMethod.Invoke(null, new object[] { this.colonistGroup.pawns });
            }
            Text.Anchor = TextAnchor.MiddleCenter;
            var moodTexture = GetMoodTexture(out string moodLabel);
            var moodRect    = new Rect(rect.x + policyButtonWidth + 135f, rect.y + 25, moodTexture.width, moodTexture.height);

            GUI.DrawTexture(moodRect, moodTexture);
            var moodLabelRect = new Rect(moodRect.x, moodRect.y + moodTexture.height, 45, 24);

            Widgets.Label(moodLabelRect, moodLabel);
            TooltipHandler.TipRegion(moodRect, Strings.MoodIconTooltip);

            var healthTexture = GetHealthTexture(out string healthPercent);
            var healthRect    = new Rect(moodRect.x + 45f, moodRect.y, healthTexture.width, healthTexture.height);

            GUI.DrawTexture(healthRect, healthTexture);
            var healthLabelRect = new Rect(healthRect.x, healthRect.y + healthRect.height, 40, 24);

            Widgets.Label(healthLabelRect, healthPercent);
            TooltipHandler.TipRegion(healthRect, Strings.HealthIconTooltip);

            var restTexture = GetRestTexture(out string restPercent);
            var restRect    = new Rect(healthRect.x + 45f, healthRect.y, restTexture.width, restTexture.height);

            GUI.DrawTexture(restRect, restTexture);
            var restLabelRect = new Rect(restRect.x, restRect.y + restRect.height, 40, 24);

            Widgets.Label(restLabelRect, restPercent);
            TooltipHandler.TipRegion(restRect, Strings.RestIconTooltip);

            var foodTexture  = GetFoodTexture(out string foodPercent);
            var foodStatRect = new Rect(restRect.x + 45f, restRect.y, foodTexture.width, foodTexture.height);

            GUI.DrawTexture(foodStatRect, foodTexture);
            var foodLabelRect = new Rect(foodStatRect.x, foodStatRect.y + foodStatRect.height, 40, 24);

            Widgets.Label(foodLabelRect, foodPercent);
            TooltipHandler.TipRegion(foodStatRect, Strings.HungerIconTooltip);

            var   pawnRowRect = new Rect(rect.x + 15, rect.y + (rect.height - 110f), rect.width - 30f, TacticalColonistBar.DefaultBaseSize.y + 42f);
            var   pawnMargin  = 20f;
            float listWidth   = this.colonistGroup.pawns.Count * (TacticalColonistBar.DefaultBaseSize.x + pawnMargin);
            Rect  rect1       = new Rect(pawnRowRect.x, pawnRowRect.y, listWidth, pawnRowRect.height - 16f);

            Widgets.BeginScrollView(pawnRowRect, ref scrollPosition, rect1);

            for (var i = 0; i < this.colonistGroup.pawns.Count; i++)
            {
                var pawnRect = new Rect(pawnRowRect.x + 13f + (i * (TacticalColonistBar.DefaultBaseSize.x + pawnMargin)), pawnRowRect.y + 17, TacticalColonistBar.DefaultBaseSize.x, TacticalColonistBar.DefaultBaseSize.y);
                DrawColonist(pawnRect, this.colonistGroup.pawns[i], this.colonistGroup.pawns[i].Map, false, false);
                HandleClicks(pawnRect, this.colonistGroup.pawns[i]);
            }

            for (var i = 0; i < this.colonistGroup.pawns.Count; i++)
            {
                var pawnRect = new Rect(pawnRowRect.x + 13f + (i * (TacticalColonistBar.DefaultBaseSize.x + pawnMargin)), pawnRowRect.y + 17, TacticalColonistBar.DefaultBaseSize.x, TacticalColonistBar.DefaultBaseSize.y);
                DrawPawnArrows(pawnRect, this.colonistGroup.pawns[i]);
            }

            Widgets.EndScrollView();
            Text.Anchor = TextAnchor.UpperLeft;
            GUI.color   = Color.white;
        }
Ejemplo n.º 3
0
        public override void DoWindowContents(Rect rect)
        {
            base.DoWindowContents(rect);
            var hostilityResponseRect = new Rect(rect.x + 20, rect.y + 25, 24, 24);

            HostilityResponseModeUtilityGroup.DrawResponseButton(hostilityResponseRect, this.colonistGroup, true);

            var medicalCareRect = new Rect(rect.x + 50, rect.y + 25, 24, 24);

            MedicalCareUtilityGroup.MedicalCareSelectButton(medicalCareRect, this.colonistGroup);

            var timeAssignmentSelectorGridRect = new Rect(rect.x + 80, rect.y + 20, 191f, 65f);

            TimeAssignmentSelector.DrawTimeAssignmentSelectorGrid(timeAssignmentSelectorGridRect);
            var timeTableHeaderRect = new Rect(rect.x + 10, rect.y + 85f, rect.width - 20f, 20f);

            DoTimeTableHeader(timeTableHeaderRect);
            var timeTableRect = new Rect(rect.x + 10, rect.y + 105, rect.width - 20f, 30f);

            DoTimeTableCell(timeTableRect);


            var policyButtonWidth = rect.width * 0.45f;
            var areaHeaderRect    = new Rect(rect.x + 10, rect.y + 195f, policyButtonWidth, 20f);

            DoAreaHeader(areaHeaderRect);

            var check = new Vector2(areaHeaderRect.xMax - 25f, areaHeaderRect.yMax - 34);

            Widgets.Checkbox(check, ref this.colonistGroup.groupAreaEnabled);
            var drawBoxRect = new Rect(check, new Vector2(24f, 24f));

            Widgets.DrawBox(drawBoxRect);
            TooltipHandler.TipRegion(drawBoxRect, Strings.GroupAreaTooltip);

            var areaRect = new Rect(rect.x + 10, rect.y + 205, policyButtonWidth, 30f);

            DoAreaCell(areaRect);

            var outfitHeaderRect = new Rect(rect.x + policyButtonWidth + 30, rect.y + 195f, policyButtonWidth, 20f);

            DoOutfitHeader(outfitHeaderRect);

            check = new Vector2(outfitHeaderRect.xMax - 26f, outfitHeaderRect.yMax - 33);
            Widgets.Checkbox(check, ref this.colonistGroup.groupOutfitEnabled);
            drawBoxRect = new Rect(check, new Vector2(24f, 24f));
            Widgets.DrawBox(drawBoxRect);
            TooltipHandler.TipRegion(drawBoxRect, Strings.GroupFoodTooltip);

            var outfitRect = new Rect(rect.x + policyButtonWidth + 30, rect.y + 205, policyButtonWidth, 30f);

            DoOutfitCell(outfitRect);

            var drugPolicyHeaderRect = new Rect(rect.x + 10, rect.y + 305f, policyButtonWidth, 20f);

            DoDrugPolicyHeader(drugPolicyHeaderRect);

            check = new Vector2(drugPolicyHeaderRect.xMax - 25f, drugPolicyHeaderRect.yMax - 33);
            Widgets.Checkbox(check, ref this.colonistGroup.groupDrugPolicyEnabled);
            drawBoxRect = new Rect(check, new Vector2(24f, 24f));
            Widgets.DrawBox(drawBoxRect);
            TooltipHandler.TipRegion(drawBoxRect, Strings.GroupDrugsTooltip);

            var drugPolicyRect = new Rect(rect.x + 10, rect.y + 315, policyButtonWidth, 30f);

            DoDrugPolicyCell(drugPolicyRect);

            var foodHeaderRect = new Rect(rect.x + policyButtonWidth + 30, rect.y + 305f, policyButtonWidth, 20f);

            DoFoodHeader(foodHeaderRect);

            check = new Vector2(foodHeaderRect.xMax - 26f, foodHeaderRect.yMax - 33);
            Widgets.Checkbox(check, ref this.colonistGroup.groupFoodRestrictionEnabled);
            drawBoxRect = new Rect(check, new Vector2(24f, 24f));
            Widgets.DrawBox(drawBoxRect);
            TooltipHandler.TipRegion(drawBoxRect, Strings.GroupFoodTooltip);

            var foodRect = new Rect(rect.x + policyButtonWidth + 30, rect.y + 315, policyButtonWidth, 30f);

            DoFoodCell(foodRect);

            if (ModCompatibility.BetterPawnControlIsActive)
            {
                ModCompatibility.restrictManagerSaveCurrentStateMethod.Invoke(null, new object[] { this.colonistGroup.pawns });
            }
            Text.Anchor = TextAnchor.MiddleCenter;
            var moodTexture = GetMoodTexture(out string moodLabel);
            var moodRect    = new Rect(rect.x + policyButtonWidth + 135f, rect.y + 25, moodTexture.width, moodTexture.height);

            GUI.DrawTexture(moodRect, moodTexture);
            var moodLabelRect = new Rect(moodRect.x, moodRect.y + moodTexture.height, 45, 24);

            Widgets.Label(moodLabelRect, moodLabel);
            TooltipHandler.TipRegion(moodRect, Strings.MoodIconTooltip);

            var healthTexture = GetHealthTexture(out string healthPercent);
            var healthRect    = new Rect(moodRect.x + 45f, moodRect.y, healthTexture.width, healthTexture.height);

            GUI.DrawTexture(healthRect, healthTexture);
            var healthLabelRect = new Rect(healthRect.x, healthRect.y + healthRect.height, 40, 24);

            Widgets.Label(healthLabelRect, healthPercent);
            TooltipHandler.TipRegion(healthRect, Strings.HealthIconTooltip);

            var restTexture = GetRestTexture(out string restPercent);
            var restRect    = new Rect(healthRect.x + 45f, healthRect.y, restTexture.width, restTexture.height);

            GUI.DrawTexture(restRect, restTexture);
            var restLabelRect = new Rect(restRect.x, restRect.y + restRect.height, 40, 24);

            Widgets.Label(restLabelRect, restPercent);
            TooltipHandler.TipRegion(restRect, Strings.RestIconTooltip);

            var foodTexture  = GetFoodTexture(out string foodPercent);
            var foodStatRect = new Rect(restRect.x + 45f, restRect.y, foodTexture.width, foodTexture.height);

            GUI.DrawTexture(foodStatRect, foodTexture);
            var foodLabelRect = new Rect(foodStatRect.x, foodStatRect.y + foodStatRect.height, 40, 24);

            Widgets.Label(foodLabelRect, foodPercent);
            TooltipHandler.TipRegion(foodStatRect, Strings.HungerIconTooltip);

            var   pawnRowRect = new Rect(rect.x + 15, rect.y + (rect.height - 110f), rect.width - 30f, TacticalColonistBar.DefaultBaseSize.y + 42f);
            var   pawnMargin  = 20f;
            float listWidth   = this.colonistGroup.pawns.Count * (TacticalColonistBar.DefaultBaseSize.x + pawnMargin);
            Rect  rect1       = new Rect(pawnRowRect.x, pawnRowRect.y, listWidth, pawnRowRect.height - 16f);

            Widgets.BeginScrollView(pawnRowRect, ref scrollPosition, rect1);

            for (var i = 0; i < this.colonistGroup.pawns.Count; i++)
            {
                var pawnRect = new Rect(pawnRowRect.x + 13f + (i * (TacticalColonistBar.DefaultBaseSize.x + pawnMargin)), pawnRowRect.y + 17, TacticalColonistBar.DefaultBaseSize.x, TacticalColonistBar.DefaultBaseSize.y);
                DrawColonist(pawnRect, this.colonistGroup.pawns[i], this.colonistGroup.pawns[i].Map, false, false);
                HandleClicks(pawnRect, this.colonistGroup.pawns[i]);
            }

            for (var i = 0; i < this.colonistGroup.pawns.Count; i++)
            {
                var pawnRect = new Rect(pawnRowRect.x + 13f + (i * (TacticalColonistBar.DefaultBaseSize.x + pawnMargin)), pawnRowRect.y + 17, TacticalColonistBar.DefaultBaseSize.x, TacticalColonistBar.DefaultBaseSize.y);
                DrawPawnArrows(pawnRect, this.colonistGroup.pawns[i]);
            }

            Widgets.EndScrollView();
            Text.Anchor = TextAnchor.UpperLeft;
            GUI.color   = Color.white;
        }
Ejemplo n.º 4
0
 public override void DoWindowContents(Rect fillRect)
 {
     base.DoWindowContents(fillRect);
     TimeAssignmentSelector.DrawTimeAssignmentSelectorGrid(new Rect(fillRect.x, fillRect.y, TimeAssignmentSelectorWidth, TimeAssignmentSelectorHeight));
 }