Exemplo n.º 1
0
        protected override void FillTab()
        {
            //ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame);
            Text.Font = GameFont.Small;
            Rect rect = new Rect(0f, 20f, size.x, size.y-20).ContractedBy(10f);
            var listingStandard = new Listing_Standard(rect);
            {
                var tryImprove = SelPawn.ImproveRelationship();
                var tryRecruit = SelPawn.TryRecruit();

                listingStandard.OverrideColumnWidth = size.x;
                listingStandard.DoLabelCheckbox("ShouldTryToRecruit".Translate(), ref tryRecruit);
                listingStandard.DoLabelCheckbox("ImproveRelationship".Translate(), ref tryImprove);
                listingStandard.DoLabel(txtRecruitmentDifficulty + ": " + MakeDifficultyRelative(SelPawn).ToString("##0"));
                listingStandard.DoLabel(txtRecruitmentPenalty + ": " + SelPawn.RecruitPenalty().ToString("##0"));
                listingStandard.DoLabel("Faction goodwill: " + SelPawn.Faction.ColonyGoodwill.ToString("##0"));

                SelPawn.guest.interactionMode = tryRecruit
                    ? PrisonerInteractionMode.AttemptRecruit
                    : tryImprove ? PrisonerInteractionMode.Chat
                    : PrisonerInteractionMode.NoInteraction;
            }
            listingStandard.End();
        }
Exemplo n.º 2
0
        public override void DoWindowContents(Rect inRect)
        {
            Rect rect = inRect.AtZero();

            rect.yMax -= 35f;
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.ColumnWidth = (rect.width - 34f) / 3f;
            listing_Standard.Begin(rect);
            Text.Font = GameFont.Medium;
            listing_Standard.Label("Audiovisuals".Translate());
            Text.Font = GameFont.Small;
            listing_Standard.Gap();
            listing_Standard.Gap();
            listing_Standard.Label("GameVolume".Translate());
            Prefs.VolumeGame = listing_Standard.Slider(Prefs.VolumeGame, 0f, 1f);
            listing_Standard.Label("MusicVolume".Translate());
            Prefs.VolumeMusic = listing_Standard.Slider(Prefs.VolumeMusic, 0f, 1f);
            listing_Standard.Label("AmbientVolume".Translate());
            Prefs.VolumeAmbient = listing_Standard.Slider(Prefs.VolumeAmbient, 0f, 1f);
            if (listing_Standard.ButtonTextLabeled("Resolution".Translate(), ResToString(Screen.width, Screen.height)))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                foreach (Resolution item in from x in UnityGUIBugsFixer.ScreenResolutionsWithoutDuplicates
                         where x.width >= 1024 && x.height >= 768
                         orderby x.width, x.height
                         select x)
                {
                    list.Add(new FloatMenuOption(ResToString(item.width, item.height), delegate
                    {
                        if (!ResolutionUtility.UIScaleSafeWithResolution(Prefs.UIScale, item.width, item.height))
                        {
                            Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, historical: false);
                        }
                        else
                        {
                            ResolutionUtility.SafeSetResolution(item);
                        }
                    }));
                }
                if (!list.Any())
                {
                    list.Add(new FloatMenuOption("NoneBrackets".Translate(), null));
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
            if (listing_Standard.ButtonTextLabeled("UIScale".Translate(), Prefs.UIScale.ToString() + "x"))
            {
                List <FloatMenuOption> list2 = new List <FloatMenuOption>();
                for (int i = 0; i < UIScales.Length; i++)
                {
                    float scale = UIScales[i];
                    list2.Add(new FloatMenuOption(UIScales[i].ToString() + "x", delegate
                    {
                        if (scale != 1f && !ResolutionUtility.UIScaleSafeWithResolution(scale, Screen.width, Screen.height))
                        {
                            Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, historical: false);
                        }
                        else
                        {
                            ResolutionUtility.SafeSetUIScale(scale);
                        }
                    }));
                }
                Find.WindowStack.Add(new FloatMenu(list2));
            }
            bool checkOn = Prefs.CustomCursorEnabled;

            listing_Standard.CheckboxLabeled("CustomCursor".Translate(), ref checkOn);
            Prefs.CustomCursorEnabled = checkOn;
            bool checkOn2 = Screen.fullScreen;
            bool flag     = checkOn2;

            listing_Standard.CheckboxLabeled("Fullscreen".Translate(), ref checkOn2);
            if (checkOn2 != flag)
            {
                ResolutionUtility.SafeSetFullscreen(checkOn2);
            }
            listing_Standard.Gap();
            bool checkOn3 = Prefs.HatsOnlyOnMap;

            listing_Standard.CheckboxLabeled("HatsShownOnlyOnMap".Translate(), ref checkOn3);
            if (checkOn3 != Prefs.HatsOnlyOnMap)
            {
                PortraitsCache.Clear();
            }
            Prefs.HatsOnlyOnMap = checkOn3;
            bool checkOn4 = Prefs.PlantWindSway;

            listing_Standard.CheckboxLabeled("PlantWindSway".Translate(), ref checkOn4);
            Prefs.PlantWindSway = checkOn4;
            bool checkOn5 = Prefs.ShowRealtimeClock;

            listing_Standard.CheckboxLabeled("ShowRealtimeClock".Translate(), ref checkOn5);
            Prefs.ShowRealtimeClock = checkOn5;
            if (listing_Standard.ButtonTextLabeled("ShowAnimalNames".Translate(), Prefs.AnimalNameMode.ToStringHuman()))
            {
                List <FloatMenuOption> list3       = new List <FloatMenuOption>();
                IEnumerator            enumerator2 = Enum.GetValues(typeof(AnimalNameDisplayMode)).GetEnumerator();
                try
                {
                    while (enumerator2.MoveNext())
                    {
                        AnimalNameDisplayMode animalNameDisplayMode = (AnimalNameDisplayMode)enumerator2.Current;
                        AnimalNameDisplayMode localMode             = animalNameDisplayMode;
                        list3.Add(new FloatMenuOption(localMode.ToStringHuman(), delegate
                        {
                            Prefs.AnimalNameMode = localMode;
                        }));
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator2 as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
                Find.WindowStack.Add(new FloatMenu(list3));
            }
            listing_Standard.NewColumn();
            Text.Font = GameFont.Medium;
            listing_Standard.Label("Gameplay".Translate());
            Text.Font = GameFont.Small;
            listing_Standard.Gap();
            listing_Standard.Gap();
            if (listing_Standard.ButtonText("KeyboardConfig".Translate()))
            {
                Find.WindowStack.Add(new Dialog_KeyBindings());
            }
            if (listing_Standard.ButtonText("ChooseLanguage".Translate()))
            {
                if (Current.ProgramState == ProgramState.Playing)
                {
                    Messages.Message("ChangeLanguageFromMainMenu".Translate(), MessageTypeDefOf.RejectInput, historical: false);
                }
                else
                {
                    List <FloatMenuOption> list4 = new List <FloatMenuOption>();
                    foreach (LoadedLanguage allLoadedLanguage in LanguageDatabase.AllLoadedLanguages)
                    {
                        LoadedLanguage localLang = allLoadedLanguage;
                        list4.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate
                        {
                            LanguageDatabase.SelectLanguage(localLang);
                        }));
                    }
                    Find.WindowStack.Add(new FloatMenu(list4));
                }
            }
            if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
            {
                if (listing_Standard.ButtonText("OpenSaveGameDataFolder".Translate()))
                {
                    Application.OpenURL(GenFilePaths.SaveDataFolderPath);
                }
            }
            else if (listing_Standard.ButtonText("ShowSaveGameDataLocation".Translate()))
            {
                Find.WindowStack.Add(new Dialog_MessageBox(Path.GetFullPath(GenFilePaths.SaveDataFolderPath)));
            }
            if (listing_Standard.ButtonText("ResetAdaptiveTutor".Translate()))
            {
                Messages.Message("AdaptiveTutorIsReset".Translate(), MessageTypeDefOf.TaskCompletion, historical: false);
                PlayerKnowledgeDatabase.ResetPersistent();
            }
            bool checkOn6 = Prefs.AdaptiveTrainingEnabled;

            listing_Standard.CheckboxLabeled("LearningHelper".Translate(), ref checkOn6);
            Prefs.AdaptiveTrainingEnabled = checkOn6;
            bool checkOn7 = Prefs.RunInBackground;

            listing_Standard.CheckboxLabeled("RunInBackground".Translate(), ref checkOn7);
            Prefs.RunInBackground = checkOn7;
            bool checkOn8 = Prefs.EdgeScreenScroll;

            listing_Standard.CheckboxLabeled("EdgeScreenScroll".Translate(), ref checkOn8);
            Prefs.EdgeScreenScroll = checkOn8;
            bool checkOn9 = Prefs.PauseOnLoad;

            listing_Standard.CheckboxLabeled("PauseOnLoad".Translate(), ref checkOn9);
            Prefs.PauseOnLoad = checkOn9;
            bool checkOn10 = Prefs.PauseOnUrgentLetter;

            listing_Standard.CheckboxLabeled("PauseOnUrgentLetter".Translate(), ref checkOn10);
            Prefs.PauseOnUrgentLetter = checkOn10;
            int maxNumberOfPlayerSettlements = Prefs.MaxNumberOfPlayerSettlements;

            listing_Standard.Label("MaxNumberOfPlayerSettlements".Translate(maxNumberOfPlayerSettlements));
            int num2 = Prefs.MaxNumberOfPlayerSettlements = Mathf.RoundToInt(listing_Standard.Slider((float)maxNumberOfPlayerSettlements, 1f, 5f));

            if (maxNumberOfPlayerSettlements != num2 && num2 > 1)
            {
                TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.MaxNumberOfPlayerSettlements);
            }
            if (listing_Standard.ButtonTextLabeled("TemperatureMode".Translate(), Prefs.TemperatureMode.ToStringHuman()))
            {
                List <FloatMenuOption> list5       = new List <FloatMenuOption>();
                IEnumerator            enumerator4 = Enum.GetValues(typeof(TemperatureDisplayMode)).GetEnumerator();
                try
                {
                    while (enumerator4.MoveNext())
                    {
                        TemperatureDisplayMode temperatureDisplayMode = (TemperatureDisplayMode)enumerator4.Current;
                        TemperatureDisplayMode localTmode             = temperatureDisplayMode;
                        list5.Add(new FloatMenuOption(localTmode.ToString(), delegate
                        {
                            Prefs.TemperatureMode = localTmode;
                        }));
                    }
                }
                finally
                {
                    IDisposable disposable2;
                    if ((disposable2 = (enumerator4 as IDisposable)) != null)
                    {
                        disposable2.Dispose();
                    }
                }
                Find.WindowStack.Add(new FloatMenu(list5));
            }
            float  autosaveIntervalDays = Prefs.AutosaveIntervalDays;
            string text  = "Days".Translate();
            string text2 = "Day".Translate().ToLower();

            if (listing_Standard.ButtonTextLabeled("AutosaveInterval".Translate(), autosaveIntervalDays + " " + ((autosaveIntervalDays != 1f) ? text : text2)))
            {
                List <FloatMenuOption> list6 = new List <FloatMenuOption>();
                if (Prefs.DevMode)
                {
                    list6.Add(new FloatMenuOption("0.125 " + text + "(debug)", delegate
                    {
                        Prefs.AutosaveIntervalDays = 0.125f;
                    }));
                    list6.Add(new FloatMenuOption("0.25 " + text + "(debug)", delegate
                    {
                        Prefs.AutosaveIntervalDays = 0.25f;
                    }));
                }
                list6.Add(new FloatMenuOption("0.5 " + text + string.Empty, delegate
                {
                    Prefs.AutosaveIntervalDays = 0.5f;
                }));
                list6.Add(new FloatMenuOption(1.ToString() + " " + text2, delegate
                {
                    Prefs.AutosaveIntervalDays = 1f;
                }));
                list6.Add(new FloatMenuOption(3.ToString() + " " + text, delegate
                {
                    Prefs.AutosaveIntervalDays = 3f;
                }));
                list6.Add(new FloatMenuOption(7.ToString() + " " + text, delegate
                {
                    Prefs.AutosaveIntervalDays = 7f;
                }));
                list6.Add(new FloatMenuOption(14.ToString() + " " + text, delegate
                {
                    Prefs.AutosaveIntervalDays = 14f;
                }));
                Find.WindowStack.Add(new FloatMenu(list6));
            }
            if (Current.ProgramState == ProgramState.Playing && Current.Game.Info.permadeathMode && Prefs.AutosaveIntervalDays > 1f)
            {
                GUI.color = Color.red;
                listing_Standard.Label("MaxPermadeathAutosaveIntervalInfo".Translate(1f));
                GUI.color = Color.white;
            }
            if (Current.ProgramState == ProgramState.Playing && listing_Standard.ButtonText("ChangeStoryteller".Translate(), "OptionsButton-ChooseStoryteller") && TutorSystem.AllowAction("ChooseStoryteller"))
            {
                Find.WindowStack.Add(new Page_SelectStorytellerInGame());
            }
            if (!DevModePermanentlyDisabledUtility.Disabled && listing_Standard.ButtonText("PermanentlyDisableDevMode".Translate()))
            {
                Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmPermanentlyDisableDevMode".Translate(), delegate
                {
                    DevModePermanentlyDisabledUtility.Disable();
                }, destructive: true));
            }
            if (!DevModePermanentlyDisabledUtility.Disabled || Prefs.DevMode)
            {
                bool checkOn11 = Prefs.DevMode;
                listing_Standard.CheckboxLabeled("DevelopmentMode".Translate(), ref checkOn11);
                Prefs.DevMode = checkOn11;
            }
            bool checkOn12 = Prefs.TestMapSizes;

            listing_Standard.CheckboxLabeled("EnableTestMapSizes".Translate(), ref checkOn12);
            Prefs.TestMapSizes = checkOn12;
            if (Prefs.DevMode)
            {
                bool checkOn13 = Prefs.ResetModsConfigOnCrash;
                listing_Standard.CheckboxLabeled("ResetModsConfigOnCrash".Translate(), ref checkOn13);
                Prefs.ResetModsConfigOnCrash = checkOn13;
                bool checkOn14 = Prefs.LogVerbose;
                listing_Standard.CheckboxLabeled("LogVerbose".Translate(), ref checkOn14);
                Prefs.LogVerbose = checkOn14;
            }
            listing_Standard.NewColumn();
            Text.Font = GameFont.Medium;
            listing_Standard.Label(string.Empty);
            Text.Font = GameFont.Small;
            listing_Standard.Gap();
            listing_Standard.Gap();
            if (listing_Standard.ButtonText("ModSettings".Translate()))
            {
                Find.WindowStack.Add(new Dialog_ModSettings());
            }
            listing_Standard.Label(string.Empty);
            listing_Standard.Label("NamesYouWantToSee".Translate());
            Prefs.PreferredNames.RemoveAll(GenText.NullOrEmpty);
            for (int j = 0; j < Prefs.PreferredNames.Count; j++)
            {
                string  name    = Prefs.PreferredNames[j];
                PawnBio pawnBio = (from b in SolidBioDatabase.allBios
                                   where b.name.ToString() == name
                                   select b).FirstOrDefault();
                if (pawnBio != null)
                {
                    switch (pawnBio.BioType)
                    {
                    case PawnBioType.BackstoryInGame:
                        name += " [B]";
                        break;

                    case PawnBioType.PirateKing:
                        name += " [PK]";
                        break;
                    }
                }
                else
                {
                    name += " [N]";
                }
                Rect rect2 = listing_Standard.GetRect(24f);
                Widgets.Label(rect2, name);
                Rect butRect = new Rect(rect2.xMax - 24f, rect2.y, 24f, 24f);
                if (Widgets.ButtonImage(butRect, TexButton.DeleteX, Color.white, GenUI.SubtleMouseoverColor))
                {
                    Prefs.PreferredNames.RemoveAt(j);
                    SoundDefOf.Tick_Low.PlayOneShotOnCamera();
                }
            }
            if (Prefs.PreferredNames.Count < 6 && listing_Standard.ButtonText("AddName".Translate() + "..."))
            {
                Find.WindowStack.Add(new Dialog_AddPreferredName());
            }
            listing_Standard.Label(string.Empty);
            if (listing_Standard.ButtonText("RestoreToDefaultSettings".Translate()))
            {
                RestoreToDefaultSettings();
            }
            listing_Standard.End();
        }
