public override void OnInspectorGUI() { UpdateIds(); UpdateLists(); base.OnInspectorGUI(); serializedObject.Update(); DrawHeader(Styles.GetStyle(Styles.StyleName.ComponentHeaderSpriteTargetImage), MenuUtils.SpriteTargetImage_Manual, MenuUtils.SpriteTargetImage_YouTube); GUILayout.Space(DGUI.Properties.Space(2)); DGUI.Property.Draw(m_image, UILabels.Image, HasReference ? ComponentColorName : ColorName.Red); GUILayout.Space(DGUI.Properties.Space(4)); int themeIndex = Database.GetThemeIndex(Target.ThemeId); if (themeIndex != -1) { ThemeTargetEditorUtils.DrawThemePopup(Database, m_theme, ThemesNames, themeIndex, ComponentColorName, serializedObject, targets, Target, InitialGUIColor, UpdateIds, UpdateLists); GUILayout.Space(DGUI.Properties.Space()); ThemeTargetEditorUtils.DrawActiveVariant(m_theme, ComponentColorName); } GUILayout.Space(DGUI.Properties.Space(2)); int propertyIndex = m_theme.GetSpritePropertyIndex(Target.PropertyId); if (Target.PropertyId == Guid.Empty || propertyIndex == -1) { ThemeTargetEditorUtils.DrawLabelNoPropertyFound(); } else { ThemeTargetEditorUtils.DrawSpriteProperties(m_theme, propertyIndex, serializedObject, targets, Target, ComponentColorName, InitialGUIColor); } GUILayout.Space(DGUI.Properties.Space(4)); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { UpdateIds(); UpdateLists(); base.OnInspectorGUI(); serializedObject.Update(); DrawHeader(Styles.GetStyle(Styles.StyleName.ComponentHeaderColorTargetUnityEvent), MenuUtils.ColorTargetUnityEvent_Manual, MenuUtils.ColorTargetUnityEvent_YouTube); GUILayout.Space(DGUI.Properties.Space(2)); DGUI.Property.UnityEvent(m_event, UILabels.Event, ComponentColorName, Target.Event.GetPersistentEventCount()); GUILayout.Space(DGUI.Properties.Space(4)); int themeIndex = Database.GetThemeIndex(Target.ThemeId); if (themeIndex != -1) { ThemeTargetEditorUtils.DrawThemePopup(Database, m_theme, ThemesNames, themeIndex, ComponentColorName, serializedObject, targets, Target, InitialGUIColor, UpdateIds, UpdateLists); GUILayout.Space(DGUI.Properties.Space()); ThemeTargetEditorUtils.DrawActiveVariant(m_theme, ComponentColorName); } GUILayout.Space(DGUI.Properties.Space(2)); int propertyIndex = m_theme.GetColorPropertyIndex(Target.PropertyId); if (Target.PropertyId == Guid.Empty || propertyIndex == -1) { ThemeTargetEditorUtils.DrawLabelNoPropertyFound(); } else { ThemeTargetEditorUtils.DrawColorProperties(m_theme, propertyIndex, serializedObject, targets, Target, InitialGUIColor); } GUILayout.Space(DGUI.Properties.Space(4)); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { UpdateIds(); UpdateLists(); base.OnInspectorGUI(); serializedObject.Update(); DrawHeader(Styles.GetStyle(Styles.StyleName.ComponentHeaderColorTargetParticleSystem), MenuUtils.ColorTargetParticleSystem_Manual, MenuUtils.ColorTargetParticleSystem_YouTube); GUILayout.Space(DGUI.Properties.Space(2)); DGUI.Property.Draw(m_particleSystem, UILabels.ParticleSystem, HasReference ? ComponentColorName : ColorName.Red); GUILayout.Space(DGUI.Properties.Space()); ThemeTargetEditorUtils.DrawOverrideAlpha(m_overrideAlpha, m_alpha, Target.ParticleSystem == null ? 1 : Target.ParticleSystem.main.startColor.color.a, ComponentColorName, InitialGUIColor); GUILayout.Space(DGUI.Properties.Space(4)); int themeIndex = Database.GetThemeIndex(Target.ThemeId); if (themeIndex != -1) { ThemeTargetEditorUtils.DrawThemePopup(Database, m_theme, ThemesNames, themeIndex, ComponentColorName, serializedObject, targets, Target, InitialGUIColor, UpdateIds, UpdateLists); GUILayout.Space(DGUI.Properties.Space()); ThemeTargetEditorUtils.DrawActiveVariant(m_theme, ComponentColorName); } GUILayout.Space(DGUI.Properties.Space(2)); int propertyIndex = m_theme.GetColorPropertyIndex(Target.PropertyId); if (Target.PropertyId == Guid.Empty || propertyIndex == -1) { ThemeTargetEditorUtils.DrawLabelNoPropertyFound(); } else { ThemeTargetEditorUtils.DrawColorProperties(m_theme, propertyIndex, serializedObject, targets, Target, InitialGUIColor); } GUILayout.Space(DGUI.Properties.Space(4)); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { UpdateIds(); UpdateLists(); base.OnInspectorGUI(); serializedObject.Update(); DrawHeader(Styles.GetStyle(Styles.StyleName.ComponentHeaderColorTargetSelectable), MenuUtils.ColorTargetSelectable_Manual, MenuUtils.ColorTargetSelectable_YouTube); GUILayout.Space(DGUI.Properties.Space(2)); DGUI.Property.Draw(m_selectable, UILabels.Selectable, HasReference ? ComponentColorName : ColorName.Red); GUILayout.Space(DGUI.Properties.Space(4)); var themeIndex = Database.GetThemeIndex(Target.ThemeId); if (themeIndex != -1) { ThemeTargetEditorUtils.DrawThemePopup(Database, m_theme, ThemesNames, themeIndex, ComponentColorName, serializedObject, targets, Target, InitialGUIColor, UpdateIds, UpdateLists); GUILayout.Space(DGUI.Properties.Space()); ThemeTargetEditorUtils.DrawActiveVariant(m_theme, ComponentColorName); } DrawPropertyIndex(Target.NormalColorPropertyId, SelectionState.Normal, m_normalAnimBool); DrawPropertyIndex(Target.HighlightedColorPropertyId, SelectionState.Highlighted, m_highlightedAnimBool); DrawPropertyIndex(Target.PressedColorPropertyId, SelectionState.Pressed, m_pressedAnimBool); #if UNITY_2019_1_OR_NEWER DrawPropertyIndex(Target.SelectedColorPropertyId, SelectionState.Selected, m_selectedAnimBool); #endif DrawPropertyIndex(Target.DisabledColorPropertyId, SelectionState.Disabled, m_disabledAnimBool); GUILayout.Space(DGUI.Properties.Space(4)); serializedObject.ApplyModifiedProperties(); }
private void DrawPropertyIndex(Guid id, SelectionState selectionState, AnimBool animBool) { GUILayout.Space(DGUI.Properties.Space(2)); var propertyIndex = m_theme.GetColorPropertyIndex(id); var propertyNotFound = id == Guid.Empty || propertyIndex == -1; GUILayout.BeginHorizontal(); { if (!propertyNotFound && !animBool.target) { GUI.color = m_theme.ActiveVariant.Colors[propertyIndex].Color; GUILayout.Label(GUIContent.none, Styles.GetStyle(Styles.StyleName.ColorButtonSelected)); GUI.color = InitialGUIColor; GUILayout.Space(2); } DGUI.Bar.Draw(selectionState.ToString(), Size.L, DGUI.Bar.Caret.CaretType.Caret, ComponentColorName, animBool); } GUILayout.EndHorizontal(); if (DGUI.FoldOut.Begin(animBool)) { GUILayout.Space(DGUI.Properties.Space(2)); if (propertyNotFound) { ThemeTargetEditorUtils.DrawLabelNoPropertyFound(); } else { DrawColorProperties(m_theme, propertyIndex, selectionState); } } DGUI.FoldOut.End(animBool); }
private void DrawPropertyIndex(Guid id, ThemeTargetEditorUtils.SelectionState selectionState, AnimBool animBool) { GUILayout.Space(DGUI.Properties.Space(2)); int propertyIndex = m_theme.GetSpritePropertyIndex(id); bool propertyNotFound = id == Guid.Empty || propertyIndex == -1; DGUI.Bar.Draw(selectionState + (propertyNotFound ? "" : ": " + m_theme.SpriteLabels[propertyIndex].Label), Size.L, DGUI.Bar.Caret.CaretType.Caret, ComponentColorName, animBool); if (DGUI.FoldOut.Begin(animBool)) { GUILayout.Space(DGUI.Properties.Space(2)); if (propertyNotFound) { ThemeTargetEditorUtils.DrawLabelNoPropertyFound(); } else { DrawSpriteProperties(m_theme, propertyIndex, selectionState); } } DGUI.FoldOut.End(animBool); }
public override void OnInspectorGUI() { #if dUI_TextMeshPro UpdateIds(); UpdateLists(); #endif base.OnInspectorGUI(); serializedObject.Update(); DrawHeader(Styles.GetStyle(Styles.StyleName.ComponentHeaderColorTargetTextMeshPro), MenuUtils.ColorTargetTextMeshPro_Manual, MenuUtils.ColorTargetTextMeshPro_YouTube); GUILayout.Space(DGUI.Properties.Space(2)); #if dUI_TextMeshPro DGUI.Property.Draw(m_textMeshPro, UILabels.TextMeshPro, HasReference ? ComponentColorName : ColorName.Red); GUILayout.Space(DGUI.Properties.Space()); ThemeTargetEditorUtils.DrawOverrideAlpha(m_overrideAlpha, m_alpha, Target.TextMeshPro == null ? 1 : Target.TextMeshPro.color.a, ComponentColorName, InitialGUIColor); GUILayout.Space(DGUI.Properties.Space(4)); int themeIndex = Database.GetThemeIndex(Target.ThemeId); if (themeIndex != -1) { ThemeTargetEditorUtils.DrawThemePopup(Database, m_theme, ThemesNames, themeIndex, ComponentColorName, serializedObject, targets, Target, InitialGUIColor, UpdateIds, UpdateLists); GUILayout.Space(DGUI.Properties.Space()); ThemeTargetEditorUtils.DrawActiveVariant(m_theme, ComponentColorName); } GUILayout.Space(DGUI.Properties.Space(2)); int propertyIndex = m_theme.GetColorPropertyIndex(Target.PropertyId); if (Target.PropertyId == Guid.Empty || propertyIndex == -1) { ThemeTargetEditorUtils.DrawLabelNoPropertyFound(); } else { ThemeTargetEditorUtils.DrawColorProperties(m_theme, propertyIndex, serializedObject, targets, Target, InitialGUIColor); } #else GetInfoMessage(SUPPORT_FOR_TEXT_MESH_PRO_NOT_ENABLED).Draw(true, InspectorWidth); #endif GUILayout.Space(DGUI.Properties.Space(4)); serializedObject.ApplyModifiedProperties(); }
public static void DrawThemePopup(ThemesDatabase database, ThemeData themeData, string[] themeNames, int themeIndex, ColorName componentColorName, SerializedObject serializedObject, Object[] targets, ThemeTarget target, Color initialGUIColor, Action updateIds, Action updateLists) { GUILayout.BeginHorizontal(); { DGUI.Line.Draw(false, componentColorName, true, () => { GUILayout.Space(DGUI.Properties.Space(2)); DGUI.Label.Draw(UILabels.SelectedTheme, Size.S, componentColorName, DGUI.Properties.SingleLineHeight); GUILayout.Space(DGUI.Properties.Space()); GUILayout.BeginVertical(GUILayout.Height(DGUI.Properties.SingleLineHeight)); { GUILayout.Space(0); GUI.color = DGUI.Colors.PropertyColor(componentColorName); EditorGUI.BeginChangeCheck(); themeIndex = EditorGUILayout.Popup(GUIContent.none, themeIndex, themeNames); GUI.color = initialGUIColor; } GUILayout.EndVertical(); if (EditorGUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { DoozyUtils.UndoRecordObjects(targets, UILabels.UpdateValue); themeData = database.Themes[themeIndex]; foreach (Object o in targets) { var themeTarget = (ThemeTarget)o; if (themeTarget == null) { continue; } themeTarget.ThemeId = themeData.Id; } updateIds.Invoke(); updateLists.Invoke(); foreach (Object o in targets) { var themeTarget = (ThemeTarget)o; if (themeTarget == null) { continue; } if (!themeData.ContainsColorProperty(themeTarget.PropertyId)) { themeTarget.PropertyId = themeData.ColorLabels.Count > 0 ? themeData.ColorLabels[0].Id : Guid.Empty; } themeTarget.UpdateTarget(themeData); } } else { DoozyUtils.UndoRecordObject(target, UILabels.UpdateValue); themeData = database.Themes[themeIndex]; target.ThemeId = themeData.Id; updateIds.Invoke(); updateLists.Invoke(); target.UpdateTarget(themeData); } } }); GUILayout.Space(DGUI.Properties.Space()); ThemeTargetEditorUtils.DrawButtonTheme(themeData, componentColorName); } GUILayout.EndHorizontal(); }