// Token: 0x06001B47 RID: 6983 RVA: 0x000A6A5C File Offset: 0x000A4C5C
        public static Listing_Standard BeginSection(this Listing_Standard L, Listing_Standard listing, bool hidesection = false, int type = 0, int sectionBorder = 4, int bottomBorder = 4)
        {
            Rect rect = L.GetRect(listing.MaxColumnHeightSeen + sectionBorder + bottomBorder);

            if (!hidesection)
            {
                switch (type)
                {
                case 1:
                    Widgets.DrawWindowBackground(rect);
                    break;

                case 2:
                    Widgets.DrawWindowBackgroundTutor(rect);
                    break;

                case 3:
                    Widgets.DrawOptionUnselected(rect);
                    break;

                case 4:
                    Widgets.DrawOptionSelected(rect);
                    break;

                default:
                    Widgets.DrawMenuSection(rect);
                    break;
                }
            }
            Listing_Standard listing_Standard = new Listing_Standard();
            Rect             rect2            = new Rect(rect.x + sectionBorder, rect.y + sectionBorder, rect.width - sectionBorder * 2f, rect.height - (sectionBorder + bottomBorder));

            listing_Standard.Begin(rect2);
            return(listing_Standard);
        }
Ejemplo n.º 2
0
        private void DrawExtras(Rect rect)
        {
            Widgets.DrawMenuSection(rect);
            Listing_Standard listing = new Listing_Standard(rect.ContractedBy(5f));

            listing.DoLabelCheckbox("ExplodeOnDeath".Translate(), ref _bp.ExplodeOnDeath);
            if (_bp.ExplodeOnDeath)
            {
                listing.DoLabel("ExplosionRadius".Translate(_bp.ExplosionRadius.ToString("0.0")));
                _bp.ExplosionRadius = listing.DoSlider(_bp.ExplosionRadius, 0.9f, 3.9f);
            }

            listing.DoLabel("StartingSkill".Translate(_bp.StartingSkillLevel));
            _bp.StartingSkillLevel = (int)listing.DoSlider(_bp.StartingSkillLevel, 1, 20);

            if (listing.DoTextButtonLabeled("SkillPassion".Translate(), _bp.SkillPassion.ToString()))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();

                foreach (Passion p in Enum.GetValues(typeof(Passion)))
                {
                    if (p != _bp.SkillPassion)
                    {
                        FloatMenuOption option = new FloatMenuOption(p.ToString(), () => _bp.SkillPassion = p);
                        list.Add(option);
                    }
                }
                Find.LayerStack.Add(new Layer_FloatMenu(list));
            }
            listing.End();
        }
Ejemplo n.º 3
0
        public static TabRecord DrawTabs(Rect baseRect, List <TabRecord> tabs, int rows)
        {
            if (rows <= 1)
            {
                return(TabDrawer.DrawTabs(baseRect, tabs, 200f));
            }
            int       num    = Mathf.FloorToInt((float)(tabs.Count / rows));
            int       num2   = 0;
            TabRecord result = null;
            Rect      rect   = baseRect;

            baseRect.yMin -= (float)(rows - 1) * 31f;
            Rect rect2 = baseRect;

            rect2.yMax = rect.y;
            Widgets.DrawMenuSection(rect2);
            for (int i = 0; i < rows; i++)
            {
                int num3 = (i != 0) ? num : (tabs.Count - (rows - 1) * num);
                TabDrawer.tmpTabs.Clear();
                for (int j = num2; j < num2 + num3; j++)
                {
                    TabDrawer.tmpTabs.Add(tabs[j]);
                }
                TabRecord tabRecord = TabDrawer.DrawTabs(baseRect, TabDrawer.tmpTabs, baseRect.width);
                if (tabRecord != null)
                {
                    result = tabRecord;
                }
                baseRect.yMin += 31f;
                num2          += num3;
            }
            TabDrawer.tmpTabs.Clear();
            return(result);
        }
Ejemplo n.º 4
0
        public override void DoWindowContents(Rect inRect)
        {
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;

            Rect rect2 = inRect;

            rect2.yMin += 35;
            tabsList.Clear();
            tabsList.Add(new TabRecord("StationTab".Translate(), delegate
            {
                tab = Tab.Station;
            }, tab == Tab.Station));
            tabsList.Add(new TabRecord("ArmorTab".Translate(), delegate
            {
                tab = Tab.Armor;
            }, tab == Tab.Armor));

            Widgets.DrawMenuSection(rect2);
            TabDrawer.DrawTabs(rect2, tabsList, maxTabWidth: 550);
            tabsList.Clear();

            switch (tab)
            {
            case Tab.Station:
                DrawStation(rect2);
                break;

            case Tab.Armor:
                DrawArmor(rect2);
                break;
            }
        }