Exemplo n.º 3
0
        public override void DoWindowContents(Rect inRect)
        {
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.ColumnWidth = 200f;
            listing_Standard.Begin(inRect.AtZero());
            listing_Standard.Label("MapSize".Translate(), -1f);
            int[] mapSizes = Dialog_AdvancedGameConfig.MapSizes;
            for (int i = 0; i < mapSizes.Length; i++)
            {
                int num = mapSizes[i];
                if (num == 200)
                {
                    listing_Standard.Label("MapSizeSmall".Translate(), -1f);
                }
                else if (num == 250)
                {
                    listing_Standard.Label("MapSizeMedium".Translate(), -1f);
                }
                else if (num == 300)
                {
                    listing_Standard.Label("MapSizeLarge".Translate(), -1f);
                }
                else if (num == 350)
                {
                    listing_Standard.Label("MapSizeExtreme".Translate(), -1f);
                }
                string label = "MapSizeDesc".Translate(new object[]
                {
                    num,
                    num * num
                });
                if (listing_Standard.RadioButton(label, Find.GameInitData.mapSize == num, 0f))
                {
                    Find.GameInitData.mapSize = num;
                }
            }
            listing_Standard.NewColumn();
            GenUI.SetLabelAlign(TextAnchor.MiddleCenter);
            listing_Standard.Label("MapStartSeason".Translate(), -1f);
            string label2;

            if (Find.GameInitData.startingSeason == Season.Undefined)
            {
                label2 = "MapStartSeasonDefault".Translate();
            }
            else
            {
                label2 = Find.GameInitData.startingSeason.LabelCap();
            }
            Rect       rect       = listing_Standard.GetRect(32f);
            GridLayout gridLayout = new GridLayout(rect, 5, 1, 0f, 4f);

            if (Widgets.ButtonText(gridLayout.GetCellRectByIndex(0, 1, 1), "-", true, false, true))
            {
                Season season = Find.GameInitData.startingSeason;
                if (season == Season.Undefined)
                {
                    season = Season.Winter;
                }
                else
                {
                    season = (Season)(season - Season.Spring);
                }
                Find.GameInitData.startingSeason = season;
            }
            Widgets.Label(gridLayout.GetCellRectByIndex(1, 3, 1), label2);
            if (Widgets.ButtonText(gridLayout.GetCellRectByIndex(4, 1, 1), "+", true, false, true))
            {
                Season season2 = Find.GameInitData.startingSeason;
                if (season2 == Season.Winter)
                {
                    season2 = Season.Undefined;
                }
                else
                {
                    season2 += 1;
                }
                Find.GameInitData.startingSeason = season2;
            }
            GenUI.ResetLabelAlign();
            if (this.selTile >= 0 && Find.GameInitData.startingSeason != Season.Undefined)
            {
                float y = Find.WorldGrid.LongLatOf(this.selTile).y;
                if (GenTemperature.AverageTemperatureAtTileForTwelfth(this.selTile, Find.GameInitData.startingSeason.GetFirstTwelfth(y)) < 3f)
                {
                    listing_Standard.Label("MapTemperatureDangerWarning".Translate(), -1f);
                }
            }
            if (Find.GameInitData.mapSize > 250)
            {
                listing_Standard.Label("MapSizePerformanceWarning".Translate(), -1f);
            }
            listing_Standard.End();
        }
        public override void DoWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Medium;
            Rect rect = new Rect(40f, 0f, 400f, 34f);

            Widgets.Label(rect, bill.LabelCap);
            Widgets.DefIcon(new Rect(0f, rect.y, 34f, 34f), bill.recipe, null, 1f, drawPlaceholder: true);
            float width = (int)((inRect.width - 34f) / 3f);
            Rect  rect2 = new Rect(0f, 80f, width, inRect.height - 80f);
            Rect  rect3 = new Rect(rect2.xMax + 17f, 50f, width, inRect.height - 50f - CloseButSize.y);
            Rect  rect4 = new Rect(rect3.xMax + 17f, 50f, 0f, inRect.height - 50f - CloseButSize.y);

            rect4.xMax = inRect.xMax;
            Text.Font  = GameFont.Small;
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.Begin(rect3);
            Listing_Standard listing_Standard2 = listing_Standard.BeginSection(RepeatModeSubdialogHeight);

            if (listing_Standard2.ButtonText(bill.repeatMode.LabelCap))
            {
                BillRepeatModeUtility.MakeConfigFloatMenu(bill);
            }
            listing_Standard2.Gap();
            if (bill.repeatMode == BillRepeatModeDefOf.RepeatCount)
            {
                listing_Standard2.Label("RepeatCount".Translate(bill.repeatCount));
                listing_Standard2.IntEntry(ref bill.repeatCount, ref repeatCountEditBuffer);
            }
            else if (bill.repeatMode == BillRepeatModeDefOf.TargetCount)
            {
                string arg = "CurrentlyHave".Translate() + ": ";
                arg += bill.recipe.WorkerCounter.CountProducts(bill);
                arg += " / ";
                arg += ((bill.targetCount < 999999) ? bill.targetCount.ToString() : "Infinite".Translate().ToLower().ToString());
                string str = bill.recipe.WorkerCounter.ProductsDescription(bill);
                if (!str.NullOrEmpty())
                {
                    arg += "\n" + "CountingProducts".Translate() + ": " + str.CapitalizeFirst();
                }
                listing_Standard2.Label(arg);
                int targetCount = bill.targetCount;
                listing_Standard2.IntEntry(ref bill.targetCount, ref targetCountEditBuffer, bill.recipe.targetCountAdjustment);
                bill.unpauseWhenYouHave = Mathf.Max(0, bill.unpauseWhenYouHave + (bill.targetCount - targetCount));
                ThingDef producedThingDef = bill.recipe.ProducedThingDef;
                if (producedThingDef != null)
                {
                    if (producedThingDef.IsWeapon || producedThingDef.IsApparel)
                    {
                        listing_Standard2.CheckboxLabeled("IncludeEquipped".Translate(), ref bill.includeEquipped);
                    }
                    if (producedThingDef.IsApparel && producedThingDef.apparel.careIfWornByCorpse)
                    {
                        listing_Standard2.CheckboxLabeled("IncludeTainted".Translate(), ref bill.includeTainted);
                    }
                    Widgets.Dropdown(listing_Standard2.GetRect(30f), bill, (Bill_Production b) => b.includeFromZone, (Bill_Production b) => GenerateStockpileInclusion(), (bill.includeFromZone == null) ? "IncludeFromAll".Translate() : "IncludeSpecific".Translate(bill.includeFromZone.label));
                    if (bill.recipe.products.Any((ThingDefCountClass prod) => prod.thingDef.useHitPoints))
                    {
                        Widgets.FloatRange(listing_Standard2.GetRect(28f), 975643279, ref bill.hpRange, 0f, 1f, "HitPoints", ToStringStyle.PercentZero);
                        bill.hpRange.min = Mathf.Round(bill.hpRange.min * 100f) / 100f;
                        bill.hpRange.max = Mathf.Round(bill.hpRange.max * 100f) / 100f;
                    }
                    if (producedThingDef.HasComp(typeof(CompQuality)))
                    {
                        Widgets.QualityRange(listing_Standard2.GetRect(28f), 1098906561, ref bill.qualityRange);
                    }
                    if (producedThingDef.MadeFromStuff)
                    {
                        listing_Standard2.CheckboxLabeled("LimitToAllowedStuff".Translate(), ref bill.limitToAllowedStuff);
                    }
                }
            }
            if (bill.repeatMode == BillRepeatModeDefOf.TargetCount)
            {
                listing_Standard2.CheckboxLabeled("PauseWhenSatisfied".Translate(), ref bill.pauseWhenSatisfied);
                if (bill.pauseWhenSatisfied)
                {
                    listing_Standard2.Label("UnpauseWhenYouHave".Translate() + ": " + bill.unpauseWhenYouHave.ToString("F0"));
                    listing_Standard2.IntEntry(ref bill.unpauseWhenYouHave, ref unpauseCountEditBuffer, bill.recipe.targetCountAdjustment);
                    if (bill.unpauseWhenYouHave >= bill.targetCount)
                    {
                        bill.unpauseWhenYouHave = bill.targetCount - 1;
                        unpauseCountEditBuffer  = bill.unpauseWhenYouHave.ToStringCached();
                    }
                }
            }
            listing_Standard.EndSection(listing_Standard2);
            listing_Standard.Gap();
            Listing_Standard listing_Standard3 = listing_Standard.BeginSection(StoreModeSubdialogHeight);
            string           text = string.Format(bill.GetStoreMode().LabelCap, (bill.GetStoreZone() != null) ? bill.GetStoreZone().SlotYielderLabel() : "");

            if (bill.GetStoreZone() != null && !bill.recipe.WorkerCounter.CanPossiblyStoreInStockpile(bill, bill.GetStoreZone()))
            {
                text     += string.Format(" ({0})", "IncompatibleLower".Translate());
                Text.Font = GameFont.Tiny;
            }
            if (listing_Standard3.ButtonText(text))
            {
                Text.Font = GameFont.Small;
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                foreach (BillStoreModeDef item in DefDatabase <BillStoreModeDef> .AllDefs.OrderBy((BillStoreModeDef bsm) => bsm.listOrder))
                {
                    if (item == BillStoreModeDefOf.SpecificStockpile)
                    {
                        List <SlotGroup> allGroupsListInPriorityOrder = bill.billStack.billGiver.Map.haulDestinationManager.AllGroupsListInPriorityOrder;
                        int count = allGroupsListInPriorityOrder.Count;
                        for (int i = 0; i < count; i++)
                        {
                            SlotGroup      group          = allGroupsListInPriorityOrder[i];
                            Zone_Stockpile zone_Stockpile = group.parent as Zone_Stockpile;
                            if (zone_Stockpile == null)
                            {
                                continue;
                            }
                            if (!bill.recipe.WorkerCounter.CanPossiblyStoreInStockpile(bill, zone_Stockpile))
                            {
                                list.Add(new FloatMenuOption(string.Format("{0} ({1})", string.Format(item.LabelCap, group.parent.SlotYielderLabel()), "IncompatibleLower".Translate()), null));
                                continue;
                            }
                            list.Add(new FloatMenuOption(string.Format(item.LabelCap, group.parent.SlotYielderLabel()), delegate
                            {
                                bill.SetStoreMode(BillStoreModeDefOf.SpecificStockpile, (Zone_Stockpile)group.parent);
                            }));
                        }
                    }
                    else
                    {
                        BillStoreModeDef smLocal = item;
                        list.Add(new FloatMenuOption(smLocal.LabelCap, delegate
                        {
                            bill.SetStoreMode(smLocal);
                        }));
                    }
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
            Text.Font = GameFont.Small;
            listing_Standard.EndSection(listing_Standard3);
            listing_Standard.Gap();
            Listing_Standard listing_Standard4 = listing_Standard.BeginSection(WorkerSelectionSubdialogHeight);

            Widgets.Dropdown(listing_Standard4.GetRect(30f), bill, (Bill_Production b) => b.pawnRestriction, (Bill_Production b) => GeneratePawnRestrictionOptions(), (bill.pawnRestriction == null) ? "AnyWorker".TranslateSimple() : bill.pawnRestriction.LabelShortCap);
            if (bill.pawnRestriction == null && bill.recipe.workSkill != null)
            {
                listing_Standard4.Label("AllowedSkillRange".Translate(bill.recipe.workSkill.label));
                listing_Standard4.IntRange(ref bill.allowedSkillRange, 0, 20);
            }
            listing_Standard.EndSection(listing_Standard4);
            listing_Standard.End();
            Rect rect5 = rect4;
            bool flag  = true;

            for (int j = 0; j < bill.recipe.ingredients.Count; j++)
            {
                if (!bill.recipe.ingredients[j].IsFixedIngredient)
                {
                    flag = false;
                    break;
                }
            }
            if (!flag)
            {
                rect5.yMin = rect5.yMax - (float)IngredientRadiusSubdialogHeight;
                rect4.yMax = rect5.yMin - 17f;
                bool num = bill.GetStoreZone() == null || bill.recipe.WorkerCounter.CanPossiblyStoreInStockpile(bill, bill.GetStoreZone());
                ThingFilterUI.DoThingFilterConfigWindow(rect4, ref thingFilterScrollPosition, bill.ingredientFilter, bill.recipe.fixedIngredientFilter, 4, null, bill.recipe.forceHiddenSpecialFilters, forceHideHitPointsConfig: false, bill.recipe.GetPremultipliedSmallIngredients(), bill.Map);
                bool flag2 = bill.GetStoreZone() == null || bill.recipe.WorkerCounter.CanPossiblyStoreInStockpile(bill, bill.GetStoreZone());
                if (num && !flag2)
                {
                    Messages.Message("MessageBillValidationStoreZoneInsufficient".Translate(bill.LabelCap, bill.billStack.billGiver.LabelShort.CapitalizeFirst(), bill.GetStoreZone().label), bill.billStack.billGiver as Thing, MessageTypeDefOf.RejectInput, historical: false);
                }
            }
            else
            {
                rect5.yMin = 50f;
            }
            Listing_Standard listing_Standard5 = new Listing_Standard();

            listing_Standard5.Begin(rect5);
            string str2 = "IngredientSearchRadius".Translate().Truncate(rect5.width * 0.6f);
            string str3 = ((bill.ingredientSearchRadius == 999f) ? "Unlimited".TranslateSimple().Truncate(rect5.width * 0.3f) : bill.ingredientSearchRadius.ToString("F0"));

            listing_Standard5.Label(str2 + ": " + str3);
            bill.ingredientSearchRadius = listing_Standard5.Slider((bill.ingredientSearchRadius > 100f) ? 100f : bill.ingredientSearchRadius, 3f, 100f);
            if (bill.ingredientSearchRadius >= 100f)
            {
                bill.ingredientSearchRadius = 999f;
            }
            listing_Standard5.End();
            Listing_Standard listing_Standard6 = new Listing_Standard();

            listing_Standard6.Begin(rect2);
            if (bill.suspended)
            {
                if (listing_Standard6.ButtonText("Suspended".Translate()))
                {
                    bill.suspended = false;
                    SoundDefOf.Click.PlayOneShotOnCamera();
                }
            }
            else if (listing_Standard6.ButtonText("NotSuspended".Translate()))
            {
                bill.suspended = true;
                SoundDefOf.Click.PlayOneShotOnCamera();
            }
            StringBuilder stringBuilder = new StringBuilder();

            if (bill.recipe.description != null)
            {
                stringBuilder.AppendLine(bill.recipe.description);
                stringBuilder.AppendLine();
            }
            stringBuilder.AppendLine("WorkAmount".Translate() + ": " + bill.recipe.WorkAmountTotal(null).ToStringWorkAmount());
            for (int k = 0; k < bill.recipe.ingredients.Count; k++)
            {
                IngredientCount ingredientCount = bill.recipe.ingredients[k];
                if (!ingredientCount.filter.Summary.NullOrEmpty())
                {
                    stringBuilder.AppendLine(bill.recipe.IngredientValueGetter.BillRequirementsDescription(bill.recipe, ingredientCount));
                }
            }
            stringBuilder.AppendLine();
            string text2 = bill.recipe.IngredientValueGetter.ExtraDescriptionLine(bill.recipe);

            if (text2 != null)
            {
                stringBuilder.AppendLine(text2);
                stringBuilder.AppendLine();
            }
            if (!bill.recipe.skillRequirements.NullOrEmpty())
            {
                stringBuilder.AppendLine("MinimumSkills".Translate());
                stringBuilder.AppendLine(bill.recipe.MinSkillString);
            }
            Text.Font = GameFont.Small;
            string text3 = stringBuilder.ToString();

            if (Text.CalcHeight(text3, rect2.width) > rect2.height)
            {
                Text.Font = GameFont.Tiny;
            }
            listing_Standard6.Label(text3);
            Text.Font = GameFont.Small;
            listing_Standard6.End();
            if (bill.recipe.products.Count == 1)
            {
                ThingDef thingDef = bill.recipe.products[0].thingDef;
                Widgets.InfoCardButton(rect2.x, rect4.y, thingDef, GenStuff.DefaultStuffFor(thingDef));
            }
        }
Exemplo n.º 5
0
        public override void DoWindowContents(Rect inRect)
        {
            Listing_Standard listing = new Listing_Standard();

            listing.Begin(inRect);

            listing.Label("Twitch Message Log");

            listing.ColumnWidth = inRect.width * 0.30f;

            if (TwitchWrapper.Client != null)
            {
                bool connected = TwitchWrapper.Client.IsConnected;

                listing.Label(connected ? TCText.ColoredText("Connected", Color.green) : TCText.ColoredText("Not Connected", Color.red));

                if (listing.ButtonText(connected ? "Disconnect" : "Connect"))
                {
                    TwitchWrapper.Client.Disconnect();
                }
            }
            else
            {
                if (listing.ButtonText("Reset Twitch Client"))
                {
                    TwitchWrapper.StartAsync();
                }
            }

            listing.End();

            float columnWidth = inRect.width * 0.49f;

            Rect headerOne = new Rect(0, 100f, columnWidth, 32f);

            Widgets.Label(headerOne, "Message Log");

            Rect messageBoxOne = new Rect(0, 132f, columnWidth, 200f);

            string messageBoxText = "";

            foreach (ChatMessage chatMessage in MessageLog.LastChatMessages)
            {
                messageBoxText += $"{chatMessage.DisplayName}: {chatMessage.Message}\n";
            }

            Widgets.TextArea(messageBoxOne, messageBoxText, true);

            Rect headerTwo = new Rect(headerOne);

            headerTwo.x += columnWidth + 10f;
            Widgets.Label(headerTwo, "Whisper Log");

            Rect messageBoxTwo = new Rect(messageBoxOne);

            messageBoxTwo.x += messageBoxTwo.width + 10f;

            string whisperBoxText = "";

            foreach (WhisperMessage whisperMessage in MessageLog.LastWhisperMessages)
            {
                whisperBoxText += $"{whisperMessage.DisplayName}: {whisperMessage.Message}\n";
            }

            Widgets.TextArea(messageBoxTwo, whisperBoxText, true);
        }
        public override void DoSettingsWindowContents(Rect inRect)
        {
            Init();

            var listingStandard = new Listing_Standard();


            // arms settings GUI
            var armsGroup      = new Rect(inRect.x, inRect.y, inRect.width, 180f);
            var armsSearchRect = new Rect(inRect.width - 200f, armsGroup.y, 200f, 24f);

            _armSearchQuery = Widgets.TextArea(armsSearchRect, _armSearchQuery);
            var armSearchQueryIsEmpty = _armSearchQuery.NullOrEmpty();

            listingStandard.Begin(armsGroup);
            listingStandard.Label("ProstheticNoMissingBodyPartsWhitelistedArmsName".Translate());
            listingStandard.End();

            var filteredArms = _armsHediff.FindAll((x) =>
                                                   armSearchQueryIsEmpty ||
                                                   x.defName.ToLower().Contains(_armSearchQuery.ToLower()) ||
                                                   x.label.ToLower().Contains(_armSearchQuery.ToLower())
                                                   );

            var armsHolder = new Rect(armsGroup.x, armsGroup.y + 30, armsGroup.width, 150f);
            var armsView   = new Rect(armsHolder.x, armsHolder.y, armsGroup.width - 24f, filteredArms.Count * 24f);

            Widgets.BeginScrollView(armsHolder, ref _armsViewScroll, armsView);
            listingStandard.Begin(armsView);

            foreach (var hediffDef in filteredArms)
            {
                listingStandard.CheckboxLabeled(
                    hediffDef.label.CapitalizeFirst() + " (" + hediffDef.defName + ")",
                    ref _armsWhitelistMap[hediffDef.defName][0],
                    hediffDef.description
                    );
            }

            listingStandard.End();
            Widgets.EndScrollView();


            // legs setting GUI
            var legsGroup      = new Rect(inRect.x, inRect.y + 230f, inRect.width, 180f);
            var legsSearchRect = new Rect(inRect.width - 200f, legsGroup.y, 200f, 24f);

            _legSearchQuery = Widgets.TextArea(legsSearchRect, _legSearchQuery);
            var legSearchQueryIsEmpty = _legSearchQuery.NullOrEmpty();

            listingStandard.Begin(legsGroup);
            listingStandard.Label("ProstheticNoMissingBodyPartsWhitelistedLegsName".Translate());
            listingStandard.End();

            var filteredLegs = _legsHediff.FindAll((x) =>
                                                   legSearchQueryIsEmpty ||
                                                   x.defName.ToLower().Contains(_legSearchQuery.ToLower()) ||
                                                   x.label.ToLower().Contains(_legSearchQuery.ToLower())
                                                   );

            var legsHolder = new Rect(legsGroup.x, legsGroup.y + 30, legsGroup.width, 150f);
            var legsView   = new Rect(legsHolder.x, legsHolder.y, legsGroup.width - 24f, filteredLegs.Count * 24f);

            Widgets.BeginScrollView(legsHolder, ref _legsViewScroll, legsView);
            listingStandard.Begin(legsView);

            foreach (var hediffDef in filteredLegs)
            {
                listingStandard.CheckboxLabeled(
                    hediffDef.label.CapitalizeFirst() + " (" + hediffDef.defName + ")",
                    ref _legsWhitelistMap[hediffDef.defName][0],
                    hediffDef.description
                    );
            }

            listingStandard.End();
            Widgets.EndScrollView();

            base.DoSettingsWindowContents(inRect);
        }
Exemplo n.º 7
0
        public override void DoSettingsWindowContents(Rect rect)
        {
            Listing_Standard list = new Listing_Standard()
            {
                ColumnWidth = rect.width
            };

            list.Begin(rect);
            list.Gap(10);
            {
                Rect fullRect  = list.GetRect(Text.LineHeight);
                Rect leftRect  = fullRect.LeftHalf().Rounded();
                Rect rightRect = fullRect.RightHalf().Rounded();

                GenUI.SetLabelAlign(TextAnchor.MiddleRight);
                Widgets.Label(leftRect, Static.LabelStoneTypesAvailable);
                GenUI.ResetLabelAlign();

                Widgets.IntRange(rightRect, 316192000, ref Settings.StoneTypesAvailable, 1, 8);
            }

            list.Gap(25);
            {
                Rect fullRect       = list.GetRect(30f);
                Rect leftLabelRect  = fullRect.LeftHalf().Rounded();
                Rect rightLabelRect = fullRect.RightHalf().Rounded();

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

                Widgets.Label(leftLabelRect, Static.LabelStoneTypesToSpawn);

                Text.Anchor = TextAnchor.UpperLeft;
                Text.Font   = GameFont.Small;
            }

            list.Gap(10);
            {
                Rect fullRect       = list.GetRect(30f);
                Rect rightLabelRect = fullRect.RightHalf().Rounded();

                DualCheckboxesWithIcons_ThingDef(
                    fullRect.LeftHalf(),
                    StoneDefOf.ChunkLimestone, StoneDefOf.ChunkSandstone,
                    StoneDefOf.Limestone.LabelCap, StoneDefOf.Sandstone.LabelCap,
                    ref Settings.SpawnLimestone, ref Settings.SpawnSandstone
                    );
            }
            list.Gap(10);

            {
                Rect fullRect = list.GetRect(30f);
                DualCheckboxesWithIcons_ThingDef(
                    fullRect.LeftHalf(),
                    StoneDefOf.ChunkClaystone, StoneDefOf.ChunkAndesite,
                    StoneDefOf.Claystone.LabelCap, StoneDefOf.Andesite.LabelCap,
                    ref Settings.SpawnClaystone, ref Settings.SpawnAndesite
                    );
            }
            list.Gap(10);

            {
                Rect fullRect = list.GetRect(30f);
                DualCheckboxesWithIcons_ThingDef(
                    fullRect.LeftHalf(),
                    StoneDefOf.ChunkSyenite, StoneDefOf.ChunkGneiss,
                    StoneDefOf.Syenite.LabelCap, StoneDefOf.Gneiss.LabelCap,
                    ref Settings.SpawnSyenite, ref Settings.SpawnGneiss
                    );
            }
            list.Gap(10);

            {
                Rect fullRect = list.GetRect(30f);
                DualCheckboxesWithIcons_ThingDef(
                    fullRect.LeftHalf(),
                    StoneDefOf.ChunkMarble, StoneDefOf.ChunkQuartzite,
                    StoneDefOf.Marble.LabelCap, StoneDefOf.Quartzite.LabelCap,
                    ref Settings.SpawnMarble, ref Settings.SpawnQuartzite
                    );
            }
            list.Gap(10);

            {
                Rect fullRect = list.GetRect(30f);
                DualCheckboxesWithIcons_ThingDef(
                    fullRect.LeftHalf(),
                    StoneDefOf.ChunkSlate, StoneDefOf.ChunkSchist,
                    StoneDefOf.Slate.LabelCap, StoneDefOf.Schist.LabelCap,
                    ref Settings.SpawnSlate, ref Settings.SpawnSchist
                    );
            }
            list.Gap(10);

            {
                Rect fullRect = list.GetRect(30f);
                DualCheckboxesWithIcons_ThingDef(
                    fullRect.LeftHalf(),
                    StoneDefOf.ChunkGabbro, StoneDefOf.ChunkGranite,
                    StoneDefOf.Gabbro.LabelCap, StoneDefOf.Granite.LabelCap,
                    ref Settings.SpawnGabbro, ref Settings.SpawnGranite
                    );
            }
            list.Gap(10);

            {
                Rect fullRect = list.GetRect(30f);
                DualCheckboxesWithIcons_ThingDef(
                    fullRect.LeftHalf(),
                    StoneDefOf.ChunkDiorite, StoneDefOf.ChunkDunite,
                    StoneDefOf.Diorite.LabelCap, StoneDefOf.Dunite.LabelCap,
                    ref Settings.SpawnDiorite, ref Settings.SpawnDunite
                    );
            }
            list.Gap(10);

            {
                Rect fullRect     = list.GetRect(30f);
                Rect leftRect     = fullRect.LeftHalf().LeftHalf().RightPartPixels(150).Rounded();
                Rect leftIconRect = fullRect.LeftHalf().LeftHalf().LeftHalf().LeftHalf().RightPartPixels(30).Rounded();

                Widgets.ThingIcon(leftIconRect, StoneDefOf.ChunkPegmatite);

                Widgets.CheckboxLabeled(leftRect, StoneDefOf.Pegmatite.LabelCap, ref Settings.SpawnPegmatite);
                Widgets.DrawHighlightIfMouseover(leftRect);
            }

            GenUI.ResetLabelAlign();
            list.End();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Draws the mod configuration window contents.
        /// </summary>
        /// <returns>The final height of the window rect.</returns>
        /// <param name="rect">Rect</param>
        public override float DoWindowContents( Rect rect )
        {
            var listing = new Listing_Standard( rect );
            {
                listing.ColumnWidth = rect.width - 4f;

                #region Main Toggle
                var toggleLabel = "MiniMap.MCMToggleMain".Translate();
                listing.CheckboxLabeled( toggleLabel, ref MiniMap.MiniMapController.visible );
                listing.Gap();
                #endregion

                #region Handle all MiniMaps and Overlays

                foreach( var minimap in Controller.Data.MiniMaps )
                {
                    if( minimap.IsOrHasIConfigurable )
                    {
                        var iMinimap = minimap as IConfigurable;

                        #region Minimap Header
                        MinimapHeader( listing, minimap );
                        #endregion

                        #region Handle MiniMap IConfigurable
                        if( iMinimap != null )
                        {
                            #region Minimap IConfigurable
                            var iMinimapRect = new Rect( listing.Indentation(), listing.CurHeight, listing.ColumnWidth, 9999f );
                            GUI.BeginGroup( iMinimapRect );
                            var iMinimapHeight = iMinimap.DrawMCMRegion( iMinimapRect.AtZero() );
                            GUI.EndGroup();
                            listing.Gap( iMinimapHeight + 6f );
                            #endregion
                        }
                        #endregion

                        #region Handle all MiniMap Overlays
                        foreach( var overlay in minimap.overlayWorkers )
                        {
                            var iOverlay = overlay as IConfigurable;

                            #region Handle Overlay IConfigurable
                            if( iOverlay != null )
                            {

                                #region Overlay Header
                                OverlayHeader( listing, overlay );
                                #endregion

                                #region Overlay IConfigurable
                                var iOverlayRect = new Rect( listing.Indentation(), listing.CurHeight, listing.ColumnWidth, 9999f );
                                GUI.BeginGroup( iOverlayRect );
                                var iOverlayHeight = iOverlay.DrawMCMRegion( iOverlayRect.AtZero() );
                                GUI.EndGroup();
                                listing.Gap( iOverlayHeight + 6f );
                                listing.Undent();
                                #endregion

                            }
                            #endregion
                        }
                        #endregion

                        #region Final Undentation
                        listing.Gap();
                        listing.Undent();
                        #endregion
                    }
                }

                #endregion

            }
            listing.End();
            return listing.CurHeight;
        }
Exemplo n.º 9
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Small;

            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.ColumnWidth = inRect.width;
            listing_Standard.Begin(inRect);

            listing_Standard.Label("ColonistHistory.SettingsTitleGeneral".Translate());

            indexRecordingIntervalHours = RecordingIntervalHoursItems.IndexOf(Settings.recordingIntervalHours);
            if (indexRecordingIntervalHours == -1)
            {
                indexRecordingIntervalHours = 0;
            }
            listing_Standard.Label("ColonistHistory.SettingsRecordingIntervalHours".Translate(RecordingIntervalHoursItems[indexRecordingIntervalHours].HoursToString()));
            indexRecordingIntervalHours     = (int)listing_Standard.Slider(indexRecordingIntervalHours, 0, RecordingIntervalHoursItems.Count - 1);
            Settings.recordingIntervalHours = RecordingIntervalHoursItems[indexRecordingIntervalHours];

            listing_Standard.CheckboxLabeled("ColonistHistory.SettingsSaveNullOrEmpty".Translate(), ref settings.saveNullOrEmpty);

            listing_Standard.Label("ColonistHistory.SettingsSaveFolderPath".Translate());
            Settings.saveFolderPath = listing_Standard.TextEntry(Settings.saveFolderPath);

            listing_Standard.CheckboxLabeled("ColonistHistory.SettingsRecordOtherFactionPawn".Translate(), ref settings.recordOtherFactionPawn);

            bool previousShowOtherFactionPawn = settings.showOtherFactionPawn;

            listing_Standard.CheckboxLabeled("ColonistHistory.SettingsShowOtherFactionPawn".Translate(), ref settings.showOtherFactionPawn);
            if (previousShowOtherFactionPawn != settings.showOtherFactionPawn)
            {
                RecordGroup.ForceRedraw();
            }

            listing_Standard.CheckboxLabeled("ColonistHistory.SettingsLightWeightSaveMode".Translate(), ref settings.lightWeightSaveMode, "ColonistHistory.SettingsLightWeightSaveModeDesc".Translate());

            listing_Standard.GapLine();

            listing_Standard.Label("ColonistHistory.SettingsTitleGraph".Translate());

            listing_Standard.TextFieldNumericLabeled <float>("ColonistHistory.SettingsHighlightedCurveWidth".Translate(), ref settings.highlightedCurveWidth, ref this.highlightedCurveWidthBuf);
            bool previousTreatingUnrecordedAsZero = settings.treatingUnrecordedAsZero;

            listing_Standard.CheckboxLabeled("ColonistHistory.SettingsTreatingUnrecordedAsZero".Translate(), ref settings.treatingUnrecordedAsZero);
            if (previousTreatingUnrecordedAsZero != settings.treatingUnrecordedAsZero)
            {
                RecordGroup.ForceRedraw();
            }
            bool previousAddZeroBeforeFirst = settings.addZeroBeforeFirst;

            listing_Standard.CheckboxLabeled("ColonistHistory.SettingsAddZeroBeforeFirst".Translate(), ref settings.addZeroBeforeFirst);
            if (previousAddZeroBeforeFirst != settings.addZeroBeforeFirst)
            {
                RecordGroup.ForceRedraw();
            }

            listing_Standard.GapLine();

            listing_Standard.Label("ColonistHistory.SettingsTitleOutputRecords".Translate());

            listing_Standard.End();

            float rowHeight = 28f;
            Rect  outRect   = new Rect(inRect.x, inRect.y + listing_Standard.CurHeight, listing_Standard.ColumnWidth, inRect.height - listing_Standard.CurHeight);
            Rect  viewRect  = new Rect(0f, 0f, inRect.width - 16f, rowHeight * settings.ColonistHistorysOrder.Count);

            //Log.Message("rect:" + rect);
            Widgets.BeginScrollView(outRect, ref this.scrollPosition, viewRect);
            float num = 0f;
            int   indexColonistHistoryDef = 0;
            int   indexReorderDown        = -1;

            foreach (ColonistHistoryDef def in settings.ColonistHistorysOrder)
            {
                bool value   = Settings.CanOutput(def);
                Rect rectRow = new Rect(0f, num, viewRect.width - 20f, rowHeight);
                if (indexColonistHistoryDef > 0 && Widgets.ButtonImage(new Rect(0f, num + (rowHeight - 24f) / 2f, 24f, 24f), MyTex.ReorderUp, Color.white, true))
                {
                    indexReorderDown = indexColonistHistoryDef - 1;
                    SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                }
                if (indexColonistHistoryDef < settings.ColonistHistorysOrder.Count - 1 && Widgets.ButtonImage(new Rect(28f, num + (rowHeight - 24f) / 2f, 24f, 24f), MyTex.ReorderDown, Color.white, true))
                {
                    indexReorderDown = indexColonistHistoryDef;
                    SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                }

                Rect rectCheckbox = new Rect(56f, num, rectRow.width - 90f, rowHeight);
                //Log.Message("rectCheckbox:" + rectCheckbox);
                Widgets.CheckboxLabeled(rectCheckbox, def.LabelCap, ref value);
                if (Mouse.IsOver(rectRow))
                {
                    Widgets.DrawHighlight(rectRow);
                }
                TooltipHandler.TipRegion(rectRow, def.description);
                Settings.ColonistHistoryOutput[def.defName] = value;

                if (def.RecordIDs.Count() >= 2 && Widgets.ButtonText(new Rect(rectCheckbox.xMax + 4f, num, 30f, rowHeight), "..."))
                {
                    Find.WindowStack.Add(new Dialog_ColonistHistoryOutputDetailed(def));
                }

                num += rectCheckbox.height;
                indexColonistHistoryDef++;
            }
            if (indexReorderDown != -1)
            {
                ColonistHistoryDef def = this.settings.ColonistHistorysOrder[indexReorderDown];
                this.settings.ColonistHistorysOrder.Remove(def);
                this.settings.ColonistHistorysOrder.Insert(indexReorderDown + 1, def);
            }
            Widgets.EndScrollView();

            Text.Font = GameFont.Medium;
        }
Exemplo n.º 10
0
        // NOTE: They removed Listing_Standard's scroll views in 1.3 :p
        //private static Rect viewRect=new Rect(0,0,100f,10000f); // OMG OMG OMG I got scrollView in Listing_Standard to work!
        public static void DoSettingsWindowContents(Rect inRect)
        {
            ModMetaData tmpMod;
            Color       origColor = GUI.color; // make option gray if ignored
            Rect        outerRect = inRect.ContractedBy(10f);

            Widgets.DrawHighlight(outerRect);

            // We put a scrollbar around a listing_standard; it seems to work okay
            bool scrollBarVisible = totalContentHeight > outerRect.height;
            var  scrollViewTotal  = new Rect(0f, 0f, outerRect.width - (scrollBarVisible ? ScrollBarWidthMargin : 0), totalContentHeight);

            Widgets.BeginScrollView(outerRect, ref scrollPosition, scrollViewTotal);

            Listing_Standard l = new Listing_Standard(GameFont.Medium); // my tiny high-resolution monitor :p

            l.Begin(new Rect(0f, 0f, scrollViewTotal.width, 9999f));    // Some RW window does this "9999f" thing, & it seems to work?
            //l.GapLine();  // Who can haul to Deep Storage (robots, animals, etc)
            l.Label("LWMDShaulToStorageExplanation".Translate());
            l.CheckboxLabeled("LWMDSrobotsCanUse".Translate(), ref robotsCanUse, "LWMDSrobotsCanUseDesc".Translate());
            string [] intLabels =
            {
                "LWM_DS_Int_Animal".Translate(),
                "LWM_DS_Int_ToolUser".Translate(),
                "LWM_DS_Int_Humanlike".Translate(),
            };
            // Setting to allow bionic racoons to haul to Deep Storage:
            l.EnumRadioButton <Intelligence>(ref Patch_IsGoodStoreCell.NecessaryIntelligenceToUseDeepStorage, "LWM_DS_IntTitle".Translate(),
                                             "LWM_DS_IntDesc".Translate(), false, intLabels);

            l.GapLine();  //Storing Delay Settings
            l.Label("LWMDSstoringDelaySettings".Translate());
            l.Label("LWMDSstoringDelayExplanation".Translate());
            l.CheckboxLabeled("LWMDSstoringTakesTimeLabel".Translate(),
                              ref storingTakesTime, "LWMDSstoringTakesTimeDesc".Translate());
            l.Label("LWMDSstoringGlobalScale".Translate((storingGlobalScale * 100f).ToString("0.")));
            storingGlobalScale = l.Slider(storingGlobalScale, 0f, 2f);
            l.CheckboxLabeled("LWMDSstoringTimeConsidersStackSize".Translate(),
                              ref storingTimeConsidersStackSize, "LWMDSstoringTimeConsidersStackSizeDesc".Translate());
            // Reset storing delay settings to defaults
            if (l.ButtonText("LWMDSstoringDelaySettings".Translate() + ": " + "ResetBinding".Translate() /*Reset to Default*/))
            {
                storingTakesTime              = true;
                storingGlobalScale            = 1f;
                storingTimeConsidersStackSize = true;
            }
            l.GapLine(); // default Storing Priority
            if (l.ButtonTextLabeled("LWM_DS_defaultStoragePriority".Translate(),
                                    defaultStoragePriority.Label()))
            {
                List <FloatMenuOption> mlist = new List <FloatMenuOption>();
                foreach (StoragePriority p in Enum.GetValues(typeof(StoragePriority)))
                {
                    mlist.Add(new FloatMenuOption(p.Label(), delegate() {
                        defaultStoragePriority = p;
                        foreach (ThingDef d in AllDeepStorageUnits)
                        {
                            d.building.defaultStorageSettings.Priority = p;
                        }
                    }));
                }
                Find.WindowStack.Add(new FloatMenu(mlist));
            }
            l.GapLine();
            l.Label("LWM_DS_userInterface".Translate());
            l.CheckboxLabeled("LWM_DS_useEjectButton".Translate(), ref useEjectButton,
                              "LWM_DS_useEjectButtonDesc".Translate());
            //TODO::
            if ((tmpMod = ModLister.GetActiveModWithIdentifier("netrve.dsgui")) != null)
            {
                GUI.color = Color.gray;
                l.Label("LWMDSignoredDueTo".Translate(tmpMod.Name));
            }
            l.CheckboxLabeled("LWM_DS_useDSRightClick".Translate(), ref useDeepStorageRightClickLogic,
                              "LWM_DS_useDSRightClickDesc".Translate());

            // Architect Menu:
            l.GapLine();  //Architect Menu location
            GUI.color = origColor;

/*
 * //            string archLabel=
 * //            if (archLabel==n
 * //            l.Label("LWMDSarchitectMenuSettings".Translate());
 *          if (architectMenuDesigCatDef==architectMenuDefaultDesigCatDef) {
 * //                if (architectLWM_DS_Storage_DesignationCatDef==null) {
 * //                    Log.Error("LWM.DeepStorage: architectLWM_DS_Storage_DesignationCatDef was null; this should never happen.");
 * //                    tmp="ERROR";
 * //                } else {
 * //                    tmp=architectCurrentDesignationCatDef.LabelCap; // todo: (default)
 * //                }
 *              archLabel+=" ("+
 *          } else {
 *              var x=DefDatabase<DesignationCategoryDef>.GetNamed(architectMenuDesignationCatDefDefName, false);
 *              if (x==null) {
 *                  // TODO
 *              }
 *              tmp=x.LabelCap; // todo: (<menuname>)
 *          }*/
            if (l.ButtonTextLabeled((architectMenuDefaultDesigCatDef + "_ArchitectMenuSettings").Translate(), // Label
                                                                                                              // value of dropdown button:
                                    DefDatabase <DesignationCategoryDef> .GetNamed(architectMenuDesigCatDef)?.LabelCap
                                    ?? "--ERROR--"))                                                          // error display text
//                                     , DefDatabase<DesigarchitectMenuDesigCatDef) ) {
            // Float menu for architect Menu choice:
            {
                List <FloatMenuOption> alist = new List <FloatMenuOption>();
                var arl = DefDatabase <DesignationCategoryDef> .AllDefsListForReading; //all reading list
                //oops:
//                alist.Add(new FloatMenuOption(DefDatabase<DesignationCategoryDef>.GetNamed(architectMenuDefaultDesigCatDef).LabelCap
                alist.Add(new FloatMenuOption(architectMenuActualDef.LabelCap +
                                              " (" + "default".Translate() + " - " + architectMenuActualDef.defName + ")",
                                              delegate() {
                    Utils.Mess(Utils.DBF.Settings, "Architect Menu placement set to default Storage");
                    ArchitectMenu_ChangeLocation(architectMenuDefaultDesigCatDef);
//                                                  architectCurrentDesignationCatDef=architectLWM_DS_Storage_DesignationCatDef;
//                                                  architectMenuDesignationCatDefDefName="LWM_DS_Storage";
//
//                                                  SettingsChanged();
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                // Architect Menu:  You may remove the "Furniture" references here if you wish
                alist.Add(new FloatMenuOption(DefDatabase <DesignationCategoryDef> .GetNamed("Furniture").LabelCap +
                                              " (Furniture)", // I know what this one's defName is!
                                              delegate() {
                    Utils.Mess(Utils.DBF.Settings, "Architect Menu placement set to Furniture.");
                    ArchitectMenu_ChangeLocation("Furniture");
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                foreach (var adcd in arl)   //architect designation cat def
                {
                    if (adcd.defName != architectMenuDefaultDesigCatDef && adcd.defName != "Furniture")
                    {
                        alist.Add(new FloatMenuOption(adcd.LabelCap + " (" + adcd.defName + ")",
                                                      delegate() {
                            Utils.Mess(Utils.DBF.Settings, "Architect Menu placement set to " + adcd);
                            ArchitectMenu_ChangeLocation(adcd.defName);
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                }
                Find.WindowStack.Add(new FloatMenu(alist));
            }
            l.CheckboxLabeled((architectMenuDefaultDesigCatDef + "_ArchitectMenuAlwaysShowCategory").Translate(),
                              ref architectMenuAlwaysShowCategory,
                              (architectMenuDefaultDesigCatDef + "_ArchitectMenuAlwaysShowDesc").Translate());
            // Do we always display?  If so, display:
            if (architectMenuAlwaysShowCategory != architectMenuAlwaysShowTmp)
            {
                if (architectMenuAlwaysShowCategory)
                {
                    ArchitectMenu_Show();
                }
                else if (architectMenuDesigCatDef != architectMenuDefaultDesigCatDef)
                {
                    ArchitectMenu_Hide();
                }
                architectMenuAlwaysShowTmp = architectMenuAlwaysShowCategory;
            }
            l.CheckboxLabeled((architectMenuDefaultDesigCatDef + "_ArchitectMenuMoveALL").Translate(),
                              ref architectMenuMoveALLStorageItems,
                              (architectMenuDefaultDesigCatDef + "_ArchitectMenuMoveALLDesc").Translate());
            if (architectMenuMoveALLStorageItems != architectMenuMoveALLTmp)
            {
                //  If turning off "all things in Storage", make sure to
                //    dump all the items into Furniture, to make sure they
                //    can at least be found somewhere.
                string ctmp = architectMenuDesigCatDef;
                if (architectMenuMoveALLStorageItems == false)
                {
                    architectMenuMoveALLStorageItems = true;
                    ArchitectMenu_ChangeLocation("Furniture");
                    architectMenuMoveALLStorageItems = false;
                }
                ArchitectMenu_ChangeLocation(ctmp);
                architectMenuMoveALLTmp = architectMenuMoveALLStorageItems;
            }
            // finished drawing settings for Architect Menu
            // -------------------
            // Allow player to turn of Over-Capacity check.
            //   Turn it off automatically for Project RimFactory and Extended Storage
            //   Note: should turn it off automatically for any other storage mods, too
            l.GapLine();
            tmpMod = ModLister.GetActiveModWithIdentifier("spdskatr.projectrimfactory")
                     ?? ModLister.GetActiveModWithIdentifier("zymex.prf.lite")
                     ?? ModLister.GetActiveModWithIdentifier("Skullywag.ExtendedStorage");
            if (tmpMod != null)
            {
                GUI.color = Color.gray;
                // This setting is disabled due to mod [Extended Storage, etc]
                l.Label("LWMDSignoredDueTo".Translate(tmpMod.Name));
            }
            l.CheckboxLabeled("LWMDSoverCapacityCheck".Translate(), ref checkOverCapacity,
                              "LWMDSoverCapacityCheckDesc".Translate());
            GUI.color = origColor;
            // Per DSU settings - let players change them around...
            l.GapLine();
            if (allowPerDSUSettings)
            {
                if (l.ButtonText("LWMDSperDSUSettings".Translate()))
                {
                    Find.WindowStack.Add(new Dialog_DS_Settings());
                }
            }
            else
            {
                l.CheckboxLabeled("LWMDSperDSUturnOn".Translate(), ref allowPerDSUSettings,
                                  "LWMDSperDSUturnOnDesc".Translate());
            }
            l.GapLine(); // End. Finis. Looks pretty having a line at the end.
            totalContentHeight = l.CurHeight + 10f;
            l.End();
            Widgets.EndScrollView();
        }
Exemplo n.º 11
0
        protected override void FillTab()
        {
            Vector2 winSize  = WITab_Terrain.WinSize;
            float   x        = winSize.x;
            Vector2 winSize2 = WITab_Terrain.WinSize;
            Rect    rect     = new Rect(0f, 0f, x, winSize2.y).ContractedBy(10f);
            Rect    rect2    = rect;

            Text.Font = GameFont.Medium;
            Widgets.Label(rect2, base.SelTile.biome.LabelCap);
            Rect rect3 = rect;

            rect3.yMin += 35f;
            Text.Font   = GameFont.Small;
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.verticalSpacing = 0f;
            listing_Standard.Begin(rect3);
            Tile    selTile   = base.SelTile;
            int     selTileID = base.SelTileID;
            Vector2 vector    = Find.WorldGrid.LongLatOf(selTileID);
            float   y         = vector.y;

            listing_Standard.Label(selTile.biome.description, -1f);
            listing_Standard.Gap(8f);
            listing_Standard.GapLine(12f);
            if (!selTile.biome.implemented)
            {
                listing_Standard.Label(selTile.biome.LabelCap + " " + "BiomeNotImplemented".Translate(), -1f);
            }
            listing_Standard.LabelDouble("Terrain".Translate(), selTile.hilliness.GetLabelCap());
            if (selTile.VisibleRoads != null)
            {
                listing_Standard.LabelDouble("Road".Translate(), GenText.ToCommaList((from roadlink in selTile.VisibleRoads
                                                                                      select roadlink.road.label).Distinct(), true).CapitalizeFirst());
            }
            if (selTile.VisibleRivers != null)
            {
                Listing_Standard listing_Standard2 = listing_Standard;
                string           leftLabel         = "River".Translate();
                Tile.RiverLink   riverLink         = selTile.VisibleRivers.MaxBy((Tile.RiverLink riverlink) => riverlink.river.degradeThreshold);
                listing_Standard2.LabelDouble(leftLabel, riverLink.river.LabelCap);
            }
            if (!Find.World.Impassable(selTileID))
            {
                int num      = 2500;
                int numTicks = Mathf.Min(num + WorldPathGrid.CalculatedCostAt(selTileID, false, -1f), 120000);
                listing_Standard.LabelDouble("MovementTimeNow".Translate(), numTicks.ToStringTicksToPeriod(true, false, true));
                int numTicks2 = Mathf.Min(num + WorldPathGrid.CalculatedCostAt(selTileID, false, Season.Summer.GetMiddleYearPct(y)), 120000);
                listing_Standard.LabelDouble("MovementTimeSummer".Translate(), numTicks2.ToStringTicksToPeriod(true, false, true));
                int numTicks3 = Mathf.Min(num + WorldPathGrid.CalculatedCostAt(selTileID, false, Season.Winter.GetMiddleYearPct(y)), 120000);
                listing_Standard.LabelDouble("MovementTimeWinter".Translate(), numTicks3.ToStringTicksToPeriod(true, false, true));
            }
            if (selTile.biome.canBuildBase)
            {
                listing_Standard.LabelDouble("StoneTypesHere".Translate(), GenText.ToCommaList(from rt in Find.World.NaturalRockTypesIn(selTileID)
                                                                                               select rt.label, true).CapitalizeFirst());
            }
            listing_Standard.LabelDouble("Elevation".Translate(), selTile.elevation.ToString("F0") + "m");
            listing_Standard.GapLine(12f);
            listing_Standard.LabelDouble("AvgTemp".Translate(), selTile.temperature.ToStringTemperature("F1"));
            float celsiusTemp = GenTemperature.AverageTemperatureAtTileForTwelfth(selTileID, Season.Winter.GetMiddleTwelfth(y));

            listing_Standard.LabelDouble("AvgWinterTemp".Translate(), celsiusTemp.ToStringTemperature("F1"));
            float celsiusTemp2 = GenTemperature.AverageTemperatureAtTileForTwelfth(selTileID, Season.Summer.GetMiddleTwelfth(y));

            listing_Standard.LabelDouble("AvgSummerTemp".Translate(), celsiusTemp2.ToStringTemperature("F1"));
            listing_Standard.LabelDouble("OutdoorGrowingPeriod".Translate(), Zone_Growing.GrowingQuadrumsDescription(selTileID));
            listing_Standard.LabelDouble("Rainfall".Translate(), selTile.rainfall.ToString("F0") + "mm");
            listing_Standard.LabelDouble("AnimalsCanGrazeNow".Translate(), (!VirtualPlantsUtility.EnvironmentAllowsEatingVirtualPlantsNowAt(selTileID)) ? "No".Translate() : "Yes".Translate());
            listing_Standard.GapLine(12f);
            listing_Standard.LabelDouble("AverageDiseaseFrequency".Translate(), string.Format("{0} {1}", ((float)(60.0 / selTile.biome.diseaseMtbDays)).ToString("F1"), "PerYear".Translate()));
            Listing_Standard listing_Standard3 = listing_Standard;
            string           leftLabel2        = "TimeZone".Translate();
            Vector2          vector2           = Find.WorldGrid.LongLatOf(selTileID);

            listing_Standard3.LabelDouble(leftLabel2, GenDate.TimeZoneAt(vector2.x).ToStringWithSign());
            StringBuilder stringBuilder = new StringBuilder();
            Rot4          rot           = Find.World.CoastDirectionAt(selTileID);

            if (rot.IsValid)
            {
                stringBuilder.AppendWithComma(("HasCoast" + rot.ToString()).Translate());
            }
            if (Find.World.HasCaves(selTileID))
            {
                stringBuilder.AppendWithComma("HasCaves".Translate());
            }
            if (stringBuilder.Length > 0)
            {
                listing_Standard.LabelDouble("SpecialFeatures".Translate(), stringBuilder.ToString().CapitalizeFirst());
            }
            if (Prefs.DevMode)
            {
                listing_Standard.LabelDouble("Debug world tile ID", selTileID.ToString());
            }
            listing_Standard.End();
        }
        public override void DoWindowContents(Rect inRect)
        {
            Listing_Standard listing = new Listing_Standard();

            listing.Begin(inRect);

            Text.Font = GameFont.Medium;
            listing.Label("<color=#4BB543>HodlBot</color> Settings");
            Text.Font = GameFont.Small;

            listing.Gap();

            listing.GapLine();

            listing.Label("HodlBot chooses events from a random category or type. The chance of one of these categories/types being picked is based on weights below. Setting to 0% disables it.");

            listing.Gap();

            string hodlbotMTBDays = Math.Truncate(((double)ToolkitSettings.HodlBotMTBDays * 100) / 100).ToString();

            listing.TextFieldNumericLabeled <float>("Average Days Between Events", ref ToolkitSettings.HodlBotMTBDays, ref hodlbotMTBDays, 0.5f, 10f);

            listing.Gap();

            if (listing.ButtonTextLabeled("Default HodlBot Weights", "Reset Weights"))
            {
                Settings_Storyteller.NewVoteCategoryWeightsHodlBot();
                Settings_Storyteller.NewVoteTypeWeightsHodlBot();
            }

            listing.Gap();

            listing.Label("Random Category Weights");

            listing.Gap();

            List <string> VoteCategoryList      = ToolkitSettings.VoteCategoryWeights.Keys.ToList();
            List <float>  VoteCategoryFloatList = ToolkitSettings.VoteCategoryWeights.Values.ToList();

            for (int i = 0; i < VoteCategoryList.Count(); i++)
            {
                string buffer   = VoteCategoryFloatList[i].ToString();
                float  newValue = VoteCategoryFloatList[i];
                listing.TextFieldNumericLabeled <float>(VoteCategoryList[i] + " - ", ref newValue, ref buffer);

                ToolkitSettings.VoteCategoryWeights[VoteCategoryList[i]] = newValue;
            }

            listing.Gap();

            listing.Label("Random Type Weights");

            listing.Gap();

            List <string> VoteTypeList      = ToolkitSettings.VoteTypeWeights.Keys.ToList();
            List <float>  VoteTypeFloatList = ToolkitSettings.VoteTypeWeights.Values.ToList();

            for (int i = 0; i < VoteTypeList.Count(); i++)
            {
                string buffer   = VoteTypeFloatList[i].ToString();
                float  newValue = VoteTypeFloatList[i];
                listing.TextFieldNumericLabeled <float>(VoteTypeList[i] + " - ", ref newValue, ref buffer);

                ToolkitSettings.VoteTypeWeights[VoteTypeList[i]] = newValue;
            }

            listing.End();
        }
Exemplo n.º 13
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            var leftRect  = new Rect(inRect.x, inRect.y, inRect.width * 0.65f, inRect.height);
            var rightRect = new Rect(inRect.x + inRect.width * 0.65f + 30f, inRect.y, inRect.width * 0.35f - 30f,
                                     inRect.height);

            var listing_options = new Listing_Standard();

            listing_options.Begin(leftRect);

            listing_options.CheckboxLabeled("PrisonLabor_ShowNews".Translate(), ref showNews,
                                            "PrisonLabor_ShowNewsDesc".Translate());

            listing_options.GapLine();

            if (listing_options.ButtonTextLabeled("PrisonLabor_DefaultInterMode".Translate(), interactionModeList[defaultInteractionMode].LabelCap))
            {
                defaultInteractionMode = defaultInteractionMode < interactionModeList.Count - 1 ? defaultInteractionMode + 1 : 0;
            }

            listing_options.GapLine();

            if (!disableMod)
            {
                listing_options.Label("PrisonLabor_AllowedWorkTypes".Translate(), -1f);
                listing_options.CheckboxLabeled("   " + "PrisonLabor_AllowAll".Translate(), ref allowAllWorktypes, "PrisonLabor_AllowAllWorkTypes".Translate());
                if (!allowAllWorktypes)
                {
                    if (listing_options.ButtonTextLabeled("   " + "PrisonLabor_AllowedWorkTypesL".Translate(), "PrisonLabor_Browse".Translate()))
                    {
                        Find.WindowStack.Add(new SelectWorkTypesDialog());
                    }
                }
                else
                {
                    listing_options.Gap();
                }

                listing_options.GapLine();

                listing_options.CheckboxLabeled("PrisonLabor_MotivationMechanics".Translate(), ref enableMotivationMechanics,
                                                "PrisonLabor_MotivationWarning".Translate());

                listing_options.GapLine();

                listing_options.CheckboxLabeled("PrisonLabor_MotivationIcons".Translate(), ref enableMotivationIcons,
                                                "PrisonLabor_MotivationIconsDesc".Translate());

                listing_options.GapLine();

                listing_options.CheckboxLabeled("PrisonLabor_CanGrowAdvanced".Translate(), ref advancedGrowing,
                                                "PrisonLabor_CanGrowAdvancedDesc".Translate());
            }
            else
            {
                listing_options.Gap();
                listing_options.Gap();
                listing_options.Label("PrisonLabor_RestartInfo".Translate(), -1f);
                listing_options.Label("PrisonLabor_RestartInfo2".Translate(), -1f);
                listing_options.Gap();
                listing_options.Gap();
                listing_options.Gap();
            }

            listing_options.Gap();
            listing_options.Gap();
            listing_options.Gap();

            listing_options.CheckboxLabeled("PrisonLabor_DisableMod".Translate(), ref disableMod,
                                            "PrisonLabor_DisableModDesc".Translate());

            listing_options.End();

            var listing_panel = new Listing_Standard();

            listing_panel.Begin(rightRect);

            var heigh_temp = rightRect.width * 0.56f;

            GUI.DrawTexture(new Rect(0, 0, rightRect.width, heigh_temp), ContentFinder <Texture2D> .Get("Preview", true));
            listing_panel.Gap(heigh_temp);
            listing_panel.Label("Prison Labor", -1f);
            listing_panel.Label("PrisonLabor_Version".Translate() + VersionUtility.versionString, -1f);

            listing_panel.GapLine();

            listing_panel.Label("PrisonLabor_Difficulty".Translate() + difficulty, -1f);

            listing_panel.GapLine();

            if (listing_panel.ButtonText("PrisonLabor_Defaults".Translate()))
            {
                PrisonLaborPrefs.RestoreToDefault();
                Init();
            }

            if (listing_panel.ButtonText("PrisonLabor_ShowNews".Translate()))
            {
                NewsDialog.showAll = true;
                NewsDialog.ForceShow();
            }

            listing_panel.End();

            Apply();
        }
Exemplo n.º 14
0
        public override void DoWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Medium;
            Rect rect = new Rect(0f, 0f, 400f, 50f);

            Widgets.Label(rect, bill.LabelCap);
            float   num           = (float)(int)((inRect.width - 34f) / 3f);
            Rect    rect2         = new Rect(0f, 80f, num, inRect.height - 80f);
            float   x             = rect2.xMax + 17f;
            float   width         = num;
            float   num2          = inRect.height - 50f;
            Vector2 closeButSize  = CloseButSize;
            Rect    rect3         = new Rect(x, 50f, width, num2 - closeButSize.y);
            float   x2            = rect3.xMax + 17f;
            float   num3          = inRect.height - 50f;
            Vector2 closeButSize2 = CloseButSize;
            Rect    rect4         = new Rect(x2, 50f, 0f, num3 - closeButSize2.y);

            rect4.xMax = inRect.xMax;
            Text.Font  = GameFont.Small;
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.Begin(rect3);
            Listing_Standard listing_Standard2 = listing_Standard.BeginSection((float)RepeatModeSubdialogHeight);

            if (listing_Standard2.ButtonText(bill.repeatMode.LabelCap))
            {
                BillRepeatModeUtility.MakeConfigFloatMenu(bill);
            }
            listing_Standard2.Gap();
            if (bill.repeatMode == BillRepeatModeDefOf.RepeatCount)
            {
                listing_Standard2.Label("RepeatCount".Translate(bill.repeatCount));
                listing_Standard2.IntEntry(ref bill.repeatCount, ref repeatCountEditBuffer);
            }
            else if (bill.repeatMode == BillRepeatModeDefOf.TargetCount)
            {
                string arg = "CurrentlyHave".Translate() + ": ";
                arg += bill.recipe.WorkerCounter.CountProducts(bill);
                arg += " / ";
                arg += ((bill.targetCount >= 999999) ? "Infinite".Translate().ToLower() : bill.targetCount.ToString());
                string str = bill.recipe.WorkerCounter.ProductsDescription(bill);
                if (!str.NullOrEmpty())
                {
                    string text = arg;
                    arg = text + "\n" + "CountingProducts".Translate() + ": " + str.CapitalizeFirst();
                }
                listing_Standard2.Label(arg);
                int targetCount = bill.targetCount;
                listing_Standard2.IntEntry(ref bill.targetCount, ref targetCountEditBuffer, bill.recipe.targetCountAdjustment);
                bill.unpauseWhenYouHave = Mathf.Max(0, bill.unpauseWhenYouHave + (bill.targetCount - targetCount));
                ThingDef producedThingDef = bill.recipe.ProducedThingDef;
                if (producedThingDef != null)
                {
                    if (producedThingDef.IsWeapon || producedThingDef.IsApparel)
                    {
                        listing_Standard2.CheckboxLabeled("IncludeEquipped".Translate(), ref bill.includeEquipped);
                    }
                    if (producedThingDef.IsApparel && producedThingDef.apparel.careIfWornByCorpse)
                    {
                        listing_Standard2.CheckboxLabeled("IncludeTainted".Translate(), ref bill.includeTainted);
                    }
                    Widgets.Dropdown(listing_Standard2.GetRect(30f), bill, (Bill_Production b) => b.includeFromZone, (Bill_Production b) => GenerateStockpileInclusion(), (bill.includeFromZone != null) ? "IncludeSpecific".Translate(bill.includeFromZone.label) : "IncludeFromAll".Translate());
                    Widgets.FloatRange(listing_Standard2.GetRect(28f), 975643279, ref bill.hpRange, 0f, 1f, "HitPoints", ToStringStyle.PercentZero);
                    if (producedThingDef.HasComp(typeof(CompQuality)))
                    {
                        Widgets.QualityRange(listing_Standard2.GetRect(28f), 1098906561, ref bill.qualityRange);
                    }
                    if (producedThingDef.MadeFromStuff)
                    {
                        listing_Standard2.CheckboxLabeled("LimitToAllowedStuff".Translate(), ref bill.limitToAllowedStuff);
                    }
                }
            }
            if (bill.repeatMode == BillRepeatModeDefOf.TargetCount)
            {
                listing_Standard2.CheckboxLabeled("PauseWhenSatisfied".Translate(), ref bill.pauseWhenSatisfied);
                if (bill.pauseWhenSatisfied)
                {
                    listing_Standard2.Label("UnpauseWhenYouHave".Translate() + ": " + bill.unpauseWhenYouHave.ToString("F0"));
                    listing_Standard2.IntEntry(ref bill.unpauseWhenYouHave, ref unpauseCountEditBuffer, bill.recipe.targetCountAdjustment);
                    if (bill.unpauseWhenYouHave >= bill.targetCount)
                    {
                        bill.unpauseWhenYouHave = bill.targetCount - 1;
                        unpauseCountEditBuffer  = bill.unpauseWhenYouHave.ToStringCached();
                    }
                }
            }
            listing_Standard.EndSection(listing_Standard2);
            listing_Standard.Gap();
            Listing_Standard listing_Standard3 = listing_Standard.BeginSection((float)StoreModeSubdialogHeight);
            string           text2             = string.Format(bill.GetStoreMode().LabelCap, (bill.GetStoreZone() == null) ? string.Empty : bill.GetStoreZone().SlotYielderLabel());

            if (bill.GetStoreZone() != null && !bill.recipe.WorkerCounter.CanPossiblyStoreInStockpile(bill, bill.GetStoreZone()))
            {
                text2    += string.Format(" ({0})", "IncompatibleLower".Translate());
                Text.Font = GameFont.Tiny;
            }
            if (listing_Standard3.ButtonText(text2))
            {
                Text.Font = GameFont.Small;
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                foreach (BillStoreModeDef item in from bsm in DefDatabase <BillStoreModeDef> .AllDefs
                         orderby bsm.listOrder
                         select bsm)
                {
                    if (item == BillStoreModeDefOf.SpecificStockpile)
                    {
                        List <SlotGroup> allGroupsListInPriorityOrder = bill.billStack.billGiver.Map.haulDestinationManager.AllGroupsListInPriorityOrder;
                        int count = allGroupsListInPriorityOrder.Count;
                        for (int i = 0; i < count; i++)
                        {
                            SlotGroup      group          = allGroupsListInPriorityOrder[i];
                            Zone_Stockpile zone_Stockpile = group.parent as Zone_Stockpile;
                            if (zone_Stockpile != null)
                            {
                                if (!bill.recipe.WorkerCounter.CanPossiblyStoreInStockpile(bill, zone_Stockpile))
                                {
                                    list.Add(new FloatMenuOption(string.Format("{0} ({1})", string.Format(item.LabelCap, group.parent.SlotYielderLabel()), "IncompatibleLower".Translate()), null));
                                }
                                else
                                {
                                    list.Add(new FloatMenuOption(string.Format(item.LabelCap, group.parent.SlotYielderLabel()), delegate
                                    {
                                        bill.SetStoreMode(BillStoreModeDefOf.SpecificStockpile, (Zone_Stockpile)group.parent);
                                    }));
                                }
                            }
                        }
                    }
                    else
                    {
                        BillStoreModeDef smLocal = item;
                        list.Add(new FloatMenuOption(smLocal.LabelCap, delegate
                        {
                            bill.SetStoreMode(smLocal);
                        }));
                    }
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
            Text.Font = GameFont.Small;
            listing_Standard.EndSection(listing_Standard3);
            listing_Standard.Gap();
            Listing_Standard listing_Standard4 = listing_Standard.BeginSection((float)WorkerSelectionSubdialogHeight);

            Widgets.Dropdown(listing_Standard4.GetRect(30f), bill, (Bill_Production b) => b.pawnRestriction, (Bill_Production b) => GeneratePawnRestrictionOptions(), (bill.pawnRestriction != null) ? bill.pawnRestriction.LabelShortCap : "AnyWorker".Translate());
            if (bill.pawnRestriction == null && bill.recipe.workSkill != null)
            {
                listing_Standard4.Label("AllowedSkillRange".Translate(bill.recipe.workSkill.label));
                listing_Standard4.IntRange(ref bill.allowedSkillRange, 0, 20);
            }
            listing_Standard.EndSection(listing_Standard4);
            listing_Standard.End();
            Rect rect5 = rect4;

            rect5.yMin = rect5.yMax - (float)IngredientRadiusSubdialogHeight;
            rect4.yMax = rect5.yMin - 17f;
            bool                         flag                          = bill.GetStoreZone() == null || bill.recipe.WorkerCounter.CanPossiblyStoreInStockpile(bill, bill.GetStoreZone());
            Rect                         rect6                         = rect4;
            ref Vector2                  scrollPosition                = ref thingFilterScrollPosition;
        protected override void FillTab()
        {
            var compPrisoner = this.SelPawn.TryGetComp<CompPrisoner>();
            if( compPrisoner == null )
            {
                throw new Exception( "ITab_Pawn_Prisoner on non-human!" );
            }

            bool isSlave = this.SelPawn.IsSlaveOfColony();
            bool isColonist = (
                ( !this.SelPawn.IsPrisonerOfColony )&&
                ( compPrisoner.wasArrested )
            );

            ConceptDatabase.KnowledgeDemonstrated( ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame );
            Text.Font = GameFont.Small;
            var iTabInnerRect = new Rect( 0.0f, 0.0f, this.size.x, 9999f ).ContractedBy( innerBorder );

            var iTabListing = new Listing_Standard( iTabInnerRect );
            {

                #region Debug
                // Window will automagically grow in height if needed
                if( Prefs.DevMode )
                {
                    var textFont = Text.Font;
                    Text.Font = GameFont.Tiny;
                    var devRect = iTabListing.GetRect( ( isColonist ? 4f : isSlave ? 5f : 6f ) * 16f );
                    devRect.height = 20f;
                    Widgets.Label( devRect, "Debug Info:" );
                    devRect.y += 16f;
                    if( !isColonist )
                    {
                        Widgets.Label( devRect, string.Format( "MTB Prison break (days): {0}", (int) PrisonBreakUtility.InitiatePrisonBreakMtbDays( this.SelPawn ) ) );
                        devRect.y += 16f;
                        Widgets.Label( devRect, string.Format( "Odds of escape attempt: {0}", (int) ( 100f * this.SelPawn.EscapeProbability() ) ) );
                        devRect.y += 16f;
                        Widgets.Label( devRect, string.Format( "Mood: {0}", (int) ( 100f * this.SelPawn.needs.mood.CurLevel ) ) );
                        devRect.y += 16f;
                        Widgets.Label( devRect, string.Format( "Sight (actual/thought): {0}/{1}", this.SelPawn.CanBeSeenByColony(), this.SelPawn.ThinksTheyCanBeSeenByColony() ) );
                        devRect.y += 16f;
                    }
                    else
                    {
                        Widgets.Label( devRect, string.Format( "wasArrested/Release: {0}", compPrisoner.wasArrested) );
                        devRect.y += 16f;
                        Widgets.Label( devRect, string.Format( "Release/Current: {0}/{1}", compPrisoner.releaseAfterTick, Find.TickManager.TicksGame ) );
                        devRect.y += 16f;
                    }

                    #region Prisoner Recruitment Difficulty
                    if( !isSlave )
                    {
                        Widgets.Label( devRect, Data.Strings.RecruitmentDifficulty.Translate() + ": " + this.SelPawn.RecruitDifficulty( Faction.OfPlayer, false ).ToString( "##0" ) );
                        devRect.y += 16f;
                    }
                    #endregion

                    Text.Font = textFont;
                    Widgets.DrawLineHorizontal( 0f, iTabListing.CurHeight, iTabListing.ColumnWidth );
                    iTabListing.Gap( innerBorder );
                }
                #endregion

                #region Original Slave Faction and Role
                if( isSlave )
                {
                    var textFont = Text.Font;
                    Text.Font = GameFont.Tiny;
                    iTabListing.Label( Data.Strings.FactionLabel.Translate( compPrisoner.originalFaction.Name ) );
                    iTabListing.Label( Data.Strings.PawnKindLabel.Translate( compPrisoner.originalPawnKind.LabelCap ) );
                    Text.Font = textFont;
                }
                #endregion

                #region Prisoner/Slave Interaction Options
                if( !isColonist )
                {
                    var interactionsRect = iTabListing.GetRect( innerBorder * 2f + 28f * ( isSlave ? 4 : 6 ) );
                    Widgets.DrawMenuSection( interactionsRect, true );
                    var interactionsInnerRect = interactionsRect.ContractedBy( innerBorder );
                    GUI.BeginGroup( interactionsInnerRect );
                    {
                        var optionRect = new Rect( 0.0f, 0.0f, interactionsInnerRect.width, 30f );

                        #region Core Options
                        foreach( PrisonerInteractionMode mode in Enum.GetValues( typeof( PrisonerInteractionMode ) ) )
                        {
                            // Can't recruit slaves and they have their own release mechanism
                            bool showThis = (
                                ( !isSlave ) ||
                                (
                                    ( mode != PrisonerInteractionMode.AttemptRecruit ) &&
                                    ( mode != PrisonerInteractionMode.Release )
                                )
                            );
                            if( showThis )
                            {
                                if( Widgets.RadioButtonLabeled( optionRect, mode.GetLabel(), this.SelPawn.guest.interactionMode == mode ) )
                                {
                                    this.SelPawn.guest.interactionMode = mode;
                                }
                                optionRect.y += 28f;
                            }
                        }
                        #endregion

                        #region Prisoner Specific Options
                        if( !isSlave )
                        {
                            // Enslave prisoner
                            if( Widgets.RadioButtonLabeled( optionRect, Data.Strings.Enslave.Translate(), this.SelPawn.guest.interactionMode == Data.PIM.EnslavePrisoner ) )
                            {
                                this.SelPawn.guest.interactionMode = Data.PIM.EnslavePrisoner;
                            }
                            optionRect.y += 28f;
                        }
                        #endregion

                        #region Slave Specific Options
                        if( isSlave )
                        {
                            // Free slave
                            if( Widgets.RadioButtonLabeled( optionRect, Data.Strings.FreeSlave.Translate(), this.SelPawn.guest.interactionMode == Data.PIM.FreeSlave ) )
                            {
                                this.SelPawn.guest.interactionMode = Data.PIM.FreeSlave;
                            }
                            optionRect.y += 28f;
                        }
                        #endregion

                    }
                    GUI.EndGroup();
                    iTabListing.Gap( innerBorder );
                }
                #endregion

                #region Transer Pawn
                if( !isColonist )
                {

                    #region [Cancel] Transfer Button
                    var transferOrCancelRect = iTabListing.GetRect( 30f );

                    #region Transfer to a valid Marker or Prison Cell

                    if( !compPrisoner.ShouldBeTransfered )
                    {
                        if( Widgets.ButtonText( transferOrCancelRect, Data.Strings.TransferPrisoner.Translate() ) )
                        {
                            var floatMenuOptions = this.TransferTargetFloatMenuOptions();
                            if(
                                ( floatMenuOptions.Count == 0 ) ||
                                (
                                    ( floatMenuOptions.Count == 1 ) &&
                                    ( floatMenuOptions[ 0 ].Label == Data.Strings.PrisonCell.Translate() ) &&
                                    ( this.SelPawn.GetRoom() == this.SelPawn.ownership.OwnedBed.GetRoom() )
                                )
                            )
                            {
                                floatMenuOptions.Add( new FloatMenuOption( Data.Strings.InstallMarker.Translate(), (Action) null ) );
                            }
                            Find.WindowStack.Add( (Window) new FloatMenu( floatMenuOptions ) );
                        }
                        else
                        {
                            this.cachedMarkers = null;
                        }
                    }
                    #endregion

                    #region Cancel Transfer

                    if( compPrisoner.ShouldBeTransfered )
                    {
                        if( Widgets.ButtonText( transferOrCancelRect, Data.Strings.CancelTransfer.Translate() ) )
                        {
                            compPrisoner.haulTarget = null;
                        }
                    }

                    #endregion

                    iTabListing.Gap( innerBorder );
                    #endregion

                    #region Transfer Target

                    var transferTargetRect = iTabListing.GetRect( 30f );
                    var style = new GUIStyle( Text.CurTextFieldStyle );
                    style.alignment = TextAnchor.MiddleCenter;

                    string label = string.Empty;
                    if( compPrisoner.haulTarget != null )
                    {
                        if( compPrisoner.haulTarget is Building_RoomMarker )
                        {
                            label = ( (Building_RoomMarker) compPrisoner.haulTarget ).markerName;
                        }
                        else if( compPrisoner.haulTarget is Building_Bed )
                        {
                            label = Data.Strings.PrisonCell.Translate();
                        }
                    }
                    GUI.Label( transferTargetRect, label, style );
                    iTabListing.Gap( innerBorder );
                    #endregion

                    #region Restraints
                    var restraintsRect = iTabListing.GetRect( innerBorder * 2f + 28f * 2f );
                    Widgets.DrawMenuSection( restraintsRect, true );
                    var restraintsInnerRect = restraintsRect.ContractedBy( innerBorder );
                    GUI.BeginGroup( restraintsInnerRect );
                    {
                        var restrainRect = new Rect( 0.0f, 0.0f, restraintsInnerRect.width, 30f );

                        Widgets.CheckboxLabeled( restrainRect, Data.Strings.RestrainCuff.Translate(), ref compPrisoner.ShouldBeCuffed );
                        restrainRect.y += 28f;

                        Widgets.CheckboxLabeled( restrainRect, Data.Strings.RestrainShackle.Translate(), ref compPrisoner.ShouldBeShackled );
                        restrainRect.y += 28f;
                    }
                    GUI.EndGroup();
                    #endregion

                }
                #endregion

                #region Food
                if( !isColonist )
                {
                    var getsFood = this.SelPawn.guest.GetsFood;
                    iTabListing.CheckboxLabeled( Data.Strings.GetsFood.Translate(), ref getsFood, (string) null );
                    this.SelPawn.guest.GetsFood = getsFood;
                }
                #endregion

                #region Medicine
                if( !isColonist )
                {
                    var medicalCareRect = iTabListing.GetRect( 28f );
                    medicalCareRect.width = MedicalCareUtility.CareSetterWidth;
                    MedicalCareUtility.MedicalCareSetter( medicalCareRect, ref this.SelPawn.playerSettings.medCare );
                }
                #endregion

            }
            iTabListing.End();
            tabHeight = iTabListing.CurHeight;
        }
Exemplo n.º 16
0
        protected override void FillWindow(UnityEngine.Rect inRect)
        {
            if (optionsDialog == null) return;
            //base.FillWindow(inRect);

            Rect optionsRect = optionsDialog.winRect;
            this.winRect = new Rect(optionsRect.xMax - 240, optionsRect.yMin, 240, optionsRect.height);
            Listing_Standard listing = new Listing_Standard(inRect);

            DoHeading(listing, "Pawn State Icons", false);

            listing.OverrideColumnWidth = this.winRect.width;

            //if (page == "main") fillPageMain(listing);
            if (page == "showhide") fillPageShowHide(listing);
            else if (page == "arrange") fillPageArrangement(listing);
            else if (page == "limits") fillPageLimits(listing);
            else fillPageMain(listing);
                
            listing.End();
        }
        public override void DoWindowContents(Rect inRect)
        {
            const float  categoryPadding      = 10f;
            const float  categoryInset        = 30f;
            const float  radioLabelInset      = 40f;
            const float  mainListingSpacing   = 6f;
            const float  subListingSpacing    = 6f;
            const float  subListingLabelWidth = 100f;
            const float  subListingRowHeight  = 30f;
            const float  checkboxListingWidth = 280f;
            const float  listingColumnSpacing = 17f;
            const string shiftTip             = "Hold Shift while starting up to prevent the quickstart.";
            var          settings             = QuickstartController.Settings;
            var          mainListing          = new Listing_Standard();

            mainListing.verticalSpacing = mainListingSpacing;
            mainListing.Begin(inRect);
            Text.Font = GameFont.Medium;
            mainListing.Label("Quickstart settings");
            Text.Font = GameFont.Small;
            mainListing.GapLine();
            mainListing.Gap();
            OperationModeRadioButton(mainListing, radioLabelInset, "Quickstart off", settings, QuickstartSettings.QuickstartMode.Disabled,
                                     "Quickstart functionality is disabled.\nThe game starts normally.");
            OperationModeRadioButton(mainListing, radioLabelInset, "Quickstart: load save file", settings, QuickstartSettings.QuickstartMode.LoadMap,
                                     "Load the selected saved game right after launch.\n" + shiftTip);
            var expectedHeight = categoryPadding * 2 + (subListingRowHeight + subListingSpacing) * 1;

            MakeSubListing(mainListing, 0, expectedHeight, categoryPadding, categoryInset, subListingSpacing, (sub, width) => {
                sub.ColumnWidth = subListingLabelWidth;
                Text.Anchor     = TextAnchor.MiddleLeft;
                var rect        = sub.GetRect(subListingRowHeight);
                Widgets.Label(rect, "Save file:");
                Text.Anchor = TextAnchor.UpperLeft;
                sub.NewColumn();
                sub.ColumnWidth = width - subListingLabelWidth - listingColumnSpacing;
                MakeSelectSaveButton(sub, settings);
            });
            OperationModeRadioButton(mainListing, radioLabelInset, "Quickstart: generate map", settings, QuickstartSettings.QuickstartMode.GenerateMap,
                                     "Generate a new map right after launch.\nWorks the same as using the \"quicktest\" command line option.\n" + shiftTip);
            expectedHeight = categoryPadding * 2 + (subListingRowHeight + subListingSpacing) * 2;
            MakeSubListing(mainListing, 0, expectedHeight, categoryPadding, categoryInset, subListingSpacing, (sub, width) => {
                sub.ColumnWidth = subListingLabelWidth;
                Text.Anchor     = TextAnchor.MiddleLeft;
                var rect        = sub.GetRect(subListingRowHeight);
                Widgets.Label(rect, "Scenario:");
                rect = sub.GetRect(subListingRowHeight);
                Widgets.Label(rect, "Map size:");
                Text.Anchor = TextAnchor.UpperLeft;
                sub.NewColumn();
                sub.ColumnWidth = width - subListingLabelWidth - listingColumnSpacing;
                MakeSelectScenarioButton(sub, settings);
                MakeSelectMapSizeButton(sub, settings);
            });
            expectedHeight = categoryPadding * 2 + (subListingRowHeight + subListingSpacing) * 3;
            MakeSubListing(mainListing, checkboxListingWidth, expectedHeight, categoryPadding, 0f, subListingSpacing, (sub, width) => {
                sub.CheckboxLabeled("Abort quickstart on error", ref settings.StopOnErrors, "Prevent quickstart if errors are detected during startup.");
                sub.CheckboxLabeled("Abort quickstart on warning", ref settings.StopOnWarnings, "Prevent quickstart if warnings are detected during startup.");
                sub.CheckboxLabeled("Ignore version & mod config mismatch", ref settings.BypassSafetyDialog, "Skip the mod config mismatch dialog and load all saved games regardless.");
            });
            mainListing.End();
            Text.Anchor = TextAnchor.UpperLeft;

            var btnSize      = new Vector2(180f, 40f);
            var buttonYStart = inRect.height - btnSize.y;

            if (Widgets.ButtonText(new Rect(inRect.x, buttonYStart, btnSize.x, btnSize.y), "Generate map now"))
            {
                Close();
                QuickstartController.InitateMapGeneration();
            }
            if (Widgets.ButtonText(new Rect(inRect.width - btnSize.x, buttonYStart, btnSize.x, btnSize.y), "Close"))
            {
                Close();
            }
        }
        protected override void FillTab()
        {
            Text.Font = GameFont.Small;
            var columnsNeeded = 1;

            var listingRect = new Rect( 0f, 0f, this.size.x, 9999f ).ContractedBy( GenUI.Gap );
            var listing = new Listing_Standard( listingRect );
            {
                listing.ColumnWidth = Data.DefaultColumnWidth;

                #region Security Header
                listing.Label( Data.Strings.DoorRestrictions.Translate() );
                var curY = listing.CurHeight;
                Widgets.DrawLine( new Vector2( 0f, curY ), new Vector2( Data.DefaultColumnWidth, curY ), Color.white, 1.0f );
                listing.Gap( GenUI.Pad );
                #endregion

                #region Do Comps
                var columnIndex = 0;
                var highestEnforced = HighestPriorityEnforced();
                foreach( var comp in Comps )
                {
                    if( comp.ColumnIndex != columnIndex )
                    {
                        listing.NewColumn();
                        columnIndex = comp.ColumnIndex;
                    }
                    var colNeeds = comp.ColumnIndex + comp.ColumnWidth;
                    if( colNeeds > columnsNeeded )
                    {
                        columnsNeeded = colNeeds;
                    }
                    comp.DrawColumns( listing, defaultHeight - GenUI.Gap * 2f, comp.Priority < highestEnforced );
                }
                #endregion

            }
            listing.End();

            #region Finalize ITab
            var newSize = new Vector2( GenUI.Gap + ( columnsNeeded * Data.DefaultColumnWidth ) + ( ( columnsNeeded - 1 ) * Listing_Standard.ColumnSpacing ) + GenUI.Gap, defaultHeight );
            if( newSize != this.size )
            {
                this.size = newSize;
                this.UpdateSize();
            }
            #endregion
        }
Exemplo n.º 19
0
        public override void DoWindowContents(Rect inRect)
        {
            Rect rect = inRect.AtZero();

            rect.yMax -= 45f;
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.ColumnWidth = (float)((rect.width - 34.0) / 3.0);
            listing_Standard.Begin(rect);
            Text.Font = GameFont.Medium;
            listing_Standard.Label("Audiovisuals".Translate(), -1f);
            Text.Font = GameFont.Small;
            listing_Standard.Gap(12f);
            listing_Standard.Gap(12f);
            listing_Standard.Label("GameVolume".Translate(), -1f);
            Prefs.VolumeGame = listing_Standard.Slider(Prefs.VolumeGame, 0f, 1f);
            listing_Standard.Label("MusicVolume".Translate(), -1f);
            Prefs.VolumeMusic = listing_Standard.Slider(Prefs.VolumeMusic, 0f, 1f);
            listing_Standard.Label("AmbientVolume".Translate(), -1f);
            Prefs.VolumeAmbient = listing_Standard.Slider(Prefs.VolumeAmbient, 0f, 1f);
            if (listing_Standard.ButtonTextLabeled("Resolution".Translate(), Dialog_Options.ResToString(Screen.width, Screen.height)))
            {
                Find.WindowStack.Add(new Dialog_ResolutionPicker());
            }
            bool customCursorEnabled = Prefs.CustomCursorEnabled;

            listing_Standard.CheckboxLabeled("CustomCursor".Translate(), ref customCursorEnabled, null);
            Prefs.CustomCursorEnabled = customCursorEnabled;
            bool fullScreen = Screen.fullScreen;
            bool flag       = fullScreen;

            listing_Standard.CheckboxLabeled("Fullscreen".Translate(), ref fullScreen, null);
            if (fullScreen != flag)
            {
                ResolutionUtility.SafeSetFullscreen(fullScreen);
            }
            listing_Standard.Label("UIScale".Translate(), -1f);
            float[] uIScales = Dialog_Options.UIScales;
            for (int i = 0; i < uIScales.Length; i++)
            {
                float num = uIScales[i];
                if (listing_Standard.RadioButton(num.ToString() + "x", Prefs.UIScale == num, 8f))
                {
                    if (!ResolutionUtility.UIScaleSafeWithResolution(num, Screen.width, Screen.height))
                    {
                        Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput);
                    }
                    else
                    {
                        ResolutionUtility.SafeSetUIScale(num);
                    }
                }
            }
            listing_Standard.Gap(12f);
            bool hatsOnlyOnMap = Prefs.HatsOnlyOnMap;

            listing_Standard.CheckboxLabeled("HatsShownOnlyOnMap".Translate(), ref hatsOnlyOnMap, null);
            if (hatsOnlyOnMap != Prefs.HatsOnlyOnMap)
            {
                PortraitsCache.Clear();
            }
            Prefs.HatsOnlyOnMap = hatsOnlyOnMap;
            listing_Standard.NewColumn();
            Text.Font = GameFont.Medium;
            listing_Standard.Label("Gameplay".Translate(), -1f);
            Text.Font = GameFont.Small;
            listing_Standard.Gap(12f);
            listing_Standard.Gap(12f);
            if (listing_Standard.ButtonText("KeyboardConfig".Translate(), null))
            {
                Find.WindowStack.Add(new Dialog_KeyBindings());
            }
            if (listing_Standard.ButtonText("ChooseLanguage".Translate(), null))
            {
                if (Current.ProgramState == ProgramState.Playing)
                {
                    Messages.Message("ChangeLanguageFromMainMenu".Translate(), MessageTypeDefOf.RejectInput);
                }
                else
                {
                    List <FloatMenuOption> list = new List <FloatMenuOption>();
                    foreach (LoadedLanguage allLoadedLanguage in LanguageDatabase.AllLoadedLanguages)
                    {
                        LoadedLanguage localLang = allLoadedLanguage;
                        list.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate
                        {
                            LanguageDatabase.SelectLanguage(localLang);
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                    Find.WindowStack.Add(new FloatMenu(list));
                }
            }
            if ((Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) && listing_Standard.ButtonText("OpenSaveGameDataFolder".Translate(), null))
            {
                Application.OpenURL(GenFilePaths.SaveDataFolderPath);
            }
            bool adaptiveTrainingEnabled = Prefs.AdaptiveTrainingEnabled;

            listing_Standard.CheckboxLabeled("LearningHelper".Translate(), ref adaptiveTrainingEnabled, null);
            Prefs.AdaptiveTrainingEnabled = adaptiveTrainingEnabled;
            if (listing_Standard.ButtonText("ResetAdaptiveTutor".Translate(), null))
            {
                Messages.Message("AdaptiveTutorIsReset".Translate(), MessageTypeDefOf.TaskCompletion);
                PlayerKnowledgeDatabase.ResetPersistent();
            }
            bool runInBackground = Prefs.RunInBackground;

            listing_Standard.CheckboxLabeled("RunInBackground".Translate(), ref runInBackground, null);
            Prefs.RunInBackground = runInBackground;
            bool edgeScreenScroll = Prefs.EdgeScreenScroll;

            listing_Standard.CheckboxLabeled("EdgeScreenScroll".Translate(), ref edgeScreenScroll, null);
            Prefs.EdgeScreenScroll = edgeScreenScroll;
            bool pauseOnLoad = Prefs.PauseOnLoad;

            listing_Standard.CheckboxLabeled("PauseOnLoad".Translate(), ref pauseOnLoad, null);
            Prefs.PauseOnLoad = pauseOnLoad;
            bool pauseOnUrgentLetter = Prefs.PauseOnUrgentLetter;

            listing_Standard.CheckboxLabeled("PauseOnUrgentLetter".Translate(), ref pauseOnUrgentLetter, null);
            Prefs.PauseOnUrgentLetter = pauseOnUrgentLetter;
            bool showRealtimeClock = Prefs.ShowRealtimeClock;

            listing_Standard.CheckboxLabeled("ShowRealtimeClock".Translate(), ref showRealtimeClock, null);
            Prefs.ShowRealtimeClock = showRealtimeClock;
            bool plantWindSway = Prefs.PlantWindSway;

            listing_Standard.CheckboxLabeled("PlantWindSway".Translate(), ref plantWindSway, null);
            Prefs.PlantWindSway = plantWindSway;
            int maxNumberOfPlayerHomes = Prefs.MaxNumberOfPlayerHomes;

            listing_Standard.Label("MaxNumberOfPlayerHomes".Translate(maxNumberOfPlayerHomes), -1f);
            int num3 = Prefs.MaxNumberOfPlayerHomes = Mathf.RoundToInt(listing_Standard.Slider((float)maxNumberOfPlayerHomes, 1f, 5f));

            if (maxNumberOfPlayerHomes != num3 && num3 > 1)
            {
                TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.MaxNumberOfPlayerHomes);
            }
            if (listing_Standard.ButtonTextLabeled("TemperatureMode".Translate(), Prefs.TemperatureMode.ToStringHuman()))
            {
                List <FloatMenuOption> list2       = new List <FloatMenuOption>();
                IEnumerator            enumerator2 = Enum.GetValues(typeof(TemperatureDisplayMode)).GetEnumerator();
                try
                {
                    while (enumerator2.MoveNext())
                    {
                        TemperatureDisplayMode temperatureDisplayMode = (TemperatureDisplayMode)enumerator2.Current;
                        TemperatureDisplayMode localTmode             = temperatureDisplayMode;
                        list2.Add(new FloatMenuOption(localTmode.ToString(), delegate
                        {
                            Prefs.TemperatureMode = localTmode;
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator2 as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
                Find.WindowStack.Add(new FloatMenu(list2));
            }
            float  autosaveIntervalDays = Prefs.AutosaveIntervalDays;
            string text  = "Days".Translate();
            string text2 = "Day".Translate().ToLower();

            if (listing_Standard.ButtonTextLabeled("AutosaveInterval".Translate(), autosaveIntervalDays + " " + ((autosaveIntervalDays != 1.0) ? text : text2)))
            {
                List <FloatMenuOption> list3 = new List <FloatMenuOption>();
                if (Prefs.DevMode)
                {
                    list3.Add(new FloatMenuOption("0.125 " + text + "(debug)", delegate
                    {
                        Prefs.AutosaveIntervalDays = 0.125f;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    list3.Add(new FloatMenuOption("0.25 " + text + "(debug)", delegate
                    {
                        Prefs.AutosaveIntervalDays = 0.25f;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                list3.Add(new FloatMenuOption("0.5 " + text + string.Empty, delegate
                {
                    Prefs.AutosaveIntervalDays = 0.5f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                list3.Add(new FloatMenuOption(1.ToString() + " " + text2, delegate
                {
                    Prefs.AutosaveIntervalDays = 1f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                list3.Add(new FloatMenuOption(3.ToString() + " " + text, delegate
                {
                    Prefs.AutosaveIntervalDays = 3f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                list3.Add(new FloatMenuOption(7.ToString() + " " + text, delegate
                {
                    Prefs.AutosaveIntervalDays = 7f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                list3.Add(new FloatMenuOption(14.ToString() + " " + text, delegate
                {
                    Prefs.AutosaveIntervalDays = 14f;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
                Find.WindowStack.Add(new FloatMenu(list3));
            }
            if (Current.ProgramState == ProgramState.Playing && Current.Game.Info.permadeathMode && Prefs.AutosaveIntervalDays > 1.0)
            {
                GUI.color = Color.red;
                listing_Standard.Label("MaxPermadeathAutosaveIntervalInfo".Translate(1f), -1f);
                GUI.color = Color.white;
            }
            if (Current.ProgramState == ProgramState.Playing && listing_Standard.ButtonText("ChangeStoryteller".Translate(), "OptionsButton-ChooseStoryteller") && TutorSystem.AllowAction("ChooseStoryteller"))
            {
                Find.WindowStack.Add(new Page_SelectStorytellerInGame());
            }
            if (listing_Standard.ButtonTextLabeled("ShowAnimalNames".Translate(), Prefs.AnimalNameMode.ToStringHuman()))
            {
                List <FloatMenuOption> list4       = new List <FloatMenuOption>();
                IEnumerator            enumerator3 = Enum.GetValues(typeof(AnimalNameDisplayMode)).GetEnumerator();
                try
                {
                    while (enumerator3.MoveNext())
                    {
                        AnimalNameDisplayMode animalNameDisplayMode = (AnimalNameDisplayMode)enumerator3.Current;
                        AnimalNameDisplayMode localMode             = animalNameDisplayMode;
                        list4.Add(new FloatMenuOption(localMode.ToStringHuman(), delegate
                        {
                            Prefs.AnimalNameMode = localMode;
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                }
                finally
                {
                    IDisposable disposable2;
                    if ((disposable2 = (enumerator3 as IDisposable)) != null)
                    {
                        disposable2.Dispose();
                    }
                }
                Find.WindowStack.Add(new FloatMenu(list4));
            }
            bool devMode = Prefs.DevMode;

            listing_Standard.CheckboxLabeled("DevelopmentMode".Translate(), ref devMode, null);
            Prefs.DevMode = devMode;
            if (Prefs.DevMode)
            {
                bool resetModsConfigOnCrash = Prefs.ResetModsConfigOnCrash;
                listing_Standard.CheckboxLabeled("ResetModsConfigOnCrash".Translate(), ref resetModsConfigOnCrash, null);
                Prefs.ResetModsConfigOnCrash = resetModsConfigOnCrash;
                bool logVerbose = Prefs.LogVerbose;
                listing_Standard.CheckboxLabeled("LogVerbose".Translate(), ref logVerbose, null);
                Prefs.LogVerbose = logVerbose;
            }
            listing_Standard.NewColumn();
            Text.Font = GameFont.Medium;
            listing_Standard.Label(string.Empty, -1f);
            Text.Font = GameFont.Small;
            listing_Standard.Gap(12f);
            listing_Standard.Gap(12f);
            if (listing_Standard.ButtonText("ModSettings".Translate(), null))
            {
                Find.WindowStack.Add(new Dialog_ModSettings());
            }
            listing_Standard.Label(string.Empty, -1f);
            listing_Standard.Label("NamesYouWantToSee".Translate(), -1f);
            Prefs.PreferredNames.RemoveAll(GenText.NullOrEmpty);
            for (int j = 0; j < Prefs.PreferredNames.Count; j++)
            {
                string  name    = Prefs.PreferredNames[j];
                PawnBio pawnBio = (from b in SolidBioDatabase.allBios
                                   where b.name.ToString() == name
                                   select b).FirstOrDefault();
                if (pawnBio == null)
                {
                    name += " [N]";
                }
                else
                {
                    switch (pawnBio.BioType)
                    {
                    case PawnBioType.BackstoryInGame:
                        name += " [B]";
                        break;

                    case PawnBioType.PirateKing:
                        name += " [PK]";
                        break;
                    }
                }
                Rect rect2 = listing_Standard.GetRect(24f);
                Widgets.Label(rect2, name);
                Rect butRect = new Rect((float)(rect2.xMax - 24.0), rect2.y, 24f, 24f);
                if (Widgets.ButtonImage(butRect, TexButton.DeleteX))
                {
                    Prefs.PreferredNames.RemoveAt(j);
                    SoundDefOf.TickLow.PlayOneShotOnCamera(null);
                }
            }
            if (Prefs.PreferredNames.Count < 6 && listing_Standard.ButtonText("AddName".Translate() + "...", null))
            {
                Find.WindowStack.Add(new Dialog_AddPreferredName());
            }
            listing_Standard.End();
        }
Exemplo n.º 20
0
        public void DoWindowContents(Rect rect)
        {
            Listing_Standard options      = new Listing_Standard();
            Color            defaultColor = new Color(100, 65, 164);

            options.Begin(rect);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            GUI.color   = Color.magenta;
            options.Label("TwitchToolkitSettingsTitle".Translate());
            GUI.color   = defaultColor;
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            options.GapLine();
            options.Gap();

            options.ColumnWidth = (rect.width / 3) - 20f;

            // Left column
            if (options.ButtonText("TwitchToolkitChat".Translate()))
            {
                currentTab = SettingsTab.Chat;
            }

            if (options.ButtonText("TwitchToolkitCoins".Translate()))
            {
                currentTab = SettingsTab.Coins;
            }

            if (options.ButtonText("Storyteller"))
            {
                currentTab = SettingsTab.Storyteller;
            }

            if (options.ButtonText("Patches"))
            {
                currentTab = SettingsTab.Patches;
            }

            options.Gap();

            if (options.ButtonText("Wiki"))
            {
                Application.OpenURL("https://github.com/hodldeeznuts/twitchtoolkit/wiki");
            }

            // Middle column
            options.NewColumn();
            options.Gap(53f);

            if (options.ButtonText("TwitchToolkitStore".Translate()))
            {
                currentTab = SettingsTab.Store;
            }

            if (options.ButtonText("TwitchToolkitKarma".Translate()))
            {
                currentTab = SettingsTab.Karma;
            }

            if (options.ButtonText(""))
            {
                currentTab = SettingsTab.Chat;
            }

            if (options.ButtonText("TwitchToolkitCooldowns".Translate()))
            {
                currentTab = SettingsTab.Cooldowns;
            }

            // Right Column
            options.NewColumn();
            options.Gap(53f);

            if (options.ButtonText(""))
            {
                currentTab = SettingsTab.Options;
            }

            if (options.ButtonText("TwitchToolkitViewers".Translate()))
            {
                currentTab = SettingsTab.Viewers;
            }

            if (options.ButtonText(""))
            {
                currentTab = SettingsTab.Integrations;
            }

            if (options.ButtonText(""))
            {
                currentTab = SettingsTab.Votes;
            }

            options.End();

            Listing_Standard gapline   = new Listing_Standard();
            Rect             gapliRect = new Rect(rect.x, rect.y, rect.width, rect.height);

            gapline.Begin(gapliRect);
            gapline.Gap();
            gapline.End();

            Rect optionsRect = rect;

            optionsRect.y      = 145;
            optionsRect.height = 620f;
            optionsRect.yMax   = 765f;

            Rect scrollViewer = new Rect(optionsRect);

            scrollViewer.height -= 145f;
            scrollViewer.yMax   -= 145f;

            Rect viewRect = new Rect(0, 0, rect.width - 125f, 430f);

            if (currentTab == SettingsTab.Chat)
            {
                viewRect.height += 400f;
            }
            if (currentTab == SettingsTab.Storyteller)
            {
                viewRect.height += 400f;
            }
            if (currentTab == SettingsTab.Karma)
            {
                viewRect.height += 250f;
            }
            if (currentTab == SettingsTab.Viewers)
            {
                viewRect.height += 80f;
            }

            Listing_Standard optionsListing = new Listing_Standard();

            optionsListing.Begin(optionsRect);
            optionsListing.BeginScrollView(scrollViewer, ref scrollVector2, ref viewRect);

            switch (currentTab)
            {
            case SettingsTab.Coins:
                Settings_Coins.DoWindowContents(viewRect, optionsListing);
                break;

            case SettingsTab.Storyteller:
                Settings_Storyteller.DoWindowContents(viewRect, optionsListing);
                break;

            case SettingsTab.Patches:
                Settings_Patches.DoWindowContents(viewRect, optionsListing);
                break;

            case SettingsTab.Store:
                Settings_Store.DoWindowContents(viewRect, optionsListing);
                break;

            case SettingsTab.Karma:
                Settings_Karma.DoWindowContents(viewRect, optionsListing);
                break;

            //case SettingsTab.Commands:
            //    Settings_Commands.DoWindowContents(viewRect, optionsListing);
            //    break;
            case SettingsTab.Cooldowns:
                Settings_Cooldowns.DoWindowContents(viewRect, optionsListing);
                break;

            //case SettingsTab.Options:
            //    Settings_Options.DoWindowContents(viewRect, optionsListing);
            //    break;
            case SettingsTab.Viewers:
                Settings_Viewers.DoWindowContents(viewRect, optionsListing);
                break;

            //case SettingsTab.Integrations:
            //    Settings_Integrations.DoWindowContents(viewRect, optionsListing);
            //    break;
            //case SettingsTab.Votes:
            //    Settings_VoteWeights.DoWindowContents(viewRect, optionsListing);
            //    break;
            default:
                Settings_Chat.DoWindowContents(viewRect, optionsListing);
                break;
            }

            optionsListing.EndScrollView(ref viewRect);
            optionsListing.End();
        }
Exemplo n.º 21
0
        public override void DoWindowContents(Rect inRect)
        {
            const float mainListingSpacing = 6f;

            var btnSize      = new Vector2(140f, 40f);
            var buttonYStart = inRect.height - btnSize.y;

            var ev = Event.current;

            if (Widgets.ButtonText(new Rect(0, buttonYStart, btnSize.x, btnSize.y), "OCity_Dialog_CreateWorld_BtnOk".Translate()) ||
                ev.isKey && ev.type == EventType.keyDown && ev.keyCode == KeyCode.Return)
            {
                int ii;
                if (string.IsNullOrEmpty(InputSeed) ||
                    !int.TryParse(InputDifficulty, out ii) || ii < 0 || ii > 2 ||
                    !int.TryParse(InputPlanetCoverage, out ii) || ii < 5 || ii > 100
                    )
                {
                    Find.WindowStack.Add(new Dialog_Message("OCity_Dialog_CreateWorld_Err".Translate(), "OCity_Dialog_CreateWorld_Err2".Translate(), null, null));
                }
                else
                {
                    ResultOK = true;
                    Close();
                }
            }

            if (Widgets.ButtonText(new Rect(inRect.width - btnSize.x, buttonYStart, btnSize.x, btnSize.y), "OCity_Dialog_CreateWorld_BtnCancel".Translate()))
            {
                Close();
            }

            var mainListing = new Listing_Standard();

            mainListing.verticalSpacing = mainListingSpacing;
            mainListing.Begin(inRect);
            Text.Font = GameFont.Medium;
            mainListing.Label(TitleText);

            Text.Font = GameFont.Small;
            mainListing.GapLine();
            mainListing.Gap();

            var textEditSize = new Vector2(150f, 25f);
            var rect         = new Rect(0, 70f, inRect.width, textEditSize.y);

            Widgets.Label(rect, "OCity_Dialog_CreateWorld_Seed".Translate());
            rect.y += textEditSize.y;
            GUI.SetNextControlName("StartTextField");
            InputSeed = GUI.TextField(rect, InputSeed, 100);
            rect.y   += textEditSize.y;

            /*
             * Widgets.Label(rect, "Общее количество осадков");
             * rect.y += textEditSize.y;
             * Input = GUI.TextField(rect, Input, 100);
             * rect.y += textEditSize.y;
             */
            /*
             * Widgets.Label(rect, "Общая темпиратура");
             * rect.y += textEditSize.y;
             * Input = GUI.TextField(rect, Input, 100);
             * rect.y += textEditSize.y;
             */

            Widgets.Label(rect, "OCity_Dialog_CreateWorld_Difficulty".Translate());
            rect.y         += textEditSize.y;
            InputDifficulty = GUI.TextField(rect, InputDifficulty, 1);
            rect.y         += textEditSize.y;

            //это уже не надо, каждый выбирает при старте
            //Widgets.Label(rect, "OCity_Dialog_CreateWorld_MapSize".Translate());
            //rect.y += textEditSize.y;
            //InputMapSize = GUI.TextField(rect, InputMapSize, 3);
            //rect.y += textEditSize.y;

            Widgets.Label(rect, "OCity_Dialog_CreateWorld_PercentWorld".Translate());
            rect.y += textEditSize.y;
            InputPlanetCoverage = GUI.TextField(rect, InputPlanetCoverage, 3);
            rect.y += textEditSize.y;

            if (NeedFockus)
            {
                NeedFockus = false;
                GUI.FocusControl("StartTextField");
            }

            mainListing.End();
        }
Exemplo n.º 22
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            Listing_Standard listing = new Listing_Standard {
                ColumnWidth = inRect.width / 3
            };

            listing.Begin(inRect);
            listing.CheckboxLabeled(UIText.ShowInspiredPawn.TranslateSimple(), ref ModSettings.ShowInspiredPawn);
            listing.CheckboxLabeled(UIText.ShowGuestPawn.TranslateSimple(), ref ModSettings.ShowGuestPawn);
            listing.CheckboxLabeled(UIText.ShowSickPawn.TranslateSimple(), ref ModSettings.ShowSickPawn);
            listing.CheckboxLabeled(UIText.ShowDraftedPawn.TranslateSimple(), ref ModSettings.ShowDraftedPawn);
            listing.CheckboxLabeled(UIText.AutoHide.TranslateSimple(), ref ModSettings.AutoHide);

            listing.GapLine();

            listing.CheckboxLabeled(UIText.SortPawnByBleeding.TranslateSimple(), ref ModSettings.SortBleedingPawn);

            const float lineHeight = GenUI.ListSpacing * 2;

            listing.Gap();
            Draw.IntegerSetting($"{UIText.MoodUpdateInterval.TranslateSimple()}:", listing.GetRect(lineHeight), ref ModSettings.MoodUpdateInterval, tooltip: UIText.TickExplaination.TranslateSimple());

            listing.Gap();
            Draw.IntegerSetting($"{UIText.StatusUpdateInterval.TranslateSimple()}:", listing.GetRect(lineHeight), ref ModSettings.StatusUpdateInterval, tooltip: UIText.TickExplaination.TranslateSimple());

            listing.Gap();
            int seconds = ModSettings.AutoHideButtonTime.Seconds;

            Draw.IntegerSetting($"{UIText.TimeToAutoHide.TranslateSimple()}:", listing.GetRect(lineHeight), ref seconds);
            if (ModSettings.AutoHideButtonTime.Seconds != seconds)
            {
                ModSettings.AutoHideButtonTime = new TimeSpan(0, 0, seconds);
            }

            listing.NewColumn();

            DrawColorOption(listing, MoodLevel.Satisfied);
            DrawColorOption(listing, MoodLevel.Minor);
            DrawColorOption(listing, MoodLevel.Major);
            DrawColorOption(listing, MoodLevel.Extreme);
            if (listing.ButtonText(ModSettings.ShownMoodLevel.ToString()))
            {
                FloatMenuUtility.MakeMenu(
                    Enum.GetValues(typeof(MoodLevel)).Cast <MoodLevel>().Where(e => e != MoodLevel.Undefined)
                    , m => m.ToString()
                    , m => () => ModSettings.ShownMoodLevel = m);
            }

            listing.GapLine();

            DrawColorOption(listing, UIText.BackgroundColor.TranslateSimple(), ModSettings.BgColor, (color) => ModSettings.BgColor = color);
            DrawColorOption(listing, UIText.ThrehsoldMarker.TranslateSimple(), ModSettings.ThresholdMarker, (color) => ModSettings.ThresholdMarker = color);
            DrawColorOption(listing, UIText.CurrMoodLevel.TranslateSimple(), ModSettings.CurrMoodLevel, color => ModSettings.CurrMoodLevel         = color);

            listing.GapLine();
            Draw.IntegerSetting(
                $"{UIText.ThrehsoldMarkerThickness.TranslateSimple()}:"
                , listing.GetRect(lineHeight)
                , ref ModSettings.ThresholdMarkerThickness
                , i => ModSettings.UISettingsChanged = true);

            listing.Gap();
            Draw.IntegerSetting(
                $"{UIText.CurrMoodLevelThickness.TranslateSimple()}:"
                , listing.GetRect(lineHeight)
                , ref ModSettings.CurrMoodLevelThickness
                , i => ModSettings.UISettingsChanged = true);

            int yOffset = Mathf.RoundToInt(ModSettings.YOffset);

            listing.Gap();
            Draw.IntegerSetting(
                $"{UIText.YOffset.TranslateSimple()}:"
                , listing.GetRect(lineHeight)
                , ref yOffset
                , i =>
            {
                ModSettings.YOffset = yOffset;
                Find.ColonistBar.MarkColonistsDirty();
                BCBManager.ModColonistBarDirty = true;
            });

            listing.NewColumn();

            Rect      rowRect   = listing.GetRect(GenUI.ListSpacing);
            WidgetRow widgetRow = new WidgetRow(rowRect.x, rowRect.y, UIDirection.RightThenDown, rowRect.width);

            widgetRow.Label($"{UIText.Hotkey.TranslateSimple()}: ");
            Rect labelRect = widgetRow.Label(
                ModSettings.CtrlKey ? $"Ctrl + {ModSettings.HotKey}"
                                       : $"{ModSettings.HotKey}");

            widgetRow.GapButtonIcon();
            if (widgetRow.ButtonText(UIText.Record.TranslateSimple()))
            {
                _recordingHotkey = true;
            }

            if (_recordingHotkey)
            {
                Widgets.DrawHighlightSelected(labelRect);
                if (Event.current.type == EventType.KeyUp || Event.current.isMouse)
                {
                    ModSettings.CtrlKey = Event.current.control;
                    if (Event.current.keyCode != KeyCode.LeftControl && Event.current.keyCode != KeyCode.RightControl)
                    {
                        ModSettings.HotKey = Event.current.keyCode;
                        _recordingHotkey   = false;
                    }
                    else
                    {
                        ModSettings.HotKey = KeyCode.None;
                    }
                }
            }

            listing.End();
        }
Exemplo n.º 23
0
        public void DoSettingsWindowContents(Rect rect)
        {
            Listing_Standard list = new Listing_Standard(GameFont.Small);

            list.ColumnWidth = rect.width / 3;
            list.Begin(rect);
            list.Gap();
            {
                string buffer      = multiplierPercentage.ToString();
                Rect   rectLine    = list.GetRect(Text.LineHeight);
                Rect   rectLeft    = rectLine.LeftHalf().Rounded();
                Rect   rectRight   = rectLine.RightHalf().Rounded();
                Rect   rectPercent = rectRight.RightPartPixels(Text.LineHeight);
                rectRight = rectRight.LeftPartPixels(rectRight.width - Text.LineHeight);
                Widgets.DrawHighlightIfMouseover(rectLine);
                TooltipHandler.TipRegion(rectLine, "MadSkills_MultiplierTip".Translate());
                TextAnchor anchorBuffer = Text.Anchor;
                Text.Anchor = TextAnchor.MiddleLeft;
                Widgets.Label(rectLeft, "MadSkills_MultiplierLabel".Translate());
                Text.Anchor = anchorBuffer;
                Widgets.TextFieldNumeric(rectRight, ref multiplierPercentage, ref buffer, 0, 10000);
                Widgets.Label(rectPercent, "%");
            }
            list.CheckboxLabeled(
                "MadSkills_TieredLabel".Translate(),
                ref tiered,
                "MadSkills_TieredTip".Translate());
            list.CheckboxLabeled(
                "MadSkills_AlterGreatMemoryLabel".Translate(),
                ref greatMemoryAltered,
                "MadSkills_AlterGreatMemoryTip".Translate());
            list.Gap();
            {
                string buffer    = dailyXPSaturationThreshold.ToString();
                Rect   rectLine  = list.GetRect(Text.LineHeight);
                Rect   rectLeft  = rectLine.LeftHalf().Rounded();
                Rect   rectRight = rectLine.RightHalf().Rounded();
                Widgets.DrawHighlightIfMouseover(rectLine);
                TooltipHandler.TipRegion(rectLine, "MadSkills_DailyXPSaturationThresholdTip".Translate());
                TextAnchor anchorBuffer = Text.Anchor;
                Text.Anchor = TextAnchor.MiddleLeft;
                Widgets.Label(rectLeft, "MadSkills_DailyXPSaturationThresholdLabel".Translate());
                Text.Anchor = anchorBuffer;
                Widgets.TextFieldNumeric(rectRight, ref dailyXPSaturationThreshold, ref buffer, 0, 100000);
            }
            {
                string buffer      = saturatedXPmultiplierPercentage.ToString();
                Rect   rectLine    = list.GetRect(Text.LineHeight);
                Rect   rectLeft    = rectLine.LeftHalf().Rounded();
                Rect   rectRight   = rectLine.RightHalf().Rounded();
                Rect   rectPercent = rectRight.RightPartPixels(Text.LineHeight);
                rectRight = rectRight.LeftPartPixels(rectRight.width - Text.LineHeight);
                Widgets.DrawHighlightIfMouseover(rectLine);
                TooltipHandler.TipRegion(rectLine, "MadSkills_SaturatedXPMultiplierTip".Translate());
                TextAnchor anchorBuffer = Text.Anchor;
                Text.Anchor = TextAnchor.MiddleLeft;
                Widgets.Label(rectLeft, "MadSkills_SaturatedXPMultiplierLabel".Translate());
                Text.Anchor = anchorBuffer;
                Widgets.TextFieldNumeric(rectRight, ref saturatedXPmultiplierPercentage, ref buffer, 0, 10000);
                Widgets.Label(rectPercent, "%");
            }
            list.End();
        }
        /*private static void InitTexturePlant(ThingDef def, string pathPart, int val, bool immature, bool leafless)
         * {
         *  if (val > 0 && def.plant != null)
         *  {
         *      string path = pathPart + "_V" + val;
         *      def.graphicData.texPath = path;
         *      if (immature)
         *      {
         *          Traverse.Create(def.plant).Field("immatureGraphicPath").SetValue(path + "_Immature");
         *      }
         *      if (leafless)
         *      {
         *          Traverse.Create(def.plant).Field("leaflessGraphicPath").SetValue(path + "_Leafless");
         *      }
         *      Traverse.Create(def.graphicData).Method("Init").GetValue();
         *      def.plant.PostLoadSpecial(def);
         *  }
         * }*/

        public void DoWindowContents(Rect rect)
        {
            Listing_Standard ls = new Listing_Standard();

            ls.Begin(rect);
            ls.Gap(GapHeight);
            // Backup original values
            TextAnchor backupAnchor = Text.Anchor;

            Text.Anchor = TextAnchor.MiddleLeft;

            // Item - Meal
            if (ls.ButtonTextLabeled("CTP_Meal".Translate(), ("CTP_Meal_" + valueMeal).Translate()))
            {
                List <FloatMenuOption> menuEntries = new List <FloatMenuOption>();
                menuEntries.Add(new FloatMenuOption(("CTP_Meal_0").Translate(), delegate
                {
                    SetTexture(ThingDefOf.MealSimple, PathMealSimple);
                    SetTexture(ThingDefOf.MealFine, PathMealFine);
                    SetTexture(ThingDefOf.MealLavish, PathMealLavish);
                    SetTexture(ThingDefOf.MealNutrientPaste, PathMealNutrientPaste);
                    SetTexture(ThingDefOf.MealSurvivalPack, PathMealSurvivalPack);
                    valueMeal = 0;
                }));
                menuEntries.Add(new FloatMenuOption(("CTP_Meal_1").Translate(), delegate
                {
                    SetTexture(ThingDefOf.MealSimple, PathMealSimple + "_V1");
                    SetTexture(ThingDefOf.MealFine, PathMealFine + "_V1");
                    SetTexture(ThingDefOf.MealLavish, PathMealLavish + "_V1");
                    SetTexture(ThingDefOf.MealNutrientPaste, PathMealNutrientPaste + "_V1");
                    SetTexture(ThingDefOf.MealSurvivalPack, PathMealSurvivalPack + "_V1");
                    valueMeal = 1;
                }));
                menuEntries.Add(new FloatMenuOption(("CTP_Meal_2").Translate(), delegate
                {
                    SetTexture(ThingDefOf.MealSimple, PathMealSimple + "_V2");
                    SetTexture(ThingDefOf.MealFine, PathMealFine + "_V2");
                    SetTexture(ThingDefOf.MealLavish, PathMealLavish + "_V2");
                    SetTexture(ThingDefOf.MealNutrientPaste, PathMealNutrientPaste + "_V2");
                    SetTexture(ThingDefOf.MealSurvivalPack, PathMealSurvivalPack + "_V2");
                    valueMeal = 2;
                }));
                Find.WindowStack.Add(new FloatMenu(menuEntries));
            }
            ls.Gap(GapHeight);
            if (ls.ButtonTextLabeled("CTP_RawBerries".Translate(), ("CTP_RawBerries_" + valueRawBerries).Translate()))
            {
                List <FloatMenuOption> menuEntries = new List <FloatMenuOption>();
                menuEntries.Add(new FloatMenuOption(("CTP_RawBerries_0").Translate(), delegate
                {
                    SetTexture(ThingDefOf.RawBerries, PathRawBerries);
                    valueRawBerries = 0;
                }));
                menuEntries.Add(new FloatMenuOption(("CTP_RawBerries_1").Translate(), delegate
                {
                    SetTexture(ThingDefOf.RawBerries, PathRawBerries + "_V1");
                    valueRawBerries = 1;
                }));
                Find.WindowStack.Add(new FloatMenu(menuEntries));
            }
            ls.GapGapLine(GapHeight);

            // Item - Resource
            if (ls.ButtonTextLabeled("CTP_Medicine".Translate(), ("CTP_Medicine_" + valueMedicine).Translate()))
            {
                List <FloatMenuOption> menuEntries = new List <FloatMenuOption>();
                menuEntries.Add(new FloatMenuOption(("CTP_Medicine_0").Translate(), delegate
                {
                    SetTexture(ThingDefOf.MedicineHerbal, PathMedicineHerbal);
                    SetTexture(ThingDefOf.MedicineIndustrial, PathMedicineIndustrial);
                    SetTexture(ThingDefOf.MedicineUltratech, PathMedicineUltratech);
                    valueMedicine = 0;
                }));
                menuEntries.Add(new FloatMenuOption(("CTP_Medicine_1").Translate(), delegate
                {
                    SetTexture(ThingDefOf.MedicineHerbal, PathMedicineHerbal + "_V1");
                    SetTexture(ThingDefOf.MedicineIndustrial, PathMedicineIndustrial + "_V1");
                    SetTexture(ThingDefOf.MedicineUltratech, PathMedicineUltratech + "_V1");
                    valueMedicine = 1;
                }));
                menuEntries.Add(new FloatMenuOption(("CTP_Medicine_2").Translate(), delegate
                {
                    SetTexture(ThingDefOf.MedicineHerbal, PathMedicineHerbal + "_V2");
                    SetTexture(ThingDefOf.MedicineIndustrial, PathMedicineIndustrial + "_V2");
                    SetTexture(ThingDefOf.MedicineUltratech, PathMedicineUltratech + "_V2");
                    valueMedicine = 2;
                }));
                menuEntries.Add(new FloatMenuOption(("CTP_Medicine_3").Translate(), delegate
                {
                    SetTexture(ThingDefOf.MedicineHerbal, PathMedicineHerbal + "_V3");
                    SetTexture(ThingDefOf.MedicineIndustrial, PathMedicineIndustrial + "_V3");
                    SetTexture(ThingDefOf.MedicineUltratech, PathMedicineUltratech + "_V3");
                    valueMedicine = 3;
                }));
                Find.WindowStack.Add(new FloatMenu(menuEntries));
            }
            ls.Gap(GapHeight);
            if (ls.ButtonTextLabeled("CTP_Silver".Translate(), ("CTP_Silver_" + valueSilver).Translate()))
            {
                List <FloatMenuOption> menuEntries = new List <FloatMenuOption>();
                menuEntries.Add(new FloatMenuOption(("CTP_Silver_0").Translate(), delegate
                {
                    SetTexture(ThingDefOf.Silver, PathSilver);
                    valueSilver = 0;
                }));
                menuEntries.Add(new FloatMenuOption(("CTP_Silver_1").Translate(), delegate
                {
                    SetTexture(ThingDefOf.Silver, PathSilver + "_V1");
                    valueSilver = 1;
                }));
                menuEntries.Add(new FloatMenuOption(("CTP_Silver_2").Translate(), delegate
                {
                    SetTexture(ThingDefOf.Silver, PathSilver + "_V2");
                    valueSilver = 2;
                }));
                Find.WindowStack.Add(new FloatMenu(menuEntries));
            }
            ls.Gap(GapHeight);
            if (ls.ButtonTextLabeled("CTP_Gold".Translate(), ("CTP_Gold_" + valueGold).Translate()))
            {
                List <FloatMenuOption> menuEntries = new List <FloatMenuOption>();
                menuEntries.Add(new FloatMenuOption(("CTP_Gold_0").Translate(), delegate
                {
                    SetTexture(ThingDefOf.Gold, PathGold);
                    valueGold = 0;
                }));
                menuEntries.Add(new FloatMenuOption(("CTP_Gold_1").Translate(), delegate
                {
                    SetTexture(ThingDefOf.Gold, PathGold + "_V1");
                    valueGold = 1;
                }));
                Find.WindowStack.Add(new FloatMenu(menuEntries));
            }
            ls.GapGapLine(GapHeight);

            // Plant
            if (ls.ButtonTextLabeled("CTP_PlantBerry".Translate(), ("CTP_PlantBerry_" + valuePlantBerry).Translate()))
            {
                List <FloatMenuOption> menuEntries = new List <FloatMenuOption>();
                menuEntries.Add(new FloatMenuOption(("CTP_PlantBerry_0").Translate(), delegate
                {
                    SetTexture(ThingDefOf.Plant_Berry, PathPlantBerry);
                    valuePlantBerry = 0;
                }));
                menuEntries.Add(new FloatMenuOption(("CTP_PlantBerry_1").Translate(), delegate
                {
                    SetTexture(ThingDefOf.Plant_Berry, PathPlantBerry + "_V1");
                    valuePlantBerry = 1;
                }));
                Find.WindowStack.Add(new FloatMenu(menuEntries));
            }
            ls.Gap(GapHeight);
            if (ls.ButtonTextLabeled("CTP_PlantHealroot".Translate(), ("CTP_PlantHealroot_" + valuePlantHealroot).Translate()))
            {
                List <FloatMenuOption> menuEntries = new List <FloatMenuOption>();
                menuEntries.Add(new FloatMenuOption(("CTP_PlantHealroot_0").Translate(), delegate
                {
                    SetTexture(ThingDefOf.Plant_Healroot, PathPlantHealroot);
                    SetTexture(ThingDefOf.Plant_HealrootWild, PathPlantHealroot);
                    valuePlantHealroot = 0;
                }));
                menuEntries.Add(new FloatMenuOption(("CTP_PlantHealroot_1").Translate(), delegate
                {
                    SetTexture(ThingDefOf.Plant_Healroot, PathPlantHealroot + "_V1");
                    SetTexture(ThingDefOf.Plant_HealrootWild, PathPlantHealroot + "_V1");
                    valuePlantHealroot = 1;
                }));
                Find.WindowStack.Add(new FloatMenu(menuEntries));
            }

            // Restore original values
            Text.Anchor = backupAnchor;
            ls.End();
        }
Exemplo n.º 25
0
        public void DrawWindow(Rect rect)
        {
            // Draw all settings.
            Listing_Standard listing = new Listing_Standard();

            listing.Begin(new Rect(rect.x, rect.y, Mathf.Min(rect.width, 320), rect.height));

            listing.Label("<color=yellow>" + "WTM_RequireRestart".Translate() + "</color>");
            listing.GapLine();

            listing.CheckboxLabeled("WTM_FlagVanilla".Translate(), ref FlagVanilla, "WTM_FlagVanilla_Desc".Translate(VanillaName.Trim()));
            VanillaName = listing.TextEntryLabeled("WTM_VanillaName".Translate(), VanillaName);
            listing.Gap();

            listing.Label("<b>" + "WTM_VisualOptions".Translate() + "</b>");

            listing.Label("WTM_Format".Translate(), tooltip: "WTM_Format_Desc".Translate());
            Format = listing.TextEntry(Format);
            if (!Format.Contains("{0}"))
            {
                listing.Label("<color=red>" + "WTM_Format_MissingTag".Translate() + "</color>");
            }
            try
            {
                _ = string.Format(Format.Replace('[', '(').Replace(']', ')'), "ExampleModName");
            }
            catch (Exception e)
            {
                _ = e;
                listing.Label("<color=red>" + "WTM_Format_FormatError".Translate() + "</color>");
            }

            listing.CheckboxLabeled("WTM_Italics".Translate(), ref Italics, "WTM_Italics_Desc".Translate());
            listing.CheckboxLabeled("WTM_Bold".Translate(), ref Bold, "WTM_Bold_Desc".Translate());

            listing.Label("WTM_CustomSize".Translate(CustomSize), tooltip: "WTM_CustomSize_Desc".Translate());
            listing.IntEntry(ref CustomSize, ref fontSizeBuffer);
            CustomSize     = Mathf.Clamp(CustomSize, 0, 64);
            fontSizeBuffer = CustomSize.ToString();

            listing.Label("WTM_BlankLines".Translate(BlankLines), tooltip: "WTM_BlankLines_Desc".Translate());
            listing.IntEntry(ref BlankLines, ref blankLinesBuffer);
            BlankLines       = Mathf.Clamp(BlankLines, 0, 12);
            blankLinesBuffer = BlankLines.ToString();

            listing.Label("WTM_SelectFontColor".Translate(), tooltip: "WTM_SelectFontColor_Desc".Translate());
            bool openColorPicker = listing.ButtonImage(GetCurrentColorTexture(), 100, 32);

            if (openColorPicker)
            {
                OpenColorPicker();
            }

            // Do preview box.
            float y          = listing.CurHeight + rect.y - 30;
            Rect  previewBox = new Rect(rect.x, y, 310, 170);

            Widgets.DrawBox(previewBox);
            previewBox = previewBox.ExpandedBy(-5);
            string rawText  = "WTM_ExampleDescription".Translate();
            string template = ModCore.MakeTemplate(this);
            string text     = ModCore.MakeNewDescription(rawText, "Example Mod", template, false);

            Widgets.Label(previewBox, text);

            listing.End();

            listing = new Listing_Standard();
            listing.Begin(new Rect(rect.x + 350, rect.y, 320, rect.height));
            if (listing.ButtonText($"{(showAdvanced ? "WTM_Hide".Translate() : "WTM_Show".Translate())} {"WTM_AdvancedSettings".Translate()}"))
            {
                showAdvanced = !showAdvanced;
            }

            if (showAdvanced)
            {
                // Draw advanced settings.
                listing.GapLine();

                listing.CheckboxLabeled("WTM_CECompat".Translate(), ref CECompat, "WTM_CECompat_Desc".Translate());
                listing.CheckboxLabeled("WTM_DetectPatched".Translate(), ref DetectPatched, "WTM_DetectPatched_Desc".Translate());

                if (!DetectPatched)
                {
                    GUI.enabled = false;
                }
                listing.CheckboxLabeled("WTM_UltraDeepMode".Translate(), ref UltraDeepMode, "WTM_UltraDeepMode_Desc".Translate());
                GUI.enabled = true;

                listing.CheckboxLabeled("WTM_ZooLabel".Translate(), ref ZooModeEnabled, "WTM_ZooDesc".Translate());
                if (ZooModeEnabled)
                {
                    listing.CheckboxLabeled("WTM_ZooMultiLabel".Translate(), ref ZooModeMultithread, "WTM_ZooMultiDesc".Translate());
                }

                listing.Label("WTM_ExcludedMods".Translate(), tooltip: "WTM_ExcludedMods_Desc".Translate());
                bool addNew      = listing.ButtonText("WTM_AddNew".Translate());
                bool removeBlank = listing.ButtonText("WTM_RemoveBlank".Translate());
                listing.Gap();

                if (addNew)
                {
                    ExcludedMods.Add("");
                }
                if (removeBlank)
                {
                    for (int i = 0; i < ExcludedMods.Count; i++)
                    {
                        string txt = ExcludedMods[i];
                        if (string.IsNullOrWhiteSpace(txt))
                        {
                            ExcludedMods.RemoveAt(i);
                            i--;
                        }
                    }
                }
                for (int i = 0; i < ExcludedMods.Count; i++)
                {
                    var mod = ExcludedMods[i];
                    mod             = listing.TextEntry(mod);
                    ExcludedMods[i] = mod;

                    string final = mod.Trim();
                    var    meta  = ModLister.GetModWithIdentifier(final, true);
                    string msg   = meta == null ? "WTM_ModNotFound".Translate() : "WTM_ModFound".Translate(meta.Name);
                    string color = meta == null ? "red" : "green";
                    listing.Label($"<color={color}>{msg}</color>");
                    listing.GapLine();
                }
            }

            listing.End();
        }
Exemplo n.º 26
0
        public static void DrawStorytellerSelectionInterface(Rect rect, ref StorytellerDef chosenStoryteller, ref DifficultyDef difficulty, Listing_Standard infoListing)
        {
            GUI.BeginGroup(rect);
            if (chosenStoryteller != null && chosenStoryteller.listVisible)
            {
                GUI.DrawTexture(new Rect(390f, rect.height - Storyteller.PortraitSizeLarge.y - 1f, Storyteller.PortraitSizeLarge.x, Storyteller.PortraitSizeLarge.y), chosenStoryteller.portraitLargeTex);
                Widgets.DrawLineHorizontal(0f, rect.height, rect.width);
            }
            Rect outRect = new Rect(0f, 0f, Storyteller.PortraitSizeTiny.x + 16f, rect.height);

            Widgets.BeginScrollView(viewRect: new Rect(0f, 0f, Storyteller.PortraitSizeTiny.x, (float)DefDatabase <StorytellerDef> .AllDefs.Count() * (Storyteller.PortraitSizeTiny.y + 10f)), outRect: outRect, scrollPosition: ref scrollPosition);
            Rect rect2 = new Rect(0f, 0f, Storyteller.PortraitSizeTiny.x, Storyteller.PortraitSizeTiny.y);

            foreach (StorytellerDef item in DefDatabase <StorytellerDef> .AllDefs.OrderBy((StorytellerDef tel) => tel.listOrder))
            {
                if (item.listVisible)
                {
                    if (Widgets.ButtonImage(rect2, item.portraitTinyTex))
                    {
                        TutorSystem.Notify_Event("ChooseStoryteller");
                        chosenStoryteller = item;
                    }
                    if (chosenStoryteller == item)
                    {
                        GUI.DrawTexture(rect2, StorytellerHighlightTex);
                    }
                    rect2.y += rect2.height + 8f;
                }
            }
            Widgets.EndScrollView();
            Text.Font = GameFont.Small;
            Widgets.Label(new Rect(outRect.xMax + 8f, 0f, 300f, 999f), "HowStorytellersWork".Translate());
            if (chosenStoryteller != null && chosenStoryteller.listVisible)
            {
                Rect rect3 = new Rect(outRect.xMax + 8f, outRect.yMin + 160f, 290f, 0f);
                rect3.height = rect.height - rect3.y;
                Text.Font    = GameFont.Medium;
                Widgets.Label(new Rect(rect3.x + 15f, rect3.y - 40f, 9999f, 40f), chosenStoryteller.label);
                Text.Anchor = TextAnchor.UpperLeft;
                Text.Font   = GameFont.Small;
                infoListing.Begin(rect3);
                infoListing.Label(chosenStoryteller.description, 160f);
                infoListing.Gap(6f);
                foreach (DifficultyDef allDef in DefDatabase <DifficultyDef> .AllDefs)
                {
                    if (!allDef.isExtreme || Prefs.ExtremeDifficultyUnlocked)
                    {
                        GUI.color = allDef.drawColor;
                        if (infoListing.RadioButton_NewTemp(allDef.LabelCap, difficulty == allDef, 0f, allDef.description, 0f))
                        {
                            difficulty = allDef;
                        }
                        infoListing.Gap(3f);
                    }
                }
                GUI.color = Color.white;
                if (Current.ProgramState == ProgramState.Entry)
                {
                    infoListing.Gap(25f);
                    bool active  = Find.GameInitData.permadeathChosen && Find.GameInitData.permadeath;
                    bool active2 = Find.GameInitData.permadeathChosen && !Find.GameInitData.permadeath;
                    if (infoListing.RadioButton("ReloadAnytimeMode".Translate(), active2, 0f, "ReloadAnytimeModeInfo".Translate()))
                    {
                        Find.GameInitData.permadeathChosen = true;
                        Find.GameInitData.permadeath       = false;
                    }
                    infoListing.Gap(3f);
                    if (infoListing.RadioButton("CommitmentMode".TranslateWithBackup("PermadeathMode"), active, 0f, "PermadeathModeInfo".Translate()))
                    {
                        Find.GameInitData.permadeathChosen = true;
                        Find.GameInitData.permadeath       = true;
                    }
                }
                infoListing.End();
            }
            GUI.EndGroup();
        }
Exemplo n.º 27
0
        public override void DoSettingsWindowContents(Rect rect)
        {
            Listing_Standard list = new Listing_Standard();

            cachedMaxHealth  = quarryMaxHealth;
            list.ColumnWidth = rect.width;
            list.Begin(rect);
            list.Gap(10);
            {
                Rect fullRect  = list.GetRect(Text.LineHeight);
                Rect leftRect  = fullRect.LeftHalf().Rounded();
                Rect rightRect = fullRect.RightHalf().Rounded();

                if (quarryMaxHealth <= 10000)
                {
                    Widgets.Label(leftRect, "QRY_DepletionLabel".Translate(quarryMaxHealth.ToString("N0")));
                }
                else
                {
                    Widgets.Label(leftRect, "QRY_DepletionLabel".Translate("Infinite"));
                }

                //Increment timer value by -100 (button).
                if (Widgets.ButtonText(new Rect(rightRect.xMin, rightRect.y, rightRect.height, rightRect.height), "-", true, false, true))
                {
                    if (quarryMaxHealth >= 200)
                    {
                        quarryMaxHealth -= 100;
                    }
                }

                quarryMaxHealth = RoundToAsInt(100, Widgets.HorizontalSlider(
                                                   new Rect(rightRect.xMin + rightRect.height + 10f, rightRect.y, rightRect.width - ((rightRect.height * 2) + 20f), rightRect.height),
                                                   quarryMaxHealth, 100f, 10100f, true));

                //Increment timer value by +100 (button).
                if (Widgets.ButtonText(new Rect(rightRect.xMax - rightRect.height, rightRect.y, rightRect.height, rightRect.height), "+", true, false, true))
                {
                    if (quarryMaxHealth < 10100)
                    {
                        quarryMaxHealth += 100;
                    }
                }

                list.Gap(25);

                {
                    Rect letterRect = list.GetRect(Text.LineHeight).LeftHalf().Rounded();

                    Widgets.CheckboxLabeled(letterRect, Static.LetterSent, ref letterSent);
                    if (Mouse.IsOver(letterRect))
                    {
                        Widgets.DrawHighlight(letterRect);
                    }
                    TooltipHandler.TipRegion(letterRect, Static.ToolTipLetter);
                }

                list.Gap(25);

                {
                    Rect junkRect         = list.GetRect(Text.LineHeight).LeftHalf().Rounded();
                    Rect junkSliderOffset = junkRect.RightHalf().Rounded().RightPartPixels(200);

                    Widgets.Label(junkRect, "QRY_SettingsJunkChance".Translate(junkChance));
                    junkChance = RoundToAsInt(5, Widgets.HorizontalSlider(
                                                  junkSliderOffset,
                                                  junkChance, 10f, 90f, true));
                    if (Mouse.IsOver(junkRect))
                    {
                        Widgets.DrawHighlight(junkRect);
                    }
                    TooltipHandler.TipRegion(junkRect, Static.ToolTipJunkChance);
                }

                list.Gap(25);

                {
                    Rect chunkRect         = list.GetRect(Text.LineHeight).LeftHalf().Rounded();
                    Rect chunkSliderOffset = chunkRect.RightHalf().Rounded().RightPartPixels(200);

                    Widgets.Label(chunkRect, "QRY_SettingsChunkChance".Translate(chunkChance));
                    chunkChance = RoundToAsInt(5, Widgets.HorizontalSlider(
                                                   chunkSliderOffset,
                                                   chunkChance, 10f, 90f, true));
                    if (Mouse.IsOver(chunkRect))
                    {
                        Widgets.DrawHighlight(chunkRect);
                    }
                    TooltipHandler.TipRegion(chunkRect, Static.ToolTipChunkChance);
                }

                list.Gap(75);
                {
                    Vector2 rbCenter = list.GetRect(Text.LineHeight).center;
                    Rect    rbRect   = new Rect(rbCenter.x - 100, rbCenter.x + 100, 200, 30);
                    // Only allows opening the resource folder on windows. I should be able to support linux and mac in the future
                    if ((Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) && Widgets.ButtonText(rbRect, "Open Resource Defs Folder"))
                    {
                        Application.OpenURL(ModsConfig.ActiveModsInLoadOrder.Single(m => m.Name == "Quarry").RootDir.ToString() + "/Defs/QuarryResourceDefs");
                    }
                }

                list.Gap(10);

                list.End();
            }
        }
        public static void DoWindowContents(Rect inRect)
        {
            //30f for top page description and bottom close button
            Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f);
            //-16 for slider, height_modifier - additional height for options
            Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + height_modifier);

            Listing_Standard listingStandard = new Listing_Standard();

            listingStandard.maxOneColumn = true;
            listingStandard.ColumnWidth  = viewRect.width / 2.05f;
            listingStandard.BeginScrollView(outRect, ref scrollPosition, ref viewRect);
            listingStandard.Begin(viewRect);
            listingStandard.Gap(4f);
            listingStandard.CheckboxLabeled("RJWH_pregnancy".Translate(), ref humanlike_pregnancy_enabled, "RJWH_pregnancy_desc".Translate());
            if (humanlike_pregnancy_enabled)
            {
                listingStandard.Gap(5f);
                listingStandard.CheckboxLabeled("  " + "genetic_trait_filter".Translate(), ref trait_filtering_enabled, "genetic_trait_filter_desc".Translate());
            }
            else
            {
                trait_filtering_enabled = false;
            }
            listingStandard.Gap(5f);
            listingStandard.CheckboxLabeled("RJWA_pregnancy".Translate(), ref animal_pregnancy_enabled, "RJWA_pregnancy_desc".Translate());
            listingStandard.Gap(5f);
            listingStandard.CheckboxLabeled("RJWB_pregnancy".Translate(), ref bestial_pregnancy_enabled, "RJWB_pregnancy_desc".Translate());
            listingStandard.Gap(5f);
            listingStandard.CheckboxLabeled("RJWI_pregnancy".Translate(), ref insect_pregnancy_enabled, "RJWI_pregnancy_desc".Translate());
            listingStandard.Gap(5f);
            listingStandard.CheckboxLabeled("egg_pregnancy_implant_anyone".Translate(), ref egg_pregnancy_implant_anyone, "egg_pregnancy_implant_anyone_desc".Translate());
            listingStandard.Gap(5f);
            listingStandard.CheckboxLabeled("egg_pregnancy_fertilize_anyone".Translate(), ref egg_pregnancy_fertilize_anyone, "egg_pregnancy_fertilize_anyone_desc".Translate());
            listingStandard.Gap(12f);

            listingStandard.CheckboxLabeled("UseParentMethod".Translate(), ref use_parent_method, "UseParentMethod_desc".Translate());
            listingStandard.Gap(5f);
            if (use_parent_method)
            {
                if (humanlike_DNA_from_mother == 0.0f)
                {
                    listingStandard.Label("  " + "OffspringLookLikeTheirMother".Translate() + ": " + "AlwaysFather".Translate(), -1f, "OffspringLookLikeTheirMother_desc".Translate());
                    humanlike_DNA_from_mother = listingStandard.Slider(humanlike_DNA_from_mother, 0.0f, 1.0f);
                }
                else if (humanlike_DNA_from_mother == 1.0f)
                {
                    listingStandard.Label("  " + "OffspringLookLikeTheirMother".Translate() + ": " + "AlwaysMother".Translate(), -1f, "OffspringLookLikeTheirMother_desc".Translate());
                    humanlike_DNA_from_mother = listingStandard.Slider(humanlike_DNA_from_mother, 0.0f, 1.0f);
                }
                else
                {
                    int value = (int)(humanlike_DNA_from_mother * 100);
                    listingStandard.Label("  " + "OffspringLookLikeTheirMother".Translate() + ": " + value + "%", -1f, "OffspringLookLikeTheirMother_desc".Translate());
                    humanlike_DNA_from_mother = listingStandard.Slider(humanlike_DNA_from_mother, 0.0f, 1.0f);
                }

                if (bestial_DNA_from_mother == 0.0f)
                {
                    listingStandard.Label("  " + "OffspringIsHuman".Translate() + ": " + "AlwaysFather".Translate(), -1f, "OffspringIsHuman_desc".Translate());
                    bestial_DNA_from_mother = listingStandard.Slider(bestial_DNA_from_mother, 0.0f, 1.0f);
                }
                else if (bestial_DNA_from_mother == 1.0f)
                {
                    listingStandard.Label("  " + "OffspringIsHuman".Translate() + ": " + "AlwaysMother".Translate(), -1f, "OffspringIsHuman_desc".Translate());
                    bestial_DNA_from_mother = listingStandard.Slider(bestial_DNA_from_mother, 0.0f, 1.0f);
                }
                else
                {
                    int value = (int)(bestial_DNA_from_mother * 100);
                    listingStandard.Label("  " + "OffspringIsHuman".Translate() + ": " + value + "%", -1f, "OffspringIsHuman_desc".Translate());
                    bestial_DNA_from_mother = listingStandard.Slider(bestial_DNA_from_mother, 0.0f, 1.0f);
                }

                if (bestiality_DNA_inheritance == 0.0f)
                {
                    listingStandard.Label("  " + "OffspringIsHuman2".Translate() + ": " + "AlwaysBeast".Translate(), -1f, "OffspringIsHuman2_desc".Translate());
                    bestiality_DNA_inheritance = listingStandard.Slider(bestiality_DNA_inheritance, 0.0f, 1.0f);
                }
                else if (bestiality_DNA_inheritance == 1.0f)
                {
                    listingStandard.Label("  " + "OffspringIsHuman2".Translate() + ": " + "AlwaysHumanlike".Translate(), -1f, "OffspringIsHuman2_desc".Translate());
                    bestiality_DNA_inheritance = listingStandard.Slider(bestiality_DNA_inheritance, 0.0f, 1.0f);
                }
                else
                {
                    listingStandard.Label("  " + "OffspringIsHuman2".Translate() + ": <--->", -1f, "OffspringIsHuman2_desc".Translate());
                    bestiality_DNA_inheritance = listingStandard.Slider(bestiality_DNA_inheritance, 0.0f, 1.0f);
                }
            }
            else
            {
                humanlike_DNA_from_mother = 100;
            }
            listingStandard.CheckboxLabeled("MechanoidImplanting".Translate(), ref mechanoid_pregnancy_enabled, "MechanoidImplanting_desc".Translate());
            listingStandard.Gap(5f);
            listingStandard.CheckboxLabeled("ComplexImpregnation".Translate(), ref complex_interspecies, "ComplexImpregnation_desc".Translate());
            listingStandard.Gap(10f);

            GUI.contentColor = Color.cyan;
            listingStandard.Label("Base pregnancy chances:");
            listingStandard.Gap(5f);
            if (humanlike_pregnancy_enabled)
            {
                listingStandard.Label("  Humanlike/Humanlike (same race): " + humanlike_impregnation_chance + "%");
            }
            else
            {
                listingStandard.Label("  Humanlike/Humanlike (same race): -DISABLED-");
            }
            if (humanlike_pregnancy_enabled && !(humanlike_impregnation_chance * interspecies_impregnation_modifier <= 0.0f) && !complex_interspecies)
            {
                listingStandard.Label("  Humanlike/Humanlike (different race): " + Math.Round(humanlike_impregnation_chance * interspecies_impregnation_modifier, 1) + "%");
            }
            else if (complex_interspecies)
            {
                listingStandard.Label("  Humanlike/Humanlike (different race): -DEPENDS ON SPECIES-");
            }
            else
            {
                listingStandard.Label("  Humanlike/Humanlike (different race): -DISABLED-");
            }
            if (animal_pregnancy_enabled)
            {
                listingStandard.Label("  Animal/Animal (same race): " + animal_impregnation_chance + "%");
            }
            else
            {
                listingStandard.Label("  Animal/Animal (same race): -DISABLED-");
            }
            if (animal_pregnancy_enabled && !(animal_impregnation_chance * interspecies_impregnation_modifier <= 0.0f) && !complex_interspecies)
            {
                listingStandard.Label("  Animal/Animal (different race): " + Math.Round(animal_impregnation_chance * interspecies_impregnation_modifier, 1) + "%");
            }
            else if (complex_interspecies)
            {
                listingStandard.Label("  Animal/Animal (different race): -DEPENDS ON SPECIES-");
            }
            else
            {
                listingStandard.Label("  Animal/Animal (different race): -DISABLED-");
            }
            if (RJWSettings.bestiality_enabled && bestial_pregnancy_enabled && !(animal_impregnation_chance * interspecies_impregnation_modifier <= 0.0f) && !complex_interspecies)
            {
                listingStandard.Label("  Humanlike/Animal: " + Math.Round(animal_impregnation_chance * interspecies_impregnation_modifier, 1) + "%");
            }
            else if (complex_interspecies)
            {
                listingStandard.Label("  Humanlike/Animal: -DEPENDS ON SPECIES-");
            }
            else
            {
                listingStandard.Label("  Humanlike/Animal: -DISABLED-");
            }
            if (RJWSettings.bestiality_enabled && bestial_pregnancy_enabled && !(animal_impregnation_chance * interspecies_impregnation_modifier <= 0.0f) && !complex_interspecies)
            {
                listingStandard.Label("  Animal/Humanlike: " + Math.Round(humanlike_impregnation_chance * interspecies_impregnation_modifier, 1) + "%");
            }
            else if (complex_interspecies)
            {
                listingStandard.Label("  Animal/Humanlike: -DEPENDS ON SPECIES-");
            }
            else
            {
                listingStandard.Label("  Animal/Humanlike: -DISABLED-");
            }
            GUI.contentColor = Color.white;

            listingStandard.NewColumn();
            listingStandard.Gap(4f);
            listingStandard.Label("PregnantCoeffecientForHuman".Translate() + ": " + humanlike_impregnation_chance + "%", -1f, "PregnantCoeffecientForHuman_desc".Translate());
            humanlike_impregnation_chance = (int)listingStandard.Slider(humanlike_impregnation_chance, 0.0f, 100f);
            listingStandard.Label("PregnantCoeffecientForAnimals".Translate() + ": " + animal_impregnation_chance + "%", -1f, "PregnantCoeffecientForAnimals_desc".Translate());
            animal_impregnation_chance = (int)listingStandard.Slider(animal_impregnation_chance, 0.0f, 100f);
            if (!complex_interspecies)
            {
                switch (interspecies_impregnation_modifier)
                {
                case 0.0f:
                    GUI.contentColor = Color.grey;
                    listingStandard.Label("InterspeciesImpregnantionModifier".Translate() + ": " + "InterspeciesDisabled".Translate(), -1f, "InterspeciesImpregnantionModifier_desc".Translate());
                    GUI.contentColor = Color.white;
                    break;

                case 1.0f:
                    GUI.contentColor = Color.cyan;
                    listingStandard.Label("InterspeciesImpregnantionModifier".Translate() + ": " + "InterspeciesMaximum".Translate(), -1f, "InterspeciesImpregnantionModifier_desc".Translate());
                    GUI.contentColor = Color.white;
                    break;

                default:
                    listingStandard.Label("InterspeciesImpregnantionModifier".Translate() + ": " + Math.Round(interspecies_impregnation_modifier * 100, 1) + "%", -1f, "InterspeciesImpregnantionModifier_desc".Translate());
                    break;
                }
                interspecies_impregnation_modifier = listingStandard.Slider(interspecies_impregnation_modifier, 0.0f, 1.0f);
            }
            listingStandard.Label("RJW_fertility_endAge_male".Translate() + ": " + (int)(fertility_endage_male * 80) + "In_human_years".Translate(), -1f, "RJW_fertility_endAge_male_desc".Translate());
            fertility_endage_male = listingStandard.Slider(fertility_endage_male, 0.1f, 3.0f);
            listingStandard.Label("RJW_fertility_endAge_female_humanlike".Translate() + ": " + (int)(fertility_endage_female_humanlike * 80) + "In_human_years".Translate(), -1f, "RJW_fertility_endAge_female_humanlike_desc".Translate());
            fertility_endage_female_humanlike = listingStandard.Slider(fertility_endage_female_humanlike, 0.1f, 3.0f);
            listingStandard.Label("RJW_fertility_endAge_female_animal".Translate() + ": " + (int)(fertility_endage_female_animal * 100) + "XofLifeExpectancy".Translate(), -1f, "RJW_fertility_endAge_female_animal_desc".Translate());
            fertility_endage_female_animal = listingStandard.Slider(fertility_endage_female_animal, 0.1f, 3.0f);

            listingStandard.EndScrollView(ref viewRect);
            listingStandard.End();
        }
        public override void DoWindowContents(Rect inRect)
        {
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.ColumnWidth = 200f;
            listing_Standard.Begin(inRect.AtZero());
            listing_Standard.Label("MapSize".Translate(), -1f);
            int[] mapSizes = Dialog_AdvancedGameConfig.MapSizes;
            foreach (int num in mapSizes)
            {
                switch (num)
                {
                case 200:
                    listing_Standard.Label("MapSizeSmall".Translate(), -1f);
                    break;

                case 250:
                    listing_Standard.Label("MapSizeMedium".Translate(), -1f);
                    break;

                case 300:
                    listing_Standard.Label("MapSizeLarge".Translate(), -1f);
                    break;

                case 350:
                    listing_Standard.Label("MapSizeExtreme".Translate(), -1f);
                    break;
                }
                string label = "MapSizeDesc".Translate(num, num * num);
                if (listing_Standard.RadioButton(label, Find.GameInitData.mapSize == num, 0f))
                {
                    Find.GameInitData.mapSize = num;
                }
            }
            listing_Standard.NewColumn();
            GenUI.SetLabelAlign(TextAnchor.MiddleCenter);
            listing_Standard.Label("MapStartSeason".Translate(), -1f);
            string     label2     = (Find.GameInitData.startingSeason != 0) ? Find.GameInitData.startingSeason.LabelCap() : "MapStartSeasonDefault".Translate();
            Rect       rect       = listing_Standard.GetRect(32f);
            GridLayout gridLayout = new GridLayout(rect, 5, 1, 0f, 4f);

            if (Widgets.ButtonText(gridLayout.GetCellRectByIndex(0, 1, 1), "-", true, false, true))
            {
                Season startingSeason = Find.GameInitData.startingSeason;
                startingSeason = ((startingSeason != 0) ? (startingSeason - 1) : Season.Winter);
                Find.GameInitData.startingSeason = startingSeason;
            }
            Widgets.Label(gridLayout.GetCellRectByIndex(1, 3, 1), label2);
            if (Widgets.ButtonText(gridLayout.GetCellRectByIndex(4, 1, 1), "+", true, false, true))
            {
                Season startingSeason2 = Find.GameInitData.startingSeason;
                startingSeason2 = ((startingSeason2 != Season.Winter) ? (startingSeason2 + 1) : Season.Undefined);
                Find.GameInitData.startingSeason = startingSeason2;
            }
            GenUI.ResetLabelAlign();
            if (this.selTile >= 0 && Find.GameInitData.startingSeason != 0)
            {
                Vector2 vector = Find.WorldGrid.LongLatOf(this.selTile);
                float   y      = vector.y;
                if (GenTemperature.AverageTemperatureAtTileForTwelfth(this.selTile, Find.GameInitData.startingSeason.GetFirstTwelfth(y)) < 3.0)
                {
                    listing_Standard.Label("MapTemperatureDangerWarning".Translate(), -1f);
                }
            }
            if (Find.GameInitData.mapSize > 250)
            {
                listing_Standard.Label("MapSizePerformanceWarning".Translate(), -1f);
            }
            listing_Standard.End();
        }
Exemplo n.º 30
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();
        }
Exemplo n.º 31
0
        public static void DrawGeneralCard(Rect rect)
        {
            Listing_Standard listing = new Listing_Standard();

            listing.Begin(rect);
            listing.Label("ZMD_generalTabInfo".Translate());

            listing.GapLine();

            listing.CheckboxLabeled("ZMD_flagHomeMapOnly".Translate(), ref MapDesignerSettings.flagHomeMapOnly, "ZMD_flagHomeMapOnlyDesc".Translate());

            listing.GapLine();

            #region presets
            Rect selPresetRect = listing.GetRect(40f);

            Rect selButtonRect = selPresetRect;
            Rect descRect      = selPresetRect;
            selButtonRect.xMax -= 0.66f * rect.width;
            descRect.xMin      += 20f + 0.34f * rect.width;

            Widgets.Label(descRect, (GetPresetLabel() + "Desc").Translate());
            Listing_Standard listing_selPreset = new Listing_Standard();
            listing_selPreset.Begin(selButtonRect);

            // preset selection
            if (listing_selPreset.ButtonTextLabeled("ZMD_presets".Translate(), GetPresetLabel().Translate()))
            {
                List <FloatMenuOption> presetList = new List <FloatMenuOption>();

                presetList.Add(new FloatMenuOption("ZMD_presetVanilla".Translate(), delegate
                {
                    selPreset = Preset.Vanilla;
                }));
                presetList.Add(new FloatMenuOption("ZMD_presetFertileValley".Translate(), delegate
                {
                    selPreset = Preset.FertileValley;
                }));
                presetList.Add(new FloatMenuOption("ZMD_presetBarrens".Translate(), delegate
                {
                    selPreset = Preset.Barrens;
                }));
                presetList.Add(new FloatMenuOption("ZMD_presetUnnatural".Translate(), delegate
                {
                    selPreset = Preset.Unnatural;
                }));
                presetList.Add(new FloatMenuOption("ZMD_presetFishingVillage".Translate(), delegate
                {
                    selPreset = Preset.FishingVillage;
                }));
                presetList.Add(new FloatMenuOption("ZMD_presetCanyon".Translate(), delegate
                {
                    selPreset = Preset.Canyon;
                }));
                presetList.Add(new FloatMenuOption("ZMD_presetZyllesChoice".Translate(), delegate
                {
                    selPreset = Preset.ZyllesChoice;
                }));
                presetList.Add(new FloatMenuOption("ZMD_presetRandom".Translate(), delegate
                {
                    selPreset = Preset.Random;
                }));
                Find.WindowStack.Add(new FloatMenu(presetList));
            }

            listing_selPreset.End();
            listing.GapLine();
            if (listing.ButtonText("ZMD_applyPreset".Translate()))
            {
                SoundDefOf.Click.PlayOneShotOnCamera(null);
                ApplyPreset();
            }


            #endregion

            listing.GapLine();
            if (listing.ButtonText("ZMD_reset".Translate()))
            {
                SoundDefOf.Click.PlayOneShotOnCamera(null);
                ResetAllSettings();
            }

            listing.End();
        }
Exemplo n.º 32
0
        public void DoContent(Rect canvas)
        {
            Widgets.DrawMenuSection(canvas);

            if (Job != null)
            {
                // leave some space for bottom buttons.
                float bottomButtonsHeight = 30f;
                float bottomButtonsGap = 6f;
                canvas.height = canvas.height - bottomButtonsHeight - bottomButtonsGap;

                // bottom buttons
                Rect bottomButtons = new Rect(canvas.xMin, canvas.height + bottomButtonsGap, canvas.width, bottomButtonsHeight);
                GUI.BeginGroup(bottomButtons);

                // add / remove to the stack
                Rect add = new Rect(bottomButtons.width * .75f, 0f, bottomButtons.width / 4f - 6f, bottomButtons.height);
                if (Source == SourceOptions.Current)
                {
                    if (Widgets.TextButton(add, "FM.Delete".Translate()))
                    {
                        Manager.JobStack.Delete(Job);
                        Job = null;
                        RefreshSourceList();
                        return; // hopefully that'll just skip to the next tick without any further errors?
                    }
                    TooltipHandler.TipRegion(add, "FMP.DeleteBillTooltip".Translate());
                }
                else
                {
                    if (Job.Trigger.IsValid)
                    {
                        if (Widgets.TextButton(add, "FM.Manage".Translate()))
                        {
                            Manager.JobStack.Add(Job);

                            Source = SourceOptions.Current;
                            RefreshSourceList();
                            SourceFilter = "";
                        }
                        TooltipHandler.TipRegion(add, "FMP.ManageBillTooltip".Translate());
                    } else
                    {
                        TextAnchor oldAnchor = Text.Anchor;
                        Color oldColor = GUI.color;
                        Text.Anchor = TextAnchor.MiddleCenter;
                        GUI.color = new Color(.6f, .6f, .6f);
                        Widgets.DrawBox(add);
                        GUI.Label(add, "FMP.NoThreshold".Translate());
                        Text.Anchor = oldAnchor;
                        GUI.color = oldColor;
                        TooltipHandler.TipRegion(add, "FMP.NoThresholdTooltip".Translate());
                    }
                }

                GUI.EndGroup();

                GUI.BeginGroup(canvas);
                Text.Anchor = TextAnchor.MiddleCenter;
                Text.Font = GameFont.Medium;
                Rect recta = new Rect(0f, 0f, canvas.width, 50f);
                Widgets.Label(recta, Job.Bill.LabelCap);
                Text.Anchor = TextAnchor.UpperLeft;
                Text.Font = GameFont.Small;
                Rect rect2 = new Rect(6f, 50f, canvas.width * .3f, canvas.height - 50f);
                Listing_Standard listingStandard = new Listing_Standard(rect2);
                if (Job.Bill.suspended)
                {
                    if (listingStandard.DoTextButton("Suspended".Translate()))
                    {
                        Job.Bill.suspended = false;
                    }
                }
                else if (listingStandard.DoTextButton("NotSuspended".Translate()))
                {
                    Job.Bill.suspended = true;
                }
                string billStoreModeLabel = ("BillStoreMode_" + Job.Bill.storeMode).Translate();
                if (listingStandard.DoTextButton(billStoreModeLabel))
                {
                    List<FloatMenuOption> list = (from BillStoreMode mode in Enum.GetValues(typeof (BillStoreMode)) select new FloatMenuOption(("BillStoreMode_" + mode).Translate(), delegate { Job.Bill.storeMode = mode; })).ToList();
                    Find.WindowStack.Add(new FloatMenu(list));
                }

                // other stuff
                listingStandard.DoGap();
                listingStandard.DoLabel("IngredientSearchRadius".Translate() + ": " + Job.Bill.ingredientSearchRadius.ToString("#####0"));
                Job.Bill.ingredientSearchRadius = Mathf.RoundToInt(listingStandard.DoSlider(Job.Bill.ingredientSearchRadius, 0f, 250f));

                if (Job.Bill.recipe.workSkill != null)
                {
                    listingStandard.DoLabel("MinimumSkillLevel".Translate(Job.Bill.recipe.workSkill.label.ToLower()) + ": " + Job.Bill.minSkillLevel.ToString("#####0"));
                    Job.Bill.minSkillLevel = Mathf.RoundToInt(listingStandard.DoSlider(Job.Bill.minSkillLevel, 0f, 20f));
                }

                // draw threshold config
                Job.Trigger.DrawThresholdConfig(ref listingStandard);
                Job.BillGivers.DrawBillGiverConfig(ref listingStandard);
                listingStandard.End();

                // ingredient picker
                Rect rect3 = new Rect(rect2.xMax + 6f, 50f, canvas.width * .4f, canvas.height - 50f);
                ThingFilterUI.DoThingFilterConfigWindow(rect3, ref BillScrollPosition, Job.Bill.ingredientFilter, Job.Bill.recipe.fixedIngredientFilter, 4);

                // description
                Rect rect4 = new Rect(rect3.xMax + 6f, rect3.y + 30f, canvas.width - rect3.xMax - 12f, canvas.height - 50f);
                StringBuilder stringBuilder = new StringBuilder();

                // add mainproduct line
                stringBuilder.AppendLine("FMP.MainProduct".Translate(Job.MainProduct.Label, Job.MainProduct.Count));
                stringBuilder.AppendLine();

                if (Job.Bill.recipe.description != null)
                {
                    stringBuilder.AppendLine(Job.Bill.recipe.description);
                    stringBuilder.AppendLine();
                }
                stringBuilder.AppendLine("WorkAmount".Translate() + ": " + Job.Bill.recipe.WorkAmountTotal(null).ToStringWorkAmount());
                stringBuilder.AppendLine();
                foreach (IngredientCount ingredientCount in Job.Bill.recipe.ingredients)
                {
                    if (!ingredientCount.filter.Summary.NullOrEmpty())
                    {
                        stringBuilder.AppendLine(Job.Bill.recipe.IngredientValueGetter.BillRequirementsDescription(ingredientCount));
                    }
                }
                stringBuilder.AppendLine();
                string text4 = Job.Bill.recipe.IngredientValueGetter.ExtraDescriptionLine();
                if (text4 != null)
                {
                    stringBuilder.AppendLine(text4);
                    stringBuilder.AppendLine();
                }
                stringBuilder.AppendLine("MinimumSkills".Translate());
                stringBuilder.AppendLine(Job.Bill.recipe.MinSkillString);
                Text.Font = GameFont.Small;
                string text5 = stringBuilder.ToString();
                if (Text.CalcHeight(text5, rect4.width) > rect4.height)
                {
                    Text.Font = GameFont.Tiny;
                }
                Widgets.Label(rect4, text5);
                Text.Font = GameFont.Small;
                if (Job.Bill.recipe.products.Count == 1)
                {
                    Widgets.InfoCardButton(rect4.x, rect3.y, Job.Bill.recipe.products[0].thingDef);
                }
            }
            GUI.EndGroup();
        }
Exemplo n.º 33
0
        public override void DoWindowContents(Rect inRect)
        {
            Listing_Standard listing = new Listing_Standard();

            listing.Begin(inRect);

            Text.Font = GameFont.Medium;
            listing.Label("Storyteller Packs");
            Text.Font = GameFont.Small;

            listing.GapLine();

            listing.Label("StorytellerPacks are packs of different types of votes. They each have their own settings, can be activated at the same time, and can be activated alongside normal storytellers.");

            listing.GapLine();

            listing.Label("All storyteller packs will consider the global weights when choosing which votes to use. A weight of 0 would never be picked, meaning it is disabled.");

            listing.Gap();

            if (listing.ButtonTextLabeled("Edit Global Vote Weights", "Edit Weights"))
            {
                Window_GlobalVoteWeights window = new Window_GlobalVoteWeights();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }

            listing.Gap();

            listing.GapLine();

            listing.Label("Enabled Storyteller Packs");

            listing.Gap(24);

            listing.ColumnWidth = (inRect.width / 2f) - 20f;

            listing.CheckboxLabeled("<color=#6441A4>Torytalker</color> - Classic / Most Balanced", ref ToolkitSettings.ToryTalkerEnabled);

            listing.Gap();

            if (listing.ButtonTextLabeled("ToryTalker Pack", "View"))
            {
                Window_ToryTalkerSettings window = new Window_ToryTalkerSettings();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }

            listing.Gap(24);

            listing.CheckboxLabeled("<color=#4BB543>HodlBot</color> - Random by Category / Type", ref ToolkitSettings.HodlBotEnabled);

            listing.Gap();

            if (listing.ButtonTextLabeled("HodlBot Pack", "View"))
            {
                Window_HodlBotSettings window = new Window_HodlBotSettings();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }

            listing.Gap(24);

            listing.CheckboxLabeled("<color=#CF0E0F>UristBot</color> - Raids Strategies / Diseases", ref ToolkitSettings.UristBotEnabled);

            listing.Gap();

            if (listing.ButtonTextLabeled("UristBot Pack", "View"))
            {
                Window_UristBotSettings window = new Window_UristBotSettings();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }

            listing.Gap(24);

            listing.CheckboxLabeled("<color=#1482CB>Milasandra</color> - Threats OnOffCycle", ref ToolkitSettings.MilasandraEnabled);

            listing.Gap();

            if (listing.ButtonTextLabeled("Milasandra Pack", "View"))
            {
                Window_Milasandra window = new Window_Milasandra();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }

            listing.NewColumn();
            listing.Gap(200f);

            listing.CheckboxLabeled("<color=#BF0030>Mercurius</color> - Misc Events Cycle", ref ToolkitSettings.MercuriusEnabled);

            listing.Gap();

            if (listing.ButtonTextLabeled("Mercurius Pack", "View"))
            {
                Window_Mercurius window = new Window_Mercurius();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }

            listing.End();
        }
Exemplo n.º 34
0
        protected override void FillTab()
        {
            var marker = SelMarker;
            Text.Font = GameFont.Small;
            var listing = new Listing_Standard( new Rect( 10f, 10f, this.size.x - 20f, this.size.y - 20f ) );
            {
                #region Marker Name
                var nameRect = listing.GetRect( 30f );
                nameRect.width /= 2.0f;
                Widgets.Label( nameRect, Data.Strings.RoomMarkerName.Translate() );
                nameRect.x += nameRect.width;
                marker.markerName = Widgets.TextField( nameRect, marker.markerName.Substring( 0, Math.Min( marker.markerName.Length, 20 ) ) );
                listing.Gap();
                #endregion

                #region Marker Type
                var typeGroupRect = listing.GetRect( 2 * 28f + 20f);
                Widgets.DrawMenuSection( typeGroupRect, true );
                var position = typeGroupRect.ContractedBy( 10f );
                GUI.BeginGroup( position );
                {
                    var allowRect = new Rect( 0.0f, 0.0f, position.width, 30f );

                    var localValue = SelMarker.AllowPrisoners;
                    ITab_Restricted.DoLabelCheckbox( ref allowRect, Data.Strings.AllowPrisoners, ref localValue );
                    SelMarker.AllowPrisoners = localValue;

                    localValue = SelMarker.AllowSlaves;
                    ITab_Restricted.DoLabelCheckbox( ref allowRect, Data.Strings.AllowSlaves, ref localValue );
                    SelMarker.AllowSlaves = localValue;
                }
                GUI.EndGroup();
                listing.Gap();
                #endregion

            }
            listing.End();
        }
Exemplo n.º 35
0
        public override void DoWindowContents(Rect rect)
        {
            base.DoWindowContents(rect);
            if (RimStoryMod.settings.enableLogging)
            {
                bigRect = rect;


                bigRect = new Rect(rect.position, new Vector2(rect.width, defaultLogSize + (35f * Resources.eventsLog.Count)));
                logSize = new Vector2(rect.x, defaultLogSize + (35f * Resources.eventsLog.Count));
                inner   = new Rect(rect.position, logSize);
                outter  = new Rect(rect.position, new Vector2(rect.width - 200, rect.height));

                listing_Standard.Begin(bigRect);
                Widgets.BeginScrollView(outter, ref vect, inner, true);

                if (Resources.eventsLog != null)
                {
                    foreach (IEvent e in Resources.eventsLog)
                    {
                        if (e != null)
                        {
                            if (e.ShowInLog() != null)
                            {
                                if (!Resources.showRaidsInLog && e is ABigThreat)
                                {
                                }
                                else if (!Resources.showDeadColonistsInLog && e is AMemorialDay)
                                {
                                }
                                else if (!Resources.showIncidentsInLog && e is IncidentShort)
                                {
                                }
                                else
                                {
                                    listing_Standard.AddLabelLine(e.ShowInLog());
                                    listing_Standard.AddHorizontalLine(3f);
                                }
                            }
                        }
                    }
                    if (Resources.eventsLog.Count == 0)
                    {
                        listing_Standard.AddLabelLine("Nothing here yet.");
                    }
                }

                Widgets.EndScrollView();



                listing_Standard.End();


                filterRect = new Rect(new Vector2(outter.width, rect.position.y), new Vector2(200, 200));
                listing_Standard.Begin(filterRect);
                listing_Standard.AddLabeledCheckbox("ShowRaidsInLog".Translate(), ref Resources.showRaidsInLog);
                listing_Standard.AddLabeledCheckbox("ShowDeadColonistsInLog".Translate(), ref Resources.showDeadColonistsInLog);
                listing_Standard.AddLabeledCheckbox("ShowIncidentsInLog".Translate(), ref Resources.showIncidentsInLog);

                listing_Standard.End();
            }
        }
Exemplo n.º 36
0
        public void DoWindowContents(Rect inRect)
        {
            var contents = new Rect(ViewMargin, ViewMargin, inRect.size.x - ViewMargin, WindowHeight);

            Widgets.BeginScrollView(inRect, ref _scrollPosition, contents, true);

            var list = new Listing_Standard();

            list.Begin(contents);

            // General
            Heading(list, "fd.settings.shield.general.heading".Translate());
            list.CheckboxLabeled(
                "fd.settings.shield.shootout.label".Translate(),
                ref EnableShootingOut,
                "fd.settings.shield.shootout.description".Translate());
            list.CheckboxLabeled(
                "fd.settings.shield.overlap-passthrough.label".Translate(),
                ref OverlapPassThrough,
                "fd.settings.shield.overlap-passthrough.description".Translate());
            list.CheckboxLabeled(
                "fd.settings.shield.scale-heat.label".Translate(),
                ref ScaleOnHeat,
                "fd.settings.shield.scale-heat.description".Translate());

            // Performance
            Heading(list, "fd.settings.shield.performance.heading".Translate());
            TextContent(list, "fd.settings.shield.performance.description".Translate());
            list.CheckboxLabeled(
                "fd.settings.shield.performance.target.label".Translate(),
                ref EnableAIAttackTargetFinder,
                "fd.settings.shield.performance.target.description".Translate());
            list.CheckboxLabeled(
                "fd.settings.shield.performance.cast.label".Translate(),
                ref EnableAICastPositionFinder,
                "fd.settings.shield.performance.cast.description".Translate());
            list.CheckboxLabeled(
                "fd.settings.shield.performance.verb.label".Translate(),
                ref EnableAIVerbFindShotLine,
                "fd.settings.shield.performance.verb.description".Translate());

            // Power
            Heading(list, "fd.settings.shield.power.heading".Translate());

//            var powerPerTileBuffer = PowerPerTile.ToString();
//            Widgets.TextFieldNumericLabeled(
//                list.GetRect(Text.LineHeight),
//                "fd.settings.shield.power.per_tile.label".Translate(),
//                ref PowerPerTile,
//                ref powerPerTileBuffer);

            // Integrity
            Heading(list, "fd.settings.shield.integrity.heading".Translate());

            var powerPerDamageBuffer = PowerPerDamage.ToString();

            Widgets.TextFieldNumericLabeled(
                list.GetRect(Text.LineHeight),
                "fd.settings.shield.integrity.power_per_damage.label".Translate(),
                ref PowerPerDamage,
                ref powerPerDamageBuffer);

            var dropPodDamageBuffer = DropPodDamage.ToString();

            Widgets.TextFieldNumericLabeled(
                list.GetRect(Text.LineHeight),
                "fd.settings.shield.integrity.drop_pod_damage.label".Translate(),
                ref DropPodDamage,
                ref dropPodDamageBuffer);

            var skyfallerDamageBuffer = SkyfallerDamage.ToString();

            Widgets.TextFieldNumericLabeled(
                list.GetRect(Text.LineHeight),
                "fd.settings.shield.integrity.skyfaller_damage.label".Translate(),
                ref SkyfallerDamage,
                ref skyfallerDamageBuffer);

            // Thermal
            Heading(list, "fd.settings.shield.thermal.heading".Translate());
            list.CheckboxLabeled(
                "fd.settings.shield.thermal.label".Translate(),
                ref EnableThermal,
                "fd.settings.shield.thermal.description".Translate());
            if (EnableThermal)
            {
                var heatPerPowerBuffer = HeatPerPower.ToString();
                Widgets.TextFieldNumericLabeled(
                    list.GetRect(Text.LineHeight),
                    "fd.settings.shield.thermal.per_power.label".Translate(),
                    ref HeatPerPower,
                    ref heatPerPowerBuffer);
                list.CheckboxLabeled(
                    "fd.settings.shield.minor_thermal_incidents.label".Translate(),
                    ref EnableMinorThermalIncidents,
                    "fd.settings.shield.minor_thermal_incidents.description".Translate());
                list.CheckboxLabeled(
                    "fd.settings.shield.major_thermal_incidents.label".Translate(),
                    ref EnableMajorThermalIncidents,
                    "fd.settings.shield.major_thermal_incidents.description".Translate());
                list.CheckboxLabeled(
                    "fd.settings.shield.critical_thermal_incidents.label".Translate(),
                    ref EnableCriticalThermalIncidents,
                    "fd.settings.shield.critical_thermal_incidents.description".Translate());
            }

            list.End();
            Widgets.EndScrollView();
        }
        public override void DoWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Medium;
            Rect rect = new Rect(0f, 0f, 400f, 50f);

            Widgets.Label(rect, this.bill.LabelCap);
            Rect    rect2         = new Rect(0f, 80f, 200f, (float)(inRect.height - 80.0));
            double  x             = rect2.xMax + 17.0;
            double  num           = inRect.height - 50.0;
            Vector2 closeButSize  = base.CloseButSize;
            Rect    rect3         = new Rect((float)x, 50f, 180f, (float)(num - closeButSize.y));
            double  x2            = rect3.xMax + 17.0;
            double  width         = inRect.width - (rect3.xMax + 17.0);
            double  num2          = inRect.height - 50.0;
            Vector2 closeButSize2 = base.CloseButSize;
            Rect    rect4         = new Rect((float)x2, 50f, (float)width, (float)(num2 - closeButSize2.y));

            Text.Font = GameFont.Small;
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.Begin(rect3);
            if (this.bill.suspended)
            {
                if (listing_Standard.ButtonText("Suspended".Translate(), null))
                {
                    this.bill.suspended = false;
                }
            }
            else if (listing_Standard.ButtonText("NotSuspended".Translate(), null))
            {
                this.bill.suspended = true;
            }
            if (listing_Standard.ButtonText(this.bill.repeatMode.LabelCap, null))
            {
                BillRepeatModeUtility.MakeConfigFloatMenu(this.bill);
            }
            string labelCap = this.bill.storeMode.LabelCap;

            if (listing_Standard.ButtonText(labelCap, null))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                foreach (BillStoreModeDef item in from bsm in DefDatabase <BillStoreModeDef> .AllDefs
                         orderby bsm.listOrder
                         select bsm)
                {
                    BillStoreModeDef smLocal = item;
                    list.Add(new FloatMenuOption(smLocal.LabelCap, delegate
                    {
                        this.bill.storeMode = smLocal;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
            listing_Standard.Gap(12f);
            if (this.bill.repeatMode == BillRepeatModeDefOf.RepeatCount)
            {
                listing_Standard.Label("RepeatCount".Translate(this.bill.RepeatInfoText), -1f);
                listing_Standard.IntSetter(ref this.bill.repeatCount, 1, "1", 42f);
                listing_Standard.IntAdjuster(ref this.bill.repeatCount, 1, 0);
                listing_Standard.IntAdjuster(ref this.bill.repeatCount, 25, 0);
            }
            else if (this.bill.repeatMode == BillRepeatModeDefOf.TargetCount)
            {
                string arg = "CurrentlyHave".Translate() + ": ";
                arg += this.bill.recipe.WorkerCounter.CountProducts(this.bill);
                arg += " / ";
                arg += ((this.bill.targetCount >= 999999) ? "Infinite".Translate().ToLower() : this.bill.targetCount.ToString());
                string text = this.bill.recipe.WorkerCounter.ProductsDescription(this.bill);
                if (!text.NullOrEmpty())
                {
                    string text2 = arg;
                    arg = text2 + "\n" + "CountingProducts".Translate() + ": " + text;
                }
                listing_Standard.Label(arg, -1f);
                int targetCount = this.bill.targetCount;
                listing_Standard.IntSetter(ref this.bill.targetCount, 1, "1", 42f);
                listing_Standard.IntAdjuster(ref this.bill.targetCount, 1, 1);
                listing_Standard.IntAdjuster(ref this.bill.targetCount, 25, 1);
                listing_Standard.IntAdjuster(ref this.bill.targetCount, 250, 1);
                this.bill.unpauseWhenYouHave = Mathf.Max(0, this.bill.unpauseWhenYouHave + (this.bill.targetCount - targetCount));
            }
            listing_Standard.Gap(12f);
            listing_Standard.Label("IngredientSearchRadius".Translate() + ": " + this.bill.ingredientSearchRadius.ToString("F0"), -1f);
            this.bill.ingredientSearchRadius = listing_Standard.Slider(this.bill.ingredientSearchRadius, 3f, 100f);
            if (this.bill.ingredientSearchRadius >= 100.0)
            {
                this.bill.ingredientSearchRadius = 999f;
            }
            if (this.bill.recipe.workSkill != null)
            {
                listing_Standard.Label("AllowedSkillRange".Translate(this.bill.recipe.workSkill.label), -1f);
                listing_Standard.IntRange(ref this.bill.allowedSkillRange, 0, 20);
            }
            if (this.bill.repeatMode == BillRepeatModeDefOf.TargetCount)
            {
                listing_Standard.Gap(12f);
                listing_Standard.CheckboxLabeled("PauseWhenSatisfied".Translate(), ref this.bill.pauseWhenSatisfied, (string)null);
                if (this.bill.pauseWhenSatisfied)
                {
                    listing_Standard.Label("UnpauseWhenYouHave".Translate() + ": " + this.bill.unpauseWhenYouHave.ToString("F0"), -1f);
                    this.bill.unpauseWhenYouHave = Mathf.RoundToInt(listing_Standard.Slider((float)this.bill.unpauseWhenYouHave, 0f, (float)(this.bill.targetCount - 1)));
                }
            }
            listing_Standard.End();
            ThingFilterUI.DoThingFilterConfigWindow(rect4, ref this.scrollPosition, this.bill.ingredientFilter, this.bill.recipe.fixedIngredientFilter, 4, (IEnumerable <ThingDef>)null, (IEnumerable <SpecialThingFilterDef>) this.bill.recipe.forceHiddenSpecialFilters, this.bill.recipe.GetPremultipliedSmallIngredients());
            StringBuilder stringBuilder = new StringBuilder();

            if (this.bill.recipe.description != null)
            {
                stringBuilder.AppendLine(this.bill.recipe.description);
                stringBuilder.AppendLine();
            }
            stringBuilder.AppendLine("WorkAmount".Translate() + ": " + this.bill.recipe.WorkAmountTotal(null).ToStringWorkAmount());
            stringBuilder.AppendLine();
            for (int i = 0; i < this.bill.recipe.ingredients.Count; i++)
            {
                IngredientCount ingredientCount = this.bill.recipe.ingredients[i];
                if (!ingredientCount.filter.Summary.NullOrEmpty())
                {
                    stringBuilder.AppendLine(this.bill.recipe.IngredientValueGetter.BillRequirementsDescription(this.bill.recipe, ingredientCount));
                }
            }
            stringBuilder.AppendLine();
            string text3 = this.bill.recipe.IngredientValueGetter.ExtraDescriptionLine(this.bill.recipe);

            if (text3 != null)
            {
                stringBuilder.AppendLine(text3);
                stringBuilder.AppendLine();
            }
            if (!this.bill.recipe.skillRequirements.NullOrEmpty())
            {
                stringBuilder.AppendLine("MinimumSkills".Translate());
                stringBuilder.AppendLine(this.bill.recipe.MinSkillString);
            }
            Text.Font = GameFont.Small;
            string text4 = stringBuilder.ToString();

            if (Text.CalcHeight(text4, rect2.width) > rect2.height)
            {
                Text.Font = GameFont.Tiny;
            }
            Widgets.Label(rect2, text4);
            Text.Font = GameFont.Small;
            if (this.bill.recipe.products.Count == 1)
            {
                Widgets.InfoCardButton(rect2.x, rect4.y, this.bill.recipe.products[0].thingDef);
            }
        }
        public override float DoWindowContents( Rect rect )
        {
            #region Save State
            var originalFont = Text.Font;
            #endregion

            var listing = new Listing_Standard( rect );
            {
                listing.ColumnWidth = rect.width;

                #region MCM description
                DoLabel(
                    ref listing,
                    Data.Strings.MCMDescription
                );
                #endregion

                #region Buy as colonists
                DoCheckbox(
                    ref listing,
                    ref Data.BoughtSlavesAsColonists,
                    Data.Strings.MCMBoughtAsColonists
                );
                #endregion

                #region Locked doors

                DoLabel(
                    ref listing,
                    Data.Strings.MCMLockedDoors
                );

                #region Drafted can use locked doors
                DoCheckbox(
                    ref listing,
                    ref Data.LockedDoorsAllowDrafted,
                    Data.Strings.MCMLockedDoorsAllowDrafted
                );
                #endregion

                #region Wardens can use locked doors
                DoCheckbox(
                    ref listing,
                    ref Data.LockedDoorsAllowWardens,
                    Data.Strings.MCMLockedDoorsAllowWardens
                );
                #endregion

                #region Doctors can use locked doors
                DoCheckbox(
                    ref listing,
                    ref Data.LockedDoorsAllowDoctors,
                    Data.Strings.MCMLockedDoorsAllowDoctors
                );
                #endregion

                #endregion

            }
            listing.End();

            #region Restore State
            Text.Font = originalFont;
            #endregion

            return listing.CurHeight;
        }
        public void DoSettingsWindowContents(Rect canvas)
        {
            Listing_Standard _Listing_Standard = new Listing_Standard();

            _Listing_Standard.ColumnWidth = 275f;
            _Listing_Standard.Begin(canvas);
            //listing_Standard.set_ColumnWidth(rect.get_width() - 4f);

            _Listing_Standard.Label("THESE SETTINGS ARE ONLY APPLIED WHEN RIMWORLD IS STARTED. After modifying them please restart Rimworld.");
            _Listing_Standard.GapLine(12f);
            _Listing_Standard.Label("Letter Suppression:");
            _Listing_Standard.Gap(12f);
            _Listing_Standard.CheckboxLabeled("Show ThreatBig", ref ShowLettersThreatBig, "True if you want to See Any ThreatBig Letters, False will Hide them. When a Letter is Shown its Name and Type will be written to the Log.");
            _Listing_Standard.CheckboxLabeled("Show ThreatSmall", ref ShowLettersThreatSmall, "True if you want to See Any ThreatSmall Letters, False will Hide them. When a Letter is Shown its Name and Type will be written to the Log.");
            _Listing_Standard.CheckboxLabeled("Show NegativeEvent", ref ShowLettersNegativeEvent, "True if you want to See Any NegativeEvent Letters, False will Hide them. When a Letter is Shown its Name and Type will be written to the Log.");
            _Listing_Standard.CheckboxLabeled("Show NeutralEvent", ref ShowLettersNeutralEvent, "True if you want to See Any NeutralEvent Letters, False will Hide them. When a Letter is Shown its Name and Type will be written to the Log.");
            _Listing_Standard.CheckboxLabeled("Show PositiveEvent", ref ShowLettersPositiveEvent, "True if you want to See Any PositiveEvent Letters, False will Hide them. When a Letter is Shown its Name and Type will be written to the Log.");
            _Listing_Standard.CheckboxLabeled("Show ItemStashFeeDemand", ref ShowLettersItemStashFeeDemand, "True if you want to See Any ItemStashFeeDemand Letters, False will Hide them. When a Letter is Shown its Name and Type will be written to the Log.");
            _Listing_Standard.Gap(12f);
            _Listing_Standard.CheckboxLabeled("Letter Names To Suppress Enabled", ref LetterNamesToSuppressEnabled, "True will Hide any Letters thats Name is in the following List, False to Ignore the List. List is Comma Separated. When a Letter is Shown its Name and Type will be written to the Log.");
            LetterNamesToSuppress = _Listing_Standard.TextEntry(LetterNamesToSuppress, 2);

            _Listing_Standard.CheckboxLabeled("Write Debug Log Letters", ref DebugLogLetters, "True if you want to Log the Letters to the Log file, useful for finding the mane so you can suppress it.");



            _Listing_Standard.GapLine(12f);

            _Listing_Standard.Label("Plant 24H:");
            _Listing_Standard.CheckboxLabeled("Plant 24H", ref Plant24HEnabled, "Enable to allow Plants to Grow 24H a day.");
            _Listing_Standard.CheckboxLabeled("Plant Lights 24H", ref PlantLights24HEnabled, "Enable to allow SunLamps to Shine 24H a day.");
            _Listing_Standard.GapLine(12f);
            _Listing_Standard.Label("Safe Trap Enabled:");
            _Listing_Standard.CheckboxLabeled("Safe Trap Enabled", ref SafeTrapEnabled, "Prevents Traps from triggering on your Colonists.");
            _Listing_Standard.GapLine(12f);
            _Listing_Standard.Label("Turret Control Enabled:");
            _Listing_Standard.CheckboxLabeled("Turret Control Enabled", ref TurretControlEnabled, "Allows force attack commands to be given to turrets.");
            _Listing_Standard.GapLine(12f);
            _Listing_Standard.Label("Hide Power Connections:");
            _Listing_Standard.CheckboxLabeled("Hide Power Connections", ref HidePowerConnections, "Hides the Small Power Connection Wires, Still show in Power overlay Mode.");
            _Listing_Standard.GapLine(12f);
            _Listing_Standard.Label("Suppress Breakdown:");
            _Listing_Standard.CheckboxLabeled("Suppress Breakdown", ref SuppressBreakdown, "Suppress random Breakdowns, This was hard to test so please let me know if you have any issues.");
            _Listing_Standard.GapLine(12f);
            //_Listing_Standard.Label("Suppress LockDevMode:");
            //_Listing_Standard.CheckboxLabeled("Suppress LockDevMode", ref LockDevMode, "Lock Dev Mode to its Current Selection.");
            //_Listing_Standard.GapLine(12f);
            _Listing_Standard.Label("Time Speed:");
            _Listing_Standard.CheckboxLabeled("Allow Speed4 Without Dev Mode", ref Speed4WithoutDev, "Allow Speed4 Without Dev Mode needing to be enabled, can be turned on by pressing '4'.");
            _Listing_Standard.CheckboxLabeled("Suppress Combat Slowdown", ref SuppressCombatSlowdown, "Suppress Limiting Speed in Combat.");

            /*
             * _Listing_Standard.GapLine(12f);
             * _Listing_Standard.Label("Blight:");
             * _Listing_Standard.Label("Blight Scale:  " + BlightScale);
             * BlightScale = (float)Math.Round((Double)_Listing_Standard.Slider(BlightScale, 1, 10), 1);
             *
             * String _CurrentBlightImageDescription = string.Empty;
             * switch (BlightImageIndex)
             * {
             *  case 0:
             *      _CurrentBlightImageDescription = "Default";
             *      break;
             *  case 1:
             *      _CurrentBlightImageDescription = "Red";
             *      break;
             *  case 2:
             *      _CurrentBlightImageDescription = "Blue";
             *      break;
             *  case 3:
             *      _CurrentBlightImageDescription = "Orange";
             *      break;
             *  case 4:
             *      _CurrentBlightImageDescription = "Purple";
             *      break;
             *  default:
             *      _CurrentBlightImageDescription = "Default";
             *      break;
             * }
             *
             *
             * Rect _BlightSelection = _Listing_Standard.GetRect(30f);
             * Widgets.Label(_BlightSelection.RightHalf(), _CurrentBlightImageDescription);
             * if (Widgets.ButtonText(_BlightSelection.LeftHalf(), "Select Blight:"))
             * {
             *  Find.WindowStack.Add(
             *      new FloatMenu(new List<FloatMenuOption> {
             *          new FloatMenuOption("Default (Green)", () => BlightImageIndex = 0),
             *          new FloatMenuOption("Red", () => BlightImageIndex = 1),
             *          new FloatMenuOption("Blue", () => BlightImageIndex = 2),
             *          new FloatMenuOption("Orange", () => BlightImageIndex = 3),
             *          new FloatMenuOption("Purple", () => BlightImageIndex = 4)
             *      }));
             * }
             *
             *
             * _Listing_Standard.GapLine(12f);
             * _Listing_Standard.Label("Suppress Stripping Cremation Corps:");
             * _Listing_Standard.CheckboxLabeled("SuppressStrippingCremationCorps", ref SuppressStrippingCremationCorps, "Stops Gear and Apparel from being removed from a Corps before Cremation, all gear will be lost.");
             */

            _Listing_Standard.GapLine(12f);
            _Listing_Standard.Label("Hide Spots:");
            _Listing_Standard.CheckboxLabeled("Hide Spots", ref HideSpots, "Stops Marriage, Caravan Packing and Party Spots from being show all the time. They will still show when Architect menu is open or one of the spots is the first thing selected. (Only checks when menu is changed)");

            _Listing_Standard.GapLine(12f);
            _Listing_Standard.Label("Suppress Roof Colapse");
            _Listing_Standard.CheckboxLabeled("Suppress Roof Colapse", ref SuppressRoofColapse, "Stops the Roof from Collapsing when support Pillars are removed.");

            _Listing_Standard.GapLine(12f);
            _Listing_Standard.Label("Suppress Rain Fire");
            _Listing_Standard.CheckboxLabeled("Suppress Rain Fire", ref SuppressRainFire, "Stops Fires from Causing Rain, Warning can burn the whole map and large fires can cause lag when they are burning.");

            _Listing_Standard.NewColumn();
            _Listing_Standard.GapLine(12f);

            _Listing_Standard.Label("Log File");
            //_Listing_Standard.Label("Current Check Size:" + LogFileSizeThresholdMB + " MB.");
            //_Listing_Standard.CheckboxLabeled("Check Log File Size", ref CheckLogFileSize, "Checks once every Ingame Day the Size of the Log File, raises an Alert if the Size is > " + LogFileSizeThresholdMB.ToString() + " MB.");
            //_Listing_Standard.IntAdjuster(ref LogFileSizeThresholdMB, 10, 10);
            _Listing_Standard.CheckboxLabeled("Supress Writing Log to File-Tooltip", ref SupressWritingToLogFile, "When Checked log messages will no longer be written to disk.If you are using this because your log file is getting massive that indicated errors that you should really fix(or report to mod/ game developers to fix). But if you are not going to do that then you may as well use this so you don’t have to deal with Multi GB Log files cluttering you HDD/ SSD and wearing them out and it might even increase performance ingame for you, but really it would be better if you could go fix the errors.");
            _Listing_Standard.GapLine(12f);

            _Listing_Standard.Label("Learning Speed Percentages:");

            _Listing_Standard.CheckboxLabeled("Learning Changes", ref ApplyLearnChanges, "Must be enabled to apply the following settings.");
            if (ApplyLearnChanges)
            {
                DrawPassionPercentage(_Listing_Standard, "No Passion%: ", ref LearnFactorPassionNonePercentage, ref _Buffer_LearnFactorPassionNone, 35);
                DrawPassionPercentage(_Listing_Standard, "Minor Pass%: ", ref LearnFactorPassionMinorPercentage, ref _Buffer_LearnFactorPassionMinor, 100);
                DrawPassionPercentage(_Listing_Standard, "Major Pass%: ", ref LearnFactorPassionMajorPercentage, ref _Buffer_LearnFactorPassionMajor, 150);
                DrawPassionPercentage(_Listing_Standard, "Daily Cap: ", ref DailyLearningSaturationAmmount, ref _Buffer_DailyLearningSaturationAmmount, 4000);

                _Listing_Standard.CheckboxLabeled("Stop Decay and GreatMemory Trait", ref PreventSkillDecay, "Stops Skill Decay and GreatMemory Trait.");
            }

            _Listing_Standard.GapLine(12f);
            _Listing_Standard.End();
        }