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(); }
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); }
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); }
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)); }
public static bool ToggleButton(Rect rect, bool toggled, string text, DeColorPalette colorPalette, GUIStyle guiStyle = null) { return(ToggleButton(rect, toggled, new GUIContent(text, ""), colorPalette, guiStyle)); }
public static void BeginGUI(DeColorPalette guiColorPalette = null, DeStylePalette guiStylePalette = null) { ChangePalette(guiColorPalette, guiStylePalette); }