Ejemplo n.º 5
0
        public override void DoWindowContents(Rect inRect)
        {
            Rect rect = new Rect(0f, 0f, inRect.width, 35f);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect, ((!this.reform) ? "FormCaravan" : "ReformCaravan").Translate());
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            CaravanUIUtility.CaravanInfo info  = new CaravanUIUtility.CaravanInfo(this.MassUsage, this.MassCapacity, this.cachedMassCapacityExplanation, this.TilesPerDay, this.cachedTilesPerDayExplanation, this.DaysWorthOfFood, this.ForagedFoodPerDay, this.cachedForagedFoodPerDayExplanation, this.Visibility, this.cachedVisibilityExplanation, -1f, -1f, null);
            CaravanUIUtility.CaravanInfo?info2 = null;
            int    currentTile   = this.CurrentTile;
            int?   ticksToArrive = (this.destinationTile != -1) ? new int?(this.TicksToArrive) : null;
            float  num           = this.lastMassFlashTime;
            Rect   rect2         = new Rect(12f, 35f, inRect.width - 24f, 40f);
            string extraDaysWorthOfFoodTipInfo = (this.destinationTile != -1) ? "DaysWorthOfFoodTooltip_OnlyFirstWaypoint".Translate() : null;

            CaravanUIUtility.DrawCaravanInfo(info, info2, currentTile, ticksToArrive, num, rect2, true, extraDaysWorthOfFoodTipInfo, false);
            Dialog_FormCaravan.tabsList.Clear();
            Dialog_FormCaravan.tabsList.Add(new TabRecord("PawnsTab".Translate(), delegate
            {
                this.tab = Dialog_FormCaravan.Tab.Pawns;
            }, this.tab == Dialog_FormCaravan.Tab.Pawns));
            Dialog_FormCaravan.tabsList.Add(new TabRecord("ItemsTab".Translate(), delegate
            {
                this.tab = Dialog_FormCaravan.Tab.Items;
            }, this.tab == Dialog_FormCaravan.Tab.Items));
            inRect.yMin += 119f;
            Widgets.DrawMenuSection(inRect);
            TabDrawer.DrawTabs(inRect, Dialog_FormCaravan.tabsList, 200f);
            Dialog_FormCaravan.tabsList.Clear();
            inRect         = inRect.ContractedBy(17f);
            inRect.height += 17f;
            GUI.BeginGroup(inRect);
            Rect rect3 = inRect.AtZero();

            this.DoBottomButtons(rect3);
            Rect inRect2 = rect3;

            inRect2.yMax -= 76f;
            bool flag = false;

            Dialog_FormCaravan.Tab tab = this.tab;
            if (tab != Dialog_FormCaravan.Tab.Pawns)
            {
                if (tab == Dialog_FormCaravan.Tab.Items)
                {
                    this.itemsTransfer.OnGUI(inRect2, out flag);
                }
            }
            else
            {
                this.pawnsTransfer.OnGUI(inRect2, out flag);
            }
            if (flag)
            {
                this.CountToTransferChanged();
            }
            GUI.EndGroup();
        }
        private void DrawPortraitArea(Rect rect)
        {
            Widgets.DrawMenuSection(rect);
            rect = rect.ContractedBy(17f);
            GUI.DrawTexture(new Rect(rect.center.x - Page_ConfigureStartingPawns.PawnPortraitSize.x / 2f, rect.yMin - 20f, Page_ConfigureStartingPawns.PawnPortraitSize.x, Page_ConfigureStartingPawns.PawnPortraitSize.y), PortraitsCache.Get(this.curPawn, Page_ConfigureStartingPawns.PawnPortraitSize, default(Vector3), 1f));
            Rect rect2 = rect;

            rect2.width = 500f;
            CharacterCardUtility.DrawCharacterCard(rect2, this.curPawn, new Action(this.RandomizeCurPawn), rect);
            Rect rect3 = rect;

            rect3.yMin  += 100f;
            rect3.xMin   = rect2.xMax + 5f;
            rect3.height = 200f;
            Text.Font    = GameFont.Medium;
            Widgets.Label(rect3, "Health".Translate());
            Text.Font   = GameFont.Small;
            rect3.yMin += 35f;
            HealthCardUtility.DrawHediffListing(rect3, this.curPawn, true);
            Rect rect4 = new Rect(rect3.x, rect3.yMax, rect3.width, 200f);

            Text.Font = GameFont.Medium;
            Widgets.Label(rect4, "Relations".Translate());
            Text.Font   = GameFont.Small;
            rect4.yMin += 35f;
            SocialCardUtility.DrawRelationsAndOpinions(rect4, this.curPawn);
        }
Ejemplo n.º 7
0
 private void DrawFactionTopMenu(Rect inRect)
 {
     Widgets.DrawMenuSection(new Rect(0, 32, 312, 65));
     DrawFactionName(inRect);
     DrawFactionTitle(inRect);
     DrawFactionIcon(inRect);
 }
Ejemplo n.º 8
0
        public override void DoWindowContents(Rect inRect)
        {
            Rect rect = new Rect(0f, 0f, inRect.width, TitleRectHeight);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect, "DockCaravan".Translate());
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            CaravanUIUtility.DrawCaravanInfo(new CaravanUIUtility.CaravanInfo(SourceMassUsage, SourceMassCapacity, cachedSourceMassCapacityExplanation, SourceTilesPerDay,
                                                                              cachedSourceTilesPerDayExplanation, SourceDaysWorthOfFood, SourceForagedFoodPerDay, cachedSourceForagedFoodPerDayExplanation, SourceVisibility,
                                                                              cachedSourceVisibilityExplanation, -1f, -1f, null), null, caravan.Tile, (!caravan.pather.Moving) ? null : new int?(TicksToArrive), -9999f,
                                             new Rect(12f, TitleRectHeight, inRect.width - 24f, 40f), true, null, false);
            inRect.yMin += 119f;
            Widgets.DrawMenuSection(inRect);
            TabDrawer.DrawTabs(inRect, new List <TabRecord>()
            {
                new TabRecord("ItemsTab".Translate(), null, true)
            }, 200f);
            inRect = inRect.ContractedBy(17f);
            GUI.BeginGroup(inRect);
            Rect rect2 = inRect.AtZero();

            DoBottomButtons(rect2);
            Rect inRect2 = rect2;

            inRect2.yMax -= 59f;
            itemsTransfer.OnGUI(inRect2, out bool flag);
            if (flag)
            {
                CountToTransferChanged();
            }
            GUI.EndGroup();
        }
Ejemplo n.º 9
0
        /******************************************************************************************
        *
        * DoWindowContents override
        *
        *
        ******************************************************************************************/
        public override void DoWindowContents(Rect inRect)
        {
            if (!noBenchWarned)
            {
                bool       flag = false;
                List <Map> maps = Find.Maps;
                for (int i = 0; i < maps.Count; i++)
                {
                    if (maps[i].listerBuildings.ColonistsHaveResearchBench())
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    Find.WindowStack.Add(new Dialog_MessageBox("ResearchMenuWithoutBench".Translate(), null, null, null, null, null, false));
                }
                noBenchWarned = true;
            }
            float num = 0f;

            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Small;
            Rect leftOutRect = new Rect(0f, num, 200f, inRect.height - num);
            Rect rect        = new Rect(leftOutRect.xMax + 10f, num, inRect.width - leftOutRect.width - 10f, inRect.height - num);

            Widgets.DrawMenuSection(rect, true);
            //thisTab.Method("DrawLeftRect").GetValue<void>(leftOutRect);
            DrawLeftRectInfo.Invoke(this, new object[] { leftOutRect });
            DrawRightRect(rect);
        }
