GetStyle() private static method

private static GetStyle ( string styleName ) : GUIStyle,
styleName string
return GUIStyle,
Beispiel #1
0
        private void DrawActionDescription()
        {
            DynamicHeight += DGUI.Properties.Space(4);
            float x              = DrawRect.x + 16;
            float lineHeight     = DGUI.Properties.SingleLineHeight;
            float iconLineHeight = lineHeight * 2;
            float iconSize       = iconLineHeight * 0.6f;
            var   iconRect       = new Rect(x, DynamicHeight + (iconLineHeight - iconSize) / 2, iconSize, iconSize);
            float textX          = iconRect.xMax + DGUI.Properties.Space(4);
            float textWidth      = DrawRect.width - iconSize - DGUI.Properties.Space(4) - 32;
            var   titleRect      = new Rect(textX, DynamicHeight, textWidth, lineHeight);

            DynamicHeight += titleRect.height;
            var descriptionRect = new Rect(textX, DynamicHeight, textWidth, lineHeight);

            DynamicHeight += descriptionRect.height;
            DynamicHeight += DGUI.Properties.Space(4);

            var sourceIconRect = new Rect();
            var sourceTextRect = new Rect();

            bool switchBackModeEnabled = TargetNode.SwitchBackMode && TargetNode.HasSource;

            if (switchBackModeEnabled)
            {
                DynamicHeight -= DGUI.Properties.Space(2);
                sourceIconRect = new Rect(iconRect.x, DynamicHeight + (iconLineHeight - iconSize) / 2, iconSize, iconSize);
                DynamicHeight += (iconLineHeight - iconSize) / 2 + 2;
                sourceTextRect = new Rect(textX, DynamicHeight, textWidth, lineHeight);
                DynamicHeight += sourceTextRect.height;
                DynamicHeight += DGUI.Properties.Space(4);
            }

            if (ZoomedBeyondSocketDrawThreshold)
            {
                return;
            }

            m_actionIcon = Styles.GetStyle(WaitForActionIconStyleName);
            m_title      = UILabels.ListenFor + ": ";

            switch (TargetNode.ListenFor)
            {
            case PortalNode.ListenerType.GameEvent:
                m_title += TargetNode.WaitForInfoTitle;
                break;

            case PortalNode.ListenerType.UIButton:
            case PortalNode.ListenerType.UIView:
            case PortalNode.ListenerType.UIDrawer:
                m_title = TargetNode.WaitForInfoTitle;
                break;
            }


            m_description = TargetNode.WaitForInfoDescription;

            Color iconAndTextColor = (DGUI.Utility.IsProSkin ? Color.white.Darker() : Color.black.Lighter()).WithAlpha(0.6f);

            DGUI.Icon.Draw(iconRect, m_actionIcon, iconAndTextColor);
            GUI.Label(titleRect, m_title, DGUI.Colors.ColorTextOfGUIStyle(DGUI.Label.Style(Editor.Size.S, TextAlign.Left), iconAndTextColor));
            GUI.Label(descriptionRect, m_description, DGUI.Colors.ColorTextOfGUIStyle(DGUI.Label.Style(Doozy.Editor.Size.M, TextAlign.Left), iconAndTextColor));

            if (!switchBackModeEnabled)
            {
                return;
            }
            m_sourceIcon = Styles.GetStyle(Styles.StyleName.IconFaAngleDoubleLeft);
            DGUI.Icon.Draw(sourceIconRect, m_sourceIcon, iconAndTextColor);
            GUI.Label(sourceTextRect, TargetNode.Source.Name, DGUI.Colors.ColorTextOfGUIStyle(DGUI.Label.Style(Doozy.Editor.Size.M, TextAlign.Left), iconAndTextColor));
        }
