Beispiel #1
0
        private void DrawMasterAudio(Rect drawRect, SerializedProperty property, ColorName backgroundColorName, ColorName textColorName)
        {
            Color initialColor = GUI.color;

            SerializedProperty soundSource = Properties.Get(PropertyName.SoundSource, property);
            SerializedProperty soundName   = Properties.Get(PropertyName.SoundName, property);

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

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

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

            DGUI.Label.Draw(outputLabelRect, UILabels.SoundSource, Size.S, textColorName);
            DGUI.Label.Draw(soundNameLabelRect, DoozySettings.Instance.UseMasterAudio ? UILabels.SoundName : UILabels.EnableSupportForMasterAudio, 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 soundNameFieldRect = new Rect(x, y, soundNameLabelWidth, DGUI.Properties.SingleLineHeight);

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

            //DRAW - OUTPUT DROPDOWN
            EditorGUI.BeginChangeCheck();
            EditorGUI.PropertyField(outputDropdownRect, soundSource, GUIContent.none, true);
            if (EditorGUI.EndChangeCheck())
            {
                DGUI.Properties.ResetKeyboardFocus();
            }

            if (DoozySettings.Instance.UseMasterAudio)
            {
                //DRAW - SOUND NAME - for MasterAudio
                EditorGUI.PropertyField(soundNameFieldRect, soundName, GUIContent.none, true);
            }
            else
            {
                var masterAudioIconRect = new Rect(soundNameFieldRect.x, soundNameFieldRect.y, soundNameFieldRect.height, soundNameFieldRect.height);
                DGUI.Icon.Draw(masterAudioIconRect, Styles.GetStyle(Styles.StyleName.IconMasterAudio));
                var buttonRect = new Rect(masterAudioIconRect.xMax + DGUI.Properties.Space(), masterAudioIconRect.y, soundNameFieldRect.width - masterAudioIconRect.width - DGUI.Properties.Space(), soundNameFieldRect.height);
                if (DGUI.Button.Draw(buttonRect, UILabels.OpenControlPanel, Size.S, ColorName.Red, ColorName.Red, true))
                {
                    DoozyWindow.Open(DoozyWindow.View.General);
                }
            }


            GUI.color = initialColor;
        }
 public static void DrawButtonTheme(ThemeData themeData, ColorName componentColorName)
 {
     if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconThemeManager),
                                            UILabels.Themes, Size.S, TextAlign.Left,
                                            componentColorName, componentColorName,
                                            DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(2), false))
     {
         DoozyWindow.Open(DoozyWindow.View.Themes);
         DoozyWindow.Instance.CurrentThemeId = themeData.Id;
     }
 }
Beispiel #3
0
 private void DrawSoundySettings()
 {
     GUILayout.BeginHorizontal();
     GUILayout.FlexibleSpace();
     if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconSoundy),
                                            UILabels.SoundySettings,
                                            Size.M, TextAlign.Left,
                                            ComponentColorName, ComponentColorName,
                                            DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(4),
                                            false))
     {
         DoozyWindow.Open(DoozyWindow.View.Soundy);
     }
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
 }
Beispiel #4
0
 private void DrawGeneralSettingsButton()
 {
     GUILayout.BeginHorizontal();
     GUILayout.FlexibleSpace();
     if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconDoozy),
                                            UILabels.GeneralSettings,
                                            Size.M, TextAlign.Left,
                                            DGUI.Colors.DisabledBackgroundColorName,
                                            DGUI.Colors.DisabledTextColorName,
                                            DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(4),
                                            false))
     {
         DoozyWindow.Open(DoozyWindow.View.General);
     }
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
 }
Beispiel #5
0
 private void DrawDebugModeAndTouchySettings()
 {
     GUILayout.BeginHorizontal();
     DGUI.Doozy.DrawDebugMode(GetProperty(PropertyName.DebugMode), ColorName.Red);
     GUILayout.FlexibleSpace();
     if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconTouchy),
                                            UILabels.TouchySettings,
                                            Size.S, TextAlign.Left,
                                            DGUI.Colors.DisabledBackgroundColorName,
                                            DGUI.Colors.DisabledTextColorName,
                                            DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(2),
                                            false))
     {
         DoozyWindow.Open(DoozyWindow.View.Touchy);
     }
     GUILayout.EndHorizontal();
 }
Beispiel #6
0
        /// <summary> Show a context menu for the graph. Shown when the developer right clicks over the grid area </summary>
        private void ShowGraphContextMenu()
        {
            var menu = new GenericMenu(); //create a generic menu

            var nodeMenus = new List <NodeMenuItem>();

            foreach (Type type in NodeTypes)
            {
                NodeMenu nodeMenu;
                string   path = GetNodeMenuName(type, out nodeMenu); //Get node context menu path
                if (string.IsNullOrEmpty(path))
                {
                    continue;                                      //empty entry means that the node will be hidden from the menu
                }
                nodeMenus.Add(new NodeMenuItem(nodeMenu, type));
            }

            nodeMenus = nodeMenus.OrderBy(n => n.Menu.Order).ThenBy(o => o.Menu.MenuName).ToList();

            string nodeRootPath = UILabels.CreateNode + "/";

            foreach (NodeMenuItem nodeMenuItem in nodeMenus)
            {
                NodeMenuItem menuItem = nodeMenuItem;
                if (menuItem.Menu.AddSeparatorBefore)
                {
                    menu.AddSeparator(nodeRootPath);
                }
                menu.AddItem(new GUIContent(nodeRootPath + menuItem.Menu.MenuName), false, () => ExecuteGraphAction(GraphAction.CreateNode, menuItem.NodeType.AssemblyQualifiedName)); //Create Node
                if (menuItem.Menu.AddSeparatorAfter)
                {
                    menu.AddSeparator(nodeRootPath);
                }
            }


//            foreach (Type type in NodeTypes)
//            {
//                NodeMenu nodeMenu;
//                string path = GetNodeMenuName(type, out nodeMenu); //Get node context menu path
//                if (string.IsNullOrEmpty(path)) continue; //empty entry means that the node will be hidden from the menu
//                Type nodeType = type;
//                menu.AddItem(new GUIContent(UILabels.Create + "/" + path), false, () => ExecuteGraphAction(GraphAction.CreateNode, nodeType.AssemblyQualifiedName)); //Create Node
//            }

            menu.AddSeparator("");
            var pasteNode = new GUIContent(UILabels.Paste);

            if (WindowSettings.CanPasteNodes)
            {
                menu.AddItem(pasteNode, false, () => { ExecuteGraphAction(GraphAction.Paste); }); //Paste Node
            }
            else
            {
                menu.AddDisabledItem(pasteNode); //Paste Node label
            }
            menu.AddSeparator("");
            if (WindowSettings.SelectedNodes.Count > 0)
            {
                menu.AddItem(new GUIContent(UILabels.CenterSelectedNodes), false, () => { CenterSelectedNodesInWindow(); }); //Center Selected Nodes
                menu.AddSeparator("");
            }

            menu.AddItem(new GUIContent(UILabels.Overview), false, () => { CenterAllNodesInWindow(); });                //Overview
            menu.AddItem(new GUIContent(UILabels.GoToStartNode), false, GoToStartOrEnterNode);                          //Go to Start Node
            menu.AddSeparator("");
            AddCustomContextMenuItems(menu, CurrentGraph);                                                              //Add custom menu options from graph
            menu.AddItem(new GUIContent(UILabels.Settings), false, () => { DoozyWindow.Open(DoozyWindow.View.Nody); }); //Settings
            menu.ShowAsContext();                                                                                       //show menu at mouse position
        }
Beispiel #7
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;
        }