コード例 #1
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.Space();

            if (binding)
            {
                Bind();
            }

            fileName.stringValue = EditorGUILayout.TextField("File Name", fileName.stringValue);

            autoCreateUI.boolValue = EditorGUILayout.Toggle("Auto Create UI", autoCreateUI.boolValue);

            binds.isExpanded = EditorGUILayout.Foldout(binds.isExpanded, "Binds");

            if (binds.isExpanded)
            {
                EditorGUI.indentLevel++;

                binds.arraySize = EditorGUILayout.IntField("Size", binds.arraySize);

                binds.arraySize = InspectorTools.DrawArraySizeButtons(binds.arraySize, 1, 1);

                if (bindsIndex > binds.arraySize - 1)
                {
                    bindsIndex = -1;
                }

                for (int x = 0; x < binds.arraySize; x++)
                {
                    SerializedProperty bindsElement = binds.GetArrayElementAtIndex(x);
                    DrawBinds(bindsElement, x);
                }

                if (bindsIndex != -1)
                {
                    int index = InspectorTools.DrawArryElementModifiers(bindsIndex, binds.arraySize, 1, 1);

                    if (index == -1)
                    {
                        binds.DeleteArrayElementAtIndex(bindsIndex);
                        bindsIndex = -1;
                    }

                    if (index != bindsIndex)
                    {
                        binds.MoveArrayElement(bindsIndex, index);
                        bindsIndex = index;
                    }
                }

                EditorGUI.indentLevel--;
            }

            serializedObject.ApplyModifiedProperties();
        }
コード例 #2
0
        void DrawSliderSkins()
        {
            sliderSkins.isExpanded = EditorGUILayout.Foldout(sliderSkins.isExpanded, "Slider Skins");

            if (sliderSkins.isExpanded)
            {
                EditorGUI.indentLevel++;

                sliderSkins.arraySize = EditorGUILayout.IntField("Size", sliderSkins.arraySize);
                sliderSkins.arraySize = InspectorTools.DrawArraySizeButtons(sliderSkins.arraySize);

                for (int i = 0; i < sliderSkins.arraySize; i++)
                {
                    EditorGUI.indentLevel++;

                    SerializedProperty sliderSkin = sliderSkins.GetArrayElementAtIndex(i);
                    DrawSliderSkin(sliderSkin, "Slider Skin " + i);

                    EditorGUI.indentLevel--;
                }

                EditorGUI.indentLevel--;
            }
        }
コード例 #3
0
        void DrawButtonSkins()
        {
            buttonSkins.isExpanded = EditorGUILayout.Foldout(buttonSkins.isExpanded, "Button Skins");

            if (buttonSkins.isExpanded)
            {
                EditorGUI.indentLevel++;

                buttonSkins.arraySize = EditorGUILayout.IntField("Size", buttonSkins.arraySize);
                buttonSkins.arraySize = InspectorTools.DrawArraySizeButtons(buttonSkins.arraySize);

                for (int i = 0; i < buttonSkins.arraySize; i++)
                {
                    EditorGUI.indentLevel++;

                    SerializedProperty buttonSkin = buttonSkins.GetArrayElementAtIndex(i);
                    DrawButtonSkin(buttonSkin, "Button Skin " + i);

                    EditorGUI.indentLevel--;
                }

                EditorGUI.indentLevel--;
            }
        }