Beispiel #2
0
        private void DrawToolbar()
        {
            GUILayout.BeginVertical(GUILayout.Height(position.height));
            {
                DGUI.AnimatedTexture.Draw(ToolbarAnimBool, NodyToolbarHeader, DoozyWindowSettings.Instance.ToolbarExpandedWidth, DoozyWindowSettings.Instance.ToolbarHeaderHeight); //Nody Toolbar Header

                DrawToolbarExpandCollapseButton();

                GUILayout.Space(DGUI.Properties.Space(4));

                DrawToolbarButton(UILabels.Graph,
                                  Styles.GetStyle(Styles.StyleName.WindowToolbarButtonNewGraph),
                                  Styles.GetStyle(Styles.StyleName.WindowToolbarButtonNewGraphSelected),
                                  false,
                                  DGUI.Colors.DisabledTextColorName,
                                  () => { CreateAndOpenGraphWidthDialog(false); });

                DrawToolbarButton(UILabels.SubGraph,
                                  Styles.GetStyle(Styles.StyleName.WindowToolbarButtonNewSubGraph),
                                  Styles.GetStyle(Styles.StyleName.WindowToolbarButtonNewSubGraphSelected),
                                  false,
                                  DGUI.Colors.DisabledTextColorName,
                                  () => { CreateAndOpenGraphWidthDialog(true); });

                GUILayout.Space(DGUI.Properties.Space(4));

                DrawToolbarButton(UILabels.Load,
                                  Styles.GetStyle(Styles.StyleName.WindowToolbarButtonLoad),
                                  Styles.GetStyle(Styles.StyleName.WindowToolbarButtonLoadSelected),
                                  false,
                                  DGUI.Colors.DisabledTextColorName,
                                  LoadGraphWidthDialog);

                if (CurrentGraph != null)
                {
                    GUILayout.Space(DGUI.Properties.Space(4));

                    DrawToolbarButton(UILabels.Save,
                                      Styles.GetStyle(Styles.StyleName.WindowToolbarButtonSave),
                                      Styles.GetStyle(Styles.StyleName.WindowToolbarButtonSaveSelected),
                                      false,
                                      DGUI.Colors.DisabledTextColorName,
                                      SaveGraph);

                    DrawToolbarButton(UILabels.SaveAs,
                                      Styles.GetStyle(Styles.StyleName.WindowToolbarButtonSaveAs),
                                      Styles.GetStyle(Styles.StyleName.WindowToolbarButtonSaveAsSelected),
                                      false,
                                      DGUI.Colors.DisabledTextColorName,
                                      SaveGraphAs);

                    GUILayout.Space(DGUI.Properties.Space(4));

                    DrawToolbarButton(UILabels.Close,
                                      Styles.GetStyle(Styles.StyleName.WindowToolbarButtonClose),
                                      Styles.GetStyle(Styles.StyleName.WindowToolbarButtonCloseSelected),
                                      false,
                                      DGUI.Colors.DisabledTextColorName,
                                      () => { CloseCurrentGraph(); });
                }

                GUILayout.FlexibleSpace();
            }
            GUILayout.EndVertical();
        }
        private void DrawViewSoundySoundDatabases(AnimBool searchEnabled)
        {
            bool foundNullReference = false;

            foreach (SoundDatabase soundDatabase in SoundyDatabase.SoundDatabases)
            {
                if (soundDatabase == null)
                {
                    foundNullReference = true;
                    break;
                }

                AnimBool  soundDatabaseAnimBool              = GetSoundDatabaseAnimBool(soundDatabase);
                AnimBool  renameSoundDatabaseAnimBool        = GetAnimBool(RENAME_SOUND_DATABASE);
                bool      isGeneralSoundDatabase             = soundDatabase.DatabaseName.Equals(SoundyManager.GENERAL);
                bool      soundDatabaseContainsSearchedSound = false;
                bool      renamingThisDatabase = !searchEnabled.target && m_soundDatabaseBeingRenamed == soundDatabase;
                bool      databaseHasIssues    = soundDatabase.HasSoundsWithMissingAudioClips; //database issues check
                ColorName viewColorName        = CurrentViewColorName;
                ColorName mixerColorName       = soundDatabase.OutputAudioMixerGroup != null ? viewColorName : DGUI.Colors.DisabledTextColorName;

                GUILayout.BeginHorizontal();
                {
                    DrawViewHorizontalPadding();

                    GUILayout.BeginVertical();
                    {
                        GUILayout.BeginHorizontal();
                        {
                            bool enabledState = GUI.enabled;
                            GUI.enabled = !(renameSoundDatabaseAnimBool.target && renamingThisDatabase) && !searchEnabled.target; //do not allow the dev to use this button if THIS database is being renamed or a search is happening
                            {
                                GUILayout.BeginVertical(GUILayout.Height(BarHeight));
                                {
                                    if (DGUI.Bar.Draw(soundDatabase.DatabaseName, BAR_SIZE, DGUI.Bar.Caret.CaretType.Caret, viewColorName, soundDatabaseAnimBool)) //database BAR
                                    {
                                        if (Selection.activeObject != null && Selection.activeObject is SoundGroupData)
                                        {
                                            Selection.activeObject = null;
                                        }
                                    }

                                    GUILayout.Space(-BarHeight - DGUI.Properties.Space());

                                    if (soundDatabase.OutputAudioMixerGroup == null)
                                    {
                                        DGUI.Colors.SetDisabledGUIColorAlpha();
                                    }

                                    float barIconSize = BarHeight * 0.6f;

                                    SoundDatabase database = soundDatabase;
                                    DGUI.Line.Draw(false,
                                                   () =>
                                    {
                                        GUILayout.FlexibleSpace();
                                        DGUI.Icon.Draw(Styles.GetStyle(Styles.StyleName.IconAudioMixerGroup), barIconSize, BarHeight, mixerColorName);                //mixer icon
                                        if (database.OutputAudioMixerGroup != null)
                                        {
                                            GUILayout.Space(DGUI.Properties.Space(2));
                                            DGUI.Label.Draw(database.OutputAudioMixerGroup.name + " (" + database.OutputAudioMixerGroup.audioMixer.name + ")", Size.S, mixerColorName, BarHeight);                //mixer label
                                        }

                                        if (databaseHasIssues)
                                        {
                                            GUILayout.Space(DGUI.Properties.Space(4));
                                            DGUI.Icon.Draw(Styles.GetStyle(Styles.StyleName.IconError), barIconSize, BarHeight, Color.red);
                                        }

                                        GUILayout.Space(DGUI.Properties.Space(2));
                                    });
                                    GUI.color = InitialGUIColor;
                                }
                                GUILayout.EndVertical();
                            }
                            GUI.enabled = enabledState;

                            if (!isGeneralSoundDatabase)
                            {
                                if (!searchEnabled.target && soundDatabaseAnimBool.faded > 0.05f && renameSoundDatabaseAnimBool.faded < 0.5f)
                                {
                                    DGUI.AlphaGroup.Begin(soundDatabaseAnimBool.faded * (1 - renameSoundDatabaseAnimBool.faded));
                                    GUILayout.Space(DGUI.Properties.Space() * soundDatabaseAnimBool.faded * (1 - renameSoundDatabaseAnimBool.faded));
                                    if (DGUI.Button.Draw(DGUI.Properties.Labels.Rename,
                                                         Size.S,
                                                         TextAlign.Center,
                                                         viewColorName,
                                                         true,
                                                         BarHeight,
                                                         80 * soundDatabaseAnimBool.faded * (1 - renameSoundDatabaseAnimBool.faded)) ||
                                        renamingThisDatabase && Event.current.keyCode == KeyCode.Escape && Event.current.type == EventType.KeyUp) //rename database button
                                    {
                                        if (!renamingThisDatabase &&
                                            EditorUtility.DisplayDialog(UILabels.RenameSoundDatabase + " '" + soundDatabase.DatabaseName + "'",
                                                                        UILabels.RenameSoundDatabaseDialogMessage +
                                                                        "\n\n" +
                                                                        UILabels.YouAreResponsibleToUpdateYourCode,
                                                                        UILabels.Continue,
                                                                        UILabels.Cancel))
                                        {
                                            StartRenameSoundDatabase(soundDatabase);
                                            Instance.Focus();
                                        }
                                        else
                                        {
                                            ResetRenameSoundDatabase();
                                        }
                                    }

                                    if (DGUI.Button.IconButton.Cancel(BarHeight)) //delete database button
                                    {
                                        SoundyDatabase.DeleteDatabase(soundDatabase);
                                        break;
                                    }

                                    DGUI.AlphaGroup.End();
                                }
                            }
                        }
                        GUILayout.EndHorizontal();

                        GUILayout.Space(DGUI.Properties.Space());

                        if (DGUI.FadeOut.Begin(searchEnabled.target ? 1 : soundDatabaseAnimBool.faded))
                        {
                            GUILayout.BeginVertical();

                            //RENAME DATABASE
                            if (renamingThisDatabase)
                            {
                                if (DGUI.FadeOut.Begin(renameSoundDatabaseAnimBool.faded, false))
                                {
                                    GUILayout.BeginVertical();
                                    {
                                        GUILayout.Space(DGUI.Properties.Space() * renameSoundDatabaseAnimBool.faded);
                                        GUILayout.BeginHorizontal(GUILayout.Height(DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(2)));
                                        {
                                            DrawDefaultViewHorizontalSpacing();

                                            GUI.color = DGUI.Colors.BackgroundColor(RENAME_COLOR_NAME);

                                            DGUI.Label.Draw(UILabels.RenameTo, Size.S, DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(2)); //rename to label

                                            GUI.SetNextControlName(RENAME);
                                            m_newSoundDatabaseName = EditorGUILayout.TextField(GUIContent.none, m_newSoundDatabaseName); //rename to field
                                            GUI.color = InitialGUIColor;

                                            if (DGUI.Button.IconButton.Ok() ||
                                                Event.current.keyCode == KeyCode.Return && Event.current.type == EventType.KeyUp) //rename OK button
                                            {
                                                Instance.Focus();

                                                if (SoundyDatabase.RenameSoundDatabase(soundDatabase, m_newSoundDatabaseName))
                                                {
                                                    GetSoundDatabaseAnimBool(m_newSoundDatabaseName).value = true;
                                                    ResetRenameSoundDatabase();
                                                    break;
                                                }
                                            }

                                            if (DGUI.Button.IconButton.Cancel() ||
                                                Event.current.keyCode == KeyCode.Escape && Event.current.type == EventType.KeyUp) //rename CANCEL button
                                            {
                                                ResetRenameSoundDatabase();
                                            }

                                            EditorGUI.FocusTextInControl(RENAME);

                                            DrawDefaultViewHorizontalSpacing();
                                        }
                                        GUILayout.EndHorizontal();

                                        GUILayout.Space(DGUI.Properties.Space(4) * renameSoundDatabaseAnimBool.faded);
                                    }
                                    GUILayout.EndVertical();
                                    GUI.color = InitialGUIColor;
                                }

                                DGUI.FadeOut.End(renameSoundDatabaseAnimBool, false);
                            }

                            GUILayout.Space(DGUI.Properties.Space() * soundDatabaseAnimBool.faded);

                            if (!searchEnabled.target)
                            {
                                float barIconSize      = DGUI.Properties.SingleLineHeight * 0.8f;
                                float barIconRowHeight = DGUI.Properties.SingleLineHeight - 1;
                                GUILayout.BeginHorizontal();
                                {
                                    SoundDatabase database = soundDatabase;
                                    DGUI.Line.Draw(true, mixerColorName,
                                                   () =>
                                    {
                                        if (database.OutputAudioMixerGroup == null)
                                        {
                                            DGUI.Colors.SetDisabledGUIColorAlpha();
                                        }
                                        DGUI.Icon.Draw(Styles.GetStyle(Styles.StyleName.IconAudioMixerGroup), barIconSize, barIconRowHeight, mixerColorName); //mixer icon
                                        GUILayout.Space(DGUI.Properties.Space());
                                        DGUI.Label.Draw(UILabels.OutputMixerGroup, Size.S, mixerColorName, DGUI.Properties.SingleLineHeight);                 //mixer label
                                        GUI.color = InitialGUIColor;
                                        AudioMixerGroup outputAudioMixerGroup = database.OutputAudioMixerGroup;
                                        GUI.color = DGUI.Colors.GetDColor(mixerColorName).Light.WithAlpha(GUI.color.a);
                                        GUILayout.BeginVertical(GUILayout.Height(DGUI.Properties.SingleLineHeight));
                                        {
                                            GUILayout.Space(0f);
                                            EditorGUI.BeginChangeCheck();
                                            outputAudioMixerGroup = (AudioMixerGroup)EditorGUILayout.ObjectField(GUIContent.none, outputAudioMixerGroup, typeof(AudioMixerGroup), false);                //mixer field
                                            if (EditorGUI.EndChangeCheck())
                                            {
                                                Undo.RecordObject(database, "Update AudioMixerGroup");
                                                database.OutputAudioMixerGroup = outputAudioMixerGroup;
                                                database.SetDirty(true);
                                            }
                                        }
                                        GUILayout.EndVertical();
                                        GUI.color = InitialGUIColor;
                                    });
                                    GUILayout.Space(DGUI.Button.IconButton.Width + DGUI.Properties.Space(4));
                                }
                                GUILayout.EndHorizontal();
                            }

                            GUILayout.Space(DGUI.Properties.Space(2) * soundDatabaseAnimBool.faded);

                            float lineHeight = DGUI.Properties.SingleLineHeight;
                            float iconSize   = lineHeight * 0.8f;

                            GUILayout.Label(GUIContent.none, GUILayout.ExpandWidth(true), GUILayout.Height(0));
                            Rect  rect = GUILayoutUtility.GetLastRect();
                            float x;
                            float y = rect.y;

                            float totalWidth           = rect.width;
                            float buttonAndPlayerWidth = rect.width - DGUI.Properties.Space(6) - iconSize - DGUI.Button.IconButton.Width;
                            float buttonWidth          = buttonAndPlayerWidth * 0.4f;
                            float playerWidth          = buttonAndPlayerWidth - buttonWidth;

                            foreach (SoundGroupData soundGroupData in soundDatabase.Database)
                            {
                                if (searchEnabled.target)
                                {
                                    if (!Regex.IsMatch(soundGroupData.SoundName, m_soundySearchPattern, RegexOptions.IgnoreCase)) //regex search check
                                    {
                                        if (!m_soundySearchAudioClipNames)
                                        {
                                            continue;
                                        }

                                        if (soundGroupData.Sounds == null || soundGroupData.Sounds.Count == 0)
                                        {
                                            continue;
                                        }

                                        bool foundAudioClipMatch = false;
                                        foreach (AudioData audioData in soundGroupData.Sounds)
                                        {
                                            if (audioData == null || audioData.AudioClip == null)
                                            {
                                                continue;
                                            }
                                            if (!Regex.IsMatch(audioData.AudioClip.name, m_soundySearchPattern, RegexOptions.IgnoreCase))
                                            {
                                                continue;
                                            }
                                            foundAudioClipMatch = true;
                                            break;
                                        }

                                        if (!foundAudioClipMatch)
                                        {
                                            continue;
                                        }
                                    }

                                    soundDatabaseContainsSearchedSound = true;
                                }


                                //draw check - if the item was scrolled out of view (up or down) -> do not draw it
                                bool drawItem = y > m_viewScrollPosition.y + 16 || y < m_viewScrollPosition.y + FullViewRect.height - 16;
                                if (!drawItem)
                                {
                                    continue;
                                }

                                bool removedEntry = false;

                                GUILayout.Space(DGUI.Properties.Space() * soundDatabaseAnimBool.faded);
                                GUILayout.Label(GUIContent.none, GUILayout.ExpandWidth(true), GUILayout.Height(lineHeight));

                                x  = rect.x;
                                y += DGUI.Properties.Space() * soundDatabaseAnimBool.faded;


                                bool noSound      = soundGroupData.SoundName.Equals(SoundyManager.NO_SOUND); //is no sound check
                                bool isSelected   = Selection.activeObject == soundGroupData;                //selected check
                                bool hasIssues    = !noSound && soundGroupData.HasMissingAudioClips;         //has issues check
                                bool enabledState = GUI.enabled;
                                GUI.enabled = !noSound;
                                {
                                    SoundyAudioPlayer.Player player = SoundyAudioPlayer.GetPlayer(soundGroupData, soundDatabase.OutputAudioMixerGroup); //player reference

                                    ColorName buttonColorName =
                                        isSelected
                                            ? hasIssues
                                                  ? ColorName.Red
                                                  : CurrentViewColorName
                                            : DGUI.Colors.DisabledBackgroundColorName;

                                    ColorName buttonTextColorName =
                                        hasIssues
                                            ? ColorName.Red
                                            : CurrentViewColorName;

                                    //                                    if (i % 2 == 0)
                                    if (player.IsPlaying)
                                    {
                                        var backgroundRect = new Rect(x - DGUI.Properties.Space(2), y - DGUI.Properties.Space(), totalWidth + DGUI.Properties.Space(4), lineHeight + DGUI.Properties.Space(2));
                                        GUI.color = DGUI.Colors.BackgroundColor(buttonColorName).WithAlpha(0.6f);
                                        GUI.Label(backgroundRect, GUIContent.none, Styles.GetStyle(Styles.StyleName.BackgroundRound));
                                        GUI.color = InitialGUIColor;
                                    }

                                    var iconRect = new Rect(x, y + (lineHeight - iconSize) / 2, iconSize, iconSize);
                                    if (!player.IsPlaying)
                                    {
                                        GUI.color = GUI.color.WithAlpha(DGUI.Utility.IsProSkin ? 0.4f : 0.6f);
                                    }
                                    DGUI.Icon.Draw(iconRect, Styles.GetStyle(noSound || hasIssues ? Styles.StyleName.IconMuteSound : Styles.StyleName.IconSound),
                                                   DGUI.Colors.TextColor(hasIssues ? ColorName.Red : buttonTextColorName)); //speaker icon
                                    GUI.color = InitialGUIColor;
                                    x        += iconSize;
                                    x        += DGUI.Properties.Space(2);
                                    var buttonRect = new Rect(x, y - DGUI.Properties.Space(), buttonWidth, lineHeight + DGUI.Properties.Space(2));
                                    if (DGUI.Button.Draw(buttonRect, soundGroupData.SoundName, Size.S, TextAlign.Left, buttonColorName, buttonTextColorName, isSelected)) //select button
                                    {
                                        Selection.activeObject = soundGroupData;
                                    }

                                    if (hasIssues)
                                    {
                                        var errorIconRect = new Rect(buttonRect.xMax - iconSize - DGUI.Properties.Space(2), buttonRect.y + (buttonRect.height - iconSize) / 2, iconSize, iconSize);
                                        DGUI.Icon.Draw(errorIconRect, Styles.GetStyle(Styles.StyleName.IconError), Color.red); //issues icon
                                    }

                                    x += buttonWidth;
                                    x += DGUI.Properties.Space(2);
                                    var playerRect = new Rect(x, y, playerWidth, lineHeight);
                                    player.DrawPlayer(playerRect, buttonTextColorName);
                                    x += playerWidth;
                                    x += DGUI.Properties.Space(2);
                                    var deleteButtonRect = new Rect(x, y, DGUI.Button.IconButton.Width, DGUI.Button.IconButton.Height);
                                    if (DGUI.Button.IconButton.Minus(deleteButtonRect))
                                    {
                                        bool wasSelected = Selection.activeObject == soundGroupData;
                                        if (soundDatabase.Remove(soundGroupData, true))
                                        {
                                            if (wasSelected)
                                            {
                                                Selection.activeObject = null;
                                            }
                                            soundDatabase.SetDirty(true);
                                            if (player.IsPlaying)
                                            {
                                                player.Stop();
                                            }
                                            removedEntry = true;
                                        }
                                    }

                                    y += lineHeight;
                                    y += DGUI.Properties.Space(2) * soundDatabaseAnimBool.faded;
                                }
                                GUI.enabled = enabledState;

                                GUILayout.Space(DGUI.Properties.Space() * soundDatabaseAnimBool.faded);
                                if (removedEntry)
                                {
                                    break;
                                }
                            }

                            GUILayout.Space(DGUI.Properties.Space() * soundDatabaseAnimBool.faded);

                            if (!searchEnabled.target)
                            {
                                GUILayout.BeginHorizontal();
                                {
                                    GUILayout.FlexibleSpace();
                                    DrawSoundDatabaseDropZone(soundDatabase);
                                    GUILayout.Space(DGUI.Properties.Space());
                                    if (DGUI.Button.IconButton.Plus())
                                    {
                                        Selection.activeObject = soundDatabase.Add(SoundyManager.NEW_SOUND_GROUP, true, true);
                                    }
                                }
                                GUILayout.EndHorizontal();
                            }


                            GUI.enabled = !(GetAnimBool(RENAME_SOUND_DATABASE).target&& renamingThisDatabase);

                            GUILayout.EndVertical();
                        }

                        DGUI.FadeOut.End(searchEnabled.target ? 1 : soundDatabaseAnimBool.faded);

                        if (searchEnabled.target)
                        {
                            if (soundDatabaseContainsSearchedSound && !m_soundDatabasesWithSearchedSoundNames.Contains(soundDatabase))
                            {
                                m_soundDatabasesWithSearchedSoundNames.Add(soundDatabase);
                                soundDatabaseAnimBool.target = true;
                            }
                            else if (!soundDatabaseContainsSearchedSound && m_soundDatabasesWithSearchedSoundNames.Contains(soundDatabase))
                            {
                                m_soundDatabasesWithSearchedSoundNames.Remove(soundDatabase);
                                soundDatabaseAnimBool.target = false;
                            }
                        }
                    }
                    GUILayout.EndVertical();

                    DrawViewHorizontalPadding();
                }
                GUILayout.EndHorizontal();
            }

            if (foundNullReference)
            {
                SoundyDatabase.RefreshDatabase(false);
            }
        }
        public override void OnPaint(IGUIContext ctx, RectangleF bounds)
        {
            base.OnPaint(ctx, bounds);

            float lineHeight      = LineHeight;
            float separatorHeight = SeparatorHeight;

            RectangleF rLine = bounds;

            rLine.Height = lineHeight;
            rLine.Width -= Padding.Right;
            rLine.Offset(0, Padding.Top);
            float textOffset = lineHeight + Padding.Left;

            bool buildTree = false;

            if (lastBounds != bounds || Tree == null)
            {
                try {
                    lastBounds         = bounds;
                    Tree               = new QuadTree(bounds);
                    itemStartPositions = new float[Menu.Count];
                    buildTree          = true;
                } catch (Exception ex) {
                    ex.LogError();
                }
            }

            for (int i = 0; i < Menu.Children.Count; i++)
            {
                IGuiMenuItem item = Menu.Children [i];

                float itemHeight = 0;

                if (item.IsSeparator)
                {
                    itemHeight = separatorHeight;
                    float y = rLine.Y + separatorHeight / 2;

                    using (Pen pen = new Pen(Theme.Colors.Base02, ScaleFactor))
                        ctx.DrawLine(pen, rLine.X + textOffset, y, rLine.X + rLine.Width, y);

                    y++;
                    using (Pen pen = new Pen(Theme.Colors.Base0, ScaleFactor))
                        ctx.DrawLine(pen, rLine.X + textOffset, y, rLine.X + rLine.Width, y);
                }
                else
                {
                    itemHeight = lineHeight;
                    WidgetStates state = WidgetStates.Default;
                    if (!item.Enabled)
                    {
                        state = WidgetStates.Disabled;
                    }
                    else if (item == m_ActiveItem)
                    {
                        if (IsFocused || Selected)
                        {
                            state = WidgetStates.Active;
                        }
                        else
                        {
                            state = WidgetStates.Selected;
                        }
                        ctx.FillRectangle(Styles.GetStyle(state).BackColorBrush,
                                          new RectangleF(rLine.X + 1, rLine.Y, rLine.Width + Padding.Right - 2, rLine.Height));
                    }

                    IWidgetStyle style = Styles.GetStyle(state);

                    if (IconFont != null)
                    {
                        char icon;
                        if (item.IsToggleButton)
                        {
                            icon = item.Checked ? (char)FontAwesomeIcons.fa_toggle_on : (char)FontAwesomeIcons.fa_toggle_off;
                        }
                        else
                        {
                            icon = (char)item.ImageIndex;
                        }

                        if (icon > 0)
                        {
                            RectangleF rIcon = rLine;
                            rIcon.Width = lineHeight;
                            ctx.DrawString(icon.ToString(), IconFont, style.ForeColorBrush, rIcon, FontFormat.DefaultIconFontFormatCenter);
                        }
                    }

                    if (Font != null)
                    {
                        RectangleF rText = new RectangleF(rLine.X + textOffset, rLine.Y + 1, rLine.Width - textOffset, rLine.Height - 1);
                        ctx.DrawString(item.Text, Font, style.ForeColorBrush, rText, FontFormat.DefaultMnemonicLine);

                        if (item.HasChildren)
                        {
                            if (IconFont != null)
                            {
                                ctx.DrawString(((char)FontAwesomeIcons.fa_caret_right).ToString(), IconFont, style.ForeColorBrush, rText, FontFormat.DefaultSingleLineFar);
                            }
                        }
                        else
                        {
                            string modifier = ModifierString(item);
                            if (modifier != null)
                            {
                                ctx.DrawString(modifier, Font, style.ForeColorBrush, rText, FontFormat.DefaultSingleLineFar);
                            }
                        }
                    }
                }

                if (buildTree)
                {
                    try {
                        Tree.Add(new LayoutItem(rLine, item));
                        itemStartPositions[i] = rLine.Y;
                    } catch (Exception ex) {
                        ex.LogError();
                    }
                }

                rLine.Offset(0, itemHeight);
            }
        }
        private void DrawInputData()
        {
            DGUI.Doozy.DrawTitleWithIconAndBackground(Styles.GetStyle(Styles.StyleName.IconFaKeyboard),
                                                      UILabels.Key,
                                                      Size.L,
                                                      DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(2),
                                                      ComponentColorName,
                                                      ComponentColorName);
            GUILayout.Space(DGUI.Properties.Space());

            var       inputMode           = (InputMode)m_inputMode.enumValueIndex;
            ColorName backgroundColorName = DGUI.Colors.GetBackgroundColorName(inputMode != InputMode.None, ComponentColorName);
            ColorName textColorName       = DGUI.Colors.GetTextColorName(inputMode != InputMode.None, ComponentColorName);


            m_alternateExpanded.target = inputMode != InputMode.None;

            DGUI.Line.Draw(false,
                           () =>
            {
                DGUI.Line.Draw(false, backgroundColorName,
                               () =>
                {
                    GUILayout.Space(DGUI.Properties.Space(2));
                    DGUI.Label.Draw(UILabels.InputMode, Size.S, textColorName, DGUI.Properties.SingleLineHeight);
                    EditorGUI.BeginChangeCheck();
                    DGUI.Property.Draw(m_inputMode, backgroundColorName, DGUI.Properties.SingleLineHeight);
                    if (EditorGUI.EndChangeCheck())
                    {
                        DGUI.Properties.ResetKeyboardFocus();
                    }
                });
            },
                           () =>
            {
                switch (inputMode)
                {
                case InputMode.KeyCode:
                    GUILayout.Space(DGUI.Properties.Space());
                    DGUI.Line.Draw(false, ComponentColorName,
                                   () =>
                    {
                        GUILayout.Space(DGUI.Properties.Space(2));
                        DGUI.Label.Draw(UILabels.KeyCode, Size.S, ComponentColorName, DGUI.Properties.SingleLineHeight);
                        DGUI.Property.Draw(m_keyCode, ComponentColorName, DGUI.Properties.SingleLineHeight);
                        GUILayout.Space(DGUI.Properties.Space());
                    });
                    break;

                case InputMode.VirtualButton:
                    GUILayout.Space(DGUI.Properties.Space());
                    DGUI.Line.Draw(false, ComponentColorName,
                                   () =>
                    {
                        GUILayout.Space(DGUI.Properties.Space(2));
                        DGUI.Label.Draw(UILabels.VirtualButton, Size.S, ComponentColorName, DGUI.Properties.SingleLineHeight);
                        DGUI.Property.Draw(m_virtualButtonName, ComponentColorName, DGUI.Properties.SingleLineHeight);
                        GUILayout.Space(DGUI.Properties.Space());
                    });
                    break;
                }
            }
                           );

            if (DGUI.FadeOut.Begin(m_alternateExpanded, false))
            {
                GUILayout.Space(DGUI.Properties.Space());
                DGUI.Line.Draw(false,
                               () =>
                {
                    DGUI.Toggle.Checkbox.Draw(m_enableAlternateInputs, UILabels.AlternateInput, ComponentColorName, true, false);
                },
                               () =>
                {
                    bool enabled = GUI.enabled;
                    GUI.enabled  = m_enableAlternateInputs.boolValue;

                    backgroundColorName = !m_enableAlternateInputs.boolValue ? DGUI.Colors.DisabledBackgroundColorName : ComponentColorName;
                    textColorName       = !m_enableAlternateInputs.boolValue ? DGUI.Colors.DisabledTextColorName : ComponentColorName;

                    switch (inputMode)
                    {
                    case InputMode.KeyCode:
                        GUILayout.Space(DGUI.Properties.Space());
                        DGUI.Line.Draw(false, backgroundColorName,
                                       () =>
                        {
                            GUILayout.Space(DGUI.Properties.Space(2));
                            DGUI.Label.Draw(UILabels.AlternateKeyCode, Size.S, textColorName, DGUI.Properties.SingleLineHeight);
                            DGUI.Property.Draw(m_keyCodeAlt, backgroundColorName, DGUI.Properties.SingleLineHeight);
                            GUILayout.Space(DGUI.Properties.Space());
                        });
                        break;

                    case InputMode.VirtualButton:
                        GUILayout.Space(DGUI.Properties.Space());
                        DGUI.Line.Draw(false, backgroundColorName,
                                       () =>
                        {
                            GUILayout.Space(DGUI.Properties.Space(2));
                            DGUI.Label.Draw(UILabels.AlternateVirtualButton, Size.S, textColorName, DGUI.Properties.SingleLineHeight);
                            DGUI.Property.Draw(m_virtualButtonNameAlt, backgroundColorName, DGUI.Properties.SingleLineHeight);
                            GUILayout.Space(DGUI.Properties.Space());
                        });
                        break;
                    }

                    GUI.enabled = enabled;
                }
                               );
            }

            DGUI.FadeOut.End(m_alternateExpanded, false);
        }
        private void DrawSpriteProperties(ThemeData themeData, int propertyIndex, ThemeTargetEditorUtils.SelectionState selectionState)
        {
            GUIStyle buttonStyleDisabled = Styles.GetStyle(Styles.StyleName.CheckBoxDisabled);
            GUIStyle buttonStyleEnabled  = Styles.GetStyle(Styles.StyleName.CheckBoxEnabled);

            for (var i = 0; i < themeData.SpriteLabels.Count; i++)
            {
                LabelId spriteProperty = themeData.SpriteLabels[i];
                int     index          = i;
                bool    selected       = i == propertyIndex;
                GUILayout.BeginHorizontal();
                {
                    GUI.color = DGUI.Colors.PropertyColor(ComponentColorName);
                    if (GUILayout.Button(GUIContent.none, selected ? buttonStyleEnabled : buttonStyleDisabled))
                    {
                        if (serializedObject.isEditingMultipleObjects)
                        {
                            DoozyUtils.UndoRecordObjects(targets, UILabels.UpdateValue);
                            foreach (Object o in targets)
                            {
                                var themeTarget = (SpriteTargetSelectable)o;
                                if (themeTarget == null)
                                {
                                    continue;
                                }
                                switch (selectionState)
                                {
                                case ThemeTargetEditorUtils.SelectionState.Highlighted:
                                    themeTarget.HighlightedSpritePropertyId = themeData.SpriteLabels[index].Id;
                                    break;

                                case ThemeTargetEditorUtils.SelectionState.Pressed:
                                    themeTarget.PressedSpritePropertyId = themeData.SpriteLabels[index].Id;
                                    break;

#if UNITY_2019_3_OR_NEWER
                                case ThemeTargetEditorUtils.SelectionState.Selected:
                                    themeTarget.SelectedSpritePropertyId = themeData.SpriteLabels[index].Id;
                                    break;
#endif
                                case ThemeTargetEditorUtils.SelectionState.Disabled:
                                    themeTarget.DisabledSpritePropertyId = themeData.SpriteLabels[index].Id;
                                    break;
                                }

                                themeTarget.UpdateTarget(themeData);
                            }
                        }
                        else
                        {
                            DoozyUtils.UndoRecordObject(target, UILabels.UpdateValue);
                            switch (selectionState)
                            {
                            case ThemeTargetEditorUtils.SelectionState.Highlighted:
                                Target.HighlightedSpritePropertyId = themeData.SpriteLabels[index].Id;
                                break;

                            case ThemeTargetEditorUtils.SelectionState.Pressed:
                                Target.PressedSpritePropertyId = themeData.SpriteLabels[index].Id;
                                break;

#if UNITY_2019_3_OR_NEWER
                            case ThemeTargetEditorUtils.SelectionState.Selected:
                                Target.SelectedSpritePropertyId = themeData.SpriteLabels[index].Id;
                                break;
#endif
                            case ThemeTargetEditorUtils.SelectionState.Disabled:
                                Target.DisabledSpritePropertyId = themeData.SpriteLabels[index].Id;
                                break;
                            }

                            Target.UpdateTarget(themeData);
                        }
                    }

                    GUI.color = InitialGUIColor;
                    GUILayout.Space(DGUI.Properties.Space(2));
                    GUI.enabled = selected;
                    DGUI.Label.Draw(spriteProperty.Label, selected ? Size.L : Size.M);
                    GUI.enabled = true;
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(DGUI.Properties.Space());
            }
        }
        private static void DrawHelpLinkBoxSupportEmail()
        {
            string emailLink = DoozySettings.MAILTO +
                               DoozySettings.SUPPORT_EMAIL_ADDRESS +
                               MyEscapeURL("?subject=DoozyUI - Support Request" +
                                           "&body=" +
                                           "What Happened" +
                                           "%0D%0A" +
                                           "------------------" +
                                           "%0D%0A" +
                                           "%0D%0A" +
                                           "%0D%0A" +
                                           "How did it happen? " +
                                           "%0D%0A" +
                                           "------------------" +
                                           "%0D%0A" +
                                           "%0D%0A" +
                                           "%0D%0A" +
                                           "%0D%0A" +
                                           "%0D%0A" +
                                           "------------------" +
                                           "%0D%0A" +
                                           "Please attach links to any relevant files, screenshots or videos that can help describe the issue better." +
                                           "%0D%0A" +
                                           "------------------" +
                                           "%0D%0A" +
                                           "Unity Version: " + Application.unityVersion +
                                           "%0D%0A" +
                                           "Operating System: " + SystemInfo.operatingSystem +
                                           "%0D%0A" +
                                           "Device Model: " + SystemInfo.deviceModel +
                                           "%0D%0A" +
                                           "------------------" +
                                           "%0D%0A");


            DrawHelpLinkBox(UILabels.SupportEmail, DoozySettings.SUPPORT_EMAIL_ADDRESS, Styles.GetStyle(Styles.StyleName.IconFaEnvelope), DGUI.Colors.LightOrDarkColorName, UILabels.Email, emailLink);
        }
        private void DrawViewHeader()
        {
            GUIStyle headerStyle;

            switch (CurrentView)
            {
            case View.General:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderGeneral);
                break;

            case View.Buttons:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderButtons);
                break;

            case View.Views:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderViews);
                break;

            case View.Canvases:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderCanvases);
                break;

            case View.Drawers:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderDrawers);
                break;

            case View.Popups:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderPopups);
                break;

            case View.Nody:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderNody);
                break;

            case View.Soundy:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderSoundy);
                break;

            case View.Touchy:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderTouchy);
                break;

            case View.Animations:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderAnimations);
                break;

            case View.Templates:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderTemplates);
                break;

            case View.Themes:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderThemes);
                break;

            case View.Debug:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderDebug);
                break;

            case View.Settings:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderSettings);
                break;

            case View.Keys:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderKeys);
                break;

            case View.Help:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderHelp);
                break;

            case View.About:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderAbout);
                break;

            default:
                headerStyle = Styles.GetStyle(Styles.StyleName.DoozyWindowViewHeaderGeneral);
                break;
            }

            GUILayout.Label(GUIContent.none, headerStyle, GUILayout.ExpandWidth(true));
            DrawDynamicViewVerticalSpace();
        }
        private void DrawLeftToolbar()
        {
            GUILayout.BeginVertical(GUILayout.Height(position.height));
            {
                DGUI.AnimatedTexture.Draw(ToolbarAnimBool, DoozyToolbarHeader, DoozyWindowSettings.Instance.ToolbarExpandedWidth, DoozyWindowSettings.Instance.ToolbarHeaderHeight); //Doozy Toolbar Header

                DrawToolbarExpandCollapseButton();
                GUILayout.Space(LeftToolbarVerticalSectionSpacing / 2);
                DrawToolbarButton(View.General, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonGeneral), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonGeneralSelected));
                GUILayout.Space(LeftToolbarVerticalSectionSpacing);
                DrawToolbarButton(View.Canvases, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonCanvases), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonCanvasesSelected));
                DrawToolbarButton(View.Views, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonViews), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonViewsSelected));
                DrawToolbarButton(View.Buttons, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonButtons), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonButtonsSelected));
                DrawToolbarButton(View.Drawers, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonDrawers), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonDrawersSelected));
                DrawToolbarButton(View.Popups, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonPopups), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonPopupsSelected));
                GUILayout.Space(LeftToolbarVerticalSectionSpacing);
                DrawToolbarButton(View.Soundy, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonSoundy), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonSoundySelected));
                DrawToolbarButton(View.Touchy, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonTouchy), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonTouchySelected));
                DrawToolbarButton(View.Nody, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonNody), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonNodySelected));