Ejemplo n.º 10
0
        public static void DrawScenarioEditInterface(Rect rect, Scenario scen, ref Vector2 infoScrollPosition)
        {
            Widgets.DrawMenuSection(rect);
            rect = rect.GetInnerRect();
            if (scen == null)
            {
                return;
            }
            Rect viewRect = new Rect(0f, 0f, rect.width - 16f, ScenarioUI.editViewHeight);

            Widgets.BeginScrollView(rect, ref infoScrollPosition, viewRect, true);
            Rect             rect2            = new Rect(0f, 0f, viewRect.width, 99999f);
            Listing_ScenEdit listing_ScenEdit = new Listing_ScenEdit(scen);

            listing_ScenEdit.ColumnWidth = rect2.width;
            listing_ScenEdit.Begin(rect2);
            listing_ScenEdit.Label("Title".Translate(), -1f, null);
            scen.name = listing_ScenEdit.TextEntry(scen.name, 1).TrimmedToLength(55);
            listing_ScenEdit.Label("Summary".Translate(), -1f, null);
            scen.summary = listing_ScenEdit.TextEntry(scen.summary, 2).TrimmedToLength(300);
            listing_ScenEdit.Label("Description".Translate(), -1f, null);
            scen.description = listing_ScenEdit.TextEntry(scen.description, 4).TrimmedToLength(1000);
            listing_ScenEdit.Gap(12f);
            foreach (ScenPart current in scen.AllParts)
            {
                current.DoEditInterface(listing_ScenEdit);
            }
            listing_ScenEdit.End();
            ScenarioUI.editViewHeight = listing_ScenEdit.CurHeight + 100f;
            Widgets.EndScrollView();
        }
        protected override void FillTab()
        {
            PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.FrameDisplayed);
            Text.Font = GameFont.Small;
            Rect rect  = new Rect(0f, 0f, base.size.x, base.size.y);
            Rect rect2 = rect.ContractedBy(10f);

            rect2.yMin += 24f;
            bool             isPrisonerOfColony = base.SelPawn.IsPrisonerOfColony;
            Listing_Standard listing_Standard   = new Listing_Standard();

            listing_Standard.Begin(rect2);
            Rect rect3 = listing_Standard.GetRect(Text.LineHeight);

            rect3.width *= 0.75f;
            bool getsFood = base.SelPawn.guest.GetsFood;

            Widgets.CheckboxLabeled(rect3, "GetsFood".Translate(), ref getsFood, false);
            base.SelPawn.guest.GetsFood = getsFood;
            listing_Standard.Gap(12f);
            Rect rect4 = listing_Standard.GetRect(28f);

            rect4.width = 140f;
            MedicalCareUtility.MedicalCareSetter(rect4, ref base.SelPawn.playerSettings.medCare);
            listing_Standard.Gap(4f);
            if (isPrisonerOfColony)
            {
                listing_Standard.Label("RecruitmentDifficulty".Translate() + ": " + base.SelPawn.RecruitDifficulty(Faction.OfPlayer, false).ToStringPercent(), -1f);
                if (base.SelPawn.guilt.IsGuilty)
                {
                    listing_Standard.Label("ConsideredGuilty".Translate(base.SelPawn.guilt.TicksUntilInnocent.ToStringTicksToPeriod(true, false, true)), -1f);
                }
                if (Prefs.DevMode)
                {
                    listing_Standard.Label("Dev: Prison break MTB days: " + (int)PrisonBreakUtility.InitiatePrisonBreakMtbDays(base.SelPawn), -1f);
                }
                Rect rect5 = listing_Standard.GetRect(200f).Rounded();
                Widgets.DrawMenuSection(rect5);
                Rect position = rect5.ContractedBy(10f);
                GUI.BeginGroup(position);
                Rect rect6 = new Rect(0f, 0f, position.width, 30f);
                foreach (PrisonerInteractionModeDef item in from pim in DefDatabase <PrisonerInteractionModeDef> .AllDefs
                         orderby pim.listOrder
                         select pim)
                {
                    if (Widgets.RadioButtonLabeled(rect6, item.LabelCap, base.SelPawn.guest.interactionMode == item))
                    {
                        base.SelPawn.guest.interactionMode = item;
                        if (item == PrisonerInteractionModeDefOf.Execution && base.SelPawn.MapHeld != null && !this.ColonyHasAnyWardenCapableOfViolence(base.SelPawn.MapHeld))
                        {
                            Messages.Message("MessageCantDoExecutionBecauseNoWardenCapableOfViolence".Translate(), base.SelPawn, MessageTypeDefOf.CautionInput);
                        }
                    }
                    rect6.y += 28f;
                }
                GUI.EndGroup();
            }
            listing_Standard.End();
        }
Ejemplo n.º 12
0
        public override void DoWindowContents(Rect inRect)
        {
            Rect rect = new Rect(0f, 0f, inRect.width, 40f);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect, "LoadTransporters".Translate(new object[]
            {
                this.TransportersLabelFull
            }));
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            Dialog_LoadShipCargo.tabsList.Clear();
            Dialog_LoadShipCargo.tabsList.Add(new TabRecord("PawnsTab".Translate(), delegate
            {
                this.tab = Dialog_LoadShipCargo.Tab.Pawns;
            }, this.tab == Dialog_LoadShipCargo.Tab.Pawns));
            Dialog_LoadShipCargo.tabsList.Add(new TabRecord("ItemsTab".Translate(), delegate
            {
                this.tab = Dialog_LoadShipCargo.Tab.Items;
            }, this.tab == Dialog_LoadShipCargo.Tab.Items));
            inRect.yMin += 72f;
            Widgets.DrawMenuSection(inRect);
            TabDrawer.DrawTabs(inRect, Dialog_LoadShipCargo.tabsList);
            inRect = inRect.ContractedBy(17f);
            GUI.BeginGroup(inRect);
            Rect rect2 = inRect.AtZero();
            Rect rect3 = rect2;

            rect3.xMin += rect2.width - this.pawnsTransfer.TotalNumbersColumnsWidths;
            rect3.y    += 32f;
            TransferableUIUtility.DrawMassInfo(rect3, this.MassUsage, this.MassCapacity, "TransportersMassUsageTooltip".Translate(), this.lastMassFlashTime, true);
            CaravanUIUtility.DrawDaysWorthOfFoodInfo(new Rect(rect3.x, rect3.y + 22f, rect3.width, rect3.height), this.DaysWorthOfFood.First, this.DaysWorthOfFood.Second, this.EnvironmentAllowsEatingVirtualPlantsNow, true, 3.40282347E+38f);
            this.DrawPassengerCapacity(rect3);

            this.DoBottomButtons(rect2);
            Rect inRect2 = rect2;

            inRect2.yMax += 59f;
            bool flag = false;

            Dialog_LoadShipCargo.Tab tab = this.tab;
            if (tab != Dialog_LoadShipCargo.Tab.Pawns)
            {
                if (tab == Dialog_LoadShipCargo.Tab.Items)
                {
                    this.itemsTransfer.OnGUI(inRect2, out flag);
                }
            }
            else
            {
                this.pawnsTransfer.OnGUI(inRect2, out flag);
            }
            if (flag)
            {
                this.CountToTransferChanged();
            }
            GUI.EndGroup();
        }
