Skip to content

Commit

Permalink
Merge pull request #223 from edbmods/optimize-options-dialog-render
Browse files Browse the repository at this point in the history
Options dialog rendering optimization
  • Loading branch information
edbmods authored Jul 11, 2018
2 parents b6a7c47 + 29abbc7 commit da9c9e7
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions Source/Dialog_Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,25 +163,27 @@ public override void DoWindowContents(Rect inRect) {
}
size.y = height;

if (enabled) {
GUI.color = Color.white;
if (Widgets.RadioButtonLabeled(itemRect, name, selected)) {
SelectAction(option);
if (cursor >= ScrollView.Position.y && cursor <= ScrollView.Position.y + ScrollView.ViewHeight) {
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;
}
}
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));
if (DescriptionFunc != null) {
Rect tipRect = new Rect(itemRect.x, itemRect.y, size.x, size.y);
TooltipHandler.TipRegion(tipRect, DescriptionFunc(option));
}
}

cursor += height;
Expand Down

0 comments on commit da9c9e7

Please sign in to comment.