//                GUILayout.Space(DGUI.Properties.Space(8));
//                DrawToolbarButton(View.Animations, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonAnimations), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonAnimationsSelected));
//                DrawToolbarButton(View.Templates, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonTemplates), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonTemplatesSelected));
                GUILayout.Space(LeftToolbarVerticalSectionSpacing);
                DrawToolbarButton(View.Settings, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonSettings), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonSettingsSelected));
                DrawToolbarButton(View.Debug, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonDebug), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonDebugSelected));
//                DrawToolbarButton(View.Keys, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonKeys), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonKeysSelected));
                GUILayout.Space(LeftToolbarVerticalSectionSpacing);
                DrawToolbarButton(View.Help, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonHelp), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonHelpSelected));
                DrawToolbarButton(View.About, Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonAbout), Styles.GetStyle(Styles.StyleName.DoozyWindowToolbarButtonAboutSelected));

                GUILayout.FlexibleSpace();
            }
            GUILayout.EndVertical();
        }
Beispiel #10
0
        private void DrawSoundy(Rect drawRect, SerializedProperty property, bool hasSound, bool hasMissingAudioClips, bool nameIsNoSound, SoundyAudioPlayer.Player player, ColorName backgroundColorName, ColorName textColorName)
        {
            Color initialColor = GUI.color;

            //LINE 1A
            SerializedProperty soundSource  = Properties.Get(PropertyName.SoundSource, property);
            SerializedProperty databaseName = Properties.Get(PropertyName.DatabaseName, property);
            SerializedProperty soundName    = Properties.Get(PropertyName.SoundName, property);

            float x = drawRect.x + DGUI.Properties.Space();
            float y = drawRect.y;

            var   outputLabelRect            = new Rect(x, y, OUTPUT_LABEL_WIDTH, TOP_ROW_HEIGHT);
            float databaseNameSoundNameWidth = (drawRect.width - OUTPUT_LABEL_WIDTH - DGUI.Properties.Space(5)) / 2;

            x += OUTPUT_LABEL_WIDTH + DGUI.Properties.Space();
            var databaseNameLabelRect = new Rect(x, y, databaseNameSoundNameWidth, TOP_ROW_HEIGHT);

            x += databaseNameSoundNameWidth + DGUI.Properties.Space();
            var soundNameLabelRect = new Rect(x, y, databaseNameSoundNameWidth, TOP_ROW_HEIGHT);

            DGUI.Label.Draw(outputLabelRect, UILabels.SoundSource, Size.S, textColorName);
            DGUI.Label.Draw(databaseNameLabelRect, UILabels.DatabaseName, Size.S, textColorName);
            DGUI.Label.Draw(soundNameLabelRect, UILabels.SoundName, Size.S, textColorName);

            //LINE 1B
            x  = drawRect.x + DGUI.Properties.Space();
            y += TOP_ROW_HEIGHT + DGUI.Properties.Space();
            var outputDropdownRect = new Rect(x, y, OUTPUT_LABEL_WIDTH, DGUI.Properties.SingleLineHeight);

            x += OUTPUT_LABEL_WIDTH + DGUI.Properties.Space();
            var databaseNameDropdownRect = new Rect(x, y, databaseNameSoundNameWidth, DGUI.Properties.SingleLineHeight);

            x += databaseNameSoundNameWidth + DGUI.Properties.Space();
            var soundNameDropdownRect = new Rect(x, y, databaseNameSoundNameWidth, DGUI.Properties.SingleLineHeight);

            SoundDatabase soundDatabase = SoundySettings.Database.GetSoundDatabase(databaseName.stringValue);

            if (soundDatabase == null)
            {
                databaseName.stringValue = SoundyManager.GENERAL;
                soundDatabase            = SoundySettings.Database.GetSoundDatabase(SoundyManager.GENERAL);
                if (soundDatabase == null)
                {
                    SoundySettings.Database.Initialize();
                }
                if (soundDatabase == null)
                {
                    return;
                }
            }

            int databaseIndex = SoundySettings.Database.DatabaseNames.IndexOf(databaseName.stringValue);

            int soundNameIndex;

            if (soundDatabase.SoundNames.Contains(soundName.stringValue))
            {
                soundNameIndex = soundDatabase.SoundNames.IndexOf(soundName.stringValue);
            }
            else
            {
                soundName.stringValue = SoundyManager.NO_SOUND;
                soundNameIndex        = soundDatabase.SoundNames.IndexOf(SoundyManager.NO_SOUND);
            }

            GUI.color = DGUI.Colors.PropertyColor(backgroundColorName);

            //DRAW - OUTPUT DROPDOWN
            EditorGUI.BeginChangeCheck();
            EditorGUI.PropertyField(outputDropdownRect, soundSource, GUIContent.none, true);
            if (EditorGUI.EndChangeCheck())
            {
                soundName.stringValue = "";
                if (player != null && player.IsPlaying)
                {
                    player.Stop();
                }
                DGUI.Properties.ResetKeyboardFocus();
            }

            //DRAW - DATABASE NAME DROPDOWN
            EditorGUI.BeginChangeCheck();
            databaseIndex = EditorGUI.Popup(databaseNameDropdownRect, databaseIndex, SoundySettings.Database.DatabaseNames.ToArray());
            if (EditorGUI.EndChangeCheck())
            {
                databaseName.stringValue = SoundySettings.Database.DatabaseNames[databaseIndex];
                DGUI.Properties.ResetKeyboardFocus();
                UpdateThisAudioDataPreviewReference(property);
                if (player != null && player.IsPlaying)
                {
                    player.Stop();
                }
            }

            if (hasMissingAudioClips && !nameIsNoSound)
            {
                GUI.color = DGUI.Colors.PropertyColor(ColorName.Red);
            }

            //DRAW - SOUND NAME NAME DROPDOWN
            EditorGUI.BeginChangeCheck();
            soundNameIndex = EditorGUI.Popup(soundNameDropdownRect, soundNameIndex, soundDatabase.SoundNames.ToArray());
            if (EditorGUI.EndChangeCheck())
            {
                soundName.stringValue = soundDatabase.SoundNames[soundNameIndex];
                DGUI.Properties.ResetKeyboardFocus();
                UpdateThisAudioDataPreviewReference(property);
                if (player != null && player.IsPlaying)
                {
                    player.Stop();
                }
            }

            GUI.color = initialColor;

            //LINE 2
            x  = drawRect.x + DGUI.Properties.Space();
            y += DGUI.Properties.SingleLineHeight + DGUI.Properties.Space();

            const float iconSize = 12f;

            var openSoundyButtonRect = new Rect(x, y, OUTPUT_LABEL_WIDTH, DGUI.Properties.SingleLineHeight);

            x += OUTPUT_LABEL_WIDTH;
            x += DGUI.Properties.Space(2);
            var outputAudioMixerGroupIconRect = new Rect(x, y + (DGUI.Properties.SingleLineHeight - iconSize) / 2, iconSize, iconSize);

            x += outputAudioMixerGroupIconRect.width;
            x += DGUI.Properties.Space();
            var outputAudioMixerGroupLabelRect = new Rect(x, y, drawRect.width - OUTPUT_LABEL_WIDTH - outputAudioMixerGroupIconRect.width - DGUI.Properties.Space(5), DGUI.Properties.SingleLineHeight);

            if (DGUI.Button.Draw(openSoundyButtonRect, DGUI.Properties.Labels.Soundy, Size.S, TextAlign.Center, hasMissingAudioClips && !nameIsNoSound ? ColorName.Red : DGUI.Colors.SoundyColorName, hasMissingAudioClips && !nameIsNoSound)) //draw Soundy sutton
            {
                DoozyWindow.Open(DoozyWindow.View.Soundy,
                                 () =>
                {
                    DoozyWindow.Instance.GetSoundDatabaseAnimBool(databaseName.stringValue).target = true;
                });
            }


            bool hasOutputAudioMixerGroup = player != null && player.OutputAudioMixerGroup != null;

            DGUI.Icon.Draw(outputAudioMixerGroupIconRect, Styles.GetStyle(Styles.StyleName.IconAudioMixerGroup), hasOutputAudioMixerGroup ? textColorName : DGUI.Colors.DisabledTextColorName);               //draw audio mixer group icon
            DGUI.Label.Draw(outputAudioMixerGroupLabelRect, player != null ? player.OutputAudioMixerGroupName : "---", Size.S, hasOutputAudioMixerGroup ? textColorName : DGUI.Colors.DisabledTextColorName); //draw audio mixer group name
            GUI.color = initialColor;

            //LINE 3
            x  = drawRect.x + DGUI.Properties.Space();
            y += DGUI.Properties.SingleLineHeight + DGUI.Properties.Space();

            DrawPlayer(drawRect, x, y, hasSound, player, textColorName);

            GUI.color = initialColor;
        }