コード例 #4
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.Space();

            fileName.stringValue = EditorGUILayout.TextField("File Name", fileName.stringValue);

            autoCreateUI.boolValue = EditorGUILayout.Toggle("Auto Create UI", autoCreateUI.boolValue);

            audioChannels.isExpanded = EditorGUILayout.Foldout(audioChannels.isExpanded, "Audio Channels");

            if (audioChannels.isExpanded)
            {
                EditorGUI.indentLevel++;

                audioChannels.arraySize = EditorGUILayout.IntField("Size", audioChannels.arraySize);
                audioChannels.arraySize = InspectorTools.DrawArraySizeButtons(audioChannels.arraySize, 1, 1);

                if (channelIndex > audioChannels.arraySize - 1)
                {
                    channelIndex = -1;
                }

                for (int i = 0; i < audioChannels.arraySize; i++)
                {
                    SerializedProperty audioChannel = audioChannels.GetArrayElementAtIndex(i);

                    SerializedProperty name = audioChannel.FindPropertyRelative("name");

                    string nameLabel = name.stringValue;

                    if (nameLabel == "")
                    {
                        nameLabel = "Channel Name";
                    }

                    EditorGUILayout.BeginHorizontal();

                    audioChannel.isExpanded = EditorGUILayout.Foldout(audioChannel.isExpanded, nameLabel);

                    if (channelIndex == i)
                    {
                        if (GUILayout.Button("Deselect"))
                        {
                            channelIndex = -1;
                        }
                    }
                    else if (GUILayout.Button("Select"))
                    {
                        channelIndex = i;
                    }

                    EditorGUILayout.EndHorizontal();
                    if (audioChannel.isExpanded)
                    {
                        InspectorTools.Space();
                        SerializedProperty volume = audioChannel.FindPropertyRelative("volume");

                        name.stringValue  = EditorGUILayout.TextField("Name", name.stringValue);
                        volume.floatValue = EditorGUILayout.Slider("Volume", volume.floatValue, 0, 1);
                    }
                }

                if (channelIndex != -1)
                {
                    int index = InspectorTools.DrawArryElementModifiers(channelIndex, audioChannels.arraySize, 1, 1);

                    if (index == -1)
                    {
                        audioChannels.DeleteArrayElementAtIndex(channelIndex);
                        channelIndex = -1;
                    }

                    if (index != channelIndex)
                    {
                        audioChannels.MoveArrayElement(channelIndex, index);
                        channelIndex = index;
                    }
                }

                EditorGUI.indentLevel--;
            }

            serializedObject.ApplyModifiedProperties();
        }