Ejemplo n.º 13
0
        public static void DrawAltitudeMeter(AerialVehicleInFlight aerialVehicle)
        {
            try
            {
                Rect rect       = new Rect(AltitudeScreenPos, MeterSize);
                Rect windowRect = new Rect(rect)
                {
                    width  = rect.width * 3 + 10,
                    height = WindowHeight + InfoWindoHeight
                };
                float elevation = (MeterSize.y - (aerialVehicle.Elevation / MaximumAltitude * MeterSize.y)).Clamp(MaxAltitudeScreenHeight, MeterSize.y - MinAltitudeScreenHeight);
                Find.WindowStack.ImmediateWindow(aerialVehicle.GetHashCode(), windowRect, WindowLayer.GameUI, delegate()
                {
                    var anchor = Text.Anchor;
                    var font   = Text.Font;
                    var color  = GUI.color;

                    Rect viewRect     = rect.AtZero();
                    windowRect.x      = rect.width + 5;
                    windowRect.y      = 5;
                    windowRect.height = WindowHeight;

                    GUI.BeginScrollView(windowRect, new Vector2(windowRect.x, elevation - WindowHeight / 2), viewRect, GUIStyle.none, GUIStyle.none);

                    GUI.DrawTexture(viewRect, VehicleTex.AltitudeMeter);

                    if (elevation <= MaximumAltitude)
                    {
                        Rect lineRect = new Rect(0, windowRect.y + elevation, viewRect.width, 1f);
                        GUI.DrawTexture(lineRect, elevation >= MeterSize.y / 2 ? BaseContent.BlackTex : BaseContent.WhiteTex);
                    }

                    GUI.color = WindowBGBorderColor;
                    Widgets.DrawLineHorizontal(0, windowRect.y + elevation + MeterSize.y / 2, viewRect.width);
                    Widgets.DrawLineVertical(viewRect.width, windowRect.y, MeterSize.y);
                    GUI.color = color;

                    Text.Font        = GameFont.Small;
                    float textHeight = Text.CalcHeight(aerialVehicle.Elevation.ToString(), viewRect.width);
                    Rect labelRect   = new Rect(viewRect.width + 5, windowRect.y + elevation - textHeight / 2, viewRect.width - 5, textHeight);
                    Widgets.DrawMenuSection(labelRect);

                    Text.Font            = GameFont.Tiny;
                    Text.Anchor          = TextAnchor.MiddleCenter;
                    int elevationRounded = Mathf.RoundToInt(aerialVehicle.Elevation);
                    GUI.Label(labelRect, elevationRounded.ToString(), Text.CurFontStyle);

                    GUI.EndScrollView(false);

                    Text.Anchor = anchor;
                    Text.Font   = font;
                    GUI.color   = color;
                }, true, false, 0);
            }
            catch (Exception ex)
            {
                SmashLog.Error($"Exception thrown while trying to draw <type>AltitudeMeter</type> for {aerialVehicle?.Label ?? "NULL"}. Exception=\"{ex.Message}\"");
            }
        }
        public override void DoWindowContents(Rect inRect)
        {
            if (searchQuery != lastSearch)
            {
                UpdateList();
            }

            Rect rect = new Rect(0f, 0f, inRect.width, 60f);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect, "Store Incidents");
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            Rect search = new Rect(inRect.width / 5, rect.height, inRect.width / 2, 26f);

            searchQuery = Widgets.TextEntryLabeled(search, "Search:", searchQuery);
            Rect resetButton = new Rect(search.x, search.y + 28f, search.width, 26f);

            if (Widgets.ButtonText(resetButton, "Reset all Incidents"))
            {
                Store_IncidentEditor.LoadBackups();
            }
            inRect.yMin += 120f;
            Widgets.DrawMenuSection(inRect);
            //TabDrawer.DrawTabs(inRect, this.tabs, 2);
            inRect = inRect.ContractedBy(17f);
            GUI.BeginGroup(inRect);
            Rect rect2 = inRect.AtZero();

            this.DoBottomButtons(rect2);
            Rect outRect = rect2;

            outRect.yMax -= 65f;
            if (storeIncidents.Count > 0)
            {
                float height   = (float)storeIncidents.Count * 24f;
                float num      = 0f;
                Rect  viewRect = new Rect(0f, 0f, outRect.width - 16f, height);
                Widgets.BeginScrollView(outRect, ref this.scrollPosition, viewRect, true);
                float num2 = this.scrollPosition.y - 24f;
                float num3 = this.scrollPosition.y + outRect.height;
                for (int i = 0; i < storeIncidents.Count; i++)
                {
                    if (num > num2 && num < num3)
                    {
                        Rect rect3 = new Rect(0f, num, viewRect.width, 24f);
                        this.DoRow(rect3, storeIncidents[i], i);
                    }
                    num += 24f;
                }
                Widgets.EndScrollView();
            }
            else
            {
                Widgets.NoneLabel(0f, outRect.width, null);
            }
            GUI.EndGroup();
        }
        /// <summary>
        /// Override of Dialog_SplitCaravan.DoWindowContents that calls into this dialog's DoBottomButtons.
        /// This was needed because Dialog_SplitCaravan.DoBottomButtons isn't virtual, but needed to be overridden.
        /// </summary>
        public override void DoWindowContents(Rect inRect)
        {
            if (session == null)
            {
                Close();
            }
            else if (session.uiDirty)
            {
                CountToTransferChanged();

                session.uiDirty = false;
            }

            Rect rect = new Rect(0f, 0f, inRect.width, 35f);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect, "SplitCaravan".Translate());
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            CaravanUIUtility.DrawCaravanInfo(new CaravanUIUtility.CaravanInfo(SourceMassUsage, SourceMassCapacity, cachedSourceMassCapacityExplanation, SourceTilesPerDay, cachedSourceTilesPerDayExplanation, SourceDaysWorthOfFood, SourceForagedFoodPerDay, cachedSourceForagedFoodPerDayExplanation, SourceVisibility, cachedSourceVisibilityExplanation, -1f, -1f, null), new CaravanUIUtility.CaravanInfo(DestMassUsage, DestMassCapacity, cachedDestMassCapacityExplanation, DestTilesPerDay, cachedDestTilesPerDayExplanation, DestDaysWorthOfFood, DestForagedFoodPerDay, cachedDestForagedFoodPerDayExplanation, DestVisibility, cachedDestVisibilityExplanation, -1f, -1f, null), caravan.Tile, (!caravan.pather.Moving) ? null : new int?(TicksToArrive), -9999f, new Rect(12f, 35f, inRect.width - 24f, 40f), true, null, false);
            tabsList.Clear();
            tabsList.Add(new TabRecord("PawnsTab".Translate(), delegate
            {
                tab = Tab.Pawns;
            }, tab == Tab.Pawns));
            tabsList.Add(new TabRecord("ItemsTab".Translate(), delegate
            {
                tab = Tab.Items;
            }, tab == Tab.Items));
            inRect.yMin += 119f;
            Widgets.DrawMenuSection(inRect);
            TabDrawer.DrawTabs(inRect, tabsList, 200f);
            inRect = inRect.ContractedBy(17f);
            GUI.BeginGroup(inRect);
            Rect rect2 = inRect.AtZero();

            DoBottomButtons(rect2);
            Rect inRect2 = rect2;

            inRect2.yMax -= 59f;
            bool flag = false;

            switch (tab)
            {
            case Tab.Pawns:
                pawnsTransfer.OnGUI(inRect2, out flag);
                break;

            case Tab.Items:
                itemsTransfer.OnGUI(inRect2, out flag);
                break;
            }
            if (flag)
            {
                CountToTransferChanged();
            }
            GUI.EndGroup();
        }