Beispiel #11
0
        private void DrawAudioClip(Rect drawRect, SerializedProperty property, bool hasSound, SoundyAudioPlayer.Player player, ColorName backgroundColorName, ColorName textColorName)
        {
            Color initialColor = GUI.color;

            SerializedProperty soundSource           = Properties.Get(PropertyName.SoundSource, property);
            SerializedProperty audioClip             = Properties.Get(PropertyName.AudioClip, property);
            SerializedProperty outputAudioMixerGroup = Properties.Get(PropertyName.OutputAudioMixerGroup, property);

            //LINE 1A
            float x = drawRect.x + DGUI.Properties.Space();
            float y = drawRect.y;

            var   outputLabelRect     = new Rect(x, y, OUTPUT_LABEL_WIDTH, TOP_ROW_HEIGHT);
            float audioClipLabelWidth = drawRect.width - OUTPUT_LABEL_WIDTH - DGUI.Properties.Space(4);

            x += OUTPUT_LABEL_WIDTH + DGUI.Properties.Space();
            var audioClipLabelRect = new Rect(x, y, audioClipLabelWidth, TOP_ROW_HEIGHT);


            DGUI.Label.Draw(outputLabelRect, UILabels.SoundSource, Size.S, textColorName);
            DGUI.Label.Draw(audioClipLabelRect, UILabels.AudioClip, Size.S, textColorName);

            //LINE 1B
            x  = drawRect.x + DGUI.Properties.Space();
            y += TOP_ROW_HEIGHT + DGUI.Properties.Space();
            var outputDropdownRect = new Rect(x, y, OUTPUT_LABEL_WIDTH, DGUI.Properties.SingleLineHeight);

            x += OUTPUT_LABEL_WIDTH + DGUI.Properties.Space();
            var audioClipRect = new Rect(x, y, audioClipLabelWidth, DGUI.Properties.SingleLineHeight);

            GUI.color = DGUI.Colors.PropertyColor(backgroundColorName);

            //DRAW - OUTPUT DROPDOWN
            EditorGUI.BeginChangeCheck();
            EditorGUI.PropertyField(outputDropdownRect, soundSource, GUIContent.none, true);
            if (EditorGUI.EndChangeCheck())
            {
                Properties.Get(PropertyName.SoundName, property).stringValue = "";
                if (player != null && player.IsPlaying)
                {
                    player.Stop();
                }
                DGUI.Properties.ResetKeyboardFocus();
            }

            EditorGUI.BeginChangeCheck();
            EditorGUI.PropertyField(audioClipRect, audioClip, GUIContent.none, true);
            if (EditorGUI.EndChangeCheck())
            {
                if (player != null && player.IsPlaying)
                {
                    player.Stop();
                }
                DGUI.Properties.ResetKeyboardFocus();
            }

            GUI.color = initialColor;

            //LINE 2
            x  = drawRect.x + DGUI.Properties.Space();
            y += DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(2);

            var     outputAudioMixerGroupContent     = new GUIContent(UILabels.OutputAudioMixerGroup);
            Vector2 outputAudioMixerGroupContentSize = DGUI.Label.Style(Size.S).CalcSize(outputAudioMixerGroupContent);

            const float iconSize = 12f;

            var outputAudioMixerGroupIconRect = new Rect(x, y + (DGUI.Properties.SingleLineHeight - iconSize) / 2, iconSize, iconSize);

            x += iconSize;
            x += DGUI.Properties.Space();
            var outputAudioMixerGroupLabelRect = new Rect(x, y + (DGUI.Properties.SingleLineHeight - outputAudioMixerGroupContentSize.y) / 2, outputAudioMixerGroupContentSize.x, outputAudioMixerGroupContentSize.y);

            x += outputAudioMixerGroupContentSize.x;
            x += DGUI.Properties.Space(2);
            var outputAudioMixerGroupRect = new Rect(x, y, drawRect.width - DGUI.Properties.Space(6) - outputAudioMixerGroupIconRect.width - outputAudioMixerGroupLabelRect.width, DGUI.Properties.SingleLineHeight);

            bool hasOutputAudioMixerGroup = outputAudioMixerGroup.objectReferenceValue != null;

            DGUI.Icon.Draw(outputAudioMixerGroupIconRect, Styles.GetStyle(Styles.StyleName.IconAudioMixerGroup), hasOutputAudioMixerGroup ? textColorName : DGUI.Colors.DisabledTextColorName);
            DGUI.Label.Draw(outputAudioMixerGroupLabelRect, outputAudioMixerGroupContent, Size.S, hasOutputAudioMixerGroup ? textColorName : DGUI.Colors.DisabledTextColorName);

            GUI.color = initialColor;

            EditorGUI.BeginChangeCheck();
            DGUI.Property.Draw(outputAudioMixerGroupRect, outputAudioMixerGroup, hasOutputAudioMixerGroup ? backgroundColorName : DGUI.Colors.DisabledBackgroundColorName);
            if (EditorGUI.EndChangeCheck())
            {
                if (player != null && player.IsPlaying)
                {
                    player.Stop();
                }
                DGUI.Properties.ResetKeyboardFocus();
            }

            GUI.color = initialColor;

            //LINE 3
            x  = drawRect.x + DGUI.Properties.Space();
            y += DGUI.Properties.SingleLineHeight + DGUI.Properties.Space();

            DrawPlayer(drawRect, x, y, hasSound, player, textColorName);

            GUI.color = initialColor;
        }
Beispiel #12
0
        private void Draw(Rect position, SerializedProperty property)
        {
            Color initialColor = GUI.color; //save the GUI color

            SoundyAudioPlayer.Player player = null;
            bool     nameIsNoSound          = false;
            bool     hasSound             = false;
            bool     hasMissingAudioClips = false;
            GUIStyle icon;

            var soundSource = (SoundSource)Properties.Get(PropertyName.SoundSource, property).intValue;

            switch (soundSource)
            {
            case SoundSource.Soundy:
                NumberOfLines[property.propertyPath] = 4;
                player = SoundyAudioPlayer.GetPlayer(GetAudioData(Properties.Get(PropertyName.DatabaseName, property).stringValue, Properties.Get(PropertyName.SoundName, property).stringValue),
                                                     GetAudioMixerGroup(Properties.Get(PropertyName.DatabaseName, property).stringValue));
                if (player != null && player.SoundGroupData != null)
                {
                    nameIsNoSound        = Properties.Get(PropertyName.SoundName, property).stringValue.Equals(SoundyManager.NO_SOUND);
                    hasSound             = player.SoundGroupData.HasSound;
                    hasMissingAudioClips = player.SoundGroupData.HasMissingAudioClips;
                }

                icon = Styles.GetStyle(Styles.StyleName.IconSoundy);
                break;

            case SoundSource.AudioClip:
                NumberOfLines[property.propertyPath] = 4;
                player = SoundyAudioPlayer.GetPlayer((AudioClip)Properties.Get(PropertyName.AudioClip, property).objectReferenceValue,
                                                     (AudioMixerGroup)Properties.Get(PropertyName.OutputAudioMixerGroup, property).objectReferenceValue);
                hasSound = player != null && player.AudioClip != null;
                icon     = Styles.GetStyle(Styles.StyleName.IconSound);
                break;

            case SoundSource.MasterAudio:
                NumberOfLines[property.propertyPath] = 2;
                hasSound = !string.IsNullOrEmpty(Properties.Get(PropertyName.SoundName, property).stringValue);
                icon     = Styles.GetStyle(DoozySettings.Instance.UseMasterAudio ? Styles.StyleName.IconMasterAudio : Styles.StyleName.IconError);
                break;

            default: throw new ArgumentOutOfRangeException();
            }

            ColorName backgroundColorName = hasSound ? DrawerColorName : DGUI.Colors.DisabledBackgroundColorName;
            ColorName textColorName       = hasSound ? DrawerColorName : DGUI.Colors.DisabledTextColorName;

            Rect drawRect = GetDrawRectAndDrawBackground(position, NumberOfLines[property.propertyPath], backgroundColorName); //calculate draw rect and draw background

            drawRect    = InsertDrawerIcon(drawRect, property, soundSource != SoundSource.MasterAudio ? backgroundColorName : DoozySettings.Instance.UseMasterAudio ? ColorName.White : ColorName.Red, icon);
            drawRect.y += DGUI.Properties.Space();

            switch (soundSource)
            {
            case SoundSource.Soundy:
                DrawSoundy(drawRect, property, hasSound, hasMissingAudioClips, nameIsNoSound, player, backgroundColorName, textColorName);
                break;

            case SoundSource.AudioClip:
                DrawAudioClip(drawRect, property, hasSound, player, backgroundColorName, textColorName);
                break;

            case SoundSource.MasterAudio:
                DrawMasterAudio(drawRect, property, backgroundColorName, textColorName);
                break;
            }

            GUI.color = initialColor; //restore the GUI color
        }
        public static bool DrawAnimationPreset(SerializedObject serializedObject,
                                               SerializedProperty loadSelectedPresetAtRuntime,
                                               SerializedProperty presetCategory,
                                               SerializedProperty presetName,
                                               UIAnimationsDatabase databases,
                                               UIAnimation animation,
                                               ColorName colorName,
                                               out UIAnimation outAnimation)
        {
            bool presetUpdated = false;

            UIAnimationDatabase database = databases.Get(presetCategory.stringValue);

            if (database == null || !database.Contains(presetName.stringValue))
            {
                presetCategory.stringValue = UIAnimations.DEFAULT_DATABASE_NAME;
                presetName.stringValue     = UIAnimations.DEFAULT_PRESET_NAME;
                serializedObject.ApplyModifiedProperties();
                presetUpdated = true;
            }

            if (database == null)
            {
                database = databases.Get(presetCategory.stringValue);
            }

            float           buttonHeight           = DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(2);
            float           lineHeight             = DGUI.Properties.SingleLineHeight;
            float           backgroundHeight       = lineHeight * 2 + DGUI.Properties.Space(2);
            GUILayoutOption backgroundHeightOption = GUILayout.Height(backgroundHeight);

            bool  loadAtRuntime = loadSelectedPresetAtRuntime.boolValue;
            float labelAlpha    = DGUI.Properties.TextIconAlphaValue(loadAtRuntime);
            Color initialColor  = GUI.color;

            bool isBeingEdited = s_behaviorPropertyBeingEdited == loadSelectedPresetAtRuntime;

            if (isBeingEdited && Event.current.keyCode == KeyCode.Escape && Event.current.type == EventType.KeyUp)
            {
                ResetPresetSettings();
            }

            UIAnimation returnAnimation = animation;

            DGUI.Line.Draw(false, colorName, false, buttonHeight,
                           () =>
            {
                GUILayout.Space(DGUI.Properties.Space());

                if (isBeingEdited)
                {
                    GUILayout.Space(DGUI.Properties.Space());
                    EditorGUI.BeginChangeCheck();
                    s_createNewPresetCategory = DGUI.Toggle.Checkbox.Draw(s_createNewPresetCategory, colorName, buttonHeight - DGUI.Properties.Space(), serializedObject.isEditingMultipleObjects);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (s_createNewPresetCategory)
                        {
                            s_selectPresetCategoryTextField = true;
                        }
                    }

                    GUILayout.Space(DGUI.Properties.Space());
                    DGUI.Label.Draw(DGUI.Properties.Labels.CreateNewCategory, Size.M, colorName, buttonHeight);
                    GUILayout.FlexibleSpace();
                    if ((Event.current.type == EventType.KeyUp && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter) && GUI.GetNameOfFocusedControl().Equals(DGUI.Properties.Labels.PresetName)) |
                        DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconSave), DGUI.Properties.Labels.SavePreset, Size.S, TextAlign.Left, ColorName.Green, ColorName.Green, buttonHeight, false))
                    {
                        if (s_createNewPresetCategory)
                        {
                            if (s_newPresetCategory == null)
                            {
                                s_newPresetCategory = string.Empty;
                            }
                            s_newPresetCategory = s_newPresetCategory.Trim();
                            if (string.IsNullOrEmpty(s_newPresetCategory))
                            {
                                EditorUtility.DisplayDialog(DGUI.Properties.Labels.NewCategory, DGUI.Properties.Labels.NewCategoryNameCannotBeEmpty, DGUI.Properties.Labels.Ok);
                            }
                            else if (databases.DatabaseNames.Contains(s_newPresetCategory))
                            {
                                EditorUtility.DisplayDialog(DGUI.Properties.Labels.NewCategory, DGUI.Properties.Labels.AnotherEntryExists, DGUI.Properties.Labels.Ok);
                            }
                            else
                            {
                                UIAnimationDatabase targetDatabase = UIAnimations.Instance.CreateDatabase(databases.DatabaseType, s_newPresetCategory, true);
                                if (string.IsNullOrEmpty(s_newPresetName))
                                {
                                    EditorUtility.DisplayDialog(DGUI.Properties.Labels.NewPreset, DGUI.Properties.Labels.NewPresetNameCannotBeEmpty, DGUI.Properties.Labels.Ok);
                                }
                                else if (targetDatabase.Contains(s_newPresetName))
                                {
                                    EditorUtility.DisplayDialog(DGUI.Properties.Labels.NewPreset, DGUI.Properties.Labels.AnotherEntryExists, DGUI.Properties.Labels.Ok);
                                }
                                else
                                {
                                    targetDatabase.CreatePreset(s_newPresetName, animation);
                                    targetDatabase.RefreshDatabase(true);
                                    databases.Update();
                                    presetCategory.stringValue = s_newPresetCategory;
                                    presetName.stringValue     = s_newPresetName;
                                    serializedObject.ApplyModifiedProperties();
                                    ResetPresetSettings();
                                    presetUpdated = true;
                                }
                            }
                        }
                        else
                        {
                            if (s_newPresetName == null)
                            {
                                s_newPresetName = string.Empty;
                            }
                            s_newPresetName = s_newPresetName.Trim();
                            if (string.IsNullOrEmpty(s_newPresetName))
                            {
                                EditorUtility.DisplayDialog(DGUI.Properties.Labels.NewPreset, DGUI.Properties.Labels.NewPresetNameCannotBeEmpty, DGUI.Properties.Labels.Ok);
                            }
                            else if (database.Contains(s_newPresetName))
                            {
                                EditorUtility.DisplayDialog(DGUI.Properties.Labels.NewPreset, DGUI.Properties.Labels.AnotherEntryExists, DGUI.Properties.Labels.Ok);
                            }
                            else
                            {
                                database.CreatePreset(s_newPresetName, animation);
                                database.RefreshDatabase(true);
                                databases.Update();
                                presetName.stringValue = s_newPresetName;
                                serializedObject.ApplyModifiedProperties();
                                ResetPresetSettings();
                            }
                        }
                    }

                    GUILayout.Space(DGUI.Properties.Space());
                    if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconClose), DGUI.Properties.Labels.Cancel, Size.S, TextAlign.Left, ColorName.Red, ColorName.Red, buttonHeight, false))
                    {
                        ResetPresetSettings();
                    }
                }
                else
                {
                    if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconFaBinoculars), colorName, colorName, buttonHeight))
                    {
                        UIAnimations.Instance.SearchForUnregisteredDatabases(true);
                    }

                    GUILayout.Space(DGUI.Properties.Space(2));

                    if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconNew), DGUI.Properties.Labels.NewPreset, Size.S, TextAlign.Left, colorName, colorName, buttonHeight, false))
                    {
                        s_behaviorPropertyBeingEdited = loadSelectedPresetAtRuntime;
                        s_createNewPresetName         = true;
                        s_newPresetCategory           = presetCategory.stringValue;
                        s_selectPresetNameTextField   = true;
                    }

                    GUILayout.FlexibleSpace();

                    if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconLoad), DGUI.Properties.Labels.LoadPreset, Size.S, TextAlign.Left, colorName, colorName, buttonHeight, false))
                    {
                        UIAnimation presetAnimation = UIAnimations.LoadPreset(animation.AnimationType, presetCategory.stringValue, presetName.stringValue);
                        if (presetAnimation != null)
                        {
                            Undo.RecordObjects(serializedObject.targetObjects, DGUI.Properties.Labels.LoadPreset);
                            returnAnimation = presetAnimation;
                            presetUpdated   = true;
                        }
                    }

                    GUILayout.Space(DGUI.Properties.Space(2));

                    if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconClose), DGUI.Properties.Labels.DeletePreset, Size.S, TextAlign.Left, colorName, colorName, buttonHeight, false))
                    {
                        if (presetCategory.stringValue.Equals(UIAnimations.DEFAULT_DATABASE_NAME) && presetName.stringValue.Equals(UIAnimations.DEFAULT_PRESET_NAME))
                        {
                            return;
                        }
                        if (EditorUtility.DisplayDialog(DGUI.Properties.Labels.DeletePreset,
                                                        DGUI.Properties.Labels.PresetCategory + ": " + presetCategory.stringValue +
                                                        "\n" +
                                                        DGUI.Properties.Labels.PresetName + ": " + presetName.stringValue,
                                                        DGUI.Properties.Labels.Yes,
                                                        DGUI.Properties.Labels.No))
                        {
                            database.Delete(presetName.stringValue, true);
                            if (database != null && database.Database.Count > 0)
                            {
                                presetName.stringValue = database.AnimationNames[0];
                            }
                            else
                            {
                                UIAnimations.Instance.Initialize();
                                presetCategory.stringValue = UIAnimations.DEFAULT_DATABASE_NAME;
                                presetName.stringValue     = UIAnimations.DEFAULT_PRESET_NAME;
                                presetUpdated = true;
                            }

                            serializedObject.ApplyModifiedProperties();
                        }
                    }
                }