コード例 #5
0
        public override void OnInspectorGUI()
        {
            InspectorTools.Space();
            savedValues.isExpanded = EditorGUILayout.Foldout(savedValues.isExpanded, "Saved Values");

            if (savedValues.isExpanded)
            {
                EditorGUI.indentLevel++;

                DrawArraySizer(savedValues);

                savedValues.arraySize = InspectorTools.DrawArraySizeButtons(savedValues.arraySize, 1, 1);

                if (savedValueIndex > savedValues.arraySize - 1)
                {
                    savedValueIndex = -1;
                }

                InspectorTools.Space();

                for (int i = 0; i < savedValues.arraySize; i++)
                {
                    SerializedProperty savedValue = savedValues.GetArrayElementAtIndex(i);
                    SerializedProperty name       = savedValue.FindPropertyRelative("name");

                    string savedValueLabel = name.stringValue;
                    if (savedValueLabel == "")
                    {
                        savedValueLabel = "Saved Value " + i;
                    }

                    EditorGUILayout.BeginHorizontal();
                    savedValue.isExpanded = EditorGUILayout.Foldout(savedValue.isExpanded, savedValueLabel);

                    if (savedValueIndex == i)
                    {
                        if (GUILayout.Button("Deselect"))
                        {
                            savedValueIndex = -1;
                        }
                    }
                    else if (GUILayout.Button("Select"))
                    {
                        savedValueIndex = i;
                    }

                    EditorGUILayout.EndHorizontal();

                    if (savedValue.isExpanded)
                    {
                        InspectorTools.Space();
                        name.stringValue = EditorGUILayout.TextField(name.stringValue);

                        SerializedProperty uiType = savedValue.FindPropertyRelative("uiType");
                        uiTypeE = (SavedValue.UI)uiType.enumValueIndex;
                        uiTypeE = (SavedValue.UI)EditorGUILayout.EnumPopup("UI", uiTypeE);
                        uiType.enumValueIndex = (int)uiTypeE;

                        SerializedProperty ui = null;

                        SerializedProperty value;
                        switch (uiTypeE)
                        {
                        case SavedValue.UI.InputField:     //Input Field
                            ui = savedValue.FindPropertyRelative("inf");

                            EditorGUILayout.PropertyField(ui, new GUIContent("InputField"));

                            SerializedProperty infData = savedValue.FindPropertyRelative("infData");
                            infDataE = (SavedValue.InputFieldData)infData.enumValueIndex;
                            infDataE = (SavedValue.InputFieldData)EditorGUILayout.EnumPopup("Data", infDataE);
                            infData.enumValueIndex = (int)infDataE;

                            switch (infDataE)
                            {
                            case SavedValue.InputFieldData.Int:         //Input Field Int

                                value          = savedValue.FindPropertyRelative("iValue");
                                value.intValue = EditorGUILayout.IntField("Value", value.intValue);

                                break;

                            case SavedValue.InputFieldData.Float:         //Input Field Float

                                value            = savedValue.FindPropertyRelative("fValue");
                                value.floatValue = EditorGUILayout.FloatField("Value", value.floatValue);

                                break;

                            case SavedValue.InputFieldData.String:          //Input Field String

                                value             = savedValue.FindPropertyRelative("sValue");
                                value.stringValue = EditorGUILayout.TextField("Value", value.stringValue);

                                break;
                            }

                            break;

                        case SavedValue.UI.Slider:     //Slider
                            ui = savedValue.FindPropertyRelative("sl");
                            EditorGUILayout.PropertyField(ui, new GUIContent("Slider"));

                            SerializedProperty slData = savedValue.FindPropertyRelative("slData");
                            slDataE = (SavedValue.SliderData)slData.enumValueIndex;
                            slDataE = (SavedValue.SliderData)EditorGUILayout.EnumPopup("Data", slDataE);
                            slData.enumValueIndex = (int)slDataE;

                            switch (slDataE)
                            {
                            case SavedValue.SliderData.Int:         //slider int

                                value          = savedValue.FindPropertyRelative("iValue");
                                value.intValue = EditorGUILayout.IntField("Value", value.intValue);

                                break;

                            case SavedValue.SliderData.Float:         //slider float

                                value            = savedValue.FindPropertyRelative("fValue");
                                value.floatValue = EditorGUILayout.FloatField("Value", value.floatValue);

                                break;
                            }

                            break;

                        case SavedValue.UI.Toggle:
                            ui = savedValue.FindPropertyRelative("togg");
                            EditorGUILayout.PropertyField(ui, new GUIContent("Toggle"));

                            value           = savedValue.FindPropertyRelative("bValue");
                            value.boolValue = EditorGUILayout.Toggle("Value", value.boolValue);

                            break;

                        case SavedValue.UI.DropDown:
                            ui = savedValue.FindPropertyRelative("drop");
                            EditorGUILayout.PropertyField(ui, new GUIContent("DropDown"));

                            value          = savedValue.FindPropertyRelative("iValue");
                            value.intValue = EditorGUILayout.IntField("Value", value.intValue);

                            break;
                        }
                        InspectorTools.Space(1);
                    }
                }

                EditorGUI.indentLevel--;

                if (savedValueIndex != -1)
                {
                    int index = InspectorTools.DrawArryElementModifiers(savedValueIndex, savedValues.arraySize, 1, 1);

                    if (index == -1)
                    {
                        savedValues.DeleteArrayElementAtIndex(savedValueIndex);
                        savedValueIndex = -1;
                    }

                    else if (index != savedValueIndex)
                    {
                        savedValues.MoveArrayElement(savedValueIndex, index);
                        savedValueIndex = index;
                    }
                }
            }

            if (GUILayout.Button("Delete Saved Values"))
            {
                item.DeleteAll();
            }

            serializedObject.ApplyModifiedProperties();
        }