Ejemplo n.º 16
0
        private void DrawAchievementsMenu(Rect rect)
        {
            Widgets.DrawMenuSection(rect);
            TabDrawer.DrawTabs(rect, tabs, 200f);
            Rect searchRect = new Rect(rect.width - 240, rect.y + 15f, 200f, 30f);

            searchText = Widgets.TextField(searchRect, searchText);
        }
Ejemplo n.º 17
0
        public override void DoWindowContents(Rect inRect)
        {
            Rect rect = new Rect(0f, 0f, inRect.width, 35f);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect, ((!reform) ? "FormCaravan" : "ReformCaravan").Translate());
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            CaravanUIUtility.CaravanInfo info  = new CaravanUIUtility.CaravanInfo(MassUsage, MassCapacity, cachedMassCapacityExplanation, TilesPerDay, cachedTilesPerDayExplanation, DaysWorthOfFood, ForagedFoodPerDay, cachedForagedFoodPerDayExplanation, Visibility, cachedVisibilityExplanation);
            CaravanUIUtility.CaravanInfo?info2 = null;
            int    currentTile   = CurrentTile;
            int?   ticksToArrive = (destinationTile != -1) ? new int?(TicksToArrive) : null;
            float  num           = lastMassFlashTime;
            Rect   rect2         = new Rect(12f, 35f, inRect.width - 24f, 40f);
            string extraDaysWorthOfFoodTipInfo = (destinationTile != -1) ? ("\n" + "DaysWorthOfFoodTooltip_OnlyFirstWaypoint".Translate()) : null;

            CaravanUIUtility.DrawCaravanInfo(info, info2, currentTile, ticksToArrive, num, rect2, lerpMassColor: true, extraDaysWorthOfFoodTipInfo);
            tabsList.Clear();
            tabsList.Add(new TabRecord("PawnsTab".Translate(), delegate
            {
                tab = Tab.Pawns;
            }, tab == Tab.Pawns));
            tabsList.Add(new TabRecord("ItemsTab".Translate(), delegate
            {
                tab = Tab.Items;
            }, tab == Tab.Items));
            inRect.yMin += 119f;
            Widgets.DrawMenuSection(inRect);
            TabDrawer.DrawTabs(inRect, tabsList);
            tabsList.Clear();
            inRect         = inRect.ContractedBy(17f);
            inRect.height += 17f;
            GUI.BeginGroup(inRect);
            Rect rect3 = inRect.AtZero();

            DoBottomButtons(rect3);
            Rect inRect2 = rect3;

            inRect2.yMax -= 76f;
            bool anythingChanged = false;

            switch (tab)
            {
            case Tab.Pawns:
                pawnsTransfer.OnGUI(inRect2, out anythingChanged);
                break;

            case Tab.Items:
                itemsTransfer.OnGUI(inRect2, out anythingChanged);
                break;
            }
            if (anythingChanged)
            {
                CountToTransferChanged();
            }
            GUI.EndGroup();
        }
Ejemplo n.º 18
0
        public static void Draw(Rect canvas)
        {
            GUI.BeginGroup(canvas);
            var menuRect      = new Rect(0f, 0f, canvas.width * 0.25f, canvas.height);
            var menuInnerRect = new Rect(0f, 0f, menuRect.width - 8f, menuRect.height - 8f);
            var menuView      = new Rect(0f, 0f, menuInnerRect.width - 16f, Text.LineHeight * PageCount);
            var pageRect      = new Rect(
                menuRect.x + menuRect.width + 5f,
                0f,
                canvas.width - menuRect.width - 5f,
                canvas.height
                );
            var pageInnerRect = new Rect(0f, 0f, pageRect.width, pageRect.height);
            var pageView      = new Rect(0f, 0f, pageRect.width - 16f, Text.LineHeight * 13);
            var listing       = new Listing_Standard();

            Widgets.DrawMenuSection(menuRect);
            listing.Begin(menuRect.ContractedBy(4f));
            Widgets.BeginScrollView(menuInnerRect, ref _menuScrollPos, menuView);
            foreach (string page in Pages)
            {
                Rect lineRect = listing.GetRect(Text.LineHeight);

                if (_lastPage == page)
                {
                    Widgets.DrawHighlightSelected(lineRect);
                }

                Widgets.Label(lineRect, $"RDA.Settings.{page}".Translate());

                if (Widgets.ButtonInvisible(lineRect))
                {
                    _lastPage = page;
                }
            }

            listing.End();
            Widgets.EndScrollView();

            listing.Begin(pageRect);
            Widgets.BeginScrollView(pageInnerRect, ref _pageScrollPos, pageView);
            switch (_lastPage)
            {
            case "General":
                DrawGeneralPage(listing);
                break;

            case "Experimental":
                DrawExperimentalPage(listing);
                break;
            }

            listing.End();
            Widgets.EndScrollView();

            GUI.EndGroup();
        }
