예제 #1
0
        public static bool DrawShowButton(SO_BaseWindow windowData, GUIContent content, GUIChangeBool show, Color color, float width = -1, bool onlyActivate = false)
        {
            if (show.Value)
            {
                GUI.backgroundColor = GetColor(windowData, color);
            }
            else
            {
                GUI.backgroundColor = GetColor(windowData, Color.grey);
            }

            bool clicked;

            if (width == -1)
            {
                clicked = GUILayout.Button(content, GUILayout.Height(20));
            }
            else
            {
                clicked = GUILayout.Button(content, GUILayout.Width(width), GUILayout.Height(20));
            }
            if (clicked)
            {
                if (onlyActivate)
                {
                    show.Value = true;
                }
                else
                {
                    show.Value = !show.Value;
                }
            }

            GUI.backgroundColor = GetColor(windowData, Color.white);
            GUI.color           = Color.white;

            return(clicked);
        }
예제 #2
0
 public static Color GetColor(SO_BaseWindow windowData, Color color)
 {
     color.a *= windowData.backgroundAlpha;
     return(color);
 }