예제 #1
0
 public static void ChangePalette(DeColorPalette newColorPalette, DeStylePalette newStylePalette)
 {
     if (newColorPalette != null)
     {
         colors = newColorPalette;
     }
     else
     {
         if (_defaultColorPalette == null)
         {
             _defaultColorPalette = new DeColorPalette();
         }
         colors = _defaultColorPalette;
     }
     if (newStylePalette != null)
     {
         styles = newStylePalette;
     }
     else
     {
         if (_defaultStylePalette == null)
         {
             _defaultStylePalette = new DeStylePalette();
         }
         styles = _defaultStylePalette;
     }
     styles.Init();
 }
예제 #2
0
        public static bool ToggleButton(bool toggled, GUIContent content, DeColorPalette colorPalette, GUIStyle guiStyle = null, params GUILayoutOption[] options)
        {
            DeColorPalette palette         = colorPalette ?? DeGUI.colors;
            Color          backgroundColor = GUI.backgroundColor;

            GUI.backgroundColor = toggled ? palette.bg.toggleOn : palette.bg.toggleOff;
            if (guiStyle == null)
            {
                guiStyle = DeGUI.styles.button.def;
            }
            object[] formats = new object[] { toggled?palette.content.toggleOn : palette.content.toggleOff };
            if (GUILayout.Button(content, guiStyle.Clone(formats), options))
            {
                toggled     = !toggled;
                GUI.changed = true;
            }
            GUI.backgroundColor = backgroundColor;
            return(toggled);
        }
예제 #3
0
        public static bool ToggleButton(Rect rect, bool toggled, GUIContent content, DeColorPalette colorPalette, GUIStyle guiStyle = null)
        {
            DeColorPalette palette         = colorPalette ?? colors;
            Color          backgroundColor = GUI.backgroundColor;

            GUI.backgroundColor = toggled ? ((Color)palette.bg.toggleOn) : ((Color)palette.bg.toggleOff);
            if (guiStyle == null)
            {
                guiStyle = styles.button.def;
            }
            object[] formats = new object[] { toggled?palette.content.toggleOn : palette.content.toggleOff };
            if (GUI.Button(rect, content, guiStyle.Clone(formats)))
            {
                toggled     = !toggled;
                GUI.changed = true;
            }
            GUI.backgroundColor = backgroundColor;
            return(toggled);
        }
예제 #4
0
 public static bool ToggleButton(bool toggled, string text, DeColorPalette colorPalette, GUIStyle guiStyle = null, params GUILayoutOption[] options)
 {
     return(ToggleButton(toggled, new GUIContent(text, ""), colorPalette, guiStyle, options));
 }
예제 #5
0
 public static bool ToggleButton(Rect rect, bool toggled, string text, DeColorPalette colorPalette, GUIStyle guiStyle = null)
 {
     return(ToggleButton(rect, toggled, new GUIContent(text, ""), colorPalette, guiStyle));
 }
예제 #6
0
 public static void BeginGUI(DeColorPalette guiColorPalette = null, DeStylePalette guiStylePalette = null)
 {
     ChangePalette(guiColorPalette, guiStylePalette);
 }