Ejemplo n.º 19
0
        public void DrawSettlementStats(int x, int y)
        {
            int statSize = 30;

            Text.Anchor = TextAnchor.MiddleLeft;
            Text.Font   = GameFont.Medium;
            for (int i = 0; i < stats.Count(); i++)
            {
                Widgets.DrawMenuSection(new Rect(x, y + ((statSize + 15) * i), 125, statSize + 10));
                //Widgets.DrawHighlight(new Rect(x, y + ((statSize + 15) * i), 125, statSize + 10));
                if (stats[i] == "militaryLevel")
                {
                    if (Widgets.ButtonImage(new Rect(x + 5 - 2, y + 5 + ((statSize + 15) * i) - 2, statSize + 4, statSize + 4), texLoad.iconMilitary))
                    {
                        Find.WindowStack.Add(new descWindowFC("SettlementMilitaryLevelDesc".Translate(), "SettlementMilitaryLevel".Translate()));
                    }
                    ;
                    Widgets.Label(new Rect(x + 50, y + ((statSize + 15) * i), 80, statSize + 10), settlement.settlementMilitaryLevel.ToString());
                }
                if (stats[i] == "happiness")
                {
                    if (Widgets.ButtonImage(new Rect(x + 5 - 2, y + 5 + ((statSize + 15) * i) - 2, statSize + 4, statSize + 4), texLoad.iconHappiness))
                    {
                        Find.WindowStack.Add(new descWindowFC("SettlementHappinessDesc".Translate(), "SettlementHappiness".Translate()));
                    }
                    ;
                    Widgets.Label(new Rect(x + 50, y + ((statSize + 15) * i), 80, statSize + 10), settlement.happiness + "%");
                }
                if (stats[i] == "loyalty")
                {
                    if (Widgets.ButtonImage(new Rect(x + 5 - 2, y + 5 + ((statSize + 15) * i) - 2, statSize + 4, statSize + 4), texLoad.iconLoyalty))
                    {
                        Find.WindowStack.Add(new descWindowFC("SettlementLoyaltyDesc".Translate(), "SettlementLoyalty".Translate()));
                    }
                    ;
                    Widgets.Label(new Rect(x + 50, y + ((statSize + 15) * i), 80, statSize + 10), settlement.loyalty + "%");
                }
                if (stats[i] == "unrest")
                {
                    if (Widgets.ButtonImage(new Rect(x + 5 - 2, y + 5 + ((statSize + 15) * i) - 2, statSize + 4, statSize + 4), texLoad.iconUnrest))
                    {
                        Find.WindowStack.Add(new descWindowFC("SettlementUnrestDesc".Translate(), "SettlementUnrest".Translate()));
                    }
                    ;
                    Widgets.Label(new Rect(x + 50, y + ((statSize + 15) * i), 80, statSize + 10), settlement.unrest + "%");
                }
                if (stats[i] == "prosperity")
                {
                    if (Widgets.ButtonImage(new Rect(x + 5 - 2, y + 5 + ((statSize + 15) * i) - 2, statSize + 4, statSize + 4), texLoad.iconProsperity))
                    {
                        Find.WindowStack.Add(new descWindowFC("SettlementProsperityDesc".Translate(), "SettlementProsperity".Translate()));
                    }
                    ;
                    Widgets.Label(new Rect(x + 50, y + ((statSize + 15) * i), 80, statSize + 10), settlement.prosperity + "%");
                }
            }
        }
Ejemplo n.º 20
0
        public void DrawDescription(int x, int y, int length, int size)
        {
            //Widgets.Label(new Rect(x, y - 20, 100, 30), "Description".Translate());
            Widgets.DrawMenuSection(new Rect(x, y, length, size));

            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.Label(new Rect(x + 5, y + 5, length - 10, size - 10), settlement.description);
        }
Ejemplo n.º 21
0
        protected override void FillTab()
        {
            Rect rect = new Rect(0f, 0f, this.size.x, this.size.y);

            GUI.BeginGroup(rect);
            Rect rect2 = new Rect(rect.x, rect.y + 20f, rect.width, 30f);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect2, ship.ShipNick);
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;

            Rect rect3 = rect2;

            rect3.y      = rect2.yMax + 100;
            rect3.height = rect.height - rect2.height;

            Widgets.DrawMenuSection(rect3, true);
            List <TabRecord> list = new List <TabRecord>();

            list.Add(new TabRecord("ShipPassengers".Translate(), delegate
            {
                this.tab = ITab_ShipCargo.Tab.Passengers;
            }, this.tab == ITab_ShipCargo.Tab.Passengers));

            list.Add(new TabRecord("ShipCargo".Translate(), delegate
            {
                this.tab = ITab_ShipCargo.Tab.Cargo;
            }, this.tab == ITab_ShipCargo.Tab.Cargo));

            list.Add(new TabRecord("ShipWeapons".Translate(), delegate
            {
                this.tab = ITab_ShipCargo.Tab.Weapons;
            }, this.tab == ITab_ShipCargo.Tab.Weapons));
            TabDrawer.DrawTabs(rect3, list);
            rect3 = rect3.ContractedBy(9f);
            //    GUI.BeginGroup(rect3);

            GUI.color = Color.white;

            if (this.tab == Tab.Passengers)
            {
                DrawCargo(rect3, false);
            }
            else if (this.tab == Tab.Cargo)
            {
                DrawCargo(rect3, true);
            }
            else if (this.tab == Tab.Weapons)
            {
                this.DrawWeaponSlots(rect3);
            }

            //      GUI.EndGroup();
            GUI.EndGroup();
        }
Ejemplo n.º 22
0
        public static void DoThingFilterConfigWindow(Rect rect, ref Vector2 scrollPosition, ThingFilter filter, ThingFilter parentFilter = null, int openMask = 1, IEnumerable <ThingDef> forceHiddenDefs = null, IEnumerable <SpecialThingFilterDef> forceHiddenFilters = null, List <ThingDef> suppressSmallVolumeTags = null, Map map = null)
        {
            Widgets.DrawMenuSection(rect);
            Text.Font = GameFont.Tiny;
            float num   = rect.width - 2f;
            Rect  rect2 = new Rect(rect.x + 1f, rect.y + 1f, num / 2f, 24f);

            if (Widgets.ButtonText(rect2, "ClearAll".Translate(), true, false, true))
            {
                filter.SetDisallowAll(forceHiddenDefs, forceHiddenFilters);
                SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera(null);
            }
            Rect rect3 = new Rect(rect2.xMax + 1f, rect2.y, rect.xMax - 1f - (rect2.xMax + 1f), 24f);

            if (Widgets.ButtonText(rect3, "AllowAll".Translate(), true, false, true))
            {
                filter.SetAllowAll(parentFilter);
                SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera(null);
            }
            Text.Font = GameFont.Small;
            rect.yMin = rect2.yMax;
            TreeNode_ThingCategory node = ThingCategoryNodeDatabase.RootNode;
            bool flag  = true;
            bool flag2 = true;

            if (parentFilter != null)
            {
                node  = parentFilter.DisplayRootCategory;
                flag  = parentFilter.allowedHitPointsConfigurable;
                flag2 = parentFilter.allowedQualitiesConfigurable;
            }
            Rect viewRect = new Rect(0f, 0f, rect.width - 16f, ThingFilterUI.viewHeight);

            Widgets.BeginScrollView(rect, ref scrollPosition, viewRect, true);
            float num2 = 2f;

            if (flag)
            {
                ThingFilterUI.DrawHitPointsFilterConfig(ref num2, viewRect.width, filter);
            }
            if (flag2)
            {
                ThingFilterUI.DrawQualityFilterConfig(ref num2, viewRect.width, filter);
            }
            float num3  = num2;
            Rect  rect4 = new Rect(0f, num2, viewRect.width, 9999f);
            Listing_TreeThingFilter listing_TreeThingFilter = new Listing_TreeThingFilter(filter, parentFilter, forceHiddenDefs, forceHiddenFilters, suppressSmallVolumeTags);

            listing_TreeThingFilter.Begin(rect4);
            listing_TreeThingFilter.DoCategoryChildren(node, 0, openMask, map, true);
            listing_TreeThingFilter.End();
            if (Event.current.type == EventType.Layout)
            {
                ThingFilterUI.viewHeight = num3 + listing_TreeThingFilter.CurHeight + 90f;
            }
            Widgets.EndScrollView();
        }
