public static void DrawLines(Vector2[] points, Color[] colors, float width) { ThrowIf.ArgumentIsNull(points, "points"); ThrowIf.ArgumentIsNull(colors, "colors"); ThrowIf.False(points.Length == colors.Length, "Points and colors array must be the same length."); for (int i = 0; i < points.Length; ++i) { Vector2 start = points[i]; Vector2 end = points[MathEx.Wrap(i + 1, 0, points.Length - 1)]; Color color = colors[i]; if (Mathf.Abs(start.x - end.x) > Mathf.Abs(start.y - end.y)) { GUIEx.DrawBox(new Rect(start.x, start.y, end.x - start.x, width), color); } else { GUIEx.DrawBox(new Rect(start.x, start.y, width, end.y - start.y), color); } GUIEx.PopColor(); } }
public static bool LabelButton(string label, GUIStyle style) { Color color = Color.black; GUIStyle labelStyle = new GUIStyle(style); Rect labelRect = GUILayoutUtility.GetRect(new GUIContent(label), style); if (GUIEx.IsHovering(labelRect)) { color = Color.blue; } Rect underlineRect = labelRect; underlineRect.y = underlineRect.yMax - 2.0f; underlineRect.height = 1.0f; labelStyle.normal.textColor = color; UnityEngine.GUI.Label(labelRect, label, labelStyle); GUIEx.DrawBox(underlineRect, color); return(false); }
public static void DrawBox(Rect area, float borderSize, Color borderColor, Color backgroundColor) { GUIEx.DrawBox(area, backgroundColor); GUIEx.DrawBorder(area, borderSize, borderColor); }