public override void DoSettingsWindowContents(Rect inRect) { Listing_Standard listing = new Listing_Standard(); listing.Begin(inRect); // wanderMultiplier listing.Label("DSFI_ConfigWanderMultiplier".Translate(), tooltip: "DSFI_TT_ConfigWanderMultiplier".Translate()); settings.wanderMultiplier = Widgets.HorizontalSlider(listing.GetRect(22f), settings.wanderMultiplier, 0.01f, 2f, false, rightAlignedLabel: string.Format("{0:f2}", settings.wanderMultiplier)); listing.Gap(); // wanderMovePolicy listing.Label("DSFI_ConfigWanderMovePolicy".Translate()); bool wanderMoveWalk = settings.wanderMovePolicy == LocomotionUrgency.Walk; Widgets.CheckboxLabeled(listing.GetRect(22f), "DSFI_ConfigWanderMovePolicy_Walk".Translate(), ref wanderMoveWalk); if (wanderMoveWalk) { settings.wanderMovePolicy = LocomotionUrgency.Walk; } bool wanderMoveRun = settings.wanderMovePolicy == LocomotionUrgency.Jog; Widgets.CheckboxLabeled(listing.GetRect(22f), "DSFI_ConfigWanderMovePolicy_Run".Translate(), ref wanderMoveRun); if (wanderMoveRun) { settings.wanderMovePolicy = LocomotionUrgency.Jog; } listing.End(); base.DoSettingsWindowContents(inRect); }
public static void DoTrainableCheckbox(Rect rect, Pawn pawn, TrainableDef td, AcceptanceReport canTrain, bool drawLabel, bool doTooltip) { bool flag = pawn.training.HasLearned(td); bool checkOn = pawn.training.GetWanted(td); bool flag2 = checkOn; Texture2D texChecked = (!flag) ? null : LearnedTrainingTex; Texture2D texUnchecked = (!flag) ? null : LearnedNotTrainingTex; if (drawLabel) { Widgets.CheckboxLabeled(rect, td.LabelCap, ref checkOn, !canTrain.Accepted, texChecked, texUnchecked); } else { Widgets.Checkbox(rect.position, ref checkOn, rect.width, !canTrain.Accepted, paintable: true, texChecked, texUnchecked); } if (checkOn != flag2) { PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.AnimalTraining, KnowledgeAmount.Total); pawn.training.SetWantedRecursive(td, checkOn); } if (doTooltip) { DoTrainableTooltip(rect, pawn, td, canTrain); } }
public override void DoContent(IEnumerable <Pawn> pawns, Rect rect, Action notifySelectionBegan, Action notifySelectionEnded) { if (allApparel == null) { allApparel = DefDatabase <ThingDef> .AllDefs.Where(def => def.IsApparel); } Text.Font = GameFont.Small; Widgets.CheckboxLabeled(rect.TopPartPixels(25), "Locks2ApparelFilter".Translate(), ref enabled); Text.Font = GameFont.Tiny; if (enabled) { Widgets.Label(rect.TopPartPixels(50).BottomPartPixels(25), "Locks2ApparelFilterBody".Translate()); var rowRect = rect.TopPartPixels(75).BottomPartPixels(25); removalSet.Clear(); foreach (ThingDef def in apparelSet) { if (Widgets.ButtonText(rowRect, def.label)) { removalSet.Add(def); Find.CurrentMap.reachability.ClearCache(); } rowRect.y += 25; } foreach (ThingDef def in removalSet) { apparelSet.Remove(def); } if (Widgets.ButtonText(rowRect, "+")) { Find.CurrentMap.reachability.ClearCache(); notifySelectionBegan.Invoke(); DoExtraContent((def) => apparelSet.Add(def), allApparel.Where(def => !apparelSet.Contains(def)), notifySelectionEnded); } } }
public static void CheckboxGroupLabeled(this Listing_Standard ls, string label, string tooltip, string cbLabel1, ref bool cbCheckOn1, string cbTooltip1, string cbLabel2, ref bool cbCheckOn2, string cbTooltip2) { // Backup original values TextAnchor backupAnchor = Text.Anchor; // Wrapper Rect rectWrapper = ls.GetRect(BaseLineHeight); Rect rectLeft = rectWrapper.LeftPart(0.5f).Rounded(); Rect rectRight = rectWrapper.RightPart(0.5f).Rounded(); if (tooltip != null) { TooltipHandler.TipRegion(rectLeft, tooltip); } // Left Text.Anchor = TextAnchor.MiddleLeft; if (label != null) { Widgets.Label(rectLeft, label); } // Right Text.Anchor = TextAnchor.MiddleRight; // Left checkbox Rect rectInnerLeft = rectRight.LeftPart(0.5f).RightPartPixels(Text.CalcSize(cbLabel1).x + 24f + 12f).Rounded(); TooltipHandler.TipRegion(rectInnerLeft, cbTooltip1); Widgets.CheckboxLabeled(rectInnerLeft, cbLabel1, ref cbCheckOn1); // Right checkbox Rect rectInnerRight = rectRight.RightPart(0.5f).RightPartPixels(Text.CalcSize(cbLabel2).x + 24f + 12f).Rounded(); TooltipHandler.TipRegion(rectInnerRight, cbTooltip2); Widgets.CheckboxLabeled(rectInnerRight, cbLabel2, ref cbCheckOn2); // Restore original values Text.Anchor = backupAnchor; }
// RimWorld.ScenPart_PawnModifier protected void DoVampModifierEditInterface(Rect rect) { Rect rect2 = new Rect(rect.x, rect.y + RowHeight, rect.width, 31); Text.Anchor = TextAnchor.MiddleCenter; Widgets.Label(rect2, "ROMV_VampireGeneration".Translate(generationRange.min + "-" + generationRange.max)); Rect rect3 = new Rect(rect.x, rect.y + RowHeight * 2, rect.width, 31); Widgets.IntRange(rect3, 21, ref generationRange, 1, 13, "", 0); //HorizontalSlider(rect3, vampChance, 0f, 1f, false, "", "", ""); //Widgets.TextFieldNumeric<float>(rect4, ref this, ref this.numOfVampsBuffer, 1, 50); Rect rect5 = new Rect(rect.x, rect.y + RowHeight * 3, rect.width, 31); Rect rect6 = rect5.LeftPart(0.333f).Rounded(); Rect rect7 = rect5.RightPart(0.666f).Rounded(); Text.Anchor = TextAnchor.MiddleRight; Widgets.Label(rect6, "ROMV_StartInCoffins".Translate()); Text.Anchor = TextAnchor.UpperLeft; Widgets.CheckboxLabeled(rect7, "", ref spawnInCoffins); Rect rect8 = new Rect(rect.x, rect.y + RowHeight * 4, rect.width, 31); Rect rect9 = rect8.LeftPart(0.666f).Rounded(); Rect rect10 = rect8.RightPart(0.333f).Rounded(); Text.Anchor = TextAnchor.MiddleRight; Widgets.Label(rect9, "ROMV_MaxVampires".Translate()); Text.Anchor = TextAnchor.UpperLeft; Widgets.TextFieldNumeric(rect10, ref maxVampires, ref maxVampiresBuf, 1, 100); }
public void LabelCheckboxDebug(string label, ref bool checkOn) { Text.Font = GameFont.Tiny; NewColumnIfNeeded(22f); Widgets.CheckboxLabeled(new Rect(curX, curY, base.ColumnWidth, 22f), label, ref checkOn); Gap(22f + verticalSpacing); }
// RimWorld.ScenPart_PawnModifier protected void DoVampModifierEditInterface(Rect rect) { Rect rect2 = new Rect(rect.x, rect.y + ScenPart.RowHeight * 2, rect.width, 31); Rect rect3 = rect2.LeftPart(0.333f).Rounded(); Rect rect4 = rect2.RightPart(0.666f).Rounded(); Text.Anchor = TextAnchor.MiddleRight; Widgets.Label(rect3, "ROMV_Chance".Translate()); Text.Anchor = TextAnchor.UpperLeft; this.vampChance = Widgets.HorizontalSlider(rect4, this.vampChance, 0f, 1f, false, "", "", ""); //Widgets.TextFieldNumeric<float>(rect4, ref this, ref this.numOfVampsBuffer, 1, 50); Rect rect5 = new Rect(rect.x, rect.y + ScenPart.RowHeight * 3, rect.width, 31); Rect rect6 = rect5.LeftPart(0.333f).Rounded(); Rect rect7 = rect5.RightPart(0.666f).Rounded(); Text.Anchor = TextAnchor.MiddleRight; Widgets.Label(rect6, "ROMV_StartInCoffins".Translate()); Text.Anchor = TextAnchor.UpperLeft; Widgets.CheckboxLabeled(rect7, "", ref this.spawnInCoffins, false); Rect rect8 = new Rect(rect.x, rect.y + ScenPart.RowHeight * 4, rect.width, 31); Rect rect9 = rect8.LeftPart(0.666f).Rounded(); Rect rect10 = rect8.RightPart(0.333f).Rounded(); Text.Anchor = TextAnchor.MiddleRight; Widgets.Label(rect9, "ROMV_MaxVampires".Translate()); Text.Anchor = TextAnchor.UpperLeft; Widgets.TextFieldNumeric <int>(rect10, ref this.maxVampires, ref this.maxVampiresBuf, 1, 100); }
static void ShowTyranid(ref Listing_Standard listing_Standard, Rect rect2, AMXBSettings settings) { listing_Standard.BeginSection(60f); Widgets.CheckboxLabeled(rect2.TopHalf().LeftHalf().ContractedBy(4), "AMXB_AllowTyranid".Translate() + (!DefDatabase <FactionDef> .AllDefs.Any(x => x.defName.Contains("OG_Tyranid")) ? "AMXB_NotYetAvailable".Translate() : "AMXB_HiddenFaction".Translate()), ref settings.AllowTyranid, !DefDatabase <FactionDef> .AllDefs.Any(x => x.defName.Contains("OG_Tyranid"))); Widgets.CheckboxLabeled(rect2.TopHalf().RightHalf().ContractedBy(4), "AMXB_AllowTyranidInfestation".Translate(), ref settings.AllowTyranidInfestation, !DefDatabase <IncidentDef> .AllDefs.Any(x => x.defName.Contains("OG_Tyranid_Infestation"))); listing_Standard.EndSection(listing_Standard); }
//public override void DoWindowContents(Rect inRect) public static void Postfix(Rect inRect) { Rect botRect = inRect.BottomPartPixels(Text.LineHeight); botRect.y -= 40f; //CloseButSize Widgets.CheckboxLabeled(botRect, "TD.DefaultSurgeryUnlimited".Translate(), ref SurgeryUnlimitedGameComponent.Get().surgeryUnlimitedDefault); }
public static void DoTrainableCheckbox(Rect rect, Pawn pawn, TrainableDef td, AcceptanceReport canTrain, bool drawLabel, bool doTooltip) { if (pawn.training.IsCompleted(td)) { if (!drawLabel) { GUI.DrawTexture(rect, TrainingCardUtility.TrainedTrainableTex); } } else { bool wanted = pawn.training.GetWanted(td); bool flag = wanted; if (drawLabel) { Widgets.CheckboxLabeled(rect, td.LabelCap, ref wanted, !canTrain.Accepted); } else { Widgets.Checkbox(rect.position, ref wanted, rect.width, !canTrain.Accepted); } if (wanted != flag) { PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.AnimalTraining, KnowledgeAmount.Total); pawn.training.SetWantedRecursive(td, wanted); } } if (doTooltip) { TrainingCardUtility.DoTrainableTooltip(rect, pawn, td, canTrain); } }
private void DoManualPrioritiesCheckbox() { Text.Font = GameFont.Small; GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; Rect rect = new Rect(5f, 5f, 140f, 30f); bool useWorkPriorities = Current.Game.playSettings.useWorkPriorities; Widgets.CheckboxLabeled(rect, "ManualPriorities".Translate(), ref Current.Game.playSettings.useWorkPriorities); if (useWorkPriorities != Current.Game.playSettings.useWorkPriorities) { foreach (Pawn item in PawnsFinder.AllMapsWorldAndTemporary_Alive) { if (item.Faction == Faction.OfPlayer && item.workSettings != null) { item.workSettings.Notify_UseWorkPrioritiesChanged(); } } } if (Current.Game.playSettings.useWorkPriorities) { GUI.color = new Color(1f, 1f, 1f, 0.5f); Text.Font = GameFont.Tiny; Widgets.Label(new Rect(rect.x, rect.y + rect.height + 4f, rect.width, 60f), "PriorityOneDoneFirst".Translate()); Text.Font = GameFont.Small; GUI.color = Color.white; } if (!Current.Game.playSettings.useWorkPriorities) { UIHighlighter.HighlightOpportunity(rect, "ManualPriorities-Off"); } }
public void DoWindowContents(Rect inRect) { Listing_Standard listing_Standard = new Listing_Standard(); Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, scrollViewHeight); listing_Standard.BeginScrollView(inRect, ref scrollPosition, ref viewRect); Widgets.Label(listing_Standard.GetRect(25f), "Total worker threads (recommendation 1-2 per CPU core):"); Widgets.IntEntry(listing_Standard.GetRect(37f), ref maxThreads, ref maxThreadsBuffer); Widgets.Label(listing_Standard.GetRect(25f), "Timeout (in miliseconds) waiting for threads (default: 8000):"); Widgets.IntEntry(listing_Standard.GetRect(37f), ref timeoutMS, ref timeoutMSBuffer, 100); Widgets.Label(listing_Standard.GetRect(25f), "Timespeed Normal (multiply by 60 for Max TPS):"); Widgets.TextFieldNumeric(listing_Standard.GetRect(30f), ref timeSpeedNormal, ref timeSpeedNormalBuffer); Widgets.Label(listing_Standard.GetRect(25f), "Timespeed Fast (multiply by 60 for Max TPS):"); Widgets.TextFieldNumeric(listing_Standard.GetRect(30f), ref timeSpeedFast, ref timeSpeedFastBuffer); Widgets.Label(listing_Standard.GetRect(25f), "Timespeed Superfast (multiply by 60 for Max TPS):"); Widgets.TextFieldNumeric(listing_Standard.GetRect(30f), ref timeSpeedSuperfast, ref timeSpeedSuperfastBuffer); Widgets.Label(listing_Standard.GetRect(25f), "Timespeed Ultrafast (multiply by 60 for Max TPS):"); Widgets.TextFieldNumeric(listing_Standard.GetRect(30f), ref timeSpeedUltrafast, ref timeSpeedUltrafastBuffer); Widgets.CheckboxLabeled(listing_Standard.GetRect(27f), "Disable alert updates at 4x speed:", ref disablesomealerts); Widgets.CheckboxLabeled(listing_Standard.GetRect(27f), "Disable thread/worker limit (debugging):", ref disablelimits); Widgets.CheckboxLabeled(listing_Standard.GetRect(27f), "Disable slowdown on combat:", ref disableforcedslowdowns); Widgets.CheckboxLabeled(listing_Standard.GetRect(27f), "Show alert when conflicting mods are detected:", ref showModConflictsAlert); Widgets.CheckboxLabeled(listing_Standard.GetRect(27f), "Show console warning when thread took over 200ms:", ref show200mswarning); Widgets.TextAreaScrollable(listing_Standard.GetRect(300f), modsText, ref scrollPos); listing_Standard.EndScrollView(ref viewRect); scrollViewHeight = viewRect.height; }
private void PrintAutoCheckbox(string text, ref bool value, ref float currentX, ref Rect rect, bool defaultValue = false) { var textWidth = Text.CalcSize(text).x + 25f; Widgets.CheckboxLabeled(new Rect(currentX, rect.y, textWidth, 30), text, ref value, defaultValue); currentX += textWidth + 25f; }
public override void DoWindowContents(Rect canvas) { GUI.BeginGroup(canvas); Text.Font = GameFont.Small; float num = 0f; Settings.Instance.planetCoverageCustom = Traverse.Create(root: page_ref).Field(name: "planetCoverage").GetValue <float>(); Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetCoverage".Translate()); Rect rect3 = new Rect(200f, num, 200f, 30f); if (Widgets.ButtonText(rect3, Settings.Instance.planetCoverageCustom.ToStringPercent())) { List <FloatMenuOption> list = new List <FloatMenuOption>(); float[] array = Prefs.DevMode ? PlanetCoveragesDev : PlanetCoverages; foreach (float coverage in array) { string text = coverage.ToStringPercent(); if (coverage == 0.05f) { text += " (dev)"; } if (coverage >= 0.07f && coverage < .3f) { text += " (RimWar)"; } FloatMenuOption item = new FloatMenuOption(text, delegate { if (Settings.Instance.planetCoverageCustom != coverage) { Settings.Instance.planetCoverageCustom = coverage; Traverse.Create(root: page_ref).Field(name: "planetCoverage").SetValue(Settings.Instance.planetCoverageCustom); } }); list.Add(item); } Find.WindowStack.Add(new FloatMenu(list)); } TooltipHandler.TipRegionByKey(new Rect(0f, num, rect3.xMax, rect3.height), "PlanetCoverageTip"); num += 40f; Rect rect7 = new Rect(0f, num, 400f, 30f); Widgets.CheckboxLabeled(rect7, "RW_playerVSworld".Translate(), ref Settings.Instance.playerVS, false); TooltipHandler.TipRegion(rect7, "RW_playerVSworldInfo".Translate()); num += 40f; Rect rect8 = new Rect(0f, num, 400f, 30f); Widgets.CheckboxLabeled(rect8, "RW_randomizeFactionRelations".Translate(), ref Settings.Instance.randomizeFactionBehavior, false); TooltipHandler.TipRegion(rect8, "RW_randomizeFactionRelationsInfo".Translate()); num += 40f; Rect rect9 = new Rect(0f, num, 400f, 30f); Widgets.CheckboxLabeled(rect9, "RW_randomizeFactionAttributes".Translate(), ref Settings.Instance.randomizeAttributes, false); TooltipHandler.TipRegion(rect9, "RW_randomizeFactionAttributesInfo".Translate()); num += 40f; Rect rect10 = new Rect(0f, num, 400f, 30f); Widgets.CheckboxLabeled(rect10, "RW_useRimWarVictory".Translate(), ref Settings.Instance.useRimWarVictory, false); TooltipHandler.TipRegion(rect10, "RW_useRimWarVictoryInfo".Translate()); GUI.EndGroup(); }
public static void DrawCheckboxRestartIfApplied(Rect rect, string label, string tip, ref bool checkOn) { if ((resetFlags & (1 << resetFlagPtr)) > 0) { checkOn = !checkOn; resetFlags ^= 1 << resetFlagPtr; } resetFlagPtr++; bool flag = checkOn; Widgets.CheckboxLabeled(rect, label, ref checkOn); TooltipHandler.TipRegion(rect, tip); if (flag != checkOn) { int i = resetFlagPtr - 1; if ((RuntimeGC.Settings.restartFlags & (1 << i)) > 0) { RuntimeGC.Settings.restartFlags ^= 1 << i; return; } Dialog_MessageBox dlg = new Dialog_MessageBox("DlgTextRestartNotice".Translate(), "OK".Translate(), delegate { RuntimeGC.Settings.restartFlags |= 1 << i; }, "UndoChange".Translate(), delegate { resetFlags |= 1 << i; }, "DlgTitleRestart".Translate()); Find.WindowStack.Add(dlg); } }
private void DoRow(Listing listing, DefState <T> state, int reorderableGroup, bool isCheckbox) { var rect = listing.GetRect(26f); ReorderableWidget.Reorderable(reorderableGroup, rect); Widgets.DrawAtlas(rect, Widgets.ButtonSubtleAtlas); rect.xMin += 28f; if (isCheckbox) { var wasEnabled = state.Enabled; Widgets.CheckboxLabeled(rect, state.Def.LabelCap, ref state.Enabled); if (state.Enabled != wasEnabled) { _applyChanges(); } } else { Widgets.Label(rect, state.Def.LabelCap); } }
private void DoMessagesPage(Rect rect) { rect.yMin += 10f; Widgets.CheckboxLabeled(new Rect(rect.x, rect.y, 200f, 30f), "ShowLetters".Translate(), ref showLetters, disabled: false, null, null, placeCheckboxNearText: true); Widgets.CheckboxLabeled(new Rect(rect.x + 200f, rect.y, 200f, 30f), "ShowMessages".Translate(), ref showMessages, disabled: false, null, null, placeCheckboxNearText: true); rect.yMin += 40f; bool flag = false; Rect outRect = rect; Rect viewRect = new Rect(0f, 0f, outRect.width - 16f, messagesLastHeight); Widgets.BeginScrollView(outRect, ref messagesScrollPos, viewRect); float num = 0f; List <IArchivable> archivablesListForReading = Find.Archive.ArchivablesListForReading; for (int num2 = archivablesListForReading.Count - 1; num2 >= 0; num2--) { if ((showLetters || (!(archivablesListForReading[num2] is Letter) && !(archivablesListForReading[num2] is ArchivedDialog))) && (showMessages || !(archivablesListForReading[num2] is Message))) { flag = true; if (num + 30f >= messagesScrollPos.y && num <= messagesScrollPos.y + outRect.height) { DoArchivableRow(new Rect(0f, num, viewRect.width, 30f), archivablesListForReading[num2], num2); } num += 30f; } } messagesLastHeight = num; Widgets.EndScrollView(); if (!flag) { Widgets.NoneLabel(rect.yMin + 3f, rect.width, "(" + "NoMessages".Translate() + ")"); } }
private void DoRecurring(Rect rect) { Widgets.CheckboxLabeled(rect, I18n.Translate("EditReminder.Recur"), ref recur); if (recur) { var timeInputRect = rect; timeInputRect.y = rect.yMax + 5; timeInputRect.height = 30; FWidgets.Label(timeInputRect, I18n.Translate("EditReminder.RecurEvery"), anchor: TextAnchor.MiddleLeft); var dayRect = timeInputRect; dayRect.x += 120f; dayRect.width = 60f; Widgets.TextFieldNumeric(dayRect, ref recurEveryDays, ref recurEveryDaysBuffer); var dayLabelRect = dayRect; dayLabelRect.x = dayRect.xMax + 4f; FWidgets.Label(dayLabelRect, I18n.Translate("EditReminder.DaysAnd"), anchor: TextAnchor.MiddleCenter); var hourRect = dayLabelRect; hourRect.x = dayLabelRect.xMax + 4f; hourRect.width = 30f; Widgets.TextFieldNumeric(hourRect, ref recurEveryHours, ref recurEveryHoursBuffer, 0, 23); var hourLabelRect = hourRect; hourLabelRect.x = hourRect.xMax + 4f; hourLabelRect.width = 60f; FWidgets.Label(hourLabelRect, I18n.Translate("EditReminder.Hours"), anchor: TextAnchor.MiddleLeft); } }
//Small helper function to create each Checkbox as i cant pass variable directly private bool CheckboxHelper(Rect rect, Listing_Standard list, bool variable, WorkTypeDef def) { rect = list.GetRect(30f); //That seems to affect the text possition bool lstatus = variable; Widgets.CheckboxLabeled(rect, def.labelShort, ref lstatus); Rect rect2 = rect; string labeltext = "ITab_DroneStation_averageskill".Translate(); rect2.x = 400 - (10 * labeltext.Length); if (def.relevantSkills.Count > 0) { int medSkill = 0; foreach (SkillRecord skill in droneStation.DroneSeetings_skillDefs) { if (def.relevantSkills.Contains(skill.def)) { medSkill += skill.levelInt; } } rect2.y += 5; medSkill = medSkill / def.relevantSkills.Count; Widgets.Label(rect2, labeltext + medSkill); } else { Widgets.Label(rect2, "-"); } return(lstatus); }
//TODO: translate public void DisplayMainOption(Rect inRect) { Rect r = new Rect(inRect.xMin, inRect.yMin, inRect.width, inRect.height / 2); bool tmp = allowAll; Widgets.CheckboxLabeled(r, "Anyone May Take?", ref allowAll); if (Mouse.IsOver(r)) { Widgets.DrawHighlight(r); } TooltipHandler.TipRegion(r, "Check this to allow anyone to take from this storage site.\nUncheck to allow only those specifically allowed to take things here."); if (allowAll && !tmp && allowNone) { allowNone = false; } tmp = allowNone; r = new Rect(inRect.xMin, inRect.yMin + inRect.height / 2, inRect.width, inRect.height / 2); Widgets.CheckboxLabeled(r, "No one May Take?", ref allowNone); if (Mouse.IsOver(r)) { Widgets.DrawHighlight(r); } TooltipHandler.TipRegion(r, "If this is checked, NO ONE may take anything from here. This overrides everything else."); if (allowNone && !tmp && allowAll) { allowAll = false; } }
public override void DoSettingsWindowContents(Rect inRect) { Text.Font = GameFont.Small; float margin = 10; float xPos = inRect.x + margin; float yOff = inRect.y + margin; float posW = inRect.width - 2 * margin; Rect editCheckbox = new Rect(xPos, yOff, posW, 24); yOff += editCheckbox.height + 1; Rect editDescription = new Rect(xPos, yOff, posW, 24); Widgets.CheckboxLabeled(editCheckbox, "SaM_Settings_editOnBuild_label".Translate(), ref settings.editOnBuild, false); Widgets.Label(editDescription, "SaM_Settings_editOnBuild_description".Translate()); yOff += editDescription.height + 9; Rect pauseCheckbox = new Rect(xPos, yOff, posW, 24); yOff += pauseCheckbox.height + 1; Rect pauseDescription = new Rect(xPos, yOff, posW, 24); Widgets.CheckboxLabeled(pauseCheckbox, "SaM_Settings_pauseOnEdit_label".Translate(), ref settings.pauseGameOnEdit, false); Widgets.Label(pauseDescription, "SaM_Settings_pauseOnEdit_description".Translate()); }
public static void Postfix(ref Rect rect) { ITab_Storage tab = ITab_StorageFillTabsPatcher.currentTab; if (tab == null) { return; } IStoreSettingsParent storeSettingsParent = (IStoreSettingsParent)typeof(ITab_Storage).GetProperty("SelStoreSettingsParent", BindingFlags.NonPublic | BindingFlags.Instance).GetGetMethod(true).Invoke(tab, new object[0]); StorageSettings settings = storeSettingsParent.GetStoreSettings(); int limit = Limits.GetLimit(settings); bool hasLimit = limit != -1; Widgets.CheckboxLabeled(new Rect(rect.xMin, rect.yMin - 24f - 3f - 32f, rect.width / 2, 24f), "Total stack limit", ref hasLimit); if (hasLimit) { if (oldSettings != settings) { buffer = limit.ToString(); } Widgets.TextFieldNumeric <int>(new Rect(rect.xMin + (rect.width / 2) + 60f, rect.yMin - 24f - 3f - 32f, rect.width / 2 - 60f, 24f), ref limit, ref buffer, 0, max); } Limits.SetLimit(settings, hasLimit ? limit : -1); oldSettings = settings; }
// All C# based mod settings can go here. If better organization // is desired, we can set up some ContainerRow classes that are // organized by XML? But that's a lot of work. private static void CSharpSettings(Listing_Standard list) { // Style: do your section of settings and then list.GapLine(); Rect rect = list.GetRect(30); Widgets.DrawRectFast(rect, Color.gray); var tmp = Text.Font; var tmpAnc = Text.Anchor; Text.Font = GameFont.Medium; Text.Anchor = TextAnchor.MiddleCenter; Widgets.Label(rect, "PRF_Settings_C_Lite_Header".Translate()); Text.Font = tmp; Text.Anchor = tmpAnc; list.Gap(); rect = list.GetRect(20); if (Mouse.IsOver(rect)) { Widgets.DrawHighlight(rect); } TooltipHandler.TipRegion(rect, "PRF_Settings_C_Lite_ToolTip".Translate()); Widgets.CheckboxLabeled(rect, "PRF_Settings_C_Lite_Label".Translate(), ref PRF_LiteMode); list.Gap(); if (PRF_LiteMode != PRF_LiteMode_last) { PRF_CustomizeDefs.ToggleLiteMode(PRF_LiteMode); } PRF_LiteMode_last = PRF_LiteMode; }
public override void DoSettingsWindowContents(Rect rect) { Listing_Standard list = new Listing_Standard() { ColumnWidth = rect.width }; list.Begin(rect); list.Gap(); { Rect leftRect = list.GetRect(Text.LineHeight).LeftHalf().Rounded(); Widgets.CheckboxLabeled(leftRect, Static.Label_ArcadeJoyBool, ref JoySettings.ArcadesGiveXp); if (Mouse.IsOver(leftRect)) { Widgets.DrawHighlight(leftRect); } TooltipHandler.TipRegion(leftRect, Static.ToolTip_ArcadeJoyBool); } list.Gap(); { Rect fullRect = list.GetRect(Text.LineHeight); Rect leftRect = fullRect.LeftHalf().Rounded(); Rect rightRect = fullRect.RightHalf().Rounded(); Widgets.Label(leftRect, "AJO_Label_ArcadeJoyGain".Translate(JoySettings.ArcadeXpMultiplier)); if (Mouse.IsOver(leftRect)) { Widgets.DrawHighlight(leftRect); } TooltipHandler.TipRegion(leftRect, Static.ToolTip_ArcadeJoyGain); IntSlider(rightRect, ref JoySettings.ArcadeXpMultiplier, 1, 3); } list.End(); }
public override void DoSettingsWindowContents(Rect inRect) { this.settings.astartePunchingFactor = Widgets.HorizontalSlider( inRect.TopHalf().TopHalf().TopHalf().ContractedBy(4), this.settings.astartePunchingFactor, 0f, 5f, true, "Astarte Punching Power : " + this.settings.astartePunchingFactor * 100 + "% : [" + 15f * this.settings.astartePunchingFactor + "]\nDefault possible in single attack (Punch 15 at 100%)" , "0%", "500%"); this.settings.astarteSplitFactor = Widgets.HorizontalSlider( inRect.TopHalf().TopHalf().BottomHalf().ContractedBy(4), this.settings.astarteSplitFactor, 0f, 5f, true, "Astarte Spit Power : " + this.settings.astarteSplitFactor * 100 + "% : [" + 80f * this.settings.astarteSplitFactor + "]\nDefault possible in single attack (Caustic Spit 80 at 100%)" , "0%", "500%"); this.settings.scale = Widgets.HorizontalSlider(inRect.TopHalf().BottomHalf().TopHalf().ContractedBy(4), this.settings.scale, 0f, 2f, true, "Astarte Size Scaler: " + this.settings.astartePunchingFactor * 100 + "% for size of " + 3f * this.settings.scale , "0%", "200%"); // Widgets.CheckboxLabeled(inRect.TopHalf().BottomHalf().BottomHalf().LeftHalf().ContractedBy(4), "n17Rimhammer Space Marine Geneseed?\n(does not affect existing adaptus)", ref settings.n17Rimhammer); Widgets.CheckboxLabeled(inRect.TopHalf().BottomHalf().BottomHalf().RightHalf().ContractedBy(4), "Cheat Mode\n(Organs included, very easy super soldiers)", ref settings.instantTransform); Widgets.Label(inRect.BottomHalf().BottomHalf().BottomHalf(), "That's all, restart before playing to ensure your change is there. -Alice.\nSource Code Available at https://github.com/alycecil"); this.settings.Write(); }
public override void DoEditInterface(Listing_ScenEdit listing) { Rect rect = listing.GetScenPartRect(this, RowHeight * 5 + 31f); Rect[] rows = rect.SplitRows(RowHeight, 31f, 4 * RowHeight); if (Widgets.ButtonText(rows[0], hediff.LabelCap, true, false, true)) { FloatMenuUtility.MakeMenu(DefDatabase <HediffDef> .AllDefs.Where((HediffDef x) => x.scenarioCanAdd), (x) => x.LabelCap, (x) => () => { hediff = x; var maxSeverity = getMaxSeverity(x); if (severityRange.max > maxSeverity) { severityRange.max = maxSeverity; } if (severityRange.min > maxSeverity) { severityRange.min = maxSeverity; } }); } Widgets.FloatRange(rows[1], listing.CurHeight.GetHashCode(), ref severityRange, 0, getMaxSeverity(hediff), R.String.Keys.MSP_HediffSeverity); DoContextEditInterface(rows[2]); if (context == PawnModifierContext.PlayerStarter) { Rect r = rows[2].BottomPart(0.25f); Widgets.CheckboxLabeled(r, "on map only (defered)", ref hideOffMap); } }
public void ProcessAvailableEquipmentSettings() { bool tmp = ShowWeapons; float checkBoxSize = 150f; Widgets.CheckboxLabeled(new Rect(0f, 0f, checkBoxSize, 24f), "Weapons", ref ShowWeapons); if (tmp != ShowWeapons) { CalculatedAvailableEquipment.Clear(); } tmp = ShowApparel; Widgets.CheckboxLabeled(new Rect(0f, 24f, checkBoxSize, 24f), "Apparel", ref ShowApparel); if (tmp != ShowApparel) { CalculatedAvailableEquipment.Clear(); } tmp = ShowDuplicates; Widgets.CheckboxLabeled(new Rect(0f, 48f, checkBoxSize, 24f), "Duplicates", ref ShowDuplicates); if (tmp != ShowDuplicates) { CalculatedAvailableEquipment.Clear(); } x += checkBoxSize + 3f; }
public static void DrawRestrictions(Rect rect, Pawn pawn, ref float curY) { GUI.BeginGroup(rect); float y = 0.0f; Widgets.ListSeparator(ref y, rect.width, "ReligionInfo_Restrictions".Translate()); Rect rect2 = new Rect(rect.x, y, rect.width, 24f); //y += 24f; //bool mayConvertByTalking = pawn.GetReligionComponent().ReligionRestrictions.MayConvertByTalking; //Widgets.CheckboxLabeled(rect2, "ReligionInfo_RestrictAttend".Translate(), ref mayConvertByTalking); //pawn.GetReligionComponent().ReligionRestrictions.MayConvertByTalking = mayConvertByTalking; Rect rect3 = new Rect(rect.x, y, rect2.width, 24f); y += 24f; bool mayDoReligionActivities = pawn.GetReligionComponent().ReligionRestrictions.MayDoReligionActivities; Widgets.CheckboxLabeled(rect3, "ReligionInfo_DoReligionActivities".Translate(), ref mayDoReligionActivities); pawn.GetReligionComponent().ReligionRestrictions.MayDoReligionActivities = mayDoReligionActivities; Rect rect4 = new Rect(rect.x, y, rect2.width, 24f); y += 24f; bool mayPray = pawn.GetReligionComponent().ReligionRestrictions.MayPray; Widgets.CheckboxLabeled(rect4, "ReligionInfo_DoPrayings".Translate(), ref mayPray); pawn.GetReligionComponent().ReligionRestrictions.MayPray = mayPray; curY += y; GUI.EndClip(); }
public void LabelCheckboxDebug(string label, ref bool checkOn) { Text.Font = GameFont.Tiny; base.NewColumnIfNeeded(22f); Widgets.CheckboxLabeled(new Rect(this.curX, this.curY, base.ColumnWidth, 22f), label, ref checkOn, false, null, null, false); base.Gap(22f + this.verticalSpacing); }
public void DoWindowContents(Rect inRect) { Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, 1200f); Widgets.BeginScrollView(inRect, ref scrollPosition, viewRect); Listing_Standard listing_Standard = new Listing_Standard(); listing_Standard.Begin(viewRect); Widgets.Label(listing_Standard.GetRect(25f), "Total worker threads (recommendation 1-2 per CPU core):"); Widgets.IntEntry(listing_Standard.GetRect(37f), ref maxThreads, ref maxThreadsBuffer); Widgets.Label(listing_Standard.GetRect(25f), "Timeout (in miliseconds) waiting for threads (default: 8000):"); Widgets.IntEntry(listing_Standard.GetRect(37f), ref timeoutMS, ref timeoutMSBuffer, 100); Widgets.Label(listing_Standard.GetRect(25f), "Timespeed Normal (multiply by 60 for Max TPS):"); Widgets.TextFieldNumeric(listing_Standard.GetRect(30f), ref timeSpeedNormal, ref timeSpeedNormalBuffer); Widgets.Label(listing_Standard.GetRect(25f), "Timespeed Fast (multiply by 60 for Max TPS):"); Widgets.TextFieldNumeric(listing_Standard.GetRect(30f), ref timeSpeedFast, ref timeSpeedFastBuffer); Widgets.Label(listing_Standard.GetRect(25f), "Timespeed Superfast (multiply by 60 for Max TPS):"); Widgets.TextFieldNumeric(listing_Standard.GetRect(30f), ref timeSpeedSuperfast, ref timeSpeedSuperfastBuffer); Widgets.Label(listing_Standard.GetRect(25f), "Timespeed Ultrafast (multiply by 60 for Max TPS):"); Widgets.TextFieldNumeric(listing_Standard.GetRect(30f), ref timeSpeedUltrafast, ref timeSpeedUltrafastBuffer); Widgets.CheckboxLabeled(listing_Standard.GetRect(27f), "Disable alert updates at 4x speed:", ref disablesomealerts); Widgets.CheckboxLabeled(listing_Standard.GetRect(27f), "Disable forced slowdowns on events like combat:", ref disableforcedslowdowns); Widgets.TextAreaScrollable(listing_Standard.GetRect(300f), modsText, ref scrollPos); listing_Standard.End(); Widgets.EndScrollView(); }