Ejemplo n.º 23
0
        public override void DoWindowContents(Rect inRect)
        {
            //grab before anchor/font
            GameFont   fontBefore   = Text.Font;
            TextAnchor anchorBefore = Text.Anchor;



            //Settlement Tax Collection Header
            Text.Anchor = TextAnchor.MiddleLeft;
            Text.Font   = GameFont.Medium;
            Widgets.DrawMenuSection(new Rect(0, 0, 544, 150));
            Widgets.Label(new Rect(10, 0, 500, 60), header);
            Widgets.DrawLineHorizontal(0, 155, 544);



            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Tiny;
            Widgets.Label(new Rect(20, 60, 470, 90), desc);


            Text.Anchor = TextAnchor.MiddleLeft;
            Text.Font   = GameFont.Tiny;



            for (int i = 0; i < options.Count(); i++)
            {
                if (Widgets.ButtonTextSubtle(new Rect(xoffset, yoffset + (i * (height + yspacing)), length, height), ""))
                {
                    if (PaymentUtil.getSilver() >= options[i].silverCost)
                    {
                        PaymentUtil.paySilver(options[i].silverCost);

                        FCEventMaker.calculateSuccess(options[i], parentEvent);
                        //Log.Message(options[i].label);


                        Find.WindowStack.TryRemove(this);
                    }
                    else
                    {
                        Messages.Message("You do not have enough silver on the map to pay for that option", MessageTypeDefOf.RejectInput);
                    }
                }

                //label
                Widgets.Label(new Rect(xoffset + 5, yoffset + 5 + (i * (height + yspacing)), length - 10, height - 10), options[i].label);
            }
            //Widgets.DrawBox(new Rect(xoffset, yoffset - yspacing, length, height - yspacing * 2));

            //reset anchor/font
            Text.Font   = fontBefore;
            Text.Anchor = anchorBefore;
        }
Ejemplo n.º 24
0
        private void DrawRightRect(Rect rect)
        {
            Widgets.DrawMenuSection(rect, false);

            var spec = MateriaMod.Instance.GetByLabel(_selected);

            if (spec == null)
            {
                return;
            }

            var prevAnchor = Text.Anchor;

            Text.Anchor = TextAnchor.UpperLeft;
            GUI.BeginGroup(rect);

            var textRect = new Rect(10f, 10f, rect.width - 10f, 45f);

            Widgets.Label(textRect, spec.Description);

            var ingTitle = new Rect(10f, 50f, rect.width - 10f, 25f);

            GUI.color = _titleColor;
            Widgets.Label(ingTitle, "Ingredients");

            GUI.color = Color.white;
            var ingRect = new Rect(10f, 80f, rect.width - 10f, 125f);

            Widgets.Label(ingRect, spec.GetIngredientText());

            var statTitle = new Rect(10f, 210f, rect.width - 10f, 25f);

            GUI.color = _titleColor;
            Widgets.Label(statTitle, "Stats");

            GUI.color = Color.white;
            var statsRect = new Rect(10f, 240f, rect.width - 10f, 200f);

            Widgets.Label(statsRect, spec.GetStatsText());

            var effectsTitle = new Rect(10f, 445f, rect.width - 10f, 25f);

            GUI.color = _titleColor;
            Widgets.Label(effectsTitle, "Effects");

            GUI.color = Color.white;
            for (int i = 0; i < spec.Effects.Count; i++)
            {
                var h = spec.Effects[i];
                var r = new Rect(10f, 475f + i * 25f, rect.width - 10f, 25f);
                Widgets.Label(r, h.Description);
            }

            GUI.EndGroup();
            Text.Anchor = prevAnchor;
        }
Ejemplo n.º 25
0
        void DrawDisplayArea(Rect rect)
        {
            Widgets.DrawMenuSection(rect);

            if (SelectedHelpDef == null)
            {
                return;
            }

            Text.Font     = GameFont.Medium;
            Text.WordWrap = false;
            float titleWidth = Text.CalcSize(SelectedHelpDef.LabelCap).x;
            var   titleRect  = new Rect(rect.xMin + WindowMargin, rect.yMin + WindowMargin, titleWidth, 60f);

            if (
                (SelectedHelpDef.keyDef != null) &&
                (SelectedHelpDef.keyDef.IconTexture() != null)
                )
            {
                var iconRect = new Rect(titleRect.xMin + WindowMargin, rect.yMin + WindowMargin, 60f - 2 * WindowMargin, 60f - 2 * WindowMargin);
                titleRect.x += 60f;
                SelectedHelpDef.keyDef.DrawColouredIcon(iconRect);
            }
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(titleRect, SelectedHelpDef.LabelCap);
            Text.Font     = GameFont.Small;
            Text.Anchor   = TextAnchor.UpperLeft;
            Text.WordWrap = true;

            Rect outRect = rect.ContractedBy(WindowMargin);

            outRect.yMin += 60f;
            Rect viewRect = outRect;

            viewRect.width -= 16f;
            viewRect.height = ContentHeight;

            GUI.BeginGroup(outRect);
            Widgets.BeginScrollView(outRect.AtZero(), ref DisplayScrollPos, viewRect.AtZero());

            Vector2 cur = Vector2.zero;

            HelpDetailSectionHelper.DrawText(ref cur, viewRect.width, SelectedHelpDef.description);

            cur.y += ParagraphMargin;

            foreach (HelpDetailSection section in SelectedHelpDef.HelpDetailSections)
            {
                section.Draw(ref cur, viewRect.width, this);
            }

            ContentHeight = cur.y;

            Widgets.EndScrollView();
            GUI.EndGroup();
        }
Ejemplo n.º 26
0
        public Listing_Standard BeginSection(float height)
        {
            Rect rect = base.GetRect(height + 8f);

            Widgets.DrawMenuSection(rect);
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.Begin(rect.ContractedBy(4f));
            return(listing_Standard);
        }
Ejemplo n.º 27
0
        private void DrawFactionBottomMenu(Rect inRect)
        {
            Text.Anchor = TextAnchor.MiddleCenter;
            Text.Font   = GameFont.Small;
            Widgets.DrawMenuSection(new Rect(0, 270, 312, 90));
            Widgets.Label(new Rect(0, 270, 250, 30), "TotalProduction".Translate());
            DrawFactionResourceIcons(inRect, 0, 300, 20);

            DrawFactionEconomicStats(inRect);
        }
