Exemplo n.º 1
0
 public static void DrawBorder(Rect area, float left, float right, float top, float bottom, Color color)
 {
     GUIEx.PushColor(color);
     // Top
     UnityEngine.GUI.DrawTexture(new Rect(area.xMin + top, area.yMin, area.width - top * 2.0f, top), GUIEx.White);
     // Bottom
     UnityEngine.GUI.DrawTexture(new Rect(area.xMin + bottom, area.yMax - bottom, area.width - bottom * 2.0f, bottom),
                                 GUIEx.White);
     // Left
     UnityEngine.GUI.DrawTexture(new Rect(area.xMin, area.yMin, left, area.height), GUIEx.White);
     // Right
     UnityEngine.GUI.DrawTexture(new Rect(area.xMax - right, area.yMin, right, area.height), GUIEx.White);
     GUIEx.PopColor();
 }
Exemplo n.º 2
0
        public static bool ImageButton(Texture2D image, GUIStyle style, params GUILayoutOption[] options)
        {
            Color    color      = Color.black;
            GUIStyle labelStyle = new GUIStyle(style);

            Rect labelRect = GUILayoutUtility.GetRect(new GUIContent(image), style, options);

            if (GUIEx.IsHovering(labelRect))
            {
                color = Color.blue;
            }

            GUIEx.PushColor(color);
            UnityEngine.GUI.DrawTexture(labelRect, image, ScaleMode.ScaleToFit);
            GUIEx.PopColor();

            return(GUIEx.WasClicked(labelRect, 0));
        }
Exemplo n.º 3
0
 public static void DrawBox(Rect area, Color backgroundColor)
 {
     GUIEx.PushColor(backgroundColor);
     UnityEngine.GUI.DrawTexture(area, GUIEx.White);
     GUIEx.PopColor();
 }