protected override void FillTab() { ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame); Text.Font = GameFont.Small; Rect position = new Rect(0f, 0f, this.size.x, this.size.y).ContractedBy(20f); bool isPrisonerOfColony = base.SelPawn.IsPrisonerOfColony; try { GUI.BeginGroup(position); float num = 10f; Rect rect = new Rect(10f, num, position.width - 20f, 32f); MedicalCareUtility.MedicalCareSetter(rect, ref base.SelPawn.playerSettings.medCare); num += 32f; num += 18f; Rect rect2 = new Rect(10f, num, position.width - 28f, position.height - num); bool getsFood = base.SelPawn.guest.GetsFood; num += WidgetDrawer.DrawLabeledCheckbox(rect2, "GetsFood".Translate(), ref getsFood); base.SelPawn.guest.GetsFood = getsFood; if (isPrisonerOfColony) { num += 6f; int length = Enum.GetValues(typeof(PrisonerInteractionMode)).Length; float height = (float)(length * 28 + 20); Rect rect3 = new Rect(0f, num, position.width, height); TabDrawer.DrawBox(rect3); Rect rect4 = rect3.ContractedBy(10f); rect4.height = 28f; IEnumerator enumerator = Enum.GetValues(typeof(PrisonerInteractionMode)).GetEnumerator(); while (enumerator.MoveNext()) { PrisonerInteractionMode prisonerInteractionMode = (PrisonerInteractionMode)((byte)enumerator.Current); if (WidgetDrawer.DrawLabeledRadioButton(rect4, prisonerInteractionMode.GetLabel(), base.SelPawn.guest.interactionMode == prisonerInteractionMode, true)) { base.SelPawn.guest.interactionMode = prisonerInteractionMode; } rect4.y += 28f; } Rect rect5 = new Rect(rect3.x, rect3.y + rect3.height + 5f, rect3.width - 4f, 28f); Text.Anchor = TextAnchor.UpperRight; Widgets.Label(rect5, "RecruitmentDifficulty".Translate() + ": " + base.SelPawn.guest.RecruitDifficulty.ToString("##0")); Text.Anchor = TextAnchor.UpperLeft; } } finally { GUI.EndGroup(); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; } if (this.PreferenceTabBrowseButtons != null && this.PreferenceTabBrowseButtons.Value) { Pawn selPawn = base.SelPawn; if (selPawn != null) { BrowseButtonDrawer.DrawBrowseButtons(this.size, selPawn); } } }
public void OnGUI(float positionX, ref float positionY, float width) { bool disabled = this.Disabled; if (disabled) { GUI.color = Dialog_InterfaceOptions.DisabledControlColor; } if (!string.IsNullOrEmpty(this.Name)) { string text = this.Name.Translate(); float num = Text.CalcHeight(text, width); Rect rect = new Rect(positionX, positionY, width, num); Widgets.Label(rect, text); if (this.Tooltip != null) { TipSignal tip = new TipSignal(() => this.Tooltip.Translate(), this.TooltipId); TooltipHandler.TipRegion(rect, tip); } positionY += num + Dialog_InterfaceOptions.PreferencePadding.y; } float num2 = (!this.Indent) ? 0f : Dialog_InterfaceOptions.IndentSize; foreach (string current in this.OptionValues) { string text2 = this.OptionTranslated(current); if (!string.IsNullOrEmpty(text2)) { float num3 = Text.CalcHeight(text2, width - MultipleSelectionStringOptionsPreference.LabelMargin - num2); Rect rect2 = new Rect(positionX - 4f + num2, positionY - 3f, width + 6f - num2, num3 + 5f); if (Mouse.IsOver(rect2)) { Widgets.DrawHighlight(rect2); } Rect rect3 = new Rect(positionX + num2, positionY, width - num2, num3); bool flag = this.IsOptionSelected(current); bool flag2 = flag; WidgetDrawer.DrawLabeledCheckbox(rect3, text2, ref flag); if (flag != flag2) { this.UpdateOption(current, flag); } positionY += num3 + Dialog_InterfaceOptions.PreferencePadding.y; } } positionY -= Dialog_InterfaceOptions.PreferencePadding.y; GUI.color = Color.white; }
public static bool DrawLabeledRadioButton(Rect rect, string labelText, bool chosen, bool playSound) { TextAnchor anchor = Text.Anchor; Text.Anchor = TextAnchor.MiddleLeft; Rect rect2 = new Rect(rect.x, rect.y - 2f, rect.width, rect.height); Widgets.Label(rect2, labelText); Text.Anchor = anchor; bool flag = Widgets.InvisibleButton(rect); if (playSound && flag && !chosen) { SoundDefOf.RadioButtonClicked.PlayOneShotOnCamera(); } Vector2 topLeft = new Vector2(rect.x + rect.width - 32f, rect.y + rect.height / 2f - 16f); WidgetDrawer.DrawRadioButton(topLeft, chosen); return(flag); }
public static float DrawLabeledCheckbox(Rect rect, string labelText, ref bool value) { return(WidgetDrawer.DrawLabeledCheckbox(rect, labelText, ref value, false)); }
protected override void FillTab() { if (this.rightClicked != null && this.infoFloatMenu != null && Find.WindowStack.Top() != this.infoFloatMenu) { this.rightClicked = null; this.infoFloatMenu = null; } Text.Font = GameFont.Small; IPlantToGrowSettable plantToGrowSettable = (IPlantToGrowSettable)Find.Selector.SelectedObjects.First <object>(); Rect position = new Rect(ITab_Growing_Alternate.PaddingSize.x, ITab_Growing_Alternate.PaddingSize.y, ITab_Growing_Alternate.ContentSize.x, ITab_Growing_Alternate.ContentSize.y); GUI.BeginGroup(position); Rect viewRect = new Rect(0f, 0f, position.width, position.height); this.scrollView.Begin(viewRect); float num = 0f; int num2 = 0; foreach (ThingDef current in GenPlant.ValidPlantTypesForGrower(Find.Selector.SingleSelectedObject)) { float num3 = Text.CalcHeight(current.LabelCap, ITab_Growing_Alternate.ContentSize.x - 32f); if (num3 < 30f) { num3 = 30f; } GUI.color = Color.white; Rect rect = new Rect(0f, num + 1f, ITab_Growing_Alternate.ContentSize.x - 28f, num3); Rect position2 = new Rect(0f, rect.y - 1f, rect.width, rect.height + 2f); Vector2 mousePosition = Event.current.mousePosition; if (position2.Contains(mousePosition) && mousePosition.y > this.scrollView.Position.y && mousePosition.y < this.scrollView.Position.y + this.scrollView.ViewHeight) { GUI.DrawTexture(position2, TexUI.HighlightTex); } else if (num2 % 2 == 0) { GUI.DrawTexture(position2, TabDrawer.AlternateRowTexture); } rect.x += 6f; rect.y += 3f; rect.width -= 4f; Widgets.InfoCardButton(rect.x, rect.y, current); rect.x += 34f; rect.width -= 34f; if ((Widgets.InvisibleButton(new Rect(rect.x, rect.y, rect.width - 36f, rect.height)) || WidgetDrawer.DrawLabeledRadioButton(rect, current.LabelCap, current == plantToGrowSettable.GetPlantDefToGrow(), false)) && plantToGrowSettable.GetPlantDefToGrow() != current) { plantToGrowSettable.SetPlantDefToGrow(current); SoundDefOf.RadioButtonClicked.PlayOneShotOnCamera(); ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.SetGrowingZonePlant, KnowledgeAmount.Total); } num += num3; num += 2f; num2++; } this.scrollView.End(num); TutorUIHighlighter.HighlightOpportunity("GrowingZoneSetPlant", new Rect(0f, 0f, ITab_Growing_Alternate.ContentSize.x, num)); GUI.EndGroup(); }