コード例 #6
0
        void DrawMenuRegion()
        {
            menuTypeE = (Menu)menuType.enumValueIndex;
            menuTypeE = (Menu)EditorGUILayout.EnumPopup("Menu Type", menuTypeE);
            menuType.enumValueIndex = (int)menuTypeE;

            if (menuTypeE == Menu.Main)
            {
                EditorGUILayout.PropertyField(newGameB, new GUIContent("New Game"));

                levels.isExpanded = EditorGUILayout.Foldout(levels.isExpanded, "Levels");

                if (levels.isExpanded)
                {
                    SerializedProperty levelsArray  = levels.FindPropertyRelative("levels");
                    SerializedProperty autoCreateUI = levels.FindPropertyRelative("autoCreateUI");

                    autoCreateUI.boolValue = EditorGUILayout.Toggle("Auto Create UI", autoCreateUI.boolValue);

                    levelsArray.arraySize = EditorGUILayout.IntField("Size", levelsArray.arraySize);

                    levelsArray.arraySize = InspectorTools.DrawArraySizeButtons(levelsArray.arraySize, 1, 1);

                    if (levelIndex > levelsArray.arraySize - 1)
                    {
                        levelIndex = -1;
                    }

                    EditorGUI.indentLevel += 2;
                    for (int i = 0; i < levelsArray.arraySize; i++)
                    {
                        SerializedProperty level = levelsArray.GetArrayElementAtIndex(i);
                        string             name  = level.FindPropertyRelative("name").stringValue;

                        if (name == "")
                        {
                            name = "Level Name";
                        }

                        DrawGameLevel(level, name, 2, true, i);
                    }
                    EditorGUI.indentLevel -= 2;

                    if (levelIndex != -1)
                    {
                        int index = InspectorTools.DrawArryElementModifiers(levelIndex, levelsArray.arraySize, 1, 1);

                        if (index == -1)
                        {
                            levelsArray.DeleteArrayElementAtIndex(levelIndex);
                            levelIndex = -1;
                        }

                        if (index != levelIndex)
                        {
                            levelsArray.MoveArrayElement(levelIndex, index);
                            levelIndex = index;
                        }
                    }
                }

                EditorGUILayout.PropertyField(levelsScroll, new GUIContent("Levels Scroll"));
                EditorGUILayout.PropertyField(levelPreview, new GUIContent("Level Preview"));
            }
            else
            {
                DrawGameLevel(mainMenuLevel, "Main Menu Level");

                EditorGUILayout.PropertyField(resumeB, new GUIContent("Resume Button"));
                EditorGUILayout.PropertyField(returnToMainB, new GUIContent("Main Menu Button", "Return To Main Menu Button"));

                EditorGUILayout.PropertyField(pauseMenu, new GUIContent("Pause Menu", "Pause Menu UI Object"));
                EditorGUILayout.PropertyField(gameUI, new GUIContent("Game UI", "Game UI Holding All UI Related To Gameplay"));
            }
        }
コード例 #7
0
        public void DrawBinds(SerializedProperty bindsElement, int currentIndex)
        {
            SerializedProperty categoryName = bindsElement.FindPropertyRelative("categoryName");
            SerializedProperty bindsArray   = bindsElement.FindPropertyRelative("binds");

            string categoryNameLabel = categoryName.stringValue;

            if (categoryNameLabel == "")
            {
                categoryNameLabel = "Category " + currentIndex;
            }

            EditorGUILayout.BeginHorizontal();

            bindsArray.isExpanded = EditorGUILayout.Foldout(bindsArray.isExpanded, categoryNameLabel);

            if (bindsIndex == currentIndex)
            {
                if (GUILayout.Button("Deselect"))
                {
                    bindsIndex = -1;
                }
            }
            else if (GUILayout.Button("Select"))
            {
                bindsIndex = currentIndex;
            }

            EditorGUILayout.EndHorizontal();

            if (bindsArray.isExpanded)
            {
                InspectorTools.Space();
                categoryName.stringValue = EditorGUILayout.TextField("Name", categoryName.stringValue);

                bindsArray.arraySize = EditorGUILayout.IntField("Size", bindsArray.arraySize);

                bindsArray.arraySize = InspectorTools.DrawArraySizeButtons(bindsArray.arraySize, 1, 1);

                if (bindIndex.bind > bindsArray.arraySize - 1 && bindIndex.binds == currentIndex)
                {
                    bindIndex = new BindIndex(-1, -1);
                }

                EditorGUI.indentLevel += 2;
                for (int i = 0; i < bindsArray.arraySize; i++)
                {
                    SerializedProperty bind = bindsArray.GetArrayElementAtIndex(i);
                    DrawBind(bind, currentIndex, i);

                    if (i == bindsArray.arraySize - 1)
                    {
                        InspectorTools.Space(1);
                    }
                }
                EditorGUI.indentLevel -= 2;

                if (bindIndex.bind != -1 && bindIndex.binds == currentIndex)
                {
                    int index = InspectorTools.DrawArryElementModifiers(bindIndex.bind, bindsArray.arraySize, 1, 1);

                    if (index == -1)
                    {
                        bindsArray.DeleteArrayElementAtIndex(bindIndex.binds);
                        bindIndex = new BindIndex(-1, -1);
                    }

                    if (index != bindIndex.bind)
                    {
                        bindsArray.MoveArrayElement(bindIndex.bind, index);
                        bindIndex.bind = index;
                    }
                }
            }
        }