Example #1
0
        void DrawDefineSymbolsBuildTargetGroup(float width)
        {
            QUI.BeginVertical(width);
            {
                QUI.GhostTitle("BUILD TARGET GROUP", QColors.Color.Blue, width);
                QUI.Space(SPACE_4);
                QUI.BeginHorizontal(width);
                {
                    QUI.Space(SPACE_8);
                    if (QUI.GhostButton("Copy to Symbols Preset   >>>", QColors.Color.Blue, width - SPACE_8, 24))
                    {
                        presetSymbols.Clear();
                        presetSymbols.AddRange(symbols);
                    }
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
                QUI.Space(SPACE_4);
                QUI.BeginHorizontal(width);
                {
                    QUI.Space(SPACE_8);
                    QUI.SetGUIBackgroundColor(EditorGUIUtility.isProSkin ? QColors.Blue.Color : QColors.BlueLight.Color);
                    selectedBuildTargetGroup = (BuildTargetGroup)EditorGUILayout.EnumPopup(selectedBuildTargetGroup, GUILayout.Width(width - SPACE_8 - (106 * selectedBuildTargetGroupIsTheActivePlatform.faded)));
                    QUI.ResetColors();
                    if (selectedBuildTargetGroupIsTheActivePlatform.faded > 0.05f)
                    {
                        QUI.Label("is the Active Platform", Style.Text.Small, 106 * selectedBuildTargetGroupIsTheActivePlatform.faded);
                    }
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();

                if (selectedBuildTargetGroup != previouslySelectedBuildTargetGroup)
                {
                    symbols = QUtils.GetScriptingDefineSymbolsForGroup(selectedBuildTargetGroup);
                    previouslySelectedBuildTargetGroup = selectedBuildTargetGroup;
                    Repaint();
                }

                QUI.Space(SPACE_8 + SPACE_16);

                QUI.BeginHorizontal(width);
                {
                    QUI.Space(SPACE_8);
                    DrawActiveSymbolsList(width - 26);
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
            }
            QUI.EndVertical();
        }
Example #2
0
        void DrawDefineSymbols()
        {
            DrawPageHeader("DEFINE SYMBOLS", QColors.Green, "Preprocessor Directives Manager", QUI.IsProSkin ? QColors.UnityLight : QColors.UnityMild, EZResources.IconDefineSymbols);
            QUI.Space(SPACE_16);

            if (EditorApplication.isCompiling)
            {
                QUI.GhostTitle("Editor is compiling...", QColors.Color.Gray); return;
            }
            selectedBuildTargetGroupIsTheActivePlatform.target = selectedBuildTargetGroup == QUtils.GetActiveBuildTargetGroup();
            QUI.BeginHorizontal(WindowSettings.CurrentPageContentWidth);
            {
                DrawDefineSymbolsBuildTargetGroup(WindowSettings.CurrentPageContentWidth / 2);
                DrawDefineSymbolsSymbolsPreset(WindowSettings.CurrentPageContentWidth / 2);
            }
            QUI.EndHorizontal();
        }
Example #3
0
        void DrawDefineSymbolsSymbolsPreset(float width)
        {
            QUI.BeginVertical(width);
            {
                QUI.GhostTitle("SYMBOLS PRESET", QColors.Color.Green, width);
                QUI.Space(SPACE_4);
                QUI.BeginHorizontal(width);
                {
                    QUI.Space(SPACE_8);
                    if (QUI.GhostButton("<<<   Copy to Build Target Group", QColors.Color.Green, width - SPACE_8, 24))
                    {
                        List <string> tempList = presetSymbols;
                        tempList = QUtils.CleanList(tempList);
                        presetSymbols.Clear();
                        presetSymbols.AddRange(tempList);
                        symbols.Clear();
                        symbols.AddRange(presetSymbols);
                        QUtils.SetScriptingDefineSymbolsForGroup(selectedBuildTargetGroup, symbols);
                        if (presetSymbols.Count == 0)
                        {
                            presetSymbols.Add("");
                        }
                    }
                    QUI.FlexibleSpace();
                }
                QUI.EndHorizontal();
                QUI.Space(SPACE_4);
                if (defineSymbolsNewPreset.value) //NEW PRESET
                {
                    QUI.BeginHorizontal(width);
                    {
                        QUI.Space(SPACE_8);
                        QUI.Label("Enter a new preset name...", Style.Text.Small, width - SPACE_8);
                    }
                    QUI.EndHorizontal();

                    QUI.Space(-SPACE_4);

                    QUI.BeginHorizontal(width);
                    {
                        QUI.Space(SPACE_8);
                        GUI.SetNextControlName("newPresetName");
                        newPresetName = QUI.TextField(newPresetName, EditorGUIUtility.isProSkin ? QColors.Green.Color : QColors.GreenLight.Color, (width - SPACE_8 - 16 - 2 - 16) * defineSymbolsNewPreset.faded);

                        //if the user hits Enter while either the key or value fields were being edited
                        bool keyboardReturnPressed = Event.current.isKey &&
                                                     Event.current.keyCode == KeyCode.Return &&
                                                     Event.current.type == EventType.KeyUp &&
                                                     (GUI.GetNameOfFocusedControl() == "newPresetName");

                        QUI.Space(-2);
                        if (QUI.ButtonOk() || keyboardReturnPressed)
                        {
                            newPresetName = newPresetName.Trim();
                            if (newPresetName.Equals(DEFAULT_PRESET_NAME))
                            {
                                QUI.DisplayDialog("Enter a new preset name", "You are trying to save a preset with the defaut preset name '" + DEFAULT_PRESET_NAME + "'. Please enter another preset name.", "Ok");
                            }
                            else if (string.IsNullOrEmpty(newPresetName))
                            {
                                QUI.DisplayDialog("Enter a new preset name", "You are trying to save a preset with no name. Please enter a name.", "Ok");
                            }
                            else if (Q.GetResource <DefineSymbols.DefineSymbolsPreset>(EZT.RESOURCES_PATH_DEFINE_SYMBOLS_PRESETS, newPresetName) != null)
                            {
                                if (QUI.DisplayDialog("Overwrite preset?", "There is a preset with the same name '" + newPresetName + "' in the presets list. Are you sure you want to overwrite it?", "Overwrite", "Cancel"))
                                {
                                    AssetDatabase.MoveAssetToTrash(EZT.RELATIVE_PATH_DEFINE_SYMBOLS_PRESETS + newPresetName + ".asset");
                                    SavePreset(presetSymbols, newPresetName);
                                    selectedPresetName = newPresetName;
                                    RefreshPresetNames();
                                    defineSymbolsNewPreset.target = false;
                                    newPresetName = "";
                                }
                            }
                            else
                            {
                                SavePreset(presetSymbols, newPresetName);
                                selectedPresetName = newPresetName;
                                RefreshPresetNames();
                                defineSymbolsNewPreset.target = false;
                                newPresetName = "";
                            }
                        }
                        QUI.Space(2);

                        //if the user hits Escape while either the key or value fields were being edited
                        bool keyboardEscapePressed = Event.current.isKey &&
                                                     Event.current.keyCode == KeyCode.Escape &&
                                                     Event.current.type == EventType.KeyUp &&
                                                     (GUI.GetNameOfFocusedControl() == "newPresetName");

                        if (QUI.ButtonCancel() || keyboardEscapePressed)
                        {
                            defineSymbolsNewPreset.target = false;
                            newPresetName = "";
                        }
                        QUI.FlexibleSpace();
                    }
                    QUI.EndHorizontal();
                    QUI.Space(5);
                }
                else //NORMAL VIEW
                {
                    QUI.BeginHorizontal(width);
                    {
                        QUI.Space(SPACE_8);
                        QUI.BeginChangeCheck();
                        QUI.SetGUIBackgroundColor(EditorGUIUtility.isProSkin ? QColors.Green.Color : QColors.GreenLight.Color);
                        selectedPresetIndex = EditorGUILayout.Popup(selectedPresetIndex, presets, GUILayout.Width(width - SPACE_8));
                        QUI.ResetColors();
                        if (QUI.EndChangeCheck())
                        {
                            Undo.RecordObject(this, "Select Preset");
                            selectedPresetName = presets[selectedPresetIndex];
                        }
                        QUI.FlexibleSpace();
                    }
                    QUI.EndHorizontal();

                    QUI.Space(SPACE_2);

                    if (loadedPresetName.Equals(selectedPresetName) || selectedPresetName.Equals(DEFAULT_PRESET_NAME))
                    {
                        QUI.BeginHorizontal(width);
                        {
                            QUI.Space(SPACE_8);
                            if (selectedPresetName.Equals(DEFAULT_PRESET_NAME))
                            {
                                if (QUI.GhostButton("Create a New Preset with current symbols", QColors.Color.Green, width - SPACE_8))
                                {
                                    defineSymbolsNewPreset.target = true;
                                    newPresetName = "";
                                }
                            }
                            else
                            {
                                if (QUI.GhostButton("NEW", QColors.Color.Green, ((width - SPACE_8) / 4) - SPACE_2))
                                {
                                    defineSymbolsNewPreset.target = true;
                                    newPresetName = "";
                                }
                                QUI.Space(SPACE_2);
                                if (QUI.GhostButton("RELOAD", QColors.Color.Green, ((width - SPACE_8) / 4) - SPACE_2))
                                {
                                    LoadPreset(selectedPresetName);
                                }
                                QUI.Space(SPACE_2);
                                if (QUI.GhostButton("SAVE", QColors.Color.Green, ((width - SPACE_8) / 4) - SPACE_2))
                                {
                                    SavePreset(presetSymbols, selectedPresetName);
                                }
                                QUI.Space(SPACE_2);
                                if (QUI.GhostButton("DELETE", QColors.Color.Red, ((width - SPACE_8) / 4) - SPACE_2))
                                {
                                    if (QUI.DisplayDialog("Delete preset?", "Are you sure you want to delete the '" + selectedPresetName + "' preset?", "Yes", "No"))
                                    {
                                        DeletePreset(selectedPresetName);
                                    }
                                }
                            }
                            QUI.FlexibleSpace();
                        }
                        QUI.EndHorizontal();
                    }
                    else
                    {
                        QUI.BeginHorizontal(width);
                        {
                            QUI.Space(SPACE_8);
                            if (QUI.GhostButton("Load Preset", QColors.Color.Green, width - SPACE_8))
                            {
                                LoadPreset(selectedPresetName);
                            }
                            QUI.FlexibleSpace();
                        }
                        QUI.EndHorizontal();
                    }
                }

                QUI.Space(-SPACE_8 - SPACE_4);
                DrawSelectedPresetsList(width);
            }
            QUI.EndVertical();
        }