public virtual bool DoGUI(Rect rect, bool colonistOrdering, FloatMenu floatMenu) { Rect rect2 = rect; float height = rect2.height; rect2.height = height - 1f; bool flag = !Disabled && Mouse.IsOver(rect2); bool flag2 = false; Text.Font = CurrentFont; Rect rect3 = rect; rect3.xMin += 4f; rect3.xMax = rect.x + 27f; rect3.yMin += 4f; rect3.yMax = rect.y + 27f; if (flag) { rect3.x += 4f; } Rect rect4 = rect; rect4.xMin += HorizontalMargin; rect4.xMax -= HorizontalMargin; rect4.xMax -= 4f; rect4.xMax -= extraPartWidth + IconOffset; rect4.x += IconOffset; if (flag) { rect4.x += 4f; } Rect rect5 = default(Rect); if (extraPartWidth != 0f) { float num = Mathf.Min(Text.CalcSize(Label).x, rect4.width - 4f); rect5 = new Rect(rect4.xMin + num, rect4.yMin, extraPartWidth, 30f); flag2 = Mouse.IsOver(rect5); } if (!Disabled) { MouseoverSounds.DoRegion(rect2); } Color color = GUI.color; if (Disabled) { GUI.color = ColorBGDisabled * color; } else if (flag && !flag2) { GUI.color = ColorBGActiveMouseover * color; } else { GUI.color = ColorBGActive * color; } GUI.DrawTexture(rect, BaseContent.WhiteTex); GUI.color = ((!Disabled) ? ColorTextActive : ColorTextDisabled) * color; if (sizeMode == FloatMenuSizeMode.Tiny) { rect4.y += 1f; } Widgets.DrawAtlas(rect, TexUI.FloatMenuOptionBG); Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(rect4, Label); Text.Anchor = TextAnchor.UpperLeft; GUI.color = iconColor; if (shownItem != null || drawPlaceHolderIcon) { Widgets.DefIcon(rect3, shownItem, null, 1f, drawPlaceHolderIcon); } else if ((bool)itemIcon) { GUI.DrawTexture(rect3, itemIcon); } GUI.color = color; if (extraPartOnGUI != null) { bool num2 = extraPartOnGUI(rect5); GUI.color = color; if (num2) { return(true); } } if (flag && mouseoverGuiAction != null) { mouseoverGuiAction(); } if (tutorTag != null) { UIHighlighter.HighlightOpportunity(rect, tutorTag); } if (Widgets.ButtonInvisible(rect2)) { if (tutorTag != null && !TutorSystem.AllowAction(tutorTag)) { return(false); } Chosen(colonistOrdering, floatMenu); if (tutorTag != null) { TutorSystem.Notify_Event(tutorTag); } return(true); } return(false); }
public virtual bool DoGUI(Rect rect, bool colonistOrdering, FloatMenu floatMenu) { Rect rect2 = rect; rect2.height -= 1f; bool flag = !this.Disabled && Mouse.IsOver(rect2); bool flag2 = false; Text.Font = this.CurrentFont; Rect rect3 = rect; rect3.xMin += this.HorizontalMargin; rect3.xMax -= this.HorizontalMargin; rect3.xMax -= 4f; rect3.xMax -= this.extraPartWidth; if (flag) { rect3.x += 4f; } Rect rect4 = default(Rect); if (this.extraPartWidth != 0f) { float num = Mathf.Min(Text.CalcSize(this.Label).x, rect3.width - 4f); rect4 = new Rect(rect3.xMin + num, rect3.yMin, this.extraPartWidth, 30f); flag2 = Mouse.IsOver(rect4); } if (!this.Disabled) { MouseoverSounds.DoRegion(rect2); } Color color = GUI.color; if (this.Disabled) { GUI.color = FloatMenuOption.ColorBGDisabled * color; } else if (flag && !flag2) { GUI.color = FloatMenuOption.ColorBGActiveMouseover * color; } else { GUI.color = FloatMenuOption.ColorBGActive * color; } GUI.DrawTexture(rect, BaseContent.WhiteTex); GUI.color = (this.Disabled ? FloatMenuOption.ColorTextDisabled : FloatMenuOption.ColorTextActive) * color; if (this.sizeMode == FloatMenuSizeMode.Tiny) { rect3.y += 1f; } Widgets.DrawAtlas(rect, TexUI.FloatMenuOptionBG); Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(rect3, this.Label); Text.Anchor = TextAnchor.UpperLeft; GUI.color = color; if (this.extraPartOnGUI != null) { bool flag3 = this.extraPartOnGUI(rect4); GUI.color = color; if (flag3) { return(true); } } if (flag && this.mouseoverGuiAction != null) { this.mouseoverGuiAction(); } if (this.tutorTag != null) { UIHighlighter.HighlightOpportunity(rect, this.tutorTag); } if (!Widgets.ButtonInvisible(rect2, false)) { return(false); } if (this.tutorTag != null && !TutorSystem.AllowAction(this.tutorTag)) { return(false); } this.Chosen(colonistOrdering, floatMenu); if (this.tutorTag != null) { TutorSystem.Notify_Event(this.tutorTag); } return(true); }