public override void DoWindowContents(Rect inRect) { GUI.color = Color.white; if (HeaderLabel != null) { Text.Font = GameFont.Medium; Widgets.Label(HeaderRect, HeaderLabel.Translate()); } Text.Font = GameFont.Small; GUI.BeginGroup(ContentRect); ScrollView.Begin(ScrollRect); float cursor = 0; if (IncludeNone) { float height = Text.CalcHeight("EdB.None".Translate(), ContentSize.x - 32); if (height < 30) { height = 30; } bool isEnabled = NoneEnabledFunc(); bool isSelected = NoneSelectedFunc(); if (Widgets.RadioButtonLabeled(new Rect(0, cursor, ContentSize.x - 32, height), "EdB.None".Translate(), isSelected)) { SelectNoneAction(); } cursor += height; cursor += 2; } Rect itemRect = new Rect(0, cursor, ContentSize.x - 32, 0); foreach (T option in options) { string name = NameFunc(option); bool selected = SelectedFunc(option); bool enabled = EnabledFunc != null?EnabledFunc(option) : true; float height = Text.CalcHeight(name, ContentSize.x - 32); if (height < 30) { height = 30; } itemRect.height = height; Vector2 size = Text.CalcSize(name); if (size.x > ContentSize.x - 32) { size.x = ContentSize.x; } size.y = height; if (enabled) { GUI.color = Color.white; if (Widgets.RadioButtonLabeled(itemRect, name, selected)) { SelectAction(option); } } else { GUI.color = new Color(0.65f, 0.65f, 0.65f); Widgets.Label(new Rect(0, cursor + 2, ContentSize.x - 32, height), name); Texture2D image = Textures.TextureRadioButtonOff; Vector2 topLeft = new Vector2(itemRect.x + itemRect.width - 24, itemRect.y + itemRect.height / 2 - 12); GUI.color = new Color(1, 1, 1, 0.28f); GUI.DrawTexture(new Rect(topLeft.x, topLeft.y, 24, 24), image); GUI.color = Color.white; } if (DescriptionFunc != null) { Rect tipRect = new Rect(itemRect.x, itemRect.y, size.x, size.y); TooltipHandler.TipRegion(tipRect, DescriptionFunc(option)); } cursor += height; cursor += 2; itemRect.y = cursor; } ScrollView.End(cursor); GUI.EndGroup(); GUI.color = Color.white; GUI.BeginGroup(FooterRect); Rect buttonRect = SingleButtonRect; if (CancelButtonLabel != null) { if (Widgets.ButtonText(CancelButtonRect, CancelButtonLabel.Translate(), true, true, true)) { this.Close(true); } buttonRect = ConfirmButtonRect; } if (Widgets.ButtonText(buttonRect, ConfirmButtonLabel.Translate(), true, true, true)) { string validationMessage = ConfirmValidation(); if (validationMessage != null) { Messages.Message(validationMessage.Translate(), MessageSound.RejectInput); } else { this.Confirm(); } } GUI.EndGroup(); }