Ejemplo n.º 28
0
        public static void DoThingFilterConfigWindow(Rect rect, ref Vector2 scrollPosition, ref ThingFilter filter, ThingFilter parentFilter = null, ThingFilter defaultFilter = null, int openMask = 1)
        {
            Widgets.DrawMenuSection(rect);
            Text.Font = GameFont.Tiny;
            float num   = rect.width - 2f;
            Rect  rect2 = new Rect(rect.x + 1f, rect.y + 1f, num / 2f, buttonHeight);

            if (Widgets.ButtonText(rect2, "ClearAll".Translate(), true, false, true))
            {
                filter.SetDisallowAll(null, null);
                SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera(null);
            }
            Rect rect3 = new Rect(rect2.xMax + 1f, rect2.y, rect.xMax - 1f - (rect2.xMax + 1f), buttonHeight);

            if (Widgets.ButtonText(rect3, "AllowAll".Translate(), true, false, true))
            {
                filter.SetAllowAll(parentFilter);
                SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera(null);
            }
            Text.Font = GameFont.Small;
            rect.yMin = rect2.yMax;
            TreeNode_ThingCategory node = ThingCategoryNodeDatabase.RootNode;

            if (parentFilter != null)
            {
                node = parentFilter.DisplayRootCategory;
            }
            Rect viewRect   = new Rect(0f, 0f, rect.width - 17f, viewHeight);
            Rect scrollrect = new Rect(rect.x, rect.y, rect.width - 1f, rect.height - buttonHeight - 1f);

            Widgets.BeginScrollView(scrollrect, ref scrollPosition, viewRect, true);
            float num2  = 2f;
            float num3  = num2;
            Rect  rect4 = new Rect(0f, num2, viewRect.width, 9999f);
            Listing_TreeThingFilter listing_TreeThingFilter = new Listing_TreeThingFilter(filter, parentFilter, null, null, null);

            listing_TreeThingFilter.Begin(rect4);
            listing_TreeThingFilter.DoCategoryChildren(node, 0, openMask, null, true);
            listing_TreeThingFilter.End();
            if (Event.current.type == EventType.Layout)
            {
                viewHeight = num3 + listing_TreeThingFilter.CurHeight + 90f;
            }
            Widgets.EndScrollView();
            Rect buttonRect = new Rect(rect.x + 1f, rect.y + 1f, num, buttonHeight);

            buttonRect.height   = 24f;
            buttonRect.position = new Vector2(buttonRect.position.x, rect.yMax - buttonHeight - 1f);
            bool clicked = Widgets.ButtonText(buttonRect, "Reset");

            if (clicked && defaultFilter != null)
            {
                filter = defaultFilter;
            }
        }
Ejemplo n.º 29
0
        public void DoSettingsWindowContents(Rect inRect)
        {
            if (!_isWindowSetup || lastRect != inRect)
            {
                lastRect = inRect;
                InitialiseWindow(inRect);
                _isWindowSetup = true;
            }

            Widgets.DrawMenuSection(menuRect);
            TabDrawer.DrawTabs(menuRect, _tabsList, 1);

            GUI.BeginGroup(tabRect);
            var font   = Text.Font;
            var anchor = Text.Anchor;

            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleCenter;

            switch (_tab)
            {
            default:
                _generalTab.DrawTab(tabRect);

                break;

            case Tab.Combat:
                _combatTab.DrawTab(tabRect);
                break;

            case Tab.Races:
                _raceTab.DrawTab(tabRect);

                break;

            case Tab.Apparel:
                _apparelTab.DrawTab(tabRect);

                break;

            case Tab.Bionics:
                _hediffTab.DrawTab(tabRect);

                break;

            case Tab.Debug:
                _debugTab.DrawTab(tabRect);

                break;
            }

            Text.Font   = font;
            Text.Anchor = anchor;
            GUI.EndGroup();
        }
Ejemplo n.º 30
0
        protected override void FillTab()
        {
            PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.FrameDisplayed);
            Text.Font = GameFont.Small;
            Rect rect  = new Rect(0f, 0f, this.size.x, this.size.y);
            Rect rect2 = rect.ContractedBy(10f);

            rect2.yMin += 24f;
            bool             isPrisonerOfColony = base.SelPawn.IsPrisonerOfColony;
            Listing_Standard listing_Standard   = new Listing_Standard();

            listing_Standard.maxOneColumn = true;
            listing_Standard.Begin(rect2);
            Rect rect3 = listing_Standard.GetRect(28f);

            rect3.width = 140f;
            MedicalCareUtility.MedicalCareSetter(rect3, ref base.SelPawn.playerSettings.medCare);
            listing_Standard.Gap(4f);
            if (isPrisonerOfColony)
            {
                listing_Standard.Label("RecruitmentDifficulty".Translate() + ": " + base.SelPawn.RecruitDifficulty(Faction.OfPlayer).ToStringPercent(), -1f, null);
                listing_Standard.Label("RecruitmentResistance".Translate() + ": " + base.SelPawn.guest.resistance.ToString("F1"), -1f, null);
                if (base.SelPawn.guilt.IsGuilty)
                {
                    listing_Standard.Label("ConsideredGuilty".Translate(base.SelPawn.guilt.TicksUntilInnocent.ToStringTicksToPeriod()), -1f, null);
                }
                Rect rect4 = listing_Standard.GetRect(160f).Rounded();
                Widgets.DrawMenuSection(rect4);
                Rect position = rect4.ContractedBy(10f);
                GUI.BeginGroup(position);
                Rect rect5 = new Rect(0f, 0f, position.width, 30f);
                foreach (PrisonerInteractionModeDef current in from pim in DefDatabase <PrisonerInteractionModeDef> .AllDefs
                         orderby pim.listOrder
                         select pim)
                {
                    if (Widgets.RadioButtonLabeled(rect5, current.LabelCap, base.SelPawn.guest.interactionMode == current))
                    {
                        base.SelPawn.guest.interactionMode = current;
                        if (current == PrisonerInteractionModeDefOf.Execution && base.SelPawn.MapHeld != null && !this.ColonyHasAnyWardenCapableOfViolence(base.SelPawn.MapHeld))
                        {
                            Messages.Message("MessageCantDoExecutionBecauseNoWardenCapableOfViolence".Translate(), base.SelPawn, MessageTypeDefOf.CautionInput, false);
                        }
                    }
                    rect5.y += 28f;
                }
                GUI.EndGroup();
                if (Prefs.DevMode)
                {
                    listing_Standard.Label("Dev: Prison break MTB days: " + (int)PrisonBreakUtility.InitiatePrisonBreakMtbDays(base.SelPawn), -1f, null);
                }
            }
            listing_Standard.End();
            this.size = new Vector2(280f, listing_Standard.CurHeight + 20f + 24f);
        }