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 float DrawLabeledCheckbox(Rect rect, string labelText, ref bool value) { return(WidgetDrawer.DrawLabeledCheckbox(rect, labelText, ref value, false)); }