//                               GUILayout.Space(DGUI.Properties.Space());
            });

            GUILayout.Space(DGUI.Properties.Space());

            GUILayout.BeginHorizontal(backgroundHeightOption, GUILayout.ExpandWidth(true));
            {
                GUILayout.BeginVertical(backgroundHeightOption, GUILayout.ExpandWidth(true));
                {
                    DGUI.Background.Draw(colorName, backgroundHeight);
                    GUILayout.Space(-backgroundHeight);
                    GUILayout.Space(DGUI.Properties.Space());
                    GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                    {
                        GUILayout.Space(DGUI.Properties.Space(2));
                        GUI.color = GUI.color.WithAlpha(labelAlpha);
                        DGUI.Label.Draw(DGUI.Properties.Labels.PresetCategory, Size.S, colorName);
                        GUI.color = initialColor;
                    }
                    GUILayout.EndHorizontal();

                    GUI.color = DGUI.Colors.PropertyColor(colorName);

                    if (isBeingEdited && s_createNewPresetCategory)
                    {
                        GUI.SetNextControlName(DGUI.Properties.Labels.PresetCategory);
                        s_newPresetCategory = EditorGUILayout.TextField(GUIContent.none, s_newPresetCategory, GUILayout.ExpandWidth(true));
                        if (s_selectPresetCategoryTextField)
                        {
                            EditorGUI.FocusTextInControl(DGUI.Properties.Labels.PresetCategory);
                            s_selectPresetCategoryTextField = false;
                        }
                    }
                    else
                    {
                        int presetCategoryIndex = databases.DatabaseNames.IndexOf(presetCategory.stringValue);
                        EditorGUI.BeginChangeCheck();
                        presetCategoryIndex = EditorGUILayout.Popup(presetCategoryIndex, databases.DatabaseNames.ToArray(), GUILayout.ExpandWidth(true));
                        if (EditorGUI.EndChangeCheck())
                        {
                            presetCategory.stringValue = databases.DatabaseNames[presetCategoryIndex];
                            database = databases.Get(databases.DatabaseNames[presetCategoryIndex]);
                            database.RefreshDatabase(false);
                            presetName.stringValue = database.AnimationNames[0];
                            DGUI.Properties.ResetKeyboardFocus();
                            presetUpdated = true;
                        }
                    }


                    GUI.color = initialColor;
                }
                GUILayout.EndVertical();
                GUILayout.Space(DGUI.Properties.Space());
                GUILayout.BeginVertical(backgroundHeightOption, GUILayout.ExpandWidth(true));
                {
                    DGUI.Background.Draw(colorName, backgroundHeight);
                    GUILayout.Space(-backgroundHeight);
                    GUILayout.Space(DGUI.Properties.Space());
                    GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                    {
                        GUILayout.Space(DGUI.Properties.Space(2));
                        GUI.color = GUI.color.WithAlpha(labelAlpha);
                        DGUI.Label.Draw(DGUI.Properties.Labels.PresetName, Size.S, colorName);
                        GUI.color = initialColor;
                    }
                    GUILayout.EndHorizontal();

                    GUI.color = DGUI.Colors.PropertyColor(colorName);

                    if (isBeingEdited && s_createNewPresetName)
                    {
                        GUI.SetNextControlName(DGUI.Properties.Labels.PresetName);
                        s_newPresetName = EditorGUILayout.TextField(GUIContent.none, s_newPresetName, GUILayout.ExpandWidth(true));
                        if (s_selectPresetNameTextField)
                        {
                            EditorGUI.FocusTextInControl(DGUI.Properties.Labels.PresetName);
                            s_selectPresetNameTextField = false;
                        }
                    }
                    else
                    {
                        int presetNameIndex = database.AnimationNames.IndexOf(presetName.stringValue);
                        EditorGUI.BeginChangeCheck();
                        presetNameIndex = EditorGUILayout.Popup(presetNameIndex, database.AnimationNames.ToArray(), GUILayout.ExpandWidth(true));
                        if (EditorGUI.EndChangeCheck())
                        {
                            presetName.stringValue = database.AnimationNames[presetNameIndex];
                            presetUpdated          = true;
                        }
                    }

                    GUI.color = initialColor;
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(DGUI.Properties.Space());
            DGUI.Toggle.Checkbox.Draw(loadSelectedPresetAtRuntime, DGUI.Properties.Labels.LoadSelectedPresetAtRuntime, colorName, true, true, DGUI.Properties.SingleLineHeight);
            GUILayout.Space(DGUI.Properties.Space(2));

            outAnimation = returnAnimation;
            return(presetUpdated);
        }
        private void DrawSounds()
        {
            bool hasIssues = Target.HasMissingAudioClips;

            DGUI.Line.Draw(true, hasIssues ? ColorName.Red : ComponentColorName, true, DGUI.Properties.SingleLineHeight,
                           () =>
            {
                GUILayout.Space(DGUI.Properties.Space());
                if (hasIssues)
                {
                    DGUI.Icon.Draw(Styles.GetStyle(Styles.StyleName.IconError), DGUI.Properties.SingleLineHeight * 0.9f, DGUI.Properties.SingleLineHeight, Color.red);                //draw error icon (if needed)
                    GUILayout.Space(DGUI.Properties.Space(3));
                }

                DGUI.Label.Draw(UILabels.Sounds, Size.XL, hasIssues ? ColorName.Red : ComponentColorName, DGUI.Properties.SingleLineHeight);                //draw 'SOUNDS' label
            });

            GUILayout.Space(DGUI.Properties.Space());

            SerializedProperty sounds = GetProperty(PropertyName.Sounds);
            bool enabledState         = GUI.enabled;

            if (sounds.arraySize == 0)
            {
                DGUI.Line.Draw(false, ColorName.Red,
                               () =>
                {
                    GUILayout.Space(DGUI.Properties.Space(2));
                    GUI.enabled = false;
                    DGUI.Label.Draw(UILabels.NoSoundsHaveBeenAdded + "...", Size.S, DGUI.Colors.BaseDColor(), DGUI.Properties.SingleLineHeight);                //draw 'No sounds have been added...' label
                    GUI.enabled = enabledState;
                    GUILayout.FlexibleSpace();
                    DrawDropZone();
                    if (DGUI.Button.IconButton.Plus(DGUI.Properties.SingleLineHeight))                //draw PLUS button
                    {
                        Undo.RecordObject(this, "Add AudioData");
                        Target.Sounds.Add(new AudioData());
                        Data.SetDirty(false);
                        m_needsSave = true;
                    }
                });
                return;
            }

//            float backgroundHeight = DGUI.Properties.Space() + DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(); //plus button height
            float backgroundHeight = -DGUI.Properties.SingleLineHeight + DGUI.Properties.Space();

            for (int i = 0; i < sounds.arraySize; i++)
            {
                backgroundHeight += EditorGUI.GetPropertyHeight(sounds.GetArrayElementAtIndex(i));
                backgroundHeight += DGUI.Properties.Space(2);
            }

            DGUI.Background.Draw(ComponentColorName, GUILayout.Height(backgroundHeight));
            GUILayout.Space(-backgroundHeight);
            GUILayout.Space(DGUI.Properties.Space());

            for (int i = 0; i < sounds.arraySize; i++)
            {
                SerializedProperty audioDataProperty = sounds.GetArrayElementAtIndex(i);
                SerializedProperty audioClipProperty = GetProperty(PropertyName.AudioClip, audioDataProperty);
                float propertyHeight = EditorGUI.GetPropertyHeight(audioClipProperty);

                bool isPlaying    = Player.IsPlaying && Player.AudioSource.clip == audioClipProperty.objectReferenceValue;
                bool hasAudioClip = audioClipProperty.objectReferenceValue != null;

                DGUI.Line.Draw(false, ComponentColorName, false, propertyHeight,
                               () =>
                {
                    GUILayout.Space(DGUI.Properties.Space());
                    if (hasAudioClip)
                    {
                        GUILayout.Space(DGUI.Properties.Space());
                        if (isPlaying)
                        {
                            if (DGUI.Button.IconButton.Stop(DGUI.Properties.SingleLineHeight, ColorName.Red))                //stop button
                            {
                                Player.Stop();
                            }
                        }
                        else
                        {
                            if (DGUI.Button.IconButton.Play(DGUI.Properties.SingleLineHeight, DGUI.Colors.DisabledTextColorName))                //play button
                            {
                                Player.Play((AudioClip)audioClipProperty.objectReferenceValue);
                            }
                        }

                        GUILayout.Space(-DGUI.Properties.Space());
                    }
                    else
                    {
                        GUILayout.Space(DGUI.Properties.Space(2));
                        DGUI.Icon.Draw(Styles.GetStyle(Styles.StyleName.IconMuteSound), DGUI.Properties.SingleLineHeight, DGUI.Properties.SingleLineHeight, ColorName.Red);                //mute icon
                        GUILayout.Space(DGUI.Properties.Space());
                    }


                    DGUI.Property.Draw(audioClipProperty, !hasAudioClip ? ColorName.Red : isPlaying ? ComponentColorName : ColorName.White, DGUI.Properties.SingleLineHeight);                //audio clip property
                    if (hasAudioClip)
                    {
                        if (DGUI.Button.Draw(DGUI.Properties.Labels.SetAsSoundName, Size.S, ComponentColorName, false, DGUI.Properties.SingleLineHeight))                //'Set as Sound Name' button
                        {
                            Undo.RecordObject(this, "Update Sound Name");
                            GetProperty(PropertyName.SoundName).stringValue = audioClipProperty.objectReferenceValue.name;
                            m_soundNameHasBeenChanged = true;
                            Data.SetDirty(true);
                        }

                        GUILayout.Space(DGUI.Properties.Space());
                    }

                    if (DGUI.Button.IconButton.Minus(propertyHeight))                //minus button
                    {
                        sounds.DeleteArrayElementAtIndex(i);
                        Data.SetDirty(false);
                        m_needsSave = true;
                    }
                });
            }

            DGUI.Line.Draw(false,
                           () =>
            {
                GUILayout.FlexibleSpace();
                DrawDropZone();
                if (DGUI.Button.IconButton.Plus(DGUI.Properties.SingleLineHeight))                //plus button
                {
//                                   sounds.InsertArrayElementAtIndex(sounds.arraySize);
                    Undo.RecordObject(this, "Add AudioData");
                    Target.Sounds.Add(new AudioData());
                    Data.SetDirty(false);
                    m_needsSave = true;
                }
            });
        }
Beispiel #15
0
        private void DrawGeneralPluginBoxTextMeshPro()
        {
            bool usePlugin = Settings.UseTextMeshPro;

            EditorGUI.BeginChangeCheck();
            usePlugin = DrawGeneralPluginBox("TextMeshPro", Settings.TextMeshProDetected, usePlugin, DefineSymbolsProcessor.DEFINE_TEXT_MESH_PRO, Styles.GetStyle(Styles.StyleName.IconTextMeshPro));
            if (EditorGUI.EndChangeCheck())
            {
                Settings.UseTextMeshPro = usePlugin;
            }
        }
        private void DrawViewDebug()
        {
            if (CurrentView != View.Debug)
            {
                return;
            }

            #region DoozyUI

            DGUI.WindowUtils.DrawIconTitle(Styles.StyleName.IconDoozyUI, "DoozyUI", "UI Components", DGUI.Colors.LightOrDarkColorName);
            DrawDynamicViewVerticalSpace(0.5f);
            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(DGUI.Bar.Height(Size.XL) + DGUI.Properties.Space(4));
                GUILayout.BeginVertical();
                {
                    #region UIButton, UICanvas, UIDrawer, UIPopup, UIToggle, UIView

                    GUILayout.BeginHorizontal();
                    {
                        bool debugUIButton = DoozySettings.Instance.DebugUIButton;
                        EditorGUI.BeginChangeCheck();
                        debugUIButton = DrawDebugButton(debugUIButton, "UIButton", Styles.GetStyle(Styles.StyleName.IconUIButton), DGUI.Colors.UIButtonColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugUIButton = debugUIButton;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugUICanvas = DoozySettings.Instance.DebugUICanvas;
                        EditorGUI.BeginChangeCheck();
                        debugUICanvas = DrawDebugButton(debugUICanvas, "UICanvas", Styles.GetStyle(Styles.StyleName.IconUICanvas), DGUI.Colors.UICanvasColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugUICanvas = debugUICanvas;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugUIDrawer = DoozySettings.Instance.DebugUIDrawer;
                        EditorGUI.BeginChangeCheck();
                        debugUIDrawer = DrawDebugButton(debugUIDrawer, "UIDrawer", Styles.GetStyle(Styles.StyleName.IconUIDrawer), DGUI.Colors.UIDrawerColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugUIDrawer = debugUIDrawer;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugUIToggle = DoozySettings.Instance.DebugUIToggle;
                        EditorGUI.BeginChangeCheck();
                        debugUIToggle = DrawDebugButton(debugUIToggle, "UIToggle", Styles.GetStyle(Styles.StyleName.IconUIToggle), DGUI.Colors.UIToggleColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugUIToggle = debugUIToggle;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);


                        bool debugUIView = DoozySettings.Instance.DebugUIView;
                        EditorGUI.BeginChangeCheck();
                        debugUIView = DrawDebugButton(debugUIView, "UIView", Styles.GetStyle(Styles.StyleName.IconUIView), DGUI.Colors.UIViewColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugUIView = debugUIView;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.FlexibleSpace();
                    }
                    GUILayout.EndHorizontal();

                    #endregion

                    GUILayout.Space(m_debugVerticalButtonSpacing);

                    #region UIPopup, UIPopupManager
                    GUILayout.BeginHorizontal();
                    {
                        bool debugUIPopup = DoozySettings.Instance.DebugUIPopup;
                        EditorGUI.BeginChangeCheck();
                        debugUIPopup = DrawDebugButton(debugUIPopup, "UIPopup", Styles.GetStyle(Styles.StyleName.IconUIPopup), DGUI.Colors.UIPopupColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugUIPopup = debugUIPopup;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugUIPopupManager = DoozySettings.Instance.DebugUIPopupManager;
                        EditorGUI.BeginChangeCheck();
                        debugUIPopupManager = DrawDebugButton(debugUIPopupManager, "UIPopup Manager", Styles.GetStyle(Styles.StyleName.IconUIPopupManager), DGUI.Colors.UIPopupManagerColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugUIPopupManager = debugUIPopupManager;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.FlexibleSpace();
                    }
                    GUILayout.EndHorizontal();
                    #endregion

                    GUILayout.Space(m_debugVerticalButtonSpacing);

                    #region UIButton Listener, UIDrawer Listener, UIView Listener

                    GUILayout.BeginHorizontal();
                    {
                        bool debugUIButtonListener = DoozySettings.Instance.DebugUIButtonListener;
                        EditorGUI.BeginChangeCheck();
                        debugUIButtonListener = DrawDebugButton(debugUIButtonListener, "UIButton Listener", Styles.GetStyle(Styles.StyleName.IconUIButtonListener), DGUI.Colors.UIButtonListenerColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugUIButtonListener = debugUIButtonListener;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugUIDrawerListener = DoozySettings.Instance.DebugUIDrawerListener;
                        EditorGUI.BeginChangeCheck();
                        debugUIDrawerListener = DrawDebugButton(debugUIDrawerListener, "UIDrawer Listener", Styles.GetStyle(Styles.StyleName.IconUIDrawerListener), DGUI.Colors.UIDrawerListenerColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugUIDrawerListener = debugUIDrawerListener;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugUIViewListener = DoozySettings.Instance.DebugUIViewListener;
                        EditorGUI.BeginChangeCheck();
                        debugUIViewListener = DrawDebugButton(debugUIViewListener, "UIView Listener", Styles.GetStyle(Styles.StyleName.IconUIViewListener), DGUI.Colors.UIViewListenerColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugUIViewListener = debugUIViewListener;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.FlexibleSpace();
                    }
                    GUILayout.EndHorizontal();

                    #endregion

                    GUILayout.Space(m_debugVerticalButtonSpacing);

                    #region Game Event Manager, Game Event Listener

                    GUILayout.BeginHorizontal();
                    {
                        bool debugGameEventManager = DoozySettings.Instance.DebugGameEventManager;
                        EditorGUI.BeginChangeCheck();
                        debugGameEventManager = DrawDebugButton(debugGameEventManager, "Game Event Manager", Styles.GetStyle(Styles.StyleName.IconGameEventManager), DGUI.Colors.GameEventManagerColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugGameEventManager = debugGameEventManager;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugGameEventListener = DoozySettings.Instance.DebugGameEventListener;
                        EditorGUI.BeginChangeCheck();
                        debugGameEventListener = DrawDebugButton(debugGameEventListener, "Game Event Listener", Styles.GetStyle(Styles.StyleName.IconGameEventListener), DGUI.Colors.GameEventListenerColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugGameEventListener = debugGameEventListener;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.FlexibleSpace();
                    }
                    GUILayout.EndHorizontal();

                    #endregion

                    GUILayout.Space(m_debugVerticalButtonSpacing);

                    #region Scene Director, Scene Loader

                    GUILayout.BeginHorizontal();
                    {
                        bool debugSceneDirector = DoozySettings.Instance.DebugSceneDirector;
                        EditorGUI.BeginChangeCheck();
                        debugSceneDirector = DrawDebugButton(debugSceneDirector, "Scene Director", Styles.GetStyle(Styles.StyleName.IconSceneDirector), DGUI.Colors.SceneDirectorColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugSceneDirector = debugSceneDirector;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugSceneLoader = DoozySettings.Instance.DebugSceneLoader;
                        EditorGUI.BeginChangeCheck();
                        debugSceneLoader = DrawDebugButton(debugSceneLoader, "Scene Loader", Styles.GetStyle(Styles.StyleName.IconSceneLoader), DGUI.Colors.SceneLoaderColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugSceneLoader = debugSceneLoader;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.FlexibleSpace();
                    }
                    GUILayout.EndHorizontal();

                    #endregion

                    GUILayout.Space(m_debugVerticalButtonSpacing);

                    #region Progressor, Progressor Group

                    GUILayout.BeginHorizontal();
                    {
                        bool debugProgressor = DoozySettings.Instance.DebugProgressor;
                        EditorGUI.BeginChangeCheck();
                        debugProgressor = DrawDebugButton(debugProgressor, "Progressor", Styles.GetStyle(Styles.StyleName.IconProgressor), DGUI.Colors.ProgressorColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugProgressor = debugProgressor;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugProgressorGroup = DoozySettings.Instance.DebugProgressorGroup;
                        EditorGUI.BeginChangeCheck();
                        debugProgressorGroup = DrawDebugButton(debugProgressorGroup, "Progressor Group", Styles.GetStyle(Styles.StyleName.IconProgressorGroup), DGUI.Colors.ProgressorGroupColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugProgressorGroup = debugProgressorGroup;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        GUILayout.FlexibleSpace();
                    }
                    GUILayout.EndHorizontal();

                    #endregion

                    GUILayout.Space(m_debugVerticalButtonSpacing);

                    #region Orientation Detector

                    GUILayout.BeginHorizontal();
                    {
                        bool debugOrientationDetector = DoozySettings.Instance.DebugOrientationDetector;
                        EditorGUI.BeginChangeCheck();
                        debugOrientationDetector = DrawDebugButton(debugOrientationDetector, "Orientation Detector", Styles.GetStyle(Styles.StyleName.IconOrientationDetector), DGUI.Colors.OrientationDetectorColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugOrientationDetector = debugOrientationDetector;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        GUILayout.FlexibleSpace();
                    }
                    GUILayout.EndHorizontal();

                    #endregion

                    GUILayout.Space(m_debugVerticalButtonSpacing);

                    #region Back Button, Key To Game Event

                    GUILayout.BeginHorizontal();
                    {
                        bool debugBackButton = DoozySettings.Instance.DebugBackButton;
                        EditorGUI.BeginChangeCheck();
                        debugBackButton = DrawDebugButton(debugBackButton, "Back Button", Styles.GetStyle(Styles.StyleName.IconBackButton), DGUI.Colors.BackButtonColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugBackButton = debugBackButton;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugKeyToAction = DoozySettings.Instance.DebugKeyToAction;
                        EditorGUI.BeginChangeCheck();
                        debugKeyToAction = DrawDebugButton(debugKeyToAction, "Key To Action", Styles.GetStyle(Styles.StyleName.IconKeyToAction), DGUI.Colors.KeyToActionColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugKeyToAction = debugKeyToAction;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }


                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugKeyToGameEvent = DoozySettings.Instance.DebugKeyToGameEvent;
                        EditorGUI.BeginChangeCheck();
                        debugKeyToGameEvent = DrawDebugButton(debugKeyToGameEvent, "Key To Game Event", Styles.GetStyle(Styles.StyleName.IconKeyToGameEvent), DGUI.Colors.KeyToGameEventColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugKeyToGameEvent = debugKeyToGameEvent;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }


                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        GUILayout.FlexibleSpace();
                    }
                    GUILayout.EndHorizontal();

                    #endregion
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();

            #endregion

            #region Soundy

            DrawDynamicViewVerticalSpace();
            DGUI.WindowUtils.DrawIconTitle(Styles.StyleName.IconSoundy, "Soundy", "Sound Components", ColorName.Orange);
            DrawDynamicViewVerticalSpace(0.5f);
            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(DGUI.Bar.Height(Size.XL) + DGUI.Properties.Space(4));
                GUILayout.BeginVertical();
                {
                    #region Soundy Manager, Soundy Pooler, Soundy Controller

                    GUILayout.BeginHorizontal();
                    {
                        bool debugSoundyManager = DoozySettings.Instance.DebugSoundyManager;
                        EditorGUI.BeginChangeCheck();
                        debugSoundyManager = DrawDebugButton(debugSoundyManager, "Soundy Manager", Styles.GetStyle(Styles.StyleName.IconSoundy), DGUI.Colors.SoundyManagerColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugSoundyManager = debugSoundyManager;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugSoundyPooler = DoozySettings.Instance.DebugSoundyPooler;
                        EditorGUI.BeginChangeCheck();
                        debugSoundyPooler = DrawDebugButton(debugSoundyPooler, "Soundy Pooler", Styles.GetStyle(Styles.StyleName.IconSoundyPooler), DGUI.Colors.SoundyPoolerColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugSoundyPooler = debugSoundyPooler;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugSoundyController = DoozySettings.Instance.DebugSoundyController;
                        EditorGUI.BeginChangeCheck();
                        debugSoundyController = DrawDebugButton(debugSoundyController, "Soundy Controller", Styles.GetStyle(Styles.StyleName.IconSoundyController), DGUI.Colors.SoundyControllerColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugSoundyController = debugSoundyController;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.FlexibleSpace();
                    }
                    GUILayout.EndHorizontal();

                    #endregion
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();

            #endregion

            #region Touchy

            DrawDynamicViewVerticalSpace();
            DGUI.WindowUtils.DrawIconTitle(Styles.StyleName.IconTouchy, "Touchy", "Touch Components", ColorName.Green);
            DrawDynamicViewVerticalSpace(0.5f);
            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(DGUI.Bar.Height(Size.XL) + DGUI.Properties.Space(4));
                GUILayout.BeginVertical();
                {
                    #region Touch Detector, Gesture Listener

                    GUILayout.BeginHorizontal();
                    {
                        bool debugTouchDetector = DoozySettings.Instance.DebugTouchDetector;
                        EditorGUI.BeginChangeCheck();
                        debugTouchDetector = DrawDebugButton(debugTouchDetector, "Touch Detector", Styles.GetStyle(Styles.StyleName.IconTouchy), DGUI.Colors.TouchDetectorColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugTouchDetector = debugTouchDetector;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        bool debugGestureListener = DoozySettings.Instance.DebugGestureListener;
                        EditorGUI.BeginChangeCheck();
                        debugGestureListener = DrawDebugButton(debugGestureListener, "Gesture Listener", Styles.GetStyle(Styles.StyleName.IconGestureListener), DGUI.Colors.GestureListenerColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugGestureListener = debugGestureListener;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.FlexibleSpace();
                    }
                    GUILayout.EndHorizontal();

                    #endregion
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();

            #endregion

            #region Nody

            DrawDynamicViewVerticalSpace();
            DGUI.WindowUtils.DrawIconTitle(Styles.StyleName.IconNody, "Nody", "Node Graph Components", ColorName.LightBlue);
            DrawDynamicViewVerticalSpace(0.5f);
            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(DGUI.Bar.Height(Size.XL) + DGUI.Properties.Space(4));
                GUILayout.BeginVertical();
                {
                    #region UIButton, UICanvas, UIDrawer, UIPopup, UIToggle, UIView

                    GUILayout.BeginHorizontal();
                    {
                        bool debugGraphController = DoozySettings.Instance.DebugGraphController;
                        EditorGUI.BeginChangeCheck();
                        debugGraphController = DrawDebugButton(debugGraphController, "Graph Controller", Nody.Styles.GetStyle(Nody.Styles.StyleName.IconGraphController), DGUI.Colors.GraphControllerColorName);
                        if (EditorGUI.EndChangeCheck())
                        {
                            DoozySettings.Instance.UndoRecord("DDebug");
                            DoozySettings.Instance.DebugGraphController = debugGraphController;
                            DoozySettings.Instance.SetDirty(false);
                            m_needsSave = true;
                        }

                        GUILayout.Space(m_debugHorizontalButtonSpacing);

                        GUILayout.FlexibleSpace();
                    }
                    GUILayout.EndHorizontal();

                    #endregion
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();

            #endregion

            DrawDynamicViewVerticalSpace(2);
        }
Beispiel #17
0
        private void DrawColorProperties(ThemeData themeData, int propertyIndex, SelectionState selectionState)
        {
            GUIStyle colorButtonStyle         = Styles.GetStyle(Styles.StyleName.ColorButton);
            GUIStyle colorButtonSelectedStyle = Styles.GetStyle(Styles.StyleName.ColorButtonSelected);

            for (int i = 0; i < themeData.ColorLabels.Count; i++)
            {
                LabelId colorProperty = themeData.ColorLabels[i];
                int     index         = i;
                bool    selected      = i == propertyIndex;
                GUILayout.BeginHorizontal();
                {
                    if (!selected)
                    {
                        GUILayout.Space((colorButtonSelectedStyle.fixedWidth - colorButtonStyle.fixedWidth) / 2);
                    }
                    GUI.color = themeData.ActiveVariant.Colors[i].Color;
                    {
                        if (GUILayout.Button(GUIContent.none, selected ? colorButtonSelectedStyle : colorButtonStyle))
                        {
                            if (serializedObject.isEditingMultipleObjects)
                            {
                                DoozyUtils.UndoRecordObjects(targets, UILabels.UpdateValue);
                                foreach (Object o in targets)
                                {
                                    var themeTarget = (ColorTargetSelectable)o;
                                    if (themeTarget == null)
                                    {
                                        continue;
                                    }
                                    switch (selectionState)
                                    {
                                    case SelectionState.Normal:
                                        themeTarget.NormalColorPropertyId = themeData.ColorLabels[index].Id;
                                        break;

                                    case SelectionState.Highlighted:
                                        themeTarget.HighlightedColorPropertyId = themeData.ColorLabels[index].Id;
                                        break;

                                    case SelectionState.Pressed:
                                        themeTarget.PressedColorPropertyId = themeData.ColorLabels[index].Id;
                                        break;

#if UNITY_2019_3_OR_NEWER
                                    case SelectionState.Selected:
                                        themeTarget.SelectedColorPropertyId = themeData.ColorLabels[index].Id;
                                        break;
#endif
                                    case SelectionState.Disabled:
                                        themeTarget.DisabledColorPropertyId = themeData.ColorLabels[index].Id;
                                        break;
                                    }

                                    themeTarget.UpdateTarget(themeData);
                                }
                            }
                            else
                            {
                                DoozyUtils.UndoRecordObject(target, UILabels.UpdateValue);
                                switch (selectionState)
                                {
                                case SelectionState.Normal:
                                    Target.NormalColorPropertyId = themeData.ColorLabels[index].Id;
                                    break;

                                case SelectionState.Highlighted:
                                    Target.HighlightedColorPropertyId = themeData.ColorLabels[index].Id;
                                    break;

                                case SelectionState.Pressed:
                                    Target.PressedColorPropertyId = themeData.ColorLabels[index].Id;
                                    break;

#if UNITY_2019_3_OR_NEWER
                                case SelectionState.Selected:
                                    Target.SelectedColorPropertyId = themeData.ColorLabels[index].Id;
                                    break;
#endif
                                case SelectionState.Disabled:
                                    Target.DisabledColorPropertyId = themeData.ColorLabels[index].Id;
                                    break;
                                }

                                Target.UpdateTarget(themeData);
                            }
                        }
                    }
                    GUI.color = InitialGUIColor;
                    GUILayout.Space(DGUI.Properties.Space(2));
                    GUI.enabled = selected;
                    DGUI.Label.Draw(colorProperty.Label, selected ? Size.L : Size.M,
                                    selected ? colorButtonSelectedStyle.fixedHeight : colorButtonStyle.fixedHeight);
                    GUI.enabled = true;
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(DGUI.Properties.Space());
            }
        }
        private void DrawUseBackButton()
        {
            bool enabled = Settings.UseBackButton;

            EditorGUI.BeginChangeCheck();
            enabled = DrawGeneralOptionBox("'Back' Button", UILabels.UseBackButtonDescription, enabled, Styles.GetStyle(Styles.StyleName.IconBackButton), DGUI.Colors.BackButtonColorName);
            if (EditorGUI.EndChangeCheck())
            {
                Settings.UseBackButton = enabled;
            }
        }
        private void DrawViewHelp()
        {
            if (CurrentView != View.Help)
            {
                return;
            }

            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            {
                //column 1 (LEFT)
                GUILayout.BeginVertical(GUILayout.ExpandWidth(true), GUILayout.MaxWidth(GeneralColumnWidth));
                {
                    DGUI.WindowUtils.DrawIconTitle(Styles.StyleName.IconDoozy, "DoozyUI", UILabels.HelpResources, DGUI.Colors.LightOrDarkColorName);
                    DrawDynamicViewVerticalSpace(0.5f);
                    DrawHelpLinkBox("Website", "doozyui.com", Styles.GetStyle(Styles.StyleName.IconDoozyUI), DGUI.Colors.LightOrDarkColorName, UILabels.Open, DoozySettings.LINK_WEBSITE_DOOZYUI);
                    DrawDynamicViewVerticalSpace(0.25f);
                    DrawHelpLinkBox("Documentation", "Manual and Script References", Styles.GetStyle(Styles.StyleName.IconFaBook), DGUI.Colors.LightOrDarkColorName, UILabels.Open, DoozySettings.LINK_WEBSITE_DOOZYUI_DOCUMENTATION);
                    DrawDynamicViewVerticalSpace(0.25f);
                    DrawHelpLinkBox("FAQ", "Frequently Asked Questions", Styles.GetStyle(Styles.StyleName.IconFaQuestion), DGUI.Colors.LightOrDarkColorName, UILabels.Open, DoozySettings.LINK_WEBSITE_DOOZYUI_DOCUMENTATION);
                    DrawDynamicViewVerticalSpace(0.25f);
                    DrawHelpLinkBox("Support Request", "Open a Support Ticket", Styles.GetStyle(Styles.StyleName.IconFaPaperPlane), DGUI.Colors.LightOrDarkColorName, UILabels.Open, DoozySettings.LINK_WEBSITE_DOOZYUI_SUPPORT_REQUEST);
                    DrawDynamicViewVerticalSpace(0.25f);
                    DrawHelpLinkBoxSupportEmail();
                }
                GUILayout.EndVertical();
                DrawDynamicViewVerticalSpace(2);
                //column 2 (RIGHT)
                GUILayout.BeginVertical(GUILayout.ExpandWidth(true), GUILayout.MaxWidth(GeneralColumnWidth));
                {
                    DGUI.WindowUtils.DrawIconTitle(Styles.StyleName.IconFaExternalLink, UILabels.OtherReferences, UILabels.UsefulLinks, DGUI.Colors.LightOrDarkColorName);
                    DrawDynamicViewVerticalSpace(0.5f);
                    DrawHelpLinkBox("Unity Manual", "Learn how to use the Unity Editor and its associated services", Styles.GetStyle(Styles.StyleName.IconFaBookOpen), ColorName.Gray, UILabels.Open, DoozySettings.LINK_WEBSITE_UNITY_MANUAL);
                    DrawDynamicViewVerticalSpace(0.25f);
                    DrawHelpLinkBox("Unity Scripting API", "Details of the scripting API that Unity provides", Styles.GetStyle(Styles.StyleName.IconFaBracketsCurly), ColorName.Gray, UILabels.Open, DoozySettings.LINK_WEBSITE_UNITY_SCRIPTING_API);
                    DrawDynamicViewVerticalSpace(0.25f);
                    DrawHelpLinkBox(".NET API Browser", "One-stop shop for all .NET-based APIs from Microsoft", Styles.GetStyle(Styles.StyleName.IconFaWindows), ColorName.Gray, UILabels.Open, DoozySettings.LINK_WEBSITE_MICROSOFT_DOT_NET_API);
                    DrawDynamicViewVerticalSpace(0.25f);
                    DrawHelpLinkBox("DOTween", "Fast, efficient, fully type-safe object-oriented animation engine", Styles.GetStyle(Styles.StyleName.IconFaChevronRight), ColorName.Gray, UILabels.Open, DoozySettings.LINK_WEBSITE_DOTWEEN);
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();

            DrawDynamicViewVerticalSpace(2);

            DGUI.WindowUtils.DrawIconTitle(Styles.StyleName.IconFaHashtag, UILabels.SocialLinks, UILabels.GetInTouch, DGUI.Colors.LightOrDarkColorName);
            DrawDynamicViewVerticalSpace(0.5f);
            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            {
                //column 1 (LEFT)
                GUILayout.BeginVertical(GUILayout.ExpandWidth(true), GUILayout.MaxWidth(GeneralColumnWidth));
                {
                    DrawHelpLinkBox("YouTube", "Doozy Entertainment Channel", Styles.GetStyle(Styles.StyleName.IconFaYoutube), ColorName.Red, UILabels.Open, DoozySettings.LINK_YOUTUBE_CHANNEL);
                    DrawDynamicViewVerticalSpace(0.25f);
                    DrawHelpLinkBox("Facebook", "Doozy Entertainment Page", Styles.GetStyle(Styles.StyleName.IconFaFacebook), ColorName.Blue, UILabels.Open, DoozySettings.LINK_FACEBOOK);
                }
                GUILayout.EndVertical();
                DrawDynamicViewVerticalSpace(2);
                //column 2 (RIGHT)
                GUILayout.BeginVertical(GUILayout.ExpandWidth(true), GUILayout.MaxWidth(GeneralColumnWidth));
                {
                    DrawHelpLinkBox("Twitter", "@doozyplay", Styles.GetStyle(Styles.StyleName.IconFaTwitter), ColorName.LightBlue, UILabels.Open, DoozySettings.LINK_TWITTER);
                    DrawDynamicViewVerticalSpace(0.25f);
                    DrawHelpLinkBox("Discord", "https://discord.gg/y9Axq7b", Styles.GetStyle(Styles.StyleName.IconFaDiscord), ColorName.Gray, UILabels.Open, DoozySettings.LINK_DISCORD_INVITE);
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();

            DrawDynamicViewVerticalSpace(2);
        }
        private void DrawAutoDisableUIInteractionsButton()
        {
            bool enabled = Settings.AutoDisableUIInteractions;

            EditorGUI.BeginChangeCheck();
            enabled = DrawGeneralOptionBox("Auto Disable UI Interactions", UILabels.AutoDisableUIInteractionsDescription, enabled, Styles.GetStyle(Styles.StyleName.IconDisableButton), ColorName.Orange);

            if (EditorGUI.EndChangeCheck())
            {
                Settings.AutoDisableUIInteractions = enabled;
            }
        }
        private void DrawOptions()
        {
            ColorName backgroundColorName = DGUI.Colors.ActionColorName;
            ColorName textColorName       = DGUI.Colors.ActionColorName;

            DrawBigTitleWithBackground(Styles.GetStyle(Styles.StyleName.IconFaEar), UILabels.GlobalListener, backgroundColorName, textColorName);
            GUILayout.Space(DGUI.Properties.Space(2));
            EditorGUILayout.BeginHorizontal();
            {
                DGUI.Property.Draw(m_listenFor, UILabels.ListenFor, backgroundColorName, textColorName);
                GUILayout.Space(DGUI.Properties.Space());
                switch (TargetNode.ListenFor)
                {
                case PortalNode.ListenerType.UIView:
                    DGUI.Property.Draw(m_uiViewTriggerAction, UILabels.TriggerAction, backgroundColorName, textColorName);
                    GUILayout.Space(DGUI.Properties.Space());
                    if ((UIViewBehaviorType)m_uiViewTriggerAction.enumValueIndex == UIViewBehaviorType.Unknown)
                    {
                        m_uiViewTriggerAction.enumValueIndex = (int)UIViewBehaviorType.Show;
                    }
                    DGUI.Toggle.Switch.Draw(m_anyValue, UILabels.AnyUIView, textColorName, true, false);
                    if (m_anyValue.boolValue)
                    {
                        backgroundColorName = DGUI.Colors.DisabledBackgroundColorName;
                        textColorName       = DGUI.Colors.DisabledTextColorName;
                    }

                    break;

                case PortalNode.ListenerType.UIButton:
                    DGUI.Property.Draw(m_uiButtonTriggerAction, UILabels.TriggerAction, backgroundColorName, textColorName);
                    GUILayout.Space(DGUI.Properties.Space());
                    DGUI.Toggle.Switch.Draw(m_anyValue, UILabels.AnyUIButton, textColorName, true, false);
                    if (m_anyValue.boolValue)
                    {
                        backgroundColorName = DGUI.Colors.DisabledBackgroundColorName;
                        textColorName       = DGUI.Colors.DisabledTextColorName;
                    }

                    break;

                case PortalNode.ListenerType.UIDrawer:
                    DGUI.Property.Draw(m_uiDrawerTriggerAction, UILabels.TriggerAction, backgroundColorName, textColorName);
                    GUILayout.Space(DGUI.Properties.Space());
                    DGUI.Toggle.Switch.Draw(m_anyValue, UILabels.AnyUIDrawer, textColorName, true, false);
                    if (m_anyValue.boolValue)
                    {
                        backgroundColorName = DGUI.Colors.DisabledBackgroundColorName;
                        textColorName       = DGUI.Colors.DisabledTextColorName;
                    }

                    break;
                }
            }
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(DGUI.Properties.Space());
            EditorGUILayout.BeginHorizontal();
            {
                // ReSharper disable once SwitchStatementMissingSomeCases
                switch (TargetNode.ListenFor)
                {
                case PortalNode.ListenerType.GameEvent:
                    DrawGameEvent(m_gameEvent, Styles.GetStyle(Styles.StyleName.IconGameEvent), UILabels.GameEvent);
//                        GUI.enabled = !TargetNode.AnyValue;
//                        DGUI.Property.Draw(m_gameEvent, UILabels.GameEvent, backgroundColorName, textColorName, TargetNode.ErrorNoGameEvent);
//                        GUI.enabled = true;
                    break;

                case PortalNode.ListenerType.UIView:
                    GUI.enabled = !TargetNode.AnyValue;
                    DGUI.Database.DrawItemsDatabaseSelector(serializedObject,
                                                            m_viewCategory, UILabels.ViewCategory,
                                                            m_viewName, UILabels.ViewName,
                                                            UIViewDatabase,
                                                            backgroundColorName);
                    GUI.enabled = true;
                    break;

                case PortalNode.ListenerType.UIButton:
                    GUI.enabled = !TargetNode.AnyValue;
                    DGUI.Database.DrawItemsDatabaseSelector(serializedObject,
                                                            m_buttonCategory, UILabels.ButtonCategory,
                                                            m_buttonName, UILabels.ButtonName,
                                                            UIButtonDatabase,
                                                            backgroundColorName);
                    GUI.enabled = true;
                    break;

                case PortalNode.ListenerType.UIDrawer:
                    GUI.enabled = !TargetNode.AnyValue;
                    DGUI.Database.DrawItemsDatabaseSelectorForGeneralCategoryOnly(UIDrawer.DefaultDrawerCategory,
                                                                                  m_drawerName, UILabels.DrawerName,
                                                                                  m_customDrawerName,
                                                                                  UIDrawerDatabase,
                                                                                  backgroundColorName);
                    GUI.enabled = true;
                    break;
                }
            }
            EditorGUILayout.EndHorizontal();
        }
Beispiel #22
0
        private void DrawActionDescription()
        {
            bool playSound = TargetNode.SoundAction == SoundNode.SoundActions.Play;

            DynamicHeight += DGUI.Properties.Space(4);
            float x          = DrawRect.x + 16;
            float lineHeight = DGUI.Properties.SingleLineHeight;

            var soundActionRect = new Rect(x, DynamicHeight, DrawRect.width - 32, lineHeight);

            DynamicHeight += soundActionRect.height;
            DynamicHeight += DGUI.Properties.Space(2);

            float iconLineHeight = lineHeight * 2;
            float iconSize       = iconLineHeight * 0.6f;
            var   iconRect       = new Rect(x, DynamicHeight + (iconLineHeight - iconSize) / 2, iconSize, iconSize);
            float textX          = iconRect.xMax + DGUI.Properties.Space(4);
            float textWidth      = DrawRect.width - iconSize - DGUI.Properties.Space(4) - 32;
            var   titleRect      = new Rect(textX, DynamicHeight, textWidth, lineHeight);

            if (playSound)
            {
                DynamicHeight += titleRect.height;
            }
            var descriptionRect = new Rect(textX, DynamicHeight, textWidth, lineHeight);

            if (playSound)
            {
                DynamicHeight += descriptionRect.height;
                DynamicHeight += DGUI.Properties.Space(4);
            }

            if (ZoomedBeyondSocketDrawThreshold)
            {
                return;
            }

            string soundAction;

            switch (TargetNode.SoundAction)
            {
            case SoundNode.SoundActions.Play:
                soundAction = UILabels.PlaySound;
                break;

            case SoundNode.SoundActions.Stop:
                soundAction = UILabels.StopAllSounds;
                break;

            case SoundNode.SoundActions.Pause:
                soundAction = UILabels.PauseAllSounds;
                break;

            case SoundNode.SoundActions.Unpause:
                soundAction = UILabels.UnpauseAllSounds;
                break;

            case SoundNode.SoundActions.Mute:
                soundAction = UILabels.MuteAllSounds;
                break;

            case SoundNode.SoundActions.Unmute:
                soundAction = UILabels.UnmuteAllSounds;
                break;

            default: throw new ArgumentOutOfRangeException();
            }

            Color soundActionTextColor = (DGUI.Utility.IsProSkin ? Color.white.Darker() : Color.black.Lighter()).WithAlpha(0.6f);

            GUI.Label(soundActionRect, soundAction, DGUI.Colors.ColorTextOfGUIStyle(DGUI.Label.Style(Doozy.Editor.Size.S, TextAlign.Center), soundActionTextColor));

            if (!playSound)
            {
                return;
            }

            m_icon        = null;
            m_title       = TargetNode.SoundData.SoundSource.ToString();
            m_description = "---";

            switch (TargetNode.SoundData.SoundSource)
            {
            case SoundSource.Soundy:
                m_icon        = Styles.GetStyle(Styles.StyleName.IconSoundy);
                m_title       = TargetNode.SoundData.DatabaseName;
                m_description = TargetNode.SoundData.SoundName;
                break;

            case SoundSource.AudioClip:
                m_icon        = Styles.GetStyle(Styles.StyleName.IconSound);
                m_description = TargetNode.SoundData.AudioClip != null ? TargetNode.SoundData.AudioClip.name : m_description;
                break;

            case SoundSource.MasterAudio:
                m_icon        = Styles.GetStyle(Styles.StyleName.IconMasterAudio);
                m_description = TargetNode.SoundData.SoundName;
                break;

            default: throw new ArgumentOutOfRangeException();
            }

            Color iconAndTextColor = DGUI.Colors.TextColor(TargetNode.HasSound ? DGUI.Colors.SoundyColorName : ColorName.Red).WithAlpha(0.6f);

            DGUI.Icon.Draw(iconRect, m_icon, TargetNode.SoundData.SoundSource == SoundSource.MasterAudio ? Color.white.WithAlpha(0.6f) : iconAndTextColor);
            GUI.Label(titleRect, m_title, DGUI.Colors.ColorTextOfGUIStyle(DGUI.Label.Style(Doozy.Editor.Size.S, TextAlign.Left), iconAndTextColor));
            GUI.Label(descriptionRect, m_description, DGUI.Colors.ColorTextOfGUIStyle(DGUI.Label.Style(Doozy.Editor.Size.M, TextAlign.Left), iconAndTextColor));
        }
        private void DrawOptions()
        {
            ColorName backgroundColorName = DGUI.Colors.ActionColorName;
            ColorName textColorName       = DGUI.Colors.ActionColorName;

            DrawBigTitleWithBackground(Styles.GetStyle(Styles.StyleName.IconAction), UILabels.Actions, backgroundColorName, textColorName);
            GUILayout.Space(DGUI.Properties.Space(2));
            GetInfoMessage(ERROR_NO_GAME_EVENT).Draw(TargetNode.ErrorNoGameEvent, InspectorWidth);
            GetInfoMessage(ERROR_NO_SCENE_NAME).Draw(TargetNode.ErrorNoSceneName, InspectorWidth);
            GetInfoMessage(ERROR_BAD_BUILD_INDEX).Draw(TargetNode.ErrorBadBuildIndex, InspectorWidth);
            EditorGUILayout.BeginHorizontal();
            {
                DGUI.Property.Draw(m_waitFor, UILabels.WaitFor, backgroundColorName, textColorName);
                if (TargetNode.WaitFor != WaitNode.WaitType.Time)
                {
                    GUILayout.Space(DGUI.Properties.Space());
                    string anyLabel = string.Empty;
                    switch (TargetNode.WaitFor)
                    {
                    case WaitNode.WaitType.GameEvent:
                        anyLabel = UILabels.AnyGameEvent;
                        break;

                    case WaitNode.WaitType.SceneLoad:
                    case WaitNode.WaitType.SceneUnload:
                    case WaitNode.WaitType.ActiveSceneChange:
                        anyLabel = UILabels.AnyScene;
                        break;

                    case WaitNode.WaitType.UIView:
                        DGUI.Property.Draw(m_uiViewTriggerAction, UILabels.TriggerAction, backgroundColorName, textColorName);
                        GUILayout.Space(DGUI.Properties.Space());
                        if ((UIViewBehaviorType)m_uiViewTriggerAction.enumValueIndex == UIViewBehaviorType.Unknown)
                        {
                            m_uiViewTriggerAction.enumValueIndex = (int)UIViewBehaviorType.Show;
                        }
                        anyLabel = UILabels.AnyUIView;
                        break;

                    case WaitNode.WaitType.UIButton:
                        DGUI.Property.Draw(m_uiButtonTriggerAction, UILabels.TriggerAction, backgroundColorName, textColorName);
                        GUILayout.Space(DGUI.Properties.Space());
                        anyLabel = UILabels.AnyUIButton;
                        break;

                    case WaitNode.WaitType.UIDrawer:
                        DGUI.Property.Draw(m_uiDrawerTriggerAction, UILabels.TriggerAction, backgroundColorName, textColorName);
                        GUILayout.Space(DGUI.Properties.Space());
                        anyLabel = UILabels.AnyUIDrawer;
                        break;
                    }
                    DGUI.Toggle.Switch.Draw(m_anyValue, anyLabel, textColorName, true, false);
                    if (m_anyValue.boolValue)
                    {
                        backgroundColorName = DGUI.Colors.DisabledBackgroundColorName;
                        textColorName       = DGUI.Colors.DisabledTextColorName;
                    }
                }
            }
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(DGUI.Properties.Space());
            EditorGUILayout.BeginHorizontal();
            {
                // ReSharper disable once SwitchStatementMissingSomeCases
                switch (TargetNode.WaitFor)
                {
                case WaitNode.WaitType.Time:
                    DGUI.Toggle.Switch.Draw(m_randomDuration, UILabels.RandomDuration, textColorName, true, false);
                    GUILayout.Space(DGUI.Properties.Space());
                    if (TargetNode.RandomDuration)
                    {
                        DGUI.Property.Draw(m_durationMin, UILabels.Min, backgroundColorName, textColorName);
                        GUILayout.Space(DGUI.Properties.Space());
                        DGUI.Property.Draw(m_durationMax, UILabels.Max, backgroundColorName, textColorName);
                    }
                    else
                    {
                        DGUI.Property.Draw(m_duration, UILabels.Duration, backgroundColorName, textColorName);
                    }

                    break;

                case WaitNode.WaitType.GameEvent:
                    GUI.enabled = !TargetNode.AnyValue;
                    DGUI.Property.Draw(m_gameEvent, UILabels.GameEvent, backgroundColorName, textColorName, TargetNode.ErrorNoGameEvent);
                    GUI.enabled = true;
                    break;

                case WaitNode.WaitType.SceneLoad:
                case WaitNode.WaitType.SceneUnload:
                case WaitNode.WaitType.ActiveSceneChange:
                    GUI.enabled = !TargetNode.AnyValue;
                    DGUI.Property.Draw(m_getSceneBy, UILabels.GetSceneBy, backgroundColorName, textColorName, DGUI.Properties.DefaultFieldWidth * 2);
                    GUILayout.Space(DGUI.Properties.Space());
                    // ReSharper disable once SwitchStatementMissingSomeCases
                    switch (TargetNode.GetSceneBy)
                    {
                    case GetSceneBy.Name:
                        DGUI.Property.Draw(m_sceneName, UILabels.SceneName, backgroundColorName, textColorName, TargetNode.ErrorNoSceneName);
                        break;

                    case GetSceneBy.BuildIndex:
                        DGUI.Property.Draw(m_sceneBuildIndex, UILabels.SceneBuildIndex, backgroundColorName, textColorName, TargetNode.ErrorBadBuildIndex);
                        break;
                    }

                    GUI.enabled = true;
                    break;

                case WaitNode.WaitType.UIView:
                    GUI.enabled = !TargetNode.AnyValue;
                    DGUI.Database.DrawItemsDatabaseSelector(serializedObject,
                                                            m_viewCategory, UILabels.ViewCategory,
                                                            m_viewName, UILabels.ViewName,
                                                            UIViewDatabase,
                                                            backgroundColorName);
                    GUI.enabled = true;
                    break;

                case WaitNode.WaitType.UIButton:
                    GUI.enabled = !TargetNode.AnyValue;
                    DGUI.Database.DrawItemsDatabaseSelector(serializedObject,
                                                            m_buttonCategory, UILabels.ButtonCategory,
                                                            m_buttonName, UILabels.ButtonName,
                                                            UIButtonDatabase,
                                                            backgroundColorName);
                    GUI.enabled = true;
                    break;

                case WaitNode.WaitType.UIDrawer:
                    GUI.enabled = !TargetNode.AnyValue;
                    DGUI.Database.DrawItemsDatabaseSelectorForGeneralCategoryOnly(UIDrawer.DefaultDrawerCategory,
                                                                                  m_drawerName, UILabels.DrawerName,
                                                                                  m_customDrawerName,
                                                                                  UIDrawerDatabase,
                                                                                  backgroundColorName);
                    GUI.enabled = true;
                    break;
                }
            }
            EditorGUILayout.EndHorizontal();
        }
Beispiel #24
0
        private void DrawGeneralOptionBoxOrientationDetector()
        {
            bool enabled = Settings.UseOrientationDetector;

            EditorGUI.BeginChangeCheck();
            enabled = DrawGeneralOptionBox("Orientation Detector", UILabels.OrientationDetectorDescription, enabled, Styles.GetStyle(Styles.StyleName.IconOrientationDetector), DGUI.Colors.OrientationDetectorColorName);
            if (EditorGUI.EndChangeCheck())
            {
                Settings.UseOrientationDetector = enabled;
            }
        }
Beispiel #25
0
 private void DrawOptions()
 {
     DrawBigTitleWithBackground(Styles.GetStyle(Styles.StyleName.IconAction), UILabels.Actions, DGUI.Colors.ActionColorName, DGUI.Colors.ActionColorName);
     GUILayout.Space(DGUI.Properties.Space(2));
     DGUI.Property.Draw(m_backButtonAction, UILabels.BackButton, DGUI.Colors.ActionColorName, DGUI.Colors.ActionColorName);
 }
Beispiel #26
0
        private void DrawGeneralPluginBoxMasterAudio()
        {
            bool usePlugin = Settings.UseMasterAudio;

            EditorGUI.BeginChangeCheck();
            usePlugin = DrawGeneralPluginBox("MasterAudio", Settings.MasterAudioDetected, usePlugin, DefineSymbolsProcessor.DEFINE_MASTER_AUDIO, Styles.GetStyle(Styles.StyleName.IconMasterAudio));
            if (EditorGUI.EndChangeCheck())
            {
                Settings.UseMasterAudio = usePlugin;
            }
        }
Beispiel #27
0
        private void DrawProgressors()
        {
            DGUI.Doozy.DrawTitleWithIcon(Styles.GetStyle(Styles.StyleName.IconProgressor),
                                         UILabels.Progressors, Size.L, DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(3),
                                         ComponentColorName);
            GUILayout.Space(DGUI.Properties.Space());

            GUILayout.BeginVertical();
            {
                float alpha            = GUI.color.a;
                float backgroundHeight = DGUI.Properties.Space() + DGUI.Properties.SingleLineHeight + DGUI.Properties.Space();
                if (m_progressors.arraySize > 0)
                {
                    for (int i = 0; i < m_progressors.arraySize; i++)
                    {
                        backgroundHeight += EditorGUI.GetPropertyHeight(m_progressors.GetArrayElementAtIndex(i));
                        backgroundHeight += DGUI.Properties.Space();
                    }
                }

                DGUI.Background.Draw(DGUI.Colors.GetBackgroundColorName(m_progressors.arraySize > 0, ComponentColorName), backgroundHeight);
                GUILayout.Space(-backgroundHeight + DGUI.Properties.Space());

                if (m_progressors.arraySize == 0)
                {
                    GUILayout.BeginHorizontal(GUILayout.Height(DGUI.Properties.SingleLineHeight));
                    {
                        GUILayout.Space(DGUI.Properties.Space(2));
                        GUI.color = GUI.color.WithAlpha(DGUI.Properties.TextIconAlphaValue(false));
                        DGUI.Label.Draw("Empty...", Size.S, DGUI.Colors.DisabledTextColorName, DGUI.Properties.SingleLineHeight);
                        GUI.color = GUI.color.WithAlpha(alpha);
                        GUILayout.FlexibleSpace();
                        if (DGUI.Button.IconButton.Plus(DGUI.Properties.SingleLineHeight))
                        {
                            m_progressors.InsertArrayElementAtIndex(m_progressors.arraySize);
                        }
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.EndVertical();
                    return;
                }

                for (int i = 0; i < m_progressors.arraySize; i++)
                {
                    SerializedProperty childProperty = m_progressors.GetArrayElementAtIndex(i);
                    float propertyHeight             = EditorGUI.GetPropertyHeight(childProperty);
                    GUILayout.BeginHorizontal(GUILayout.Height(propertyHeight));
                    {
                        GUILayout.Space(DGUI.Properties.Space(2));
                        GUI.color = GUI.color.WithAlpha(DGUI.Properties.TextIconAlphaValue(false));
                        DGUI.Label.Draw(i.ToString(), Size.S, DGUI.Colors.DisabledTextColorName, propertyHeight);
                        GUI.color = GUI.color.WithAlpha(alpha);
                        GUILayout.Space(DGUI.Properties.Space(2));
                        if (Target.Progressors[i] != null)
                        {
                            GUILayout.Space(DGUI.Properties.Space(2));
                            DGUI.Label.Draw(Mathf.Round(Target.Progressors[i].Progress * 100) + "%", Size.S, ComponentColorName, propertyHeight);
                        }
                        DGUI.Property.Draw(childProperty);
                        if (DGUI.Button.IconButton.Minus(propertyHeight))
                        {
                            m_progressors.DeleteArrayElementAtIndex(i);
                        }
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.Space(DGUI.Properties.Space());
                }

                GUILayout.BeginHorizontal(GUILayout.Height(DGUI.Properties.SingleLineHeight));
                {
                    GUILayout.FlexibleSpace();
                    if (DGUI.Button.IconButton.Plus(DGUI.Properties.SingleLineHeight))
                    {
                        m_progressors.InsertArrayElementAtIndex(m_progressors.arraySize);

                        //Reset the newly created serialized property to its default value
                        SerializedProperty p = m_progressors.GetArrayElementAtIndex(m_progressors.arraySize - 1);
                        p.objectReferenceValue = default(Object);
                    }
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
        }
Beispiel #28
0
        private void DrawGeneralPluginBoxPlaymaker()
        {
            bool usePlugin = Settings.UsePlaymaker;

            EditorGUI.BeginChangeCheck();
            usePlugin = DrawGeneralPluginBox("Playmaker", Settings.PlaymakerDetected, usePlugin, DefineSymbolsProcessor.DEFINE_PLAYMAKER, Styles.GetStyle(Styles.StyleName.IconPlaymaker));
            if (EditorGUI.EndChangeCheck())
            {
                Settings.UsePlaymaker = usePlugin;
            }
        }
        private void DrawActions()
        {
            ColorName currentColor = Target.IsActive ? ComponentColorName : ColorName.Red;

            DGUI.Doozy.DrawTitleWithIconAndBackground(Styles.GetStyle(Styles.StyleName.IconAction),
                                                      UILabels.Actions,
                                                      Size.L,
                                                      DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(2),
                                                      currentColor,
                                                      currentColor);

            GUILayout.Space(DGUI.Properties.Space());

            SerializedProperty soundDataProperty      = GetProperty(PropertyName.SoundData, m_actions);
            SerializedProperty effectProperty         = GetProperty(PropertyName.Effect, m_actions);
            SerializedProperty animatorEventsProperty = GetProperty(PropertyName.AnimatorEvents, m_actions);
            SerializedProperty gameEventsProperty     = GetProperty(PropertyName.GameEvents, m_actions);
            SerializedProperty unityEventProperty     = GetProperty(PropertyName.Event, m_actions);


            if (!m_soundDataExpanded.target && !m_effectExpanded.target && !m_animatorEventsExpanded.target && !m_gameEventsExpanded.target && !m_unityEventsExpanded.target)
            {
                m_soundDataExpanded.target = true;
            }

            GUILayout.BeginHorizontal();
            {
                if (DGUI.Doozy.DrawSubSectionButtonLeft(m_soundDataExpanded.target,
                                                        UILabels.Sound,
                                                        currentColor,
                                                        DGUI.IconGroup.GetIcon(
                                                            Target.Actions.HasSound,
                                                            DGUI.IconGroup.IconSize,
                                                            DGUI.Icon.Sound, DGUI.Icon.Sound,
                                                            currentColor, DGUI.Colors.DisabledIconColorName)))
                {
                    m_soundDataExpanded.target     = true;
                    m_effectExpanded.value         = false;
                    m_animatorEventsExpanded.value = false;
                    m_gameEventsExpanded.value     = false;
                    m_unityEventsExpanded.value    = false;
                }

                GUILayout.Space(DGUI.Properties.Space());

                if (DGUI.Doozy.DrawSubSectionButtonMiddle(m_effectExpanded.target,
                                                          UILabels.Effect,
                                                          currentColor,
                                                          DGUI.IconGroup.GetIcon(
                                                              Target.Actions.HasEffect,
                                                              DGUI.IconGroup.IconSize,
                                                              DGUI.Icon.Effect, DGUI.Icon.Effect,
                                                              currentColor, DGUI.Colors.DisabledIconColorName)))
                {
                    m_soundDataExpanded.value      = false;
                    m_effectExpanded.target        = true;
                    m_animatorEventsExpanded.value = false;
                    m_gameEventsExpanded.value     = false;
                    m_unityEventsExpanded.value    = false;
                    SoundyAudioPlayer.StopAllPlayers();
                }

                GUILayout.Space(DGUI.Properties.Space());

                if (DGUI.Doozy.DrawSubSectionButtonMiddle(m_animatorEventsExpanded.target,
                                                          UILabels.Animators,
                                                          currentColor,
                                                          DGUI.IconGroup.GetIconWithCounter(
                                                              Target.Actions.HasAnimatorEvents,
                                                              Target.Actions.AnimatorEventsCount,
                                                              DGUI.IconGroup.IconSize,
                                                              DGUI.Icon.Animator, DGUI.Icon.Animator,
                                                              currentColor, DGUI.Colors.DisabledIconColorName)))
                {
                    m_soundDataExpanded.value       = false;
                    m_effectExpanded.value          = false;
                    m_animatorEventsExpanded.target = true;
                    m_gameEventsExpanded.value      = false;
                    m_unityEventsExpanded.value     = false;
                    SoundyAudioPlayer.StopAllPlayers();
                }

                GUILayout.Space(DGUI.Properties.Space());

                if (DGUI.Doozy.DrawSubSectionButtonMiddle(m_gameEventsExpanded.target,
                                                          UILabels.GameEvents,
                                                          currentColor,
                                                          DGUI.IconGroup.GetIconWithCounter(
                                                              Target.Actions.HasGameEvents,
                                                              Target.Actions.GameEventsCount,
                                                              DGUI.IconGroup.IconSize,
                                                              DGUI.Icon.GameEvent, DGUI.Icon.GameEvent,
                                                              currentColor, DGUI.Colors.DisabledIconColorName)))
                {
                    m_soundDataExpanded.value      = false;
                    m_effectExpanded.value         = false;
                    m_animatorEventsExpanded.value = false;
                    m_gameEventsExpanded.target    = true;
                    m_unityEventsExpanded.value    = false;
                    SoundyAudioPlayer.StopAllPlayers();
                }

                GUILayout.Space(DGUI.Properties.Space());

                if (DGUI.Doozy.DrawSubSectionButtonRight(m_unityEventsExpanded.target,
                                                         UILabels.UnityEvents,
                                                         currentColor,
                                                         DGUI.IconGroup.GetIconWithCounter(
                                                             Target.Actions.HasUnityEvent,
                                                             Target.Actions.UnityEventListenerCount,
                                                             DGUI.IconGroup.IconSize,
                                                             DGUI.Icon.UnityEvent, DGUI.Icon.UnityEvent,
                                                             currentColor, DGUI.Colors.DisabledIconColorName)))
                {
                    m_soundDataExpanded.value      = false;
                    m_effectExpanded.value         = false;
                    m_animatorEventsExpanded.value = false;
                    m_gameEventsExpanded.value     = false;
                    m_unityEventsExpanded.target   = true;
                    SoundyAudioPlayer.StopAllPlayers();
                }
            }
            GUILayout.EndHorizontal();

            //ADD EXTRA SPACE if needed
            if (m_animatorEventsExpanded.target ||
                m_effectExpanded.target ||
                m_gameEventsExpanded.target)
            {
                GUILayout.Space(DGUI.Properties.Space());
            }

            //DRAW SOUND
            if (m_soundDataExpanded.target)
            {
                DGUI.Property.DrawWithFade(soundDataProperty, m_soundDataExpanded);
            }

            //DRAW EFFECT
            if (m_effectExpanded.target)
            {
                DGUI.Doozy.DrawUIEffect(Target.gameObject,
                                        Target.Actions.Effect,
                                        GetProperty(PropertyName.ParticleSystem, effectProperty),
                                        GetProperty(PropertyName.Behavior, effectProperty),
                                        GetProperty(PropertyName.StopBehavior, effectProperty),
                                        GetProperty(PropertyName.AutoSort, effectProperty),
                                        GetProperty(PropertyName.SortingSteps, effectProperty),
                                        GetProperty(PropertyName.CustomSortingLayer, effectProperty),
                                        GetProperty(PropertyName.CustomSortingOrder, effectProperty),
                                        m_effectExpanded,
                                        currentColor);
            }

            //DRAW ANIMATOR EVENTS
            if (m_animatorEventsExpanded.target)
            {
                DGUI.List.DrawWithFade(animatorEventsProperty, m_animatorEventsExpanded, currentColor, UILabels.ListIsEmpty);
            }

            //DRAW GAME EVENTS
            if (m_gameEventsExpanded.target)
            {
                DGUI.List.DrawWithFade(gameEventsProperty, m_gameEventsExpanded, currentColor, UILabels.ListIsEmpty, 1);
            }

            //DRAW EVENTS (UnityEvent)
            if (m_unityEventsExpanded.target)
            {
                DGUI.Property.UnityEventWithFade(unityEventProperty, m_unityEventsExpanded, "Actions.Event", currentColor, Target.Actions.UnityEventListenerCount);
            }
        }
Beispiel #30
0
        public static void DrawColorProperties(ThemeData themeData, int propertyIndex,
                                               SerializedObject serializedObject, Object[] targets, ThemeTarget target,
                                               Color initialGUIColor)
        {
            GUIStyle colorButtonStyle         = Styles.GetStyle(Styles.StyleName.ColorButton);
            GUIStyle colorButtonSelectedStyle = Styles.GetStyle(Styles.StyleName.ColorButtonSelected);

            if (themeData.ColorLabels.Count != themeData.ActiveVariant.Colors.Count)
            {
                foreach (LabelId labelId in themeData.ColorLabels.Where(labelId => !themeData.ActiveVariant.ContainsColor(labelId.Id)))
                {
                    themeData.ActiveVariant.AddColorProperty(labelId.Id);
                }
            }

            for (int i = 0; i < themeData.ColorLabels.Count; i++)
            {
                LabelId colorProperty = themeData.ColorLabels[i];
                int     index         = i;
                bool    selected      = i == propertyIndex;
                GUILayout.BeginHorizontal();
                {
                    if (!selected)
                    {
                        GUILayout.Space((colorButtonSelectedStyle.fixedWidth - colorButtonStyle.fixedWidth) / 2);
                    }
                    GUI.color = themeData.ActiveVariant.Colors[i].Color;
                    {
                        if (GUILayout.Button(GUIContent.none, selected ? colorButtonSelectedStyle : colorButtonStyle))
                        {
                            if (serializedObject.isEditingMultipleObjects)
                            {
                                DoozyUtils.UndoRecordObjects(targets, UILabels.UpdateValue);
                                foreach (Object o in targets)
                                {
                                    var themeTarget = (ThemeTarget)o;
                                    if (themeTarget == null)
                                    {
                                        continue;
                                    }
                                    themeTarget.PropertyId = themeData.ColorLabels[index].Id;
                                    themeTarget.UpdateTarget(themeData);
                                }
                            }
                            else
                            {
                                DoozyUtils.UndoRecordObject(target, UILabels.UpdateValue);
                                target.PropertyId = themeData.ColorLabels[index].Id;
                                target.UpdateTarget(themeData);
                            }
                        }
                    }
                    GUI.color = initialGUIColor;
                    GUILayout.Space(DGUI.Properties.Space(2));
                    GUI.enabled = selected;
                    DGUI.Label.Draw(colorProperty.Label, selected ? Size.L : Size.M, selected ? colorButtonSelectedStyle.fixedHeight : colorButtonStyle.fixedHeight);
                    GUI.enabled = true;
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(DGUI.Properties.Space());
            }
        }