Exemplo n.º 1
0
        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();
        }
        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);
        }