Ejemplo n.º 1
0
        protected void DrawVerticalNode(int nodeId)
        {
            if (vertV3Style == null)
            {
                vertV3Style = new GUIStyle("HelpBox")
                {
                    padding = new RectOffset(8, 8, 8, 8)
                }
            }
            ;

            if (vertV3StyleBlank == null)
            {
                vertV3StyleBlank = new GUIStyle("HelpBox")
                {
                    padding = new RectOffset(8, 8, 8, 8), normal = ((GUIStyle)"Label").normal
                }
            }
            ;

            var node = nodes.GetArrayElementAtIndex(nodeId);

            float px, rx, sx;
            float py, ry, sy;
            float pz, rz, sz;

            var posmask = (AxisMask)posDef.FindPropertyRelative("includeAxes").intValue;
            var rotmask = (AxisMask)rotDef.FindPropertyRelative("includeAxes").intValue;
            var sclmask = (AxisMask)sclDef.FindPropertyRelative("includeAxes").intValue;

            var trs = node.FindPropertyRelative("trs");
            var pos = trs.GetArrayElementAtIndex(0);
            var rot = trs.GetArrayElementAtIndex(1);
            var scl = trs.GetArrayElementAtIndex(2);


            EditorGUILayout.BeginHorizontal("HelpBox");


            EditorGUILayout.BeginVertical(GUILayout.MaxWidth(RANGE_LABEL_WIDTH));
            EditorGUILayout.LabelField("[" + nodeId + "]", GUILayout.MaxWidth(RANGE_LABEL_WIDTH));
            EditorGUILayout.BeginVertical(vertV3StyleBlank, GUILayout.MinWidth(16));
            EditorGUILayout.LabelField("X:", labelright, GUILayout.MaxWidth(RANGE_LABEL_WIDTH));
            EditorGUILayout.LabelField("Y:", labelright, GUILayout.MaxWidth(RANGE_LABEL_WIDTH));
            EditorGUILayout.LabelField("Z:", labelright, GUILayout.MaxWidth(RANGE_LABEL_WIDTH));
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndVertical();

            // Position
            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField(" Pos", GUILayout.MinWidth(16));
            EditorGUILayout.BeginVertical(posmask != 0 ? vertV3Style : vertV3StyleBlank);
            if (posmask != 0)
            {
                px = DrawVerticalAxis(pos, 0, posmask);
                py = DrawVerticalAxis(pos, 1, posmask);
                pz = DrawVerticalAxis(pos, 2, posmask);

                var newpos = new Vector3(px, py, pz);
                if (newpos != pos.vector3Value)
                {
                    pos.vector3Value = newpos;
                }
            }
            else
            {
                DrawEmptyTRS();
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndVertical();

            // Rotation
            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField(" Rot", GUILayout.MinWidth(16));
            EditorGUILayout.BeginVertical(rotmask != 0 ? vertV3Style : vertV3StyleBlank);
            if (rotmask != 0)
            {
                rx = DrawVerticalAxis(rot, 0, rotmask);
                ry = DrawVerticalAxis(rot, 1, rotmask);
                rz = DrawVerticalAxis(rot, 2, rotmask);


                var newrot = new Vector3(rx, ry, rz);
                if (newrot != rot.vector3Value)
                {
                    rot.vector3Value = newrot;
                }
            }
            else
            {
                DrawEmptyTRS();
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndVertical();

            // Scale
            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField(" Scl", GUILayout.MinWidth(16));
            EditorGUILayout.BeginVertical(sclmask != 0 ? vertV3Style : vertV3StyleBlank);
            if (sclmask != 0)
            {
                sx = DrawVerticalAxis(scl, 0, sclmask);
                sy = DrawVerticalAxis(scl, 1, sclmask);
                sz = DrawVerticalAxis(scl, 2, sclmask);

                var newscl = new Vector3(sx, sy, sz);
                if (newscl != scl.vector3Value)
                {
                    scl.vector3Value = newscl;
                }
            }
            else
            {
                DrawEmptyTRS();
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndVertical();

            EditorGUILayout.EndHorizontal();
        }
Ejemplo n.º 2
0
        public void OnInspectorGUI()
        {
            GUILayout.BeginVertical("box");

            EditorGUILayout.LabelField("Spline settings", GUIStyles.BoxTitleStyle);

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.PropertyField(curveResolution, new GUIContent("Curve Resolution"));
            EditorGUILayout.PropertyField(loop, new GUIContent("Loop"));

            EditorGUILayout.PropertyField(separation, new GUIContent("Separation"));

            if (gizmo.splineSettings.separation == SplineSettings.Separation.Fixed)
            {
                EditorGUILayout.PropertyField(separationDistance, new GUIContent("  Distance"));
            }
            else if (gizmo.splineSettings.separation == SplineSettings.Separation.Range)
            {
                EditorGuiUtilities.MinMaxEditor("  Distance Min", ref separationDistanceMin, "  Distance Max", ref separationDistanceMax);
            }
            else if (gizmo.splineSettings.separation == SplineSettings.Separation.PrefabBounds)
            {
                EditorGuiUtilities.MinMaxEditor("  Distance Min", ref separationDistanceMin, "  Distance Max", ref separationDistanceMax);
            }

            EditorGUILayout.PropertyField(lanes, new GUIContent("Lanes"));

            if (lanes.intValue > 1)
            {
                EditorGUILayout.PropertyField(skipCenterLane, new GUIContent("Skip Center Lane"));
            }

            EditorGUILayout.PropertyField(laneDistance, new GUIContent("Lane Distance"));

            EditorGUILayout.PropertyField(instanceRotation, new GUIContent("Rotation"));

            // allow control point rotation only in spline rotation mode
            SplineSettings.Rotation selectedInstanceRotation = (SplineSettings.Rotation)System.Enum.GetValues(typeof(SplineSettings.Rotation)).GetValue(instanceRotation.enumValueIndex);

            if (selectedInstanceRotation == SplineSettings.Rotation.Spline)
            {
                EditorGUILayout.PropertyField(controlPointRotation, new GUIContent("Control Point Rotation"));
            }

            EditorGUILayout.PropertyField(attachMode, new GUIContent("Attach Mode"));

            EditorGUILayout.PropertyField(reusePrefabs, new GUIContent("Reuse Prefabs", "If active, then already created prefabs will be reused. Otherwise new prefabs are created whenever something changes ont he spline."));
            EditorGUILayout.PropertyField(snap, new GUIContent("Snap", "Snap to the closest vertical object / terrain. Best used for initial alignment."));

            EditorGUILayout.PropertyField(debug, new GUIContent("Debug"));

            bool changed = EditorGUI.EndChangeCheck();

            if (changed)
            {
                // at least 1 lane must be active
                if (lanes.intValue <= 1)
                {
                    skipCenterLane.boolValue = false;
                }

                // avoid endless loop by limiting min distance between objects to a value above 0
                if (separationDistance.floatValue <= 0)
                {
                    separationDistance.floatValue = minDistanceBetweenObjectsd;
                }


                // allow control point rotation only in spline rotation mode
                if (selectedInstanceRotation != SplineSettings.Rotation.Spline)
                {
                    controlPointRotation.boolValue = false;
                }
            }

            dirty.boolValue |= changed;

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("New"))
            {
                ClearSpline(false);
            }

            if (GUILayout.Button("Clear"))
            {
                ClearSpline(true);
            }

            if (GUILayout.Button("Update"))
            {
                UpdatePrefabs();
            }

            if (GUILayout.Button("Snap All"))
            {
                SnapAll();
            }


            GUILayout.EndHorizontal();

            GUILayout.EndVertical();

            PerformEditorAction();
        }
Ejemplo n.º 3
0
 public override void OnInspectorGUI()
 {
     EditorGUILayout.LabelField("Please attach \"ScaleJitter\" insted of this.");
 }
Ejemplo n.º 4
0
    public override void OnInspectorGUI()
    {
        if (target != null)
        {
            serializedObject.Update();

            //Basic mission meta-data
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("ID");
            EditorGUILayout.SelectableLabel(serializedObject.targetObject.name);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("ID In-Game");
            EditorGUILayout.SelectableLabel(string.Format("mod_{0}_{1}", ModConfig.ID, serializedObject.targetObject.name));
            EditorGUILayout.EndHorizontal();

            SerializedProperty displayNameProperty = serializedObject.FindProperty("DisplayName");
            EditorGUILayout.PropertyField(displayNameProperty);
            displayNameProperty.stringValue = displayNameProperty.stringValue.Trim();
            EditorGUILayout.PropertyField(serializedObject.FindProperty("Description"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("PacingEventsEnabled"));

            SerializedProperty componentPools = serializedObject.FindProperty("GeneratorSetting.ComponentPools");

            if (factoryMode <= FactoryMode.FiniteSequenceGlobalTimeStrikes)
            {
                int newTotalBombCount = EditorGUILayout.IntField("Bomb Count", totalBombCount);
                setTotalBombCount(newTotalBombCount);
            }
            else
            {
                bool wasEnabled = GUI.enabled;
                GUI.enabled = false;
                EditorGUILayout.TextField("Bomb Count", "Infinite");
                GUI.enabled = wasEnabled;
            }

            FactoryMode newFactoryMode = (FactoryMode)EditorGUILayout.Popup("Factory Mode", (int)factoryMode, FactoryModeFriendlyNames);
            if (newFactoryMode != factoryMode)
            {
                if (newFactoryMode == FactoryMode.Static)
                {
                    if (factoryModeComponentPool != -1)
                    {
                        componentPools.DeleteArrayElementAtIndex(factoryModeComponentPool);
                        readCurrentMission();
                    }
                }
                else if (factoryModeComponentPool == -1)
                {
                    int index = addComponentPool(serializedObject.FindProperty("GeneratorSetting"));
                    SerializedProperty componentPool = componentPools.GetArrayElementAtIndex(index);
                    componentPool.FindPropertyRelative("Count").intValue     = (int)newFactoryMode;
                    componentPool.FindPropertyRelative("ModTypes").arraySize = 1;
                    componentPool.FindPropertyRelative("ModTypes").GetArrayElementAtIndex(0).stringValue = FACTORY_MODE_COMPONENT_POOL_ID;
                    factoryModeComponentPool = index;
                }
                else
                {
                    componentPools.GetArrayElementAtIndex(factoryModeComponentPool).FindPropertyRelative("Count").intValue = (int)newFactoryMode;
                }
                if (newFactoryMode >= FactoryMode.InfiniteSequence)
                {
                    setTotalBombCount(1);
                }
                factoryMode = newFactoryMode;
            }

            //Generator Settings
            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Generator Settings");

            List <string> unusedGeneratorSettings     = new List <string>();
            List <KeyValuePair <int, string> > tabMap = new List <KeyValuePair <int, string> >();
            tabMap.Add(new KeyValuePair <int, string>(0, "Bomb 0"));
            foreach (KeyValuePair <int, KeyValuePair <KMGeneratorSetting, int> > kv in multipleBombsGeneratorSettings)
            {
                if (kv.Key < totalBombCount || factoryMode >= FactoryMode.InfiniteSequence)
                {
                    tabMap.Add(new KeyValuePair <int, string>(kv.Key, "Bomb " + kv.Key));
                }
                else
                {
                    unusedGeneratorSettings.Add(kv.Key.ToString());
                }
            }
            tabMap.Sort((x, y) => x.Key.CompareTo(y.Key));

            if (unusedGeneratorSettings.Count > 0)
            {
                string unusedGeneratorSettingsWarningMessage = "The mission contains unused generator settings (for " + (unusedGeneratorSettings.Count > 1 ? "bombs " + string.Join(", ", unusedGeneratorSettings.ToArray()) : "bomb " + unusedGeneratorSettings[0]) + ").";
                EditorGUILayout.HelpBox(unusedGeneratorSettingsWarningMessage, MessageType.Warning);
            }

            EditorGUILayout.BeginVertical("box");
            int currentTab = activeGeneratorSetting != -1 ? tabMap.FindIndex((x) => x.Key == activeGeneratorSetting) : tabMap.Count;
            if (currentTab == -1)
            {
                activeGeneratorSetting = 0;
                currentTab             = 0;
            }
            List <string> tabs = new List <string>();
            tabs.Add(tabMap[0].Value);
            float minWidth = new GUIStyle("ButtonLeft").CalcSize(new GUIContent(tabMap[0].Value)).x;
            for (int i = 1; i < tabMap.Count; i++)
            {
                tabs.Add(tabMap[i].Value);
                float width = new GUIStyle("Button").CalcSize(new GUIContent(tabMap[i].Value)).x;
                if (width > minWidth)
                {
                    minWidth = width;
                }
            }
            tabs.Add("+");
            bool fits = Screen.width / tabs.Count > minWidth; //Screen.width is not an accurate measure of the available width but having the bar space always visible was too ugly
            if (!fits)
            {
                scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, GUILayout.Height(40));
            }
            int newTab = GUILayout.Toolbar(currentTab, tabs.ToArray());
            if (!fits)
            {
                EditorGUILayout.EndScrollView();
            }
            if (newTab != currentTab)
            {
                if (newTab == tabs.Count - 1)
                {
                    activeGeneratorSetting = -1;
                }
                else
                {
                    activeGeneratorSetting     = tabMap[newTab].Key;
                    activeComponentPool        = -1;
                    GUIUtility.keyboardControl = 0;
                }
            }

            if (activeGeneratorSetting == -1)
            {
                if (factoryMode <= FactoryMode.FiniteSequenceGlobalTimeStrikes)
                {
                    List <int> vaildBombs = new List <int>();
                    for (int i = 1; i < totalBombCount; i++)
                    {
                        if (!multipleBombsGeneratorSettings.ContainsKey(i))
                        {
                            vaildBombs.Add(i);
                        }
                    }
                    if (vaildBombs.Count == 0)
                    {
                        EditorGUILayout.HelpBox("All of the bombs have a Generator Setting.", MessageType.None);
                    }
                    else
                    {
                        if (!vaildBombs.Contains(currentAddGeneratorSettingIndex))
                        {
                            currentAddGeneratorSettingIndex = vaildBombs[0];
                        }
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField("Add Generator Setting for bomb");
                        currentAddGeneratorSettingIndex = vaildBombs[EditorGUILayout.Popup(vaildBombs.IndexOf(currentAddGeneratorSettingIndex), vaildBombs.Select((x) => x.ToString()).ToArray(), GUILayout.Width(60))];
                        EditorGUILayout.EndHorizontal();
                    }
                    bool wasEnabled = GUI.enabled;
                    GUI.enabled = vaildBombs.Count != 0;
                    if (GUILayout.Button("Add Generator Setting"))
                    {
                        addGeneratorSetting(currentAddGeneratorSettingIndex);
                    }
                    GUI.enabled = wasEnabled;
                }
                else
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Add Generator Setting for bomb");
                    currentAddGeneratorSettingIndex = EditorGUILayout.IntField(currentAddGeneratorSettingIndex, GUILayout.Width(60));
                    EditorGUILayout.EndHorizontal();
                    bool isVaildBomb = currentAddGeneratorSettingIndex != 0 && !multipleBombsGeneratorSettings.ContainsKey(currentAddGeneratorSettingIndex);
                    if (!isVaildBomb)
                    {
                        EditorGUILayout.HelpBox("Bomb " + currentAddGeneratorSettingIndex + " already has a Generator Setting.", MessageType.None);
                    }
                    bool wasEnabled = GUI.enabled;
                    GUI.enabled = isVaildBomb;
                    if (GUILayout.Button("Add Generator Setting"))
                    {
                        addGeneratorSetting(currentAddGeneratorSettingIndex);
                    }
                    GUI.enabled = wasEnabled;
                }
            }
            else if (activeGeneratorSetting == 0)
            {
                bool wasEnabled = GUI.enabled;
                GUI.enabled = false;
                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUILayout.Button("Delete");
                EditorGUILayout.EndHorizontal();
                GUI.enabled = wasEnabled;
                drawGeneratorSetting(serializedObject.FindProperty("GeneratorSetting"), true);
            }
            else
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                bool delete = GUILayout.Button("Delete");
                EditorGUILayout.EndHorizontal();
                if (delete)
                {
                    removeGeneratorSetting(activeGeneratorSetting);
                }
                else
                {
                    KeyValuePair <KMGeneratorSetting, int> activeKV = multipleBombsGeneratorSettings[activeGeneratorSetting];
                    KMMission dummyMission = CreateInstance <KMMission>();
                    dummyMission.GeneratorSetting = activeKV.Key;
                    SerializedObject dummyMissionObject = new SerializedObject(dummyMission);
                    drawGeneratorSetting(dummyMissionObject.FindProperty("GeneratorSetting"), false);
                    if (dummyMissionObject.ApplyModifiedProperties())
                    {
                        serializedObject.FindProperty("GeneratorSetting").FindPropertyRelative("ComponentPools").GetArrayElementAtIndex(activeKV.Value).FindPropertyRelative("ModTypes").GetArrayElementAtIndex(0).stringValue = "Multiple Bombs:" + activeGeneratorSetting + ":" + JsonConvert.SerializeObject(activeKV.Key);
                    }
                }
            }
            EditorGUILayout.EndVertical();
        }
        serializedObject.ApplyModifiedProperties();
    }
Ejemplo n.º 5
0
    /// Displays the parameters of the CoreBrainInternal in the Inspector
    public void OnInspector()
    {
#if ENABLE_TENSORFLOW && UNITY_EDITOR
        EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
        broadcast = EditorGUILayout.Toggle("Broadcast", broadcast);
        SerializedObject serializedBrain = new SerializedObject(this);
        GUILayout.Label("Edit the Tensorflow graph parameters here");
        SerializedProperty tfGraphModel = serializedBrain.FindProperty("graphModel");
        serializedBrain.Update();
        EditorGUILayout.ObjectField(tfGraphModel);
        serializedBrain.ApplyModifiedProperties();

        if (graphModel == null)
        {
            EditorGUILayout.HelpBox("Please provide a tensorflow graph as a bytes file.", MessageType.Error);
        }


        graphScope = EditorGUILayout.TextField("Graph Scope : ", graphScope);

        if (BatchSizePlaceholderName == "")
        {
            BatchSizePlaceholderName = "batch_size";
        }
        BatchSizePlaceholderName = EditorGUILayout.TextField("Batch Size Node Name", BatchSizePlaceholderName);
        if (StatePlacholderName == "")
        {
            StatePlacholderName = "state";
        }
        StatePlacholderName = EditorGUILayout.TextField("State Node Name", StatePlacholderName);
        if (RecurrentInPlaceholderName == "")
        {
            RecurrentInPlaceholderName = "recurrent_in";
        }
        RecurrentInPlaceholderName = EditorGUILayout.TextField("Recurrent Input Node Name", RecurrentInPlaceholderName);
        if (RecurrentOutPlaceholderName == "")
        {
            RecurrentOutPlaceholderName = "recurrent_out";
        }
        RecurrentOutPlaceholderName = EditorGUILayout.TextField("Recurrent Output Node Name", RecurrentOutPlaceholderName);

        if (brain.brainParameters.cameraResolutions != null)
        {
            if (brain.brainParameters.cameraResolutions.Count() > 0)
            {
                if (ObservationPlaceholderName == null)
                {
                    ObservationPlaceholderName = new string[brain.brainParameters.cameraResolutions.Count()];
                }
                if (ObservationPlaceholderName.Count() != brain.brainParameters.cameraResolutions.Count())
                {
                    ObservationPlaceholderName = new string[brain.brainParameters.cameraResolutions.Count()];
                }
                for (int obs_number = 0; obs_number < brain.brainParameters.cameraResolutions.Count(); obs_number++)
                {
                    if ((ObservationPlaceholderName[obs_number] == "") || (ObservationPlaceholderName[obs_number] == null))
                    {
                        ObservationPlaceholderName[obs_number] = "observation_" + obs_number;
                    }
                }
                SerializedProperty opn = serializedBrain.FindProperty("ObservationPlaceholderName");
                serializedBrain.Update();
                EditorGUILayout.PropertyField(opn, true);
                serializedBrain.ApplyModifiedProperties();
            }
        }

        if (ActionPlaceholderName == "")
        {
            ActionPlaceholderName = "action";
        }
        ActionPlaceholderName = EditorGUILayout.TextField("Action Node Name", ActionPlaceholderName);



        SerializedProperty tfPlaceholders = serializedBrain.FindProperty("graphPlaceholders");
        serializedBrain.Update();
        EditorGUILayout.PropertyField(tfPlaceholders, true);
        serializedBrain.ApplyModifiedProperties();
#endif
    }
Ejemplo n.º 6
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuSavesList)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            saveListType = (AC_SaveListType)CustomGUILayout.EnumPopup("List type:", saveListType, apiPrefix + ".savesListType", "How this list behaves");
            if (saveListType == AC_SaveListType.Save)
            {
                if (fixedOption || !allowEmptySlots)
                {
                    showNewSaveOption = CustomGUILayout.Toggle("Show 'New save' option?", showNewSaveOption, apiPrefix + ".showNewSaveOption", "If True, a slot that represents a 'new save' space can be displayed if appropriate");
                }

                if ((!fixedOption && allowEmptySlots) || showNewSaveOption)
                {
                    newSaveText = CustomGUILayout.TextField("'New save' text:", newSaveText, apiPrefix + ".newSaveText", "The display text when a slot represents a 'new save' space");
                }
                autoHandle = CustomGUILayout.Toggle("Save when click on?", autoHandle, apiPrefix + ".autoHandle");
                if (autoHandle)
                {
                    ActionListGUI("ActionList after saving:", menu.title, "AfterSaving", apiPrefix, "An ActionList asset that runs after the game is saved");
                }
                else
                {
                    ActionListGUI("ActionList when click:", menu.title, "OnClick", apiPrefix, "An ActionList asset that runs after the user clicks on a save file");
                }
            }
            else if (saveListType == AC_SaveListType.Load)
            {
                if (fixedOption || allowEmptySlots)
                {
                    emptySlotText = CustomGUILayout.TextField("'Empty slot' text:", emptySlotText, apiPrefix + ".emptySlotText", "The display text when a slot is empty");
                }

                autoHandle = CustomGUILayout.Toggle("Load when click on?", autoHandle, apiPrefix + ".autoHandle");
                if (autoHandle)
                {
                    ActionListGUI("ActionList after loading:", menu.title, "AfterLoading", apiPrefix, "An ActionList asset that runs after the game is loaded");
                }
                else
                {
                    ActionListGUI("ActionList when click:", menu.title, "OnClick", apiPrefix, "An ActionList asset that runs after the user clicks on a save file");
                }
            }
            else if (saveListType == AC_SaveListType.Import)
            {
                autoHandle = true;
                                #if UNITY_STANDALONE
                importProductName  = CustomGUILayout.TextField("Import product name:", importProductName, apiPrefix + ".importProductName", "The name of the project to import files from");
                importSaveFilename = CustomGUILayout.TextField("Import save filename:", importSaveFilename, apiPrefix + ".importSaveFilename", "The filename syntax of import files");
                ActionListGUI("ActionList after import:", menu.title, "After_Import", apiPrefix, "An ActionList asset that runs after a save file is imported");
                checkImportBool = CustomGUILayout.Toggle("Require Bool to be true?", checkImportBool, apiPrefix + ".checkImportBool", "If True, then a specific Boolean global variable must = True for an import file to be listed");
                if (checkImportBool)
                {
                    if (KickStarter.variablesManager != null)
                    {
                        ShowVarGUI(KickStarter.variablesManager.vars);
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("A Variables Manager is required.", MessageType.Warning);
                    }
                }
                                #else
                EditorGUILayout.HelpBox("This feature is only available for standalone platforms (PC, Mac, Linux)", MessageType.Warning);
                                #endif
            }

            displayType = (SaveDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType", "How save files are displayed");

            fixedOption = CustomGUILayout.Toggle("Fixed Save ID only?", fixedOption, apiPrefix + ".fixedOption", "If True, then only one save slot will be shown");
            if (fixedOption)
            {
                numSlots     = 1;
                slotSpacing  = 0f;
                optionToShow = CustomGUILayout.IntField("ID to display:", optionToShow, apiPrefix + ".optionToShow", "The index number of the save slot to show");

                if (saveListType == AC_SaveListType.Load)
                {
                    hideIfNotValid = CustomGUILayout.Toggle("Hide if no save file found?", hideIfNotValid, apiPrefix + ".hideIfNotValid", "If True, then the element will be hidden if the slot ID it represents is not filled with a valid save");
                }
            }
            else
            {
                maxSlots        = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots", "The maximum number of slots that can be displayed at once");
                allowEmptySlots = CustomGUILayout.Toggle("Allow empty slots?", allowEmptySlots, apiPrefix + ".allowEmptySlots", "If True, then all slots will be shown even if they are not already assigned a save file.");

                if (source == MenuSource.AdventureCreator)
                {
                    if (allowEmptySlots)
                    {
                        numSlots = maxSlots;
                    }
                    else
                    {
                        numSlots = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots");
                    }
                    slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 30f, apiPrefix + ".slotSpacing");
                    orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation");
                    if (orientation == ElementOrientation.Grid)
                    {
                        gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth");
                    }
                }
            }

            if (source != MenuSource.AdventureCreator)
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");
                uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle", "The method by which this element (or slots within it) are hidden from view when made invisible");
                EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel);

                if (fixedOption)
                {
                    uiSlots = ResizeUISlots(uiSlots, 1);
                }
                else
                {
                    uiSlots = ResizeUISlots(uiSlots, maxSlots);
                }

                for (int i = 0; i < uiSlots.Length; i++)
                {
                    uiSlots[i].LinkedUiGUI(i, source);
                }

                linkUIGraphic = (LinkUIGraphic)CustomGUILayout.EnumPopup("Link graphics to:", linkUIGraphic, "", "What Image component the element's graphics should be linked to");
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
        public override void OnInspectorGUI()
        {
            // GUI skin variable
            GUISkin customSkin;

            // Select GUI skin depending on the editor theme
            if (EditorGUIUtility.isProSkin == true)
            {
                customSkin = (GUISkin)Resources.Load("Editor\\Custom Skin Dark");
            }
            else
            {
                customSkin = (GUISkin)Resources.Load("Editor\\Custom Skin Light");
            }

            GUILayout.Space(-70);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            // Top Header
            GUILayout.Box(new GUIContent(""), customSkin.FindStyle("Button Top Header"));

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

            // Toolbar content
            GUIContent[] toolbarTabs = new GUIContent[3];
            toolbarTabs[0] = new GUIContent("Content");
            toolbarTabs[1] = new GUIContent("Resources");
            toolbarTabs[2] = new GUIContent("Settings");

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Space(60);

            currentTab = GUILayout.Toolbar(currentTab, toolbarTabs, customSkin.FindStyle("Toolbar Indicators"));

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Space(50);

            // Draw toolbar tabs as a button
            if (GUILayout.Button(new GUIContent("Content", "Content"), customSkin.FindStyle("Toolbar Items")))
            {
                currentTab = 0;
            }

            if (GUILayout.Button(new GUIContent("Resources", "Resources"), customSkin.FindStyle("Toolbar Resources")))
            {
                currentTab = 1;
            }

            if (GUILayout.Button(new GUIContent("Settings", "Settings"), customSkin.FindStyle("Toolbar Settings")))
            {
                currentTab = 2;
            }

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

            // Property variables
            var buttonText         = serializedObject.FindProperty("buttonText");
            var clickEvent         = serializedObject.FindProperty("clickEvent");
            var hoverEvent         = serializedObject.FindProperty("hoverEvent");
            var normalText         = serializedObject.FindProperty("normalText");
            var useCustomContent   = serializedObject.FindProperty("useCustomContent");
            var enableButtonSounds = serializedObject.FindProperty("enableButtonSounds");
            var useHoverSound      = serializedObject.FindProperty("useHoverSound");
            var useClickSound      = serializedObject.FindProperty("useClickSound");
            var soundSource        = serializedObject.FindProperty("soundSource");
            var hoverSound         = serializedObject.FindProperty("hoverSound");
            var clickSound         = serializedObject.FindProperty("clickSound");

            // Draw content depending on tab index
            switch (currentTab)
            {
            case 0:
                GUILayout.Space(20);
                GUILayout.Label("CONTENT", customSkin.FindStyle("Header"));
                GUILayout.Space(2);
                GUILayout.BeginHorizontal(EditorStyles.helpBox);

                EditorGUILayout.LabelField(new GUIContent("Button Text"), customSkin.FindStyle("Text"), GUILayout.Width(120));
                EditorGUILayout.PropertyField(buttonText, new GUIContent(""));

                GUILayout.EndHorizontal();

                if (useCustomContent.boolValue == false && buttonTarget.normalText != null)
                {
                    buttonTarget.normalText.text = buttonText.stringValue;
                }

                else if (useCustomContent.boolValue == false && buttonTarget.normalText == null)
                {
                    GUILayout.Space(2);
                    EditorGUILayout.HelpBox("'Text Object' is not assigned. Go to Resources tab and assign the correct variable.", MessageType.Error);
                }

                if (enableButtonSounds.boolValue == true && useHoverSound.boolValue == true)
                {
                    GUILayout.BeginHorizontal(EditorStyles.helpBox);

                    EditorGUILayout.LabelField(new GUIContent("Hover Sound"), customSkin.FindStyle("Text"), GUILayout.Width(120));
                    EditorGUILayout.PropertyField(hoverSound, new GUIContent(""));

                    GUILayout.EndHorizontal();
                }

                if (enableButtonSounds.boolValue == true && useClickSound.boolValue == true)
                {
                    GUILayout.BeginHorizontal(EditorStyles.helpBox);

                    EditorGUILayout.LabelField(new GUIContent("Click Sound"), customSkin.FindStyle("Text"), GUILayout.Width(120));
                    EditorGUILayout.PropertyField(clickSound, new GUIContent(""));

                    GUILayout.EndHorizontal();
                }

                GUILayout.Space(4);
                EditorGUILayout.PropertyField(clickEvent, new GUIContent("On Click Event"), true);
                EditorGUILayout.PropertyField(hoverEvent, new GUIContent("On Hover Event"), true);
                GUILayout.Space(4);
                break;

            case 1:
                GUILayout.Space(20);
                GUILayout.Label("RESOURCES", customSkin.FindStyle("Header"));
                GUILayout.Space(2);
                GUILayout.BeginHorizontal(EditorStyles.helpBox);

                EditorGUILayout.LabelField(new GUIContent("Text Object"), customSkin.FindStyle("Text"), GUILayout.Width(120));
                EditorGUILayout.PropertyField(normalText, new GUIContent(""));

                GUILayout.EndHorizontal();

                if (enableButtonSounds.boolValue == true)
                {
                    GUILayout.BeginHorizontal(EditorStyles.helpBox);

                    EditorGUILayout.LabelField(new GUIContent("Sound Source"), customSkin.FindStyle("Text"), GUILayout.Width(120));
                    EditorGUILayout.PropertyField(soundSource, new GUIContent(""));

                    GUILayout.EndHorizontal();
                }

                GUILayout.Space(4);
                break;

            case 2:
                GUILayout.Space(20);
                GUILayout.Label("SETTINGS", customSkin.FindStyle("Header"));
                GUILayout.Space(2);
                GUILayout.BeginHorizontal(EditorStyles.helpBox);

                useCustomContent.boolValue = GUILayout.Toggle(useCustomContent.boolValue, new GUIContent("Use Custom Content"), customSkin.FindStyle("Toggle"));
                useCustomContent.boolValue = GUILayout.Toggle(useCustomContent.boolValue, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));

                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(EditorStyles.helpBox);

                enableButtonSounds.boolValue = GUILayout.Toggle(enableButtonSounds.boolValue, new GUIContent("Enable Button Sounds"), customSkin.FindStyle("Toggle"));
                enableButtonSounds.boolValue = GUILayout.Toggle(enableButtonSounds.boolValue, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));

                GUILayout.EndHorizontal();

                if (enableButtonSounds.boolValue == true)
                {
                    GUILayout.BeginHorizontal(EditorStyles.helpBox);

                    useHoverSound.boolValue = GUILayout.Toggle(useHoverSound.boolValue, new GUIContent("Enable Hover Sound"), customSkin.FindStyle("Toggle"));
                    useHoverSound.boolValue = GUILayout.Toggle(useHoverSound.boolValue, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));

                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal(EditorStyles.helpBox);

                    useClickSound.boolValue = GUILayout.Toggle(useClickSound.boolValue, new GUIContent("Enable Click Sound"), customSkin.FindStyle("Toggle"));
                    useClickSound.boolValue = GUILayout.Toggle(useClickSound.boolValue, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));

                    GUILayout.EndHorizontal();

                    if (buttonTarget.soundSource == null)
                    {
                        EditorGUILayout.HelpBox("'Sound Source' is not assigned. Go to Resources tab or click the button to create a new audio source.", MessageType.Info);

                        if (GUILayout.Button("+ Create a new one", customSkin.button))
                        {
                            buttonTarget.soundSource = buttonTarget.gameObject.AddComponent(typeof(AudioSource)) as AudioSource;
                            currentTab = 2;
                        }
                    }
                }

                GUILayout.Space(4);
                break;
            }

            // Apply the changes
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 8
0
        private void OnGUI()
        {
            MethodOption.MonoMethodsFromJson();

            EditorGUILayout.LabelField(new GUIContent(header), EditorStyles.helpBox);

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical();
            currentTemplate.Name = EditorGUILayout.TextField("Name", currentTemplate.Name);
            if (!string.IsNullOrEmpty(warningBox))
            {
                EditorGUILayout.HelpBox(warningBox, MessageType.Error);
            }

            scriptType = (ScriptType)EditorGUILayout.EnumPopup("Script Type", scriptType);
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(SmallBox(this.position.width));
            if (GUILayout.Button("Create Script"))
            {
                if (currentTemplate.Validate(out warningBox))
                {
                    CreateScript();
                    AssetDatabase.Refresh();
                    if (closeOnConfirm)
                    {
                        this.Close();
                    }
                }
            }
            closeOnConfirm = EditorGUILayout.ToggleLeft("Close on Confirm?", closeOnConfirm);
            EditorGUILayout.EndVertical();



            EditorGUILayout.Space();

            // METHOD LISTING
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
            if (scriptType == ScriptType.MonoBehaviour || scriptType == ScriptType.ScriptableObject)
            {
                EditorGUILayout.LabelField("Methods", EditorStyles.boldLabel);
                methodFilter = EditorGUILayout.TextField("Search: ", methodFilter);
                System.Collections.Generic.IEnumerable <MethodOption> filteredOptions;
                if (string.IsNullOrEmpty(methodFilter))
                {
                    switch (scriptType)
                    {
                    case ScriptType.MonoBehaviour:
                        filteredOptions = monoMethods.Where(o => o.Name.ToUpper().Contains(methodFilter.ToUpper()));
                        break;

                    case ScriptType.ScriptableObject:
                        filteredOptions = scriptableMethods.Where(o => o.Name.ToUpper().Contains(methodFilter.ToUpper()));
                        break;

                    default:
                    case ScriptType.Normal:
                        filteredOptions = new System.Collections.Generic.List <MethodOption>();
                        break;
                    }
                }
                else
                {
                    switch (scriptType)
                    {
                    case ScriptType.MonoBehaviour:
                        filteredOptions = monoMethods;
                        break;

                    case ScriptType.ScriptableObject:
                        filteredOptions = scriptableMethods;
                        break;

                    default:
                    case ScriptType.Normal:
                        filteredOptions = new System.Collections.Generic.List <MethodOption>();
                        break;
                    }
                }
                filteredOptions = filteredOptions.OrderByDescending(o => o.Ranking);
                foreach (var option in filteredOptions)
                {
                    option.Include = EditorGUILayout.ToggleLeft(option.Name, option.Include);
                }
            }
            EditorGUILayout.EndScrollView();
        }
Ejemplo n.º 9
0
        private void ShowSidebar()
        {
            ResizeScrollView();

            if (def && showSide)
            {
                float padding = 20;
                EditorGUI.DrawRect(new Rect(position.width - _sidePanelWidth, 0, _sidePanelWidth, position.height), panelColor);
                GUILayout.BeginArea(new Rect(position.width - _sidePanelWidth + padding, padding, _sidePanelWidth - padding * 2, position.height - padding * 2));
                EditorGUILayout.BeginVertical();
                float w = EditorGUIUtility.labelWidth;
                EditorGUIUtility.labelWidth = 1;

                if (GUILayout.Button(dirty ? "Save *" : "Save"))
                {
                    AssetDatabase.SaveAssets();
                    dirty = false;
                    StateMachineClassGenerator.GenerateAbstractClass(def);
                }

                if (GUILayout.Button("New Impl Class..."))
                {
                    var path = EditorUtility.SaveFilePanelInProject("Save new class", def.name + "Impl.cs", "cs", "Enter a name for the new impl class");
                    if (path.Length > 0)
                    {
                        StateMachineClassGenerator.GenerateImplClass(def, path);
                    }
                }

                if (types == null)
                {
                    types = typeof(StateMachine).Assembly.GetTypes()
                            .Where(p => !p.IsGenericType && typeof(StateMachine).IsAssignableFrom(p))
                            .Select(t => t.FullName).ToArray();
                }

                int index = Array.IndexOf(types, def.baseClass);
                if (index < 0)
                {
                    index = Array.IndexOf(types, typeof(StateMachine).FullName);
                }
                int prev = index;

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Base Class");
                index = EditorGUILayout.Popup(index, types);

                if (prev != index)
                {
                    dirty = true;
                }

                EditorGUILayout.EndHorizontal();
                def.baseClass = types[index];

                if (editingState != null)
                {
                    EditorGUILayout.LabelField("State " + editingState.name);
                    EditorGUILayout.LabelField("State Events", EditorStyles.boldLabel);

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Enter: ");
                    bool enter = EditorGUILayout.Toggle(editingState.hasEnter);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("During: ");
                    bool during = EditorGUILayout.Toggle(editingState.hasDuring);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Exit: ");
                    bool exit = EditorGUILayout.Toggle(editingState.hasExit);
                    EditorGUILayout.EndHorizontal();


                    if (enter != editingState.hasEnter || during != editingState.hasDuring || exit != editingState.hasExit)
                    {
                        editingState.hasEnter  = enter;
                        editingState.hasDuring = during;
                        editingState.hasExit   = exit;

                        dirty = true;
                        EditorUtility.SetDirty(def);
                    }
                }
                else if (editingTransition.t1 != null)
                {
                    EditorGUILayout.LabelField("Transition From " + editingTransition.t1.name + " To " + editingTransition.t2.to);
                    EditorGUILayout.LabelField("Transition Events", EditorStyles.boldLabel);

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Notify: ");
                    bool notify = EditorGUILayout.Toggle("Notify: ", editingTransition.t2.hasNotify);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.LabelField("Conditions", EditorStyles.boldLabel);

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Exit Time: ");
                    float exitTime = EditorGUILayout.FloatField(editingTransition.t2.exitTime);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Mode: ");
                    var mode = (StateMachineDefinition.TransitionMode)EditorGUILayout.EnumPopup(editingTransition.t2.mode);
                    EditorGUILayout.EndHorizontal();

                    if (notify != editingTransition.t2.hasNotify || exitTime != editingTransition.t2.exitTime || mode != editingTransition.t2.mode)
                    {
                        editingTransition.t2.hasNotify = notify;
                        editingTransition.t2.exitTime  = exitTime;
                        editingTransition.t2.mode      = mode;

                        dirty = true;
                        EditorUtility.SetDirty(def);
                    }
                }

                EditorGUILayout.EndVertical();
                EditorGUIUtility.labelWidth = w;

                GUILayout.EndArea();
            }
        }
Ejemplo n.º 10
0
    public override void OnInspectorGUI()
    {
        MegaModifyObject mod = (MegaModifyObject)target;

        MegaModifiers.GlobalDisplay = EditorGUILayout.Toggle("GlobalDisplayGizmos", MegaModifiers.GlobalDisplay);
        mod.Enabled     = EditorGUILayout.Toggle("Enabled", mod.Enabled);
        mod.recalcnorms = EditorGUILayout.Toggle("Recalc Normals", mod.recalcnorms);
        MegaNormalMethod method = mod.NormalMethod;

        mod.NormalMethod    = (MegaNormalMethod)EditorGUILayout.EnumPopup("Normal Method", mod.NormalMethod);
        mod.recalcbounds    = EditorGUILayout.Toggle("Recalc Bounds", mod.recalcbounds);
        mod.recalcCollider  = EditorGUILayout.Toggle("Recalc Collider", mod.recalcCollider);
        mod.recalcTangents  = EditorGUILayout.Toggle("Recalc Tangents", mod.recalcTangents);
        mod.DoLateUpdate    = EditorGUILayout.Toggle("Do Late Update", mod.DoLateUpdate);
        mod.InvisibleUpdate = EditorGUILayout.Toggle("Invisible Update", mod.InvisibleUpdate);
        mod.GrabVerts       = EditorGUILayout.Toggle("Grab Verts", mod.GrabVerts);
        mod.DrawGizmos      = EditorGUILayout.Toggle("Draw Gizmos", mod.DrawGizmos);

        if (mod.NormalMethod != method && mod.NormalMethod == MegaNormalMethod.Mega)
        {
            mod.BuildNormalMapping(mod.mesh, false);
        }

        //showmulti = EditorGUILayout.Foldout(showmulti, "Multi Core");
#if !UNITY_FLASH && !UNITY_METRO && !UNITY_WP8
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Copy Object"))
        {
            GameObject obj = MegaCopyObject.DoCopyObjects(mod.gameObject);
            if (obj)
            {
                obj.transform.position = mod.gameObject.transform.position;

                Selection.activeGameObject = obj;
            }
        }

        if (GUILayout.Button("Copy Hierarchy"))
        {
            GameObject obj = MegaCopyObject.DoCopyObjectsChildren(mod.gameObject);
            Selection.activeGameObject = obj;
        }

        EditorGUILayout.EndHorizontal();
#endif
        if (GUILayout.Button("Threading Options"))
        {
            showmulti = !showmulti;
        }

        if (showmulti)
        {
            MegaModifiers.ThreadingOn = EditorGUILayout.Toggle("Threading Enabled", MegaModifiers.ThreadingOn);
            mod.UseThreading          = EditorGUILayout.Toggle("Thread This Object", mod.UseThreading);
        }

        EditorGUIUtility.LookLikeControls();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }

        showorder = EditorGUILayout.Foldout(showorder, "Modifier Order");

        if (showorder && mod.mods != null)
        {
            for (int i = 0; i < mod.mods.Length; i++)
            {
                EditorGUILayout.LabelField("", i.ToString() + " - " + mod.mods[i].ModName() + " " + mod.mods[i].Order + " MaxLOD: " + mod.mods[i].MaxLOD);
                if (mod.mods[i].Label != "")
                {
                    EditorGUILayout.LabelField("\t" + mod.mods[i].Label);
                }
            }
        }

        // Group stuff
        if (GUILayout.Button("Group Members"))
        {
            showgroups = !showgroups;
        }

        if (showgroups)
        {
            //if ( GUILayout.Button("Add Object") )
            //{
            //MegaModifierTarget targ = new MegaModifierTarget();
            //	mod.group.Add(targ);
            //}

            for (int i = 0; i < mod.group.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                mod.group[i] = (GameObject)EditorGUILayout.ObjectField("Obj " + i, mod.group[i], typeof(GameObject), true);
                if (GUILayout.Button("Del"))
                {
                    mod.group.Remove(mod.group[i]);
                    i--;
                }
                EditorGUILayout.EndHorizontal();
            }

            GameObject newobj = (GameObject)EditorGUILayout.ObjectField("Add", null, typeof(GameObject), true);
            if (newobj)
            {
                mod.group.Add(newobj);
            }

            if (GUILayout.Button("Update"))
            {
                // for each group member check if it has a modify object comp, if not add one and copy values over
                // calculate box for all meshes and set, and set the Offset for each one
                // then for each modifier attached find or add and set instance value
                // in theory each gizmo should overlap the others

                // Have a method to update box and offsets if we allow moving in the group
            }
        }

        //if ( GUILayout.Button("Create Copy") )
        //{
        //	CloneObject();
        //}
    }
Ejemplo n.º 11
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            //Dimensions
            GUILayout.Space(SECTION_SPACE);
            EditorGUILayout.LabelField("Dimensions", EditorStyles.boldLabel);
            //Thickness
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(thickness, new GUIContent("Thickness"));
            //Increment buttons, no longer used
//			if (GUILayout.Button ("-", EditorStyles.miniButtonLeft)) {
//				myUILine.thickness -= incrementThicknessAmount;
//			}
//			if (GUILayout.Button ("+", EditorStyles.miniButtonRight)) {
//				myUILine.thickness += incrementThicknessAmount;
//			}
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.PropertyField(stitchEdges, new GUIContent("Stitch Joints"));
            EditorGUILayout.PropertyField(fillPercent, new GUIContent("Fill Percent"));
            EditorGUILayout.PropertyField(fillSubdivisions, new GUIContent("Subdivisions"));
            //Smooth
            GUILayout.Space(SECTION_SPACE);
//		EditorGUILayout.LabelField ("Smooth", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(smoothLine, new GUIContent("Smooth Line"));
            if (smoothLine.boolValue)
            {
                EditorGUILayout.PropertyField(smoothSubdivisions, new GUIContent("Subdivisions"));
            }
            //dotted
            GUILayout.Space(SECTION_SPACE);
//		EditorGUILayout.LabelField ("Dotted", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(dottedLine, new GUIContent("Dotted Line"));
            if (dottedLine.boolValue)
            {
                EditorGUILayout.PropertyField(dottedLineSubdivisions, new GUIContent("Subdivisions"));
            }
            //Caps
            GUILayout.Space(SECTION_SPACE);
            EditorGUILayout.LabelField("Caps", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(startCap, new GUIContent("Start Cap"));
            if (startCap.boolValue)
            {
                EditorGUILayout.PropertyField(startCapWidth, new GUIContent("Start Cap Radius"));
                EditorGUILayout.PropertyField(startCapThickness, new GUIContent("Start Cap Thickness"));
                EditorGUILayout.PropertyField(startCapColor, new GUIContent("Start Cap Color"));;
                EditorGUILayout.PropertyField(startCapGlow, new GUIContent("Start Cap Glow"));
            }
            GUILayout.Space(SECTION_SPACE);
            EditorGUILayout.PropertyField(endCap, new GUIContent("End Cap"));
            if (endCap.boolValue)
            {
                EditorGUILayout.PropertyField(endCapWidth, new GUIContent("End Cap Radius"));
                EditorGUILayout.PropertyField(endCapThickness, new GUIContent("End Cap Thickness"));
                EditorGUILayout.PropertyField(endCapColor, new GUIContent("End Cap Color"));
                EditorGUILayout.PropertyField(endCapGlow, new GUIContent("End Cap Glow"));
            }
            //Appearance
            GUILayout.Space(SECTION_SPACE);
            EditorGUILayout.LabelField("Appearance", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(material, new GUIContent("Material"));
            EditorGUILayout.PropertyField(useGradient, new GUIContent("Use Gradient"));
            if (useGradient.boolValue)
            {
                EditorGUILayout.PropertyField(gradient, new GUIContent("Gradient"));
            }
            else
            {
                EditorGUILayout.PropertyField(m_Color, new GUIContent("Line Color"));
            }
            //Glow
            GUILayout.Space(SECTION_SPACE);
            EditorGUILayout.LabelField("Glow", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(shouldGlow, new GUIContent("Glow"));
            if (shouldGlow.boolValue)
            {
                EditorGUILayout.PropertyField(glowColor, new GUIContent("Glow Color"));
                EditorGUILayout.PropertyField(glowDistance, new GUIContent("Glow Thickness"));
            }

            //Dimensions
            GUILayout.Space(SECTION_SPACE);
            EditorGUILayout.LabelField("Nodes", EditorStyles.boldLabel);
            int nodesCount = myUILine.nodes.Count;

            //Add
            GUILayout.BeginHorizontal();
            GUILayout.Label("Add ", EditorStyles.label, GUILayout.ExpandWidth(false));
            amount = GUILayout.TextField(amount, EditorStyles.textField, GUILayout.Width(40));
            GUILayout.Label(" Nodes", EditorStyles.label, GUILayout.ExpandWidth(false));
            if (GUILayout.Button("Add", EditorStyles.miniButton))
            {
                if (int.TryParse(amount, out intAmount))
                {
                    for (int i = 0; i < intAmount; ++i)
                    {
//						Vector3 offset = Vector3.Scale (incrementAmount, myUILine.transform.lossyScale);
//						if (nodesCount != 0 && nodesCount != 1)
//							offset = Vector3.Scale (myUILine.transform.lossyScale,));
                        Vector3 offset;
                        if (myUILine.nodes.Count >= 2)
                        {
                            offset = incrementAmount.x * Vector3.Normalize(myUILine.nodes [nodesCount - 1] - myUILine.nodes [nodesCount - 2]);
                        }
                        else
                        {
                            offset = new Vector3(30f, 30f, 0);
                        }
                        Vector3 nodePosition = Vector3.zero;
                        if (nodesCount != 0)
                        {
                            nodePosition = ((Vector3)myUILine.nodes [nodesCount - 1]);
                        }
                        myUILine.nodes.Add(nodePosition + offset);

                        nodesCount = myUILine.nodes.Count;
                    }
                }
            }
            GUILayout.EndHorizontal();
            //node display:
            EditorGUI.indentLevel = 1;
            for (int i = 0; i < nodesCount; i++)
            {
                GUILayout.Label("Node " + (i + 1), EditorStyles.label);
                GUILayout.BeginHorizontal();
                myUILine.nodes [i] = EditorGUILayout.Vector2Field("", myUILine.nodes [i], GUILayout.Height(10));
                if (GUILayout.Button("X", EditorStyles.miniButtonRight))
                {
                    myUILine.nodes.RemoveAt(i);
                }
                GUILayout.EndHorizontal();
                nodesCount = myUILine.nodes.Count;
            }
            GUILayout.Space(SECTION_SPACE);
            EditorGUI.indentLevel = 0;

            serializedObject.ApplyModifiedProperties();
            if (GUI.changed)
            {
                EditorUtility.SetDirty(myUILine);
                myUILine.SetAllDirty_Public();
            }
        }
Ejemplo n.º 12
0
    private void _DisplayApiExample( )
    {
        string helpText =
            "TRYME! Try to drag game object from various places and Display prefab properties.\n" +
            "- From scene\n" +
            "- From asset folder\n" +
            "- From prefab editing stage\n" +
            "- Nested prefab, child of nested prefab, non-prefab\n" +
            "Output below.";

        EditorGUILayout.HelpBox(helpText, MessageType.Info);
        m_TestingPrefab = EditorGUILayout.ObjectField("Testing GameObject", m_TestingPrefab, typeof(GameObject), true);


        if (m_TestingPrefab == null)
        {
            m_CurrentDisplayingPrefab = null;
        }

        if (m_TestingPrefab != m_CurrentDisplayingPrefab)
        {
            m_CurrentDisplayingPrefab = m_TestingPrefab;
            m_CurrentProperties       = PrefabHelper.GetPrefabProperties(m_TestingPrefab as GameObject);
        }

        // Display output
        var    prop   = m_CurrentProperties;
        string report = "";

        if (prop.isPartOfPrefabStage)
        {
            report += "Is ";
            if (prop.isPrefabStageRoot)
            {
                report += "root of ";
            }
            else
            {
                report += "child of ";
            }
            report += "prefabStage";
            report += "\n";
        }

        if (prop.isPartOfPrefabAsset)
        {
            report += "Is ";
            if (prop.isPrefabAssetRoot)
            {
                report += "root of ";
            }
            else
            {
                report += "child of ";
            }
            report += "prefabAsset";
            report += "\n";
        }

        if (prop.isPartOfPrefabInstance)
        {
            report += "Is ";
            if (prop.isPrefabInstanceRoot)
            {
                report += "root of ";
            }
            else
            {
                report += "child of ";
            }
            report += "prefabInstance";
            report += "\n";
        }
#if false
        if (prop.isVariant)
        {
            report += "variant";
            report += " ";
        }
#endif
        if (prop.isSceneObject)
        {
            report += "Is sceneObject";
            report += "\n";
        }

        report += "nearest AssetPath: " + prop.prefabAssetPath;
        report += "\n";

        if (prop.prefabAssetRoot != null)
        {
            report += "Prefab asset root is: " + prop.prefabAssetRoot.name;
            report += "\n";
        }

        EditorGUILayout.HelpBox(report, MessageType.None);

        if (prop.nearestInstanceRoot != null)
        {
            GUI.enabled = false;
            EditorGUILayout.LabelField("Resolved nearest instance root");
            EditorGUI.indentLevel += 1;
            EditorGUILayout.ObjectField(prop.nearestInstanceRoot, typeof(GameObject), true);
            EditorGUI.indentLevel -= 1;
            GUI.enabled            = true;
        }


        if (prop.prefabAssetRoot != null)
        {
            GUI.enabled = false;
            EditorGUILayout.LabelField("Resolved prefab asset root");
            EditorGUI.indentLevel += 1;
            EditorGUILayout.ObjectField(prop.prefabAssetRoot, typeof(GameObject), false);
            EditorGUI.indentLevel -= 1;
            GUI.enabled            = true;
        }
    }
Ejemplo n.º 13
0
        static void Drawer_PhysicalCamera(SerializedHDCamera p, Editor owner)
        {
            var cam = p.baseCameraSettings;

            EditorGUILayout.LabelField("Camera Body", EditorStyles.boldLabel);

            using (new EditorGUI.IndentLevelScope())
            {
                EditorGUI.BeginChangeCheck();

                int oldFilmGateIndex = Array.IndexOf(k_ApertureFormatValues, new Vector2((float)Math.Round(cam.sensorSize.vector2Value.x, 3), (float)Math.Round(cam.sensorSize.vector2Value.y, 3)));

                // If it is not one of the preset sizes, set it to custom
                oldFilmGateIndex = (oldFilmGateIndex == -1) ? k_CustomPresetIndex: oldFilmGateIndex;

                // Get the new user selection
                int newFilmGateIndex = EditorGUILayout.Popup(cameraTypeContent, oldFilmGateIndex, k_ApertureFormatNames);

                if (EditorGUI.EndChangeCheck())
                {
                    // Retrieve the previous custom size value, if one exists for this camera
                    object previousCustomValue;
                    s_PerCameraSensorSizeHistory.TryGetValue((Camera)p.serializedObject.targetObject, out previousCustomValue);

                    // When switching from custom to a preset, update the last custom value (to display again, in case the user switches back to custom)
                    if (oldFilmGateIndex == k_CustomPresetIndex)
                    {
                        if (previousCustomValue == null)
                        {
                            s_PerCameraSensorSizeHistory.Add((Camera)p.serializedObject.targetObject, cam.sensorSize.vector2Value);
                        }
                        else
                        {
                            previousCustomValue = cam.sensorSize.vector2Value;
                        }
                    }

                    if (newFilmGateIndex < k_CustomPresetIndex)
                    {
                        cam.sensorSize.vector2Value = k_ApertureFormatValues[newFilmGateIndex];
                    }
                    else
                    {
                        // The user switched back to custom, so display by deafulr the previous custom value
                        if (previousCustomValue != null)
                        {
                            cam.sensorSize.vector2Value = (Vector2)previousCustomValue;
                        }
                        else
                        {
                            cam.sensorSize.vector2Value = new Vector2(36.0f, 24.0f); // this is the value new cameras are created with
                        }
                    }
                }

                EditorGUILayout.PropertyField(cam.sensorSize, sensorSizeContent);
                EditorGUILayout.PropertyField(p.iso, isoContent);

                // Custom layout for shutter speed
                const int k_UnitMenuWidth       = 80;
                const int k_OffsetPerIndent     = 15;
                const int k_LabelFieldSeparator = 2;
                const int k_Offset       = 1;
                int       oldIndentLevel = EditorGUI.indentLevel;

                // Don't take into account the indentLevel when rendering the units field
                EditorGUI.indentLevel = 0;

                var lineRect  = EditorGUILayout.GetControlRect();
                var fieldRect = new Rect(k_OffsetPerIndent + k_LabelFieldSeparator + k_Offset, lineRect.y, lineRect.width - k_UnitMenuWidth, lineRect.height);
                var unitMenu  = new Rect(fieldRect.xMax + k_LabelFieldSeparator, lineRect.y, k_UnitMenuWidth - k_LabelFieldSeparator, lineRect.height);

                // We cannot had the shutterSpeedState as this is not a serialized property but a global edition mode.
                // This imply that it will never go bold nor can be reverted in prefab overrides

                m_ShutterSpeedState.value = (ShutterSpeedUnit)EditorGUI.Popup(unitMenu, (int)m_ShutterSpeedState.value, k_ShutterSpeedUnitNames);
                // Reset the indent level
                EditorGUI.indentLevel = oldIndentLevel;

                EditorGUI.BeginProperty(fieldRect, shutterSpeedContent, p.shutterSpeed);
                {
                    // if we we use (1 / second) units, then change the value for the display and then revert it back
                    if (m_ShutterSpeedState.value == ShutterSpeedUnit.OneOverSecond && p.shutterSpeed.floatValue > 0)
                    {
                        p.shutterSpeed.floatValue = 1.0f / p.shutterSpeed.floatValue;
                    }
                    EditorGUI.PropertyField(fieldRect, p.shutterSpeed, shutterSpeedContent);
                    if (m_ShutterSpeedState.value == ShutterSpeedUnit.OneOverSecond && p.shutterSpeed.floatValue > 0)
                    {
                        p.shutterSpeed.floatValue = 1.0f / p.shutterSpeed.floatValue;
                    }
                }
                EditorGUI.EndProperty();

                using (var horizontal = new EditorGUILayout.HorizontalScope())
                    using (var propertyScope = new EditorGUI.PropertyScope(horizontal.rect, gateFitContent, cam.gateFit))
                        using (var checkScope = new EditorGUI.ChangeCheckScope())
                        {
                            int gateValue = (int)(Camera.GateFitMode)EditorGUILayout.EnumPopup(propertyScope.content, (Camera.GateFitMode)cam.gateFit.intValue);
                            if (checkScope.changed)
                            {
                                cam.gateFit.intValue = gateValue;
                            }
                        }
            }

            EditorGUILayout.LabelField("Lens", EditorStyles.boldLabel);

            using (new EditorGUI.IndentLevelScope())
            {
                using (var horizontal = new EditorGUILayout.HorizontalScope())
                    using (new EditorGUI.PropertyScope(horizontal.rect, focalLengthContent, cam.focalLength))
                        using (var checkScope = new EditorGUI.ChangeCheckScope())
                        {
                            bool isPhysical = p.projectionMatrixMode.intValue == (int)ProjectionMatrixMode.PhysicalPropertiesBased;
                            // We need to update the focal length if the camera is physical and the FoV has changed.
                            bool focalLengthIsDirty = (s_FovChanged && isPhysical);

                            float sensorLength   = cam.fovAxisMode.intValue == 0 ? cam.sensorSize.vector2Value.y : cam.sensorSize.vector2Value.x;
                            float focalLengthVal = focalLengthIsDirty ? Camera.FieldOfViewToFocalLength(s_FovLastValue, sensorLength) : cam.focalLength.floatValue;
                            focalLengthVal = EditorGUILayout.FloatField(focalLengthContent, focalLengthVal);
                            if (checkScope.changed || focalLengthIsDirty)
                            {
                                cam.focalLength.floatValue = focalLengthVal;
                            }
                        }

                // Custom layout for aperture
                var rect = EditorGUILayout.BeginHorizontal();
                {
                    // Magic values/offsets to get the UI look consistent
                    const float textRectSize         = 80;
                    const float textRectPaddingRight = 62;
                    const float unitRectPaddingRight = 97;
                    const float sliderPaddingLeft    = 2;
                    const float sliderPaddingRight   = 77;

                    var labelRect = rect;
                    labelRect.width  = EditorGUIUtility.labelWidth;
                    labelRect.height = EditorGUIUtility.singleLineHeight;
                    EditorGUI.LabelField(labelRect, apertureContent);

                    GUI.SetNextControlName("ApertureSlider");
                    var sliderRect = rect;
                    sliderRect.x    += labelRect.width + sliderPaddingLeft;
                    sliderRect.width = rect.width - labelRect.width - sliderPaddingRight;
                    float newVal = GUI.HorizontalSlider(sliderRect, p.aperture.floatValue, HDPhysicalCamera.kMinAperture, HDPhysicalCamera.kMaxAperture);

                    // keep only 2 digits of precision, like the otehr editor fields
                    newVal = Mathf.Floor(100 * newVal) / 100.0f;

                    if (p.aperture.floatValue != newVal)
                    {
                        p.aperture.floatValue = newVal;
                        // Note: We need to move the focus when the slider changes, otherwise the textField will not update
                        GUI.FocusControl("ApertureSlider");
                    }

                    var unitRect = rect;
                    unitRect.x     += rect.width - unitRectPaddingRight;
                    unitRect.width  = textRectSize;
                    unitRect.height = EditorGUIUtility.singleLineHeight;
                    EditorGUI.LabelField(unitRect, "f /", EditorStyles.label);

                    var textRect = rect;
                    textRect.x      = rect.width - textRectPaddingRight;
                    textRect.width  = textRectSize;
                    textRect.height = EditorGUIUtility.singleLineHeight;
                    string newAperture = EditorGUI.TextField(textRect, p.aperture.floatValue.ToString());
                    try
                    {
                        p.aperture.floatValue = Mathf.Clamp(float.Parse(newAperture), HDPhysicalCamera.kMinAperture, HDPhysicalCamera.kMaxAperture);
                    }
                    catch
                    { }
                }

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space(EditorGUIUtility.singleLineHeight);
                EditorGUILayout.PropertyField(cam.lensShift, lensShiftContent);
            }

            EditorGUILayout.LabelField("Aperture Shape", EditorStyles.boldLabel);

            using (new EditorGUI.IndentLevelScope())
            {
                EditorGUILayout.PropertyField(p.bladeCount, bladeCountContent);

                using (var horizontal = new EditorGUILayout.HorizontalScope())
                    using (var propertyScope = new EditorGUI.PropertyScope(horizontal.rect, curvatureContent, p.curvature))
                    {
                        var v = p.curvature.vector2Value;

                        // The layout system breaks alignment when mixing inspector fields with custom layout'd
                        // fields as soon as a scrollbar is needed in the inspector, so we'll do the layout
                        // manually instead
                        const int kFloatFieldWidth = 50;
                        const int kSeparatorWidth  = 5;
                        float     indentOffset     = EditorGUI.indentLevel * 15f;
                        var       lineRect         = EditorGUILayout.GetControlRect();
                        var       labelRect        = new Rect(lineRect.x, lineRect.y, EditorGUIUtility.labelWidth - indentOffset, lineRect.height);
                        var       floatFieldLeft   = new Rect(labelRect.xMax, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height);
                        var       sliderRect       = new Rect(floatFieldLeft.xMax + kSeparatorWidth - indentOffset, lineRect.y, lineRect.width - labelRect.width - kFloatFieldWidth * 2 - kSeparatorWidth * 2, lineRect.height);
                        var       floatFieldRight  = new Rect(sliderRect.xMax + kSeparatorWidth - indentOffset, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height);

                        EditorGUI.PrefixLabel(labelRect, propertyScope.content);
                        v.x = EditorGUI.FloatField(floatFieldLeft, v.x);
                        EditorGUI.MinMaxSlider(sliderRect, ref v.x, ref v.y, HDPhysicalCamera.kMinAperture, HDPhysicalCamera.kMaxAperture);
                        v.y = EditorGUI.FloatField(floatFieldRight, v.y);

                        p.curvature.vector2Value = v;
                    }

                EditorGUILayout.PropertyField(p.barrelClipping, barrelClippingContent);
                EditorGUILayout.PropertyField(p.anamorphism, anamorphismContent);
            }
        }
Ejemplo n.º 14
0
 protected void DrawEmptyTRS()
 {
     EditorGUILayout.LabelField("", GUILayout.MaxWidth(AXIS_LAB_WID));
     EditorGUILayout.LabelField("", GUILayout.MaxWidth(AXIS_LAB_WID));
     EditorGUILayout.LabelField("", GUILayout.MaxWidth(AXIS_LAB_WID));
 }
Ejemplo n.º 15
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            if (ac_.activeAnimation != ac_.animationLastLoaded_)
            {
                previewInEditor_ = false;
                ac_.CloseAnimation();
            }

            DrawDefaultInspector();
            CRGUIUtils.Splitter();

            /*
             * EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
             * EditorGUI.BeginChangeCheck();
             * previewInEditor_ = EditorGUILayout.Toggle("Preview", previewInEditor_);
             * if ( EditorGUI.EndChangeCheck() )
             * {
             * AnimationPreview( previewInEditor_ );
             * }
             * EditorGUI.EndDisabledGroup();
             */


            bool isPlayingOrPreviewInEditor = EditorApplication.isPlayingOrWillChangePlaymode || previewInEditor_;

            EditorGUI.BeginDisabledGroup(!isPlayingOrPreviewInEditor);
            EditorGUI.BeginChangeCheck();

            editorFrame_ = Mathf.Clamp(ac_.lastReadFrame_, 0, ac_.lastFrame_);
            editorFrame_ = EditorGUILayout.Slider(new GUIContent("Frame"), editorFrame_, ac_.firstFrame_, ac_.lastFrame_);
            if (EditorGUI.EndChangeCheck() && isPlayingOrPreviewInEditor)
            {
                ac_.SetFrame(editorFrame_);
                SceneView.RepaintAll();
            }

            EditorGUI.EndDisabledGroup();
            EditorGUILayout.LabelField(new GUIContent("Time"), new GUIContent(ac_.time_.ToString("F3")));
            EditorGUILayout.LabelField(new GUIContent("Frame Count"), new GUIContent(ac_.frameCount_.ToString()));
            EditorGUILayout.LabelField(new GUIContent("FPS"), new GUIContent(ac_.fps_.ToString()));
            EditorGUILayout.LabelField(new GUIContent("Animation Length"), new GUIContent(ac_.animationLength_.ToString()));
            CRGUIUtils.Splitter();

            EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);

            CRGUIUtils.Splitter();
            if (GUILayout.Button(new GUIContent("Record screenshots in play mode")))
            {
                MakeCameraScreenshots();
            }

            if (GUILayout.Button(new GUIContent("Remove camera recorder component")))
            {
                RemoveCameraRecorder();
            }

            EditorGUI.EndDisabledGroup();

            Repaint();
        }
Ejemplo n.º 16
0
    public void OnGUI()
    {
        if (levelsDatabase == null)
        {
            EditorGUILayout.HelpBox("Levels Database can't be found.", MessageType.Error, true);

            if (GUILayout.Button("Create Levels Database"))
            {
                levelsDatabase = EditorUtils.CreateAsset <LevelsDatabase>(LEVELS_DATABASE_PATH + "Levels Database", true);

                OnEnable();
            }

            return;
        }


        int arrayList = levelsSerializedProperty.arraySize;

        if (arrayList == 0)
        {
            EditorGUILayout.BeginVertical(GUI.skin.box);
            EditorGUILayout.HelpBox("Levels Database is empty.", MessageType.Warning, true);
            EditorGUILayout.EndHorizontal();

            if (GUILayout.Button("Add Level"))
            {
                AddNewLevel();

                return;
            }

            return;
        }


        EditorGUILayout.BeginVertical(GUI.skin.box, GUILayout.Height(264));
        int paginationEnd = pagination.GetMaxElementNumber();

        for (int i = pagination.GetMinElementNumber(); i < paginationEnd; i++)
        {
            int  index           = i;
            bool isLevelSelected = selectedLevelID == i;

            if (isLevelSelected)
            {
                GUI.color = selectedColor;
            }

            Rect clickRect = (Rect)EditorGUILayout.BeginHorizontal(GUI.skin.box);

            EditorGUILayout.LabelField(levelsDatabase.Levels[i].EditorName + "   |   Items: " + (levelsDatabase.Levels[i].Items != null ? levelsDatabase.Levels[i].Items.Length : 0));

            GUILayout.FlexibleSpace();

            GUI.color = Color.grey;
            if (GUILayout.Button("=", EditorStyles.miniButton, GUILayout.Width(16), GUILayout.Height(16)))
            {
                GenericMenu menu = new GenericMenu();

                if (isLevelSelected)
                {
                    menu.AddItem(new GUIContent("Unselect"), false, delegate
                    {
                        Unselect();
                    });
                }
                else
                {
                    menu.AddItem(new GUIContent("Select"), false, delegate
                    {
                        Select(index);
                    });
                }

                menu.AddItem(new GUIContent("Remove"), false, delegate
                {
                    if (EditorUtility.DisplayDialog("Are you sure?", "This level will be removed!", "Remove", "Cancel"))
                    {
                        if (isLevelSelected)
                        {
                            Unselect();
                        }

                        levelsSerializedProperty.DeleteArrayElementAtIndex(index);

                        pagination.Init(levelsSerializedProperty.arraySize);

                        return;
                    }
                });

                menu.AddSeparator("");

                if (i > 0)
                {
                    menu.AddItem(new GUIContent("Move up"), false, delegate
                    {
                        levelsSerializedProperty.MoveArrayElement(index, index - 1);

                        if (isLevelSelected)
                        {
                            selectedLevelID -= 1;
                        }
                        else if (selectedLevelID == index - 1)
                        {
                            selectedLevelID = index;
                        }
                    });
                }
                else
                {
                    menu.AddDisabledItem(new GUIContent("Move up"));
                }

                if (i + 1 < arrayList)
                {
                    menu.AddItem(new GUIContent("Move down"), false, delegate
                    {
                        levelsSerializedProperty.MoveArrayElement(index, index + 1);

                        if (isLevelSelected)
                        {
                            selectedLevelID += 1;
                        }
                        else if (selectedLevelID == index + 1)
                        {
                            selectedLevelID = index;
                        }
                    });
                }
                else
                {
                    menu.AddDisabledItem(new GUIContent("Move down"));
                }

                menu.ShowAsContext();
            }

            GUI.color = Color.white;

            GUILayout.Space(5);

            if (GUI.Button(clickRect, GUIContent.none, GUIStyle.none))
            {
                if (isLevelSelected)
                {
                    Unselect();
                }
                else
                {
                    Select(i);
                }

                return;
            }

            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndHorizontal();

        pagination.DrawPagination();

        EditorGUILayout.Space();
        if (levelsDatabase == null)
        {
            EditorGUILayout.HelpBox("Level Database is not found.", MessageType.Error, true);

            if (GUILayout.Button("Create Levels Database"))
            {
                levelsDatabase = EditorUtils.GetAsset <LevelsDatabase>();

                return;
            }
        }
        else
        {
            UnityEngine.SceneManagement.Scene currentScene = EditorSceneManager.GetActiveScene();

            if (selectedLevelID != -1)
            {
                bool rightSceneSelected = currentScene.name == "LevelEditor";

                EditorGUILayout.PropertyField(levelNameProperty);

                GUILayout.Space(5);

                if (!rightSceneSelected)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.HelpBox("LevelEditor scene is required for editing.", MessageType.Warning);
                    if (GUILayout.Button("Open", GUILayout.Height(40f)))
                    {
                        EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();
                        EditorSceneManager.OpenScene(SCENES_PATH + "LevelEditor.unity");

                        LoadObjects();

                        cameraTransform = Camera.main.transform;

                        cameraTransform.position = CameraController.STAGE_ONE_CAM_POS_EDITOR;
                        currentStageIsFirst      = true;
                    }
                    EditorGUILayout.EndHorizontal();

                    GUI.enabled = false;
                }

                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Objects management:", lableStyle);

                EditorGUILayout.BeginHorizontal();

                if (levelsDatabase.Levels[selectedLevelID].Items != null && levelsDatabase.Levels[selectedLevelID].Items.Length == 0)
                {
                    GUI.enabled = false;
                }

                GUI.color = redColor;
                if (GUILayout.Button("Clear Objects", GUILayout.MinWidth(80f), GUILayout.MaxWidth(90f), GUILayout.Height(30f)))
                {
                    if (EditorUtility.DisplayDialog("Are you sure?", "Level parts will be removed!", "Remove", "Cancel"))
                    {
                        ClearObjects();
                    }
                }
                GUI.color = defaultGUIColor;

                GUILayout.FlexibleSpace();



                if (GUILayout.Button("Load Objects", GUILayout.MinWidth(90f), GUILayout.MaxWidth(150f), GUILayout.Height(30f)))
                {
                    LoadObjects();
                }

                GUI.enabled = true;


                if (GUILayout.Button("Save Objects", GUILayout.MinWidth(90f), GUILayout.MaxWidth(150f), GUILayout.Height(30f)))
                {
                    SaveObjects();
                }

                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Camera:", lableStyle);

                EditorGUILayout.BeginHorizontal();


                if (currentStageIsFirst)
                {
                    GUI.color = selectedColor;
                }

                if (GUILayout.Button("Stage One Position", GUILayout.MinWidth(90f), GUILayout.MaxWidth(150f), GUILayout.Height(30f)))
                {
                    cameraTransform.position = CameraController.STAGE_ONE_CAM_POS_EDITOR;
                    currentStageIsFirst      = true;
                }

                GUI.color = defaultGUIColor;

                if (!currentStageIsFirst)
                {
                    GUI.color = selectedColor;
                }

                if (GUILayout.Button("Stage Two Position", GUILayout.MinWidth(90f), GUILayout.MaxWidth(150f), GUILayout.Height(30f)))
                {
                    cameraTransform.position = CameraController.STAGE_TWO_CAM_POS_EDITOR;
                    currentStageIsFirst      = false;
                }

                GUI.color = defaultGUIColor;

                EditorGUILayout.EndHorizontal();

                if (!rightSceneSelected)
                {
                    GUI.enabled = true;
                }
            }
            else
            {
                if (GUILayout.Button("Add Level", GUILayout.Height(40f)))
                {
                    AddNewLevel();

                    return;
                }
            }
        }

        levelDatabaseSerializedObject.ApplyModifiedProperties();
    }
Ejemplo n.º 17
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        Color c = GUI.backgroundColor;         // store value

        GUI.backgroundColor = Color.cyan;
        EditorGUILayout.HelpBox("Auto play. Start initialization whe the object is acivated.", MessageType.Info);
        GUI.backgroundColor = c;

        EditorGUILayout.Space();

        myScript._autoplay = EditorGUILayout.Toggle("Play at Start: ", myScript._autoplay);

        EditorGUILayout.Space();
        EditorGUILayout.Space();

        GUI.backgroundColor = Color.cyan;
        EditorGUILayout.HelpBox("Don't destroy this gameObject!", MessageType.Info);
        GUI.backgroundColor = c;

        EditorGUILayout.Space();

        myScript._dontDestroy = EditorGUILayout.Toggle("Don't Destroy: ", myScript._dontDestroy);

        EditorGUILayout.Space();
        EditorGUILayout.Space();

        GUI.backgroundColor = Color.cyan;
        EditorGUILayout.HelpBox("Key list for load and unload a database. Default is kEverytime.", MessageType.Info);
        GUI.backgroundColor = c;

        EditorGUILayout.Space();

        // DrawDefaultInspector();
        for (int i = 1; i < myScript._keys.Count; ++i)
        {
            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.TextArea(myScript._keys[i], GUILayout.MaxWidth(150));
            GUI.backgroundColor = Color.red;
            if (GUILayout.Button("-", GUILayout.MaxWidth(30)))
            {
                myScript._keys.RemoveAt(i);
                return;
            }
            GUI.backgroundColor = c;
            EditorGUILayout.EndHorizontal();
        }

        GUI.backgroundColor = Color.green;
        if (GUILayout.Button("Add Key"))
        {
            myScript._keys.Add("");
        }
        GUI.backgroundColor = c;

        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();

        GUI.backgroundColor = Color.cyan;
        EditorGUILayout.HelpBox("Database list:", MessageType.Info);
        GUI.backgroundColor = c;

        for (int i = 0; i < myScript.transform.childCount; ++i)
        {
            Transform t = myScript.transform.GetChild(i);

            Util_PoolManagerDatabase o = t.GetComponent <Util_PoolManagerDatabase>();
            if (o != null)
            {
                EditorGUILayout.Space();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(t.name, GUILayout.MaxWidth(150));
                GUI.backgroundColor = Color.red;
                if (GUILayout.Button("-", GUILayout.MaxWidth(30)))
                {
                    DestroyImmediate(t.gameObject);
                    myScript._database.RemoveAt(i);
                    return;
                }

                GUI.backgroundColor = c;
                if (GUILayout.Button(">", GUILayout.MaxWidth(30)))
                {
                    Selection.activeGameObject = t.gameObject;
                }
                EditorGUILayout.EndHorizontal();
            }
        }

        EditorGUILayout.Space();


        GUI.backgroundColor = Color.green;
        if (GUILayout.Button("Add Database"))
        {
            AddDatabase();
        }
        GUI.backgroundColor = c;

        Util_PoolLoading.Instance = myScript;

        serializedObject.ApplyModifiedProperties();
    }
Ejemplo n.º 18
0
    void OnGUI()
    {
        EditorGUILayout.Space();
        EditorGUILayout.Space();

        EditorGUILayout.LabelField("PDT Random Item Spawner 1.0", largecenter);

        EditorGUILayout.Space();
        EditorGUILayout.Space();



        //
        //if(GUILayout.Button("Force Load"))
        //{
        //    gen.customItems = CustomItemManager.initializeListPrefab(CustomItemManager.loadItemList(CustomItemManager.getItemListPath()));
        //}

        if (GUILayout.Button("Add Custom Item Slot"))
        {
            try
            {
                //First try directly editing a correctly loaded list

                CustomItem[] temp = new CustomItem[CustomItemManager.items.Length + 1];
                CustomItem   newi = new CustomItem();
                newi.generationChance = 0.5f;
                newi.type             = "New Item";

                for (int i = 0; i < temp.Length; i++)
                {
                    if (i < CustomItemManager.items.Length)
                    {
                        temp[i] = CustomItemManager.items[i];
                    }
                    else
                    {
                        temp[i] = newi;
                    }
                }

                CustomItemManager.items = temp;
            }
            catch
            {
                //Then try loading list to see if it exists

                try
                {
                    CustomItemManager.items = CustomItemManager.initializeListPrefab(CustomItemManager.loadItemList(CustomItemManager.getItemListPath()));

                    CustomItem[] temp = new CustomItem[CustomItemManager.items.Length + 1];
                    CustomItem   newi = new CustomItem();
                    newi.generationChance = 0.5f;
                    newi.type             = "New Item";

                    for (int i = 0; i < temp.Length; i++)
                    {
                        if (i < CustomItemManager.items.Length)
                        {
                            temp[i] = CustomItemManager.items[i];
                        }
                        else
                        {
                            temp[i] = newi;
                        }
                    }

                    CustomItemManager.items = temp;
                }
                catch
                {
                    //Finally create and save an entirely new list if all fails

                    CustomItem[] temp = new CustomItem[1];
                    CustomItem   newi = new CustomItem();
                    newi.generationChance = 0.5f;
                    newi.type             = "New Item";

                    CustomItemManager.saveItemList(CustomItemManager.getItemListPath(), temp);
                    CustomItemManager.items = temp;
                }
            }
        }

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();
        EditorGUIUtility.labelWidth = 1;
        EditorGUIUtility.fieldWidth = 0;
        GUILayout.Space(30);
        EditorGUILayout.LabelField("Type");
        GUILayout.Space(10);
        EditorGUILayout.LabelField("Prefab");
        GUILayout.Space(20);
        EditorGUILayout.LabelField("Spawn Chance", GUILayout.Width(115));
        //GUILayout.Space(50);
        EditorGUILayout.LabelField("Pickupable?", GUILayout.Width(70));
        GUILayout.Space(10);
        EditorGUILayout.LabelField("Spawn Type", GUILayout.Width(90));
        //GUILayout.Space(20);
        EditorGUILayout.LabelField("Unique?");
        GUILayout.Space(20);
        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        if (CustomItemManager.items != null)
        {
            for (int i = 0; i < CustomItemManager.items.Length; i++)
            {
                EditorGUILayout.BeginHorizontal();

                EditorGUIUtility.labelWidth = 50;

                EditorGUIUtility.fieldWidth = 40;


                if (GUILayout.Button("X", GUILayout.Width(20)))
                {
                    List <CustomItem> t = new List <CustomItem>(CustomItemManager.items);
                    t.RemoveAt(i);
                    CustomItemManager.items = t.ToArray();
                    continue;
                }
                CustomItemManager.items[i].type = EditorGUILayout.TextField(CustomItemManager.items[i].type, GUILayout.Width(55));
                GUILayout.Space(10);
                CustomItemManager.items[i].prefab           = (GameObject)EditorGUILayout.ObjectField("", CustomItemManager.items[i].prefab, typeof(GameObject), GUILayout.Width(70));
                EditorGUIUtility.labelWidth                 = 45;
                CustomItemManager.items[i].generationChance = EditorGUILayout.Slider("", CustomItemManager.items[i].generationChance, 0, 1, GUILayout.Width(140));
                GUILayout.Space(20);
                EditorGUIUtility.labelWidth           = 10;
                CustomItemManager.items[i].pickupable = EditorGUILayout.Toggle("", CustomItemManager.items[i].pickupable, GUILayout.Width(25));
                GUILayout.Space(10);
                CustomItemManager.items[i].spawntype = (CustomItemSpawnType)EditorGUILayout.EnumPopup(CustomItemManager.items[i].spawntype, GUILayout.Width(100));
                GUILayout.Space(20);
                CustomItemManager.items[i].unique = EditorGUILayout.Toggle("", CustomItemManager.items[i].unique, GUILayout.Width(25));

                EditorGUILayout.EndHorizontal();
            }
        }
        else
        {
            try
            {
                CustomItemManager.items = CustomItemManager.initializeListPrefab(CustomItemManager.loadItemList(CustomItemManager.getItemListPath()));
            }
            catch
            {
            }
        }

        EditorGUILayout.Space();

        if (GUILayout.Button("Save / Apply Custom Item List"))
        {
            CustomItemManager.saveItemList(CustomItemManager.getItemListPath(), CustomItemManager.items);
        }
    }
Ejemplo n.º 19
0
    public override void OnInspectorGUI ()
	{
		myTarget = (EnviroSkyMgr)target;

		if (boxStyle == null) {
			boxStyle = new GUIStyle (GUI.skin.box);
            boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
			boxStyle.fontStyle = FontStyle.Bold;
			boxStyle.alignment = TextAnchor.UpperLeft;
		}

        if (boxStyleModified == null)
        {
            boxStyleModified = new GUIStyle(EditorStyles.helpBox);
            boxStyleModified.normal.textColor = GUI.skin.label.normal.textColor;
            boxStyleModified.fontStyle = FontStyle.Bold;
            boxStyleModified.fontSize = 11;
            boxStyleModified.alignment = TextAnchor.UpperLeft;
        }

        if (wrapStyle == null)
		{
			wrapStyle = new GUIStyle(GUI.skin.label);
			wrapStyle.fontStyle = FontStyle.Normal;
			wrapStyle.wordWrap = true;
			wrapStyle.alignment = TextAnchor.UpperLeft;
		}

        if (headerStyle == null)
        {
            headerStyle = new GUIStyle(GUI.skin.label);
            headerStyle.fontStyle = FontStyle.Bold;
            headerStyle.wordWrap = true;
            headerStyle.alignment = TextAnchor.UpperLeft;
        }

        if (headerFoldout == null)
        {
            headerFoldout = new GUIStyle(EditorStyles.foldout);
            headerFoldout.fontStyle = FontStyle.Bold;
        }


        GUILayout.BeginVertical("Enviro - Sky Manager 2.3.1", boxStyle);
		GUILayout.Space(20);
		EditorGUILayout.LabelField("Welcome to the Enviro Sky Manager! Add Lite and Standard Enviro instances and switch between those. Add third party support components or choose your render pipeline.", wrapStyle);
	

        GUI.backgroundColor = boxColor1;
        GUILayout.BeginVertical("", boxStyleModified);
        GUI.backgroundColor = Color.white;
        myTarget.showSetup = GUILayout.Toggle(myTarget.showSetup, "Setup", headerFoldout);
        if (myTarget.showSetup)
        {
            //  
     
            GUILayout.BeginVertical("General", boxStyleModified);
           
            GUILayout.Space(20);
            myTarget.dontDestroy = EditorGUILayout.ToggleLeft("  Don't Destroy On Load", myTarget.dontDestroy);

            GUILayout.EndVertical();

            GUILayout.BeginVertical("Render Pipeline", boxStyleModified);
            GUILayout.Space(20);
            EditorGUILayout.LabelField("Please set your render pipeline here and choose between 'Legacy' and 'LWRP/URP'. Get Enviro Pro if you want to use 'HDRP'.", wrapStyle);
            GUILayout.Space(10);


#if ENVIRO_HDRP
             GUILayout.Label("Current Render Pipeline:   HDRP", headerStyle);
#elif ENVIRO_LWRP
             GUILayout.Label("Current Render Pipeline:   LWRP/URP", headerStyle);
#else
            GUILayout.Label("Current Render Pipeline:   Legacy", headerStyle);
#endif

            GUILayout.Space(10);
#if ENVIRO_PRO && !ENVIRO_HDRP
            if (GUILayout.Button("Activate HDRP Support"))
                {
                    AddDefineSymbol("ENVIRO_HDRP");
                    RemoveDefineSymbol("ENVIRO_LWRP");
                }
#endif

#if !ENVIRO_LWRP
                if (GUILayout.Button("Activate LWRP/URP Support"))
                {
                     AddDefineSymbol("ENVIRO_LWRP");
                     RemoveDefineSymbol("ENVIRO_HDRP");
                }
#endif

#if ENVIRO_LWRP || ENVIRO_HDRP
            if (GUILayout.Button("Activate Legacy Support"))
                {
                    RemoveDefineSymbol("ENVIRO_LWRP");
                    RemoveDefineSymbol("ENVIRO_HDRP");
                }
#endif

#if ENVIRO_LWRP
                GUILayout.BeginVertical("LWRP/URP Setup", boxStyleModified);
                GUILayout.Space(20);
                EditorGUILayout.LabelField("Please import the files for URP with the 'Import' button. This will import all necesarry files and a preconfigured Renderer. After that you need to assign the 'Enviro URP Renderer' in your URP quality settings as custom renderer.", wrapStyle);
                GUILayout.Space(10);
#if ENVIRO_LW
                if (GUILayout.Button("Import LWRP/URP Support for Enviro Lite"))
                {
                    AssetDatabase.ImportPackage("Assets/Enviro - Sky and Weather/Enviro Lite/URP Support/Enviro_Lite_URP.unitypackage", false);
                }
#endif
#if ENVIRO_HD
                if (GUILayout.Button("Import LWRP/URP Support for Enviro Standard"))
                {
                    AssetDatabase.ImportPackage("Assets/Enviro - Sky and Weather/Enviro Standard/URP Support/Enviro_Standard_URP.unitypackage", false);
                }
#endif
                GUILayout.EndVertical();
#endif

#if ENVIRO_HDRP
                GUILayout.BeginVertical("HDRP Setup", boxStyleModified);
                GUILayout.Space(20);
                EditorGUILayout.LabelField("Please assign the Enviro Post Processing Effects in your HDRP Default Settings  -> Quality Settings", wrapStyle);
                GUILayout.EndVertical();
#endif


            GUILayout.EndVertical();

            GUILayout.Space(10);

#if ENVIRO_HD
            GUILayout.BeginVertical("Standard Version", boxStyleModified);
            GUILayout.Space(20);
            if (myTarget.enviroHDInstance == null)
            {
                if (GUILayout.Button("Create Standard Instance"))
                {
                    myTarget.CreateEnviroHDInstance();
                }
                if (GUILayout.Button("Create Standard VR Instance"))
                {
                    myTarget.CreateEnviroHDVRInstance();
                }
            }
            else
            {
                GUILayout.Label("Current Instance found!", headerStyle);
                GUILayout.Label("Delete " + myTarget.enviroHDInstance.gameObject.name + " if you want to add other prefab!");
            }
            GUILayout.EndVertical();
#else
                 GUILayout.BeginVertical("Standard Version", boxStyleModified);
                GUILayout.Space(20);
                GUILayout.Label("Attention! No Enviro Standard define found! Not needed for Enviro Lite users! Click on the button underneath to add it. It should add the required define if Enviro Standard folder was found. Otherwise ignore this.", headerStyle);
                GUILayout.Space(5);
                if (GUILayout.Button("Add Enviro Standard Define"))
                {
                     ForceAddDefineSymbol("ENVIRO_HD");
                }
               GUILayout.EndVertical();
#endif

#if ENVIRO_LW
            GUILayout.BeginVertical("Lite Version", boxStyleModified);
            GUILayout.Space(20);
            if (myTarget.enviroLWInstance == null)
            {
                if (GUILayout.Button("Create Lite Instance"))
                {
                    myTarget.CreateEnviroLWInstance();
                }
                if (GUILayout.Button("Create Lite Mobile Instance"))
                {
                    myTarget.CreateEnviroLWMobileInstance();
                }
            }
            else
            {
                GUILayout.Label("Current Instance found!", headerStyle);
                GUILayout.Label("Delete " + myTarget.enviroLWInstance.gameObject.name + " if you want to add other prefab!");
            }
            GUILayout.EndVertical();
#else
                GUILayout.BeginVertical("Lite Version", boxStyleModified);
                GUILayout.Space(20);
                GUILayout.Label("Attention! No Enviro Lite define found! Click on the button underneath to add it. It should add the required define if Enviro Lite folder was found. Otherwise ignore this.", headerStyle);
                 GUILayout.Space(5);
                if (GUILayout.Button("Add Enviro Lite Define"))
                {
                     ForceAddDefineSymbol("ENVIRO_LW");
                }
             GUILayout.EndVertical();
#endif
        }
        GUILayout.EndVertical();

        //EditorGUILayout.EndToggleGroup();
        GUI.backgroundColor = boxColor1;
        GUILayout.BeginVertical("", boxStyleModified);
        GUI.backgroundColor = Color.white;
       //myTarget.showInstances = EditorGUILayout.BeginToggleGroup(" Instances", myTarget.showInstances);
       myTarget.showInstances = GUILayout.Toggle(myTarget.showInstances, "Instances", headerFoldout);
        if (myTarget.showInstances)
        {
          //  GUILayout.Space(10);
#if ENVIRO_HD
            if (myTarget.enviroHDInstance != null)
            {
                if (myTarget.currentEnviroSkyVersion != EnviroSkyMgr.EnviroSkyVersion.HD)
                    GUI.backgroundColor = modifiedColor;
                else
                {
                    if (myTarget.enviroHDInstance.Player == null || myTarget.enviroHDInstance.PlayerCamera == null)
                        GUI.backgroundColor = modifiedColor;
                    else
                        GUI.backgroundColor = greenColor;
                }

                GUILayout.BeginVertical(myTarget.enviroHDInstance.gameObject.name, boxStyle);
                GUI.backgroundColor = Color.white;
                GUILayout.Space(20);
                if (myTarget.currentEnviroSkyVersion != EnviroSkyMgr.EnviroSkyVersion.HD)
                {
                    if (GUILayout.Button("Activate"))
                    {
                        myTarget.ActivateHDInstance();
                    }
                }
                else if (myTarget.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.HD)
                {
                    if (myTarget.enviroHDInstance.Player == null || myTarget.enviroHDInstance.PlayerCamera == null)
                    {
                        GUILayout.Label("Player and/or camera assignment is missing!");

                        if (GUILayout.Button("Auto Assign"))
                        {
                            myTarget.enviroHDInstance.AssignAndStart(Camera.main.gameObject, Camera.main);
                        }
                    }
                    else
                    {
                        if (Application.isPlaying)
                        {
                            if (!myTarget.enviroHDInstance.started)
                            {
                                if (GUILayout.Button("Play"))
                                {
                                    myTarget.enviroHDInstance.Play(myTarget.enviroHDInstance.GameTime.ProgressTime);
                                }
                            }
                            else
                            {
                                if (GUILayout.Button("Stop"))
                                {
                                    myTarget.enviroHDInstance.Stop(false, true);
                                }

                            }
                        }

                        if (GUILayout.Button("Deactivate"))
                        {
                            myTarget.DeactivateHDInstance();
                        }
           
                    }
                }

                if (GUILayout.Button("Show"))
                {                  
                    Selection.activeObject = myTarget.enviroHDInstance;
                }
                if (GUILayout.Button("Delete"))
                {
                    if (EditorUtility.DisplayDialog("Delete Instance?", "Are you sure that you want to delete this instance?", "Delete", "Cancel"))
                        myTarget.DeleteHDInstance();
                }

                GUILayout.EndVertical();
            }
#endif

#if ENVIRO_LW

            if (myTarget.enviroLWInstance != null)
            {
                if (myTarget.currentEnviroSkyVersion != EnviroSkyMgr.EnviroSkyVersion.LW)
                    GUI.backgroundColor = modifiedColor;
                else
                {
                    if (myTarget.enviroLWInstance.Player == null || myTarget.enviroLWInstance.PlayerCamera == null)
                        GUI.backgroundColor = modifiedColor;
                    else
                        GUI.backgroundColor = greenColor;
                }

                GUILayout.BeginVertical(myTarget.enviroLWInstance.gameObject.name, boxStyle);
                GUI.backgroundColor = Color.white;
                GUILayout.Space(20);
                if (myTarget.currentEnviroSkyVersion != EnviroSkyMgr.EnviroSkyVersion.LW)
                {
                    if (GUILayout.Button("Activate"))
                    {
                        myTarget.ActivateLWInstance();
                    }
                }
                else if (myTarget.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.LW)
                {
                    if (myTarget.enviroLWInstance.Player == null || myTarget.enviroLWInstance.PlayerCamera == null)
                    {
                        GUILayout.Label("Player and/or camera assignment is missing!");

                        if (GUILayout.Button("Auto Assign"))
                        {
                            if (Camera.main != null)
                                myTarget.enviroLWInstance.AssignAndStart(Camera.main.gameObject, Camera.main);
                        }
                    }
                    else
                    {
                        if (Application.isPlaying)
                        {
                            if (!myTarget.enviroLWInstance.started)
                            {
                                if (GUILayout.Button("Play"))
                                {
                                    myTarget.enviroLWInstance.Play(myTarget.enviroLWInstance.GameTime.ProgressTime);
                                }
                            }
                            else
                            {
                                if (GUILayout.Button("Stop"))
                                {
                                    myTarget.enviroLWInstance.Stop(false, true);
                                }
                            }
                        }
                        if (GUILayout.Button("Deactivate"))
                        {
                            myTarget.DeactivateLWInstance();
                        }

           
                    }
                }
                 
                if (GUILayout.Button("Show"))
                {
             
                    Selection.activeObject = myTarget.enviroLWInstance;
                }

                if (GUILayout.Button("Delete"))
                {
                    if (EditorUtility.DisplayDialog("Delete Instance?", "Are you sure that you want to delete this instance?", "Delete", "Cancel"))
                        myTarget.DeleteLWInstance();
                }

                GUILayout.EndVertical();
            }
#endif
        }
        GUILayout.EndVertical();
        //EditorGUILayout.EndToggleGroup();
        GUI.backgroundColor = boxColor1;
        GUILayout.BeginVertical("", boxStyleModified);
        GUI.backgroundColor = Color.white;
        // myTarget.showThirdParty = EditorGUILayout.BeginToggleGroup(" Third Party Support", myTarget.showThirdParty);
        myTarget.showThirdParty = GUILayout.Toggle(myTarget.showThirdParty, "Third Party Support", headerFoldout);
        if (myTarget.showThirdParty)
        {
            GUILayout.BeginVertical("", boxStyleModified);
            //myTarget.showThirdPartyMisc = EditorGUILayout.BeginToggleGroup(" Miscellaneous", myTarget.showThirdPartyMisc);
            myTarget.showThirdPartyMisc = GUILayout.Toggle(myTarget.showThirdPartyMisc, "Miscellaneous", headerFoldout);

            if (myTarget.showThirdPartyMisc)
            {
                //WAPI
                GUILayout.BeginVertical("World Manager API", boxStyleModified);
                GUILayout.Space(20);
#if WORLDAPI_PRESENT
                if (myTarget.gameObject.GetComponent<EnviroWorldAPIIntegration>() == null)
                {
                    if (GUILayout.Button("Add WAPI Support"))
                    {
                        myTarget.gameObject.AddComponent<EnviroWorldAPIIntegration>();
                    }
                }
                else
                {
                    if (GUILayout.Button("Remove WAPI Support"))
                    {
                        DestroyImmediate(myTarget.gameObject.GetComponent<EnviroWorldAPIIntegration>());
                    }

                }
#else
            EditorGUILayout.LabelField("World Manager API no found!", wrapStyle);
#endif
                GUILayout.EndVertical();

                //Vegetation Studio Pro
                GUILayout.BeginVertical("Vegetation Studio Pro", boxStyleModified);
                GUILayout.Space(20);
#if VEGETATION_STUDIO_PRO
                if (myTarget.gameObject.GetComponent<EnviroVegetationStudioPro>() == null)
                {
                    if (GUILayout.Button("Add Vegetation Studio Pro Support"))
                    {
                        myTarget.gameObject.AddComponent<EnviroVegetationStudioPro>();
                    }
                }
                else
                {
                    if (GUILayout.Button("Remove Vegetation Studio Pro Support"))
                    {
                        DestroyImmediate(myTarget.gameObject.GetComponent<EnviroVegetationStudioPro>());
                    }

                }
#else
                EditorGUILayout.LabelField("Vegetation Studio Pro not found in project!", wrapStyle);
#endif
                GUILayout.EndVertical();


                //PEGASUS
                GUILayout.BeginVertical("Pegasus", boxStyleModified);
                GUILayout.Space(20);
#if ENVIRO_PEGASUS_SUPPORT
            EditorGUILayout.LabelField("Pegasus support is activated! Please use the new enviro trigger to drive enviro settings with Pegasus.");
            GUILayout.Space(20);
            if (GUILayout.Button("Deactivate Pegasus Support"))
            {
                RemoveDefineSymbol("ENVIRO_PEGASUS_SUPPORT");
            }
#else
                EditorGUILayout.LabelField("Pegasus support not activated! Please activate if you have Pegasus in your project.");
                GUILayout.Space(10);
                if (GUILayout.Button("Activate Pegasus Support"))
                {
                    AddDefineSymbol("ENVIRO_PEGASUS_SUPPORT");
                }
                if (GUILayout.Button("Deactivate Pegasus Support"))
                {
                    RemoveDefineSymbol("ENVIRO_PEGASUS_SUPPORT");
                }
#endif
                GUILayout.EndVertical();
                //////////


                //FogVolume
                GUILayout.BeginVertical("FogVolume 3", boxStyleModified);
                GUILayout.Space(20);
#if ENVIRO_FV3_SUPPORT

            if (myTarget.gameObject.GetComponent<EnviroFogVolumeIntegration>() == null)
            {
                if (GUILayout.Button("Add FogVolume Support"))
                {
                    myTarget.gameObject.AddComponent<EnviroFogVolumeIntegration>();
                }
            }
            else
            {
                if (GUILayout.Button("Remove FogVolume Support"))
                {
                    DestroyImmediate(myTarget.gameObject.GetComponent<EnviroFogVolumeIntegration>());
                }
            }
            GUILayout.Space(20);
            if (GUILayout.Button("Deactivate FogVolume Support"))
            {
                RemoveDefineSymbol("ENVIRO_FV3_SUPPORT");
            }
#else
                EditorGUILayout.LabelField("FogVolume3 support not activated! Please activate if you have FogVolume3 package in your project.");
                GUILayout.Space(10);
                if (GUILayout.Button("Activate FogVolume Support"))
                {
                    AddDefineSymbol("ENVIRO_FV3_SUPPORT");
                }
                if (GUILayout.Button("Deactivate FogVolume Support"))
                {
                    RemoveDefineSymbol("ENVIRO_FV3_SUPPORT");
                }
                
#endif
                GUILayout.EndVertical();
                //////////
                //Aura 2
                GUILayout.BeginVertical("Aura 2", boxStyleModified);
                GUILayout.Space(20);
#if AURA_IN_PROJECT
                if (!myTarget.aura2Support)
                {
                    EditorGUILayout.LabelField("Aura 2 support is deactivated!", wrapStyle);
                    if (GUILayout.Button("Activate Aura 2 Support"))
                    {
                        myTarget.aura2Support = true;
                    }
                }
                else
                {
                    EditorGUILayout.LabelField("Aura 2 is active! Please assign your Aura 2 presets in your weather presets! Enviro will change aura preset for you on weather changes then.", wrapStyle);
                    GUILayout.Space(20);
                    GUILayout.BeginVertical("", boxStyle);
                    GUILayout.Space(5);
                    if (myTarget.IsAvailable() && myTarget.Components != null && myTarget.Components.DirectLight.GetComponent<Aura2API.AuraLight>() == null)
                    {
                        if (GUILayout.Button("Convert Enviro Directional Light to Aura2"))
                        {
                             myTarget.Components.DirectLight.gameObject.AddComponent<Aura2API.AuraLight>();

                             if(myTarget.Components.AdditionalDirectLight != null && myTarget.Components.AdditionalDirectLight.GetComponent<Aura2API.AuraLight>() == null)
                                myTarget.Components.AdditionalDirectLight.gameObject.AddComponent<Aura2API.AuraLight>();
                        }
                    }
                    else
                    {
                        myTarget.aura2DirectionalLightIntensity = EditorGUILayout.CurveField("Aura2 Directional Light Strength",myTarget.aura2DirectionalLightIntensity);     
                       
                        if(myTarget.IsAvailable() && myTarget.Components.AdditionalDirectLight != null)
                           myTarget.aura2DirectionalLightIntensityMoon = EditorGUILayout.CurveField("Aura2 Directional Light Moon Strength",myTarget.aura2DirectionalLightIntensityMoon);     
                    }
                    if (myTarget.IsAvailable() && myTarget.Camera != null && myTarget.Camera.GetComponent<Aura2API.AuraCamera>() == null)
                    {
                        if (GUILayout.Button("Add Aura2 Camera component"))
                        {
                            Aura2API.Aura.AddAuraToCameras();
                        }
                    }
                    else
                    {
                        myTarget.aura2TransitionSpeed = EditorGUILayout.FloatField("Aura2 Transition Speed", myTarget.aura2TransitionSpeed);
                    }
                    GUILayout.Space(5);
                    GUILayout.EndVertical();
                    GUILayout.Space(20);


                    if (GUILayout.Button("Deactivate Aura 2 Support"))
                    {
                        myTarget.aura2Support = false;
                    }

                }
#else
                EditorGUILayout.LabelField("Aura 2 not found in your project.", wrapStyle);
#endif
                GUILayout.EndVertical();






            }
            GUILayout.EndVertical();
             //   EditorGUILayout.EndToggleGroup();


            GUILayout.BeginVertical("", boxStyleModified);
            //myTarget.showThirdPartyShaders = EditorGUILayout.BeginToggleGroup(" Shaders", myTarget.showThirdPartyShaders);
            myTarget.showThirdPartyShaders = GUILayout.Toggle(myTarget.showThirdPartyShaders, "Shaders", headerFoldout);
            if (myTarget.showThirdPartyShaders)
            {

                //CTS
                GUILayout.BeginVertical("Complete Terrain Shader", boxStyleModified);
                GUILayout.Space(20);
#if CTS_PRESENT
            if(myTarget.gameObject.GetComponent<EnviroCTSIntegration>() == null)
            {     
                if (GUILayout.Button("Add CTS Support"))
                {
                    myTarget.gameObject.AddComponent<EnviroCTSIntegration>();
                }
            }
            else
            {
                if (GUILayout.Button("Remove WAPI Support"))
                {
                    DestroyImmediate(myTarget.gameObject.GetComponent<EnviroCTSIntegration>());
                }

            }
#else
                EditorGUILayout.LabelField("CTS not found in project!", wrapStyle);
#endif
                GUILayout.EndVertical();


                //MicroSplat
                GUILayout.BeginVertical("MicroSplat", boxStyleModified);
                GUILayout.Space(20);

#if ENVIRO_MICROSPLAT_SUPPORT

            if (myTarget.gameObject.GetComponent<EnviroMicroSplatIntegration>() == null)
            {
                if (GUILayout.Button("Add MicroSplat Support"))
                {
                    myTarget.gameObject.AddComponent<EnviroMicroSplatIntegration>();
                }
            }
            else
            {
                if (GUILayout.Button("Remove MicroSplat Support"))
                {
                    DestroyImmediate(myTarget.gameObject.GetComponent<EnviroMicroSplatIntegration>());
                }
            }
            GUILayout.Space(20);
            if (GUILayout.Button("Deactivate MicroSplat Support"))
            {
                RemoveDefineSymbol("ENVIRO_MICROSPLAT_SUPPORT");
            }
#else
                EditorGUILayout.LabelField("MicroSplat support not activated! Please activate if you have Microsplat in your project.");
                GUILayout.Space(10);
                if (GUILayout.Button("Activate MicroSplat Support"))
                {
                    AddDefineSymbol("ENVIRO_MICROSPLAT_SUPPORT");
                }
                if (GUILayout.Button("Deactivate MicroSplat Support"))
                {
                    RemoveDefineSymbol("ENVIRO_MICROSPLAT_SUPPORT");
                }
#endif
                GUILayout.EndVertical();
                //////////

                //MegaSplat
                GUILayout.BeginVertical("MegaSplat", boxStyleModified);
                GUILayout.Space(20);
#if ENVIRO_MEGASPLAT_SUPPORT

            if (myTarget.gameObject.GetComponent<EnviroMegaSplatIntegration>() == null)
            {
                if (GUILayout.Button("Add MegaSplat Support"))
                {
                    myTarget.gameObject.AddComponent<EnviroMegaSplatIntegration>();
                }
            }
            else
            {
                if (GUILayout.Button("Remove MegaSplat Support"))
                {
                    DestroyImmediate(myTarget.gameObject.GetComponent<EnviroMegaSplatIntegration>());
                }
            }
            GUILayout.Space(20);
            if (GUILayout.Button("Deactivate MegaSplat Support"))
            {
                RemoveDefineSymbol("ENVIRO_MEGASPLAT_SUPPORT");
            }
#else
                EditorGUILayout.LabelField("MegaSplat support not activated! Please activate if you have MegaSplat in your project.");
                GUILayout.Space(10);
                if (GUILayout.Button("Activate MegaSplat Support"))
                {
                    AddDefineSymbol("ENVIRO_MEGASPLAT_SUPPORT");
                }
                if (GUILayout.Button("Deactivate MegaSplat Support"))
                {
                    RemoveDefineSymbol("ENVIRO_MEGASPLAT_SUPPORT");
                }
#endif
                GUILayout.EndVertical();
                //////////

                //RTP
                GUILayout.BeginVertical("Relief Terrain Shader", boxStyleModified);
                GUILayout.Space(20);

#if ENVIRO_RTP_SUPPORT
            if (myTarget.gameObject.GetComponent<EnviroRTPIntegration>() == null)
            {
                if (GUILayout.Button("Add RTP Support"))
                {
                    myTarget.gameObject.AddComponent<EnviroRTPIntegration>();
                }
            }
            else
            {
                if (GUILayout.Button("Remove RTP Support"))
                {
                    DestroyImmediate(myTarget.gameObject.GetComponent<EnviroRTPIntegration>());
                }
            }
            GUILayout.Space(20);
            if (GUILayout.Button("Deactivate RTP Support"))
            {
                RemoveDefineSymbol("ENVIRO_RTP_SUPPORT");
            }
#else
                EditorGUILayout.LabelField("Relief Terrain Shader support not activated! Please activate if you have Relief Terrain Shader package in your project.");
                GUILayout.Space(10);
                if (GUILayout.Button("Activate RTP Support"))
                {
                    AddDefineSymbol("ENVIRO_RTP_SUPPORT");
                }
                if (GUILayout.Button("Deactivate RTP Support"))
                {
                    RemoveDefineSymbol("ENVIRO_RTP_SUPPORT");
                }
#endif
                GUILayout.EndVertical();
                //////////

                //UBER
                GUILayout.BeginVertical("UBER Shaderframework", boxStyleModified);
                GUILayout.Space(20);

#if ENVIRO_UBER_SUPPORT
            if (myTarget.gameObject.GetComponent<EnviroRTPIntegration>() == null)
            {
                if (GUILayout.Button("Add UBER Support"))
                {
                    myTarget.gameObject.AddComponent<EnviroRTPIntegration>();
                }
            }
            else
            {
                if (GUILayout.Button("Remove UBER Support"))
                {
                    DestroyImmediate(myTarget.gameObject.GetComponent<EnviroRTPIntegration>());
                }
            }
            GUILayout.Space(20);
            if (GUILayout.Button("Deactivate UBER Support"))
            {
                RemoveDefineSymbol("ENVIRO_UBER_SUPPORT");
            }
#else
                EditorGUILayout.LabelField("UBER Shader support not activated! Please activate if you have UBER Shader package in your project.");
                GUILayout.Space(10);
                if (GUILayout.Button("Activate UBER Support"))
                {
                    AddDefineSymbol("ENVIRO_UBER_SUPPORT");
                }
                if (GUILayout.Button("Deactivate UBER Support"))
                {
                    RemoveDefineSymbol("ENVIRO_UBER_SUPPORT");
                }
#endif
                GUILayout.EndVertical();
                //////////

                //LUX
                GUILayout.BeginVertical("LUX Shaderframework", boxStyleModified);
                GUILayout.Space(20);

#if ENVIRO_LUX_SUPPORT
            if (myTarget.gameObject.GetComponent<EnviroLUXIntegration>() == null)
            {
                if (GUILayout.Button("Add LUX Support"))
                {
                    myTarget.gameObject.AddComponent<EnviroLUXIntegration>();
                }
            }
            else
            {
                if (GUILayout.Button("Remove LUX Support"))
                {
                    DestroyImmediate(myTarget.gameObject.GetComponent<EnviroLUXIntegration>());
                }
            }
            GUILayout.Space(20);
            if (GUILayout.Button("Deactivate LUX Support"))
            {
                RemoveDefineSymbol("ENVIRO_LUX_SUPPORT");
            }
#else
                EditorGUILayout.LabelField("LUX Shader support not activated! Please activate if you have LUX Shader package in your project.");
                GUILayout.Space(10);
                if (GUILayout.Button("Activate LUX Support"))
                {
                    AddDefineSymbol("ENVIRO_LUX_SUPPORT");
                }
                if (GUILayout.Button("Deactivate LUX Support"))
                {
                    RemoveDefineSymbol("ENVIRO_LUX_SUPPORT");
                }
#endif
                GUILayout.EndVertical();
                //////////

                //Global Snow
                GUILayout.BeginVertical("Global Snow", boxStyleModified);
                GUILayout.Space(20);

#if ENVIRO_GLOBALSNOW_SUPPORT
            if (myTarget.gameObject.GetComponent<GlobalSnowIntegration>() == null)
            {
                if (GUILayout.Button("Add Global Snow Support"))
                {
                    myTarget.gameObject.AddComponent<GlobalSnowIntegration>();
                }
            }
            else
            {
                if (GUILayout.Button("Remove Global Snow Support"))
                {
                    DestroyImmediate(myTarget.gameObject.GetComponent<GlobalSnowIntegration>());
                }
            }
            GUILayout.Space(20);
            if (GUILayout.Button("Deactivate Global Snow Support"))
            {
                RemoveDefineSymbol("ENVIRO_GLOBALSNOW_SUPPORT");
            }
#else
                EditorGUILayout.LabelField("Global Snow support not activated! Please activate if you have Global Snow package in your project.");
                GUILayout.Space(10);
                if (GUILayout.Button("Activate Global Snow Support"))
                {
                    AddDefineSymbol("ENVIRO_GLOBALSNOW_SUPPORT");
                }
                if (GUILayout.Button("Deactivate Global Snow Support"))
                {
                    RemoveDefineSymbol("ENVIRO_GLOBALSNOW_SUPPORT");
                }
#endif
                GUILayout.EndVertical();
                //////////



            }
            GUILayout.EndVertical();
        //EditorGUILayout.EndToggleGroup();


            GUILayout.BeginVertical("", boxStyleModified);
           // myTarget.showThirdPartyNetwork = EditorGUILayout.BeginToggleGroup(" Networking", myTarget.showThirdPartyNetwork);
            myTarget.showThirdPartyNetwork = GUILayout.Toggle(myTarget.showThirdPartyNetwork, "Networking", headerFoldout);
            if (myTarget.showThirdPartyNetwork)
            {

                //UNET
                GUILayout.BeginVertical("UNet Networking", boxStyleModified);
                GUILayout.Space(20);
#if ENVIRO_UNET_SUPPORT
            EditorGUILayout.LabelField("UNET support is activated! Please also add the EnviroUNetPlayer component to your players!");

            if (myTarget.gameObject.GetComponent<EnviroUNetServer>() == null)
            {
                if (GUILayout.Button("Add UNet Integration Component"))
                {
                    myTarget.gameObject.AddComponent<EnviroUNetServer>();
                }
            }
            else
            {
                if (GUILayout.Button("Remove UNet Integration Component"))
                {
                    DestroyImmediate(myTarget.gameObject.GetComponent<EnviroUNetServer>());
                }
            }
            GUILayout.Space(10);
            if (GUILayout.Button("Deactivate UNet Support"))
            {
                RemoveDefineSymbol("ENVIRO_UNET_SUPPORT");
            }
#else
                EditorGUILayout.LabelField("UNet support not activated! Please activate if would like to use UNet with Enviro.");
                GUILayout.Space(10);
                if (GUILayout.Button("Activate UNet Support"))
                {
                    AddDefineSymbol("ENVIRO_UNET_SUPPORT");
                }
                if (GUILayout.Button("Deactivate UNet Support"))
                {
                    RemoveDefineSymbol("ENVIRO_UNET_SUPPORT");
                }
#endif
                GUILayout.EndVertical();
                //////////

                

                //Mirror
                GUILayout.BeginVertical("Mirror Networking", boxStyleModified);
                GUILayout.Space(20);
#if ENVIRO_MIRROR_SUPPORT
            EditorGUILayout.LabelField("Mirror support is activated! Please also add the EnviroMirrorPlayer component to your players!");

            if (GameObject.Find("/Enviro Mirror Server") == null)
            {
                if (GUILayout.Button("Add Mirror Integration Component"))
                {
                GameObject mServer = new GameObject();
                mServer.name = "Enviro Mirror Server";
                mServer.AddComponent<EnviroMirrorServer>();
                }
            }
            else
            {
                if (GUILayout.Button("Remove Mirror Integration Component"))
                {

                if(GameObject.Find("/Enviro Mirror Server") != null)
                    DestroyImmediate(GameObject.Find("/Enviro Mirror Server"));
                }
            }
            GUILayout.Space(10);
            if (GUILayout.Button("Deactivate Mirror Support"))
            {
                RemoveDefineSymbol("ENVIRO_MIRROR_SUPPORT");
            }
#else
                EditorGUILayout.LabelField("Mirror support not activated! Please activate if would like to use Mirror with Enviro.");
                GUILayout.Space(10);
                if (GUILayout.Button("Activate Mirror Support"))
                {
                    AddDefineSymbol("ENVIRO_MIRROR_SUPPORT");
                }
                if (GUILayout.Button("Deactivate Mirror Support"))
                {
                    RemoveDefineSymbol("ENVIRO_MIRROR_SUPPORT");
                }
#endif
                GUILayout.EndVertical();
                //////////

                //Photon
                GUILayout.BeginVertical("Photon Networking", boxStyleModified);
            GUILayout.Space(20);
#if ENVIRO_PHOTON_SUPPORT
            EditorGUILayout.LabelField("Photon PUN 2 support is activated!");

            if (myTarget.gameObject.GetComponent<EnviroPhotonIntegration>() == null)
            {
                if (GUILayout.Button("Add Photon Integration Component"))
                {
                    myTarget.gameObject.AddComponent<EnviroPhotonIntegration>();
                }
            }
            else
            {
                if (GUILayout.Button("Remove Photon Integration Component"))
                {
                    DestroyImmediate(myTarget.gameObject.GetComponent<EnviroPhotonIntegration>());
                }
            }
            GUILayout.Space(10);
            if (GUILayout.Button("Deactivate Photon Support"))
            {
                RemoveDefineSymbol("ENVIRO_PHOTON_SUPPORT");
            }
#else
            EditorGUILayout.LabelField("Photon support not activated! Please activate if you have Photon PUN 2 in your project.");
            GUILayout.Space(10);
            if (GUILayout.Button("Activate Photon Support"))
            {
                AddDefineSymbol("ENVIRO_PHOTON_SUPPORT");
            }
            if (GUILayout.Button("Deactivate Photon Support"))
            {
                RemoveDefineSymbol("ENVIRO_PHOTON_SUPPORT");
            }
#endif
            GUILayout.EndVertical();
                //////////

            }
            GUILayout.EndVertical();
            //EditorGUILayout.EndToggleGroup();


        }
        // END THIRDPARTY



        // END Utilities

        GUILayout.EndVertical();
        //EditorGUILayout.EndToggleGroup();


#if ENVIRO_HD
        GUI.backgroundColor = boxColor1;
        GUILayout.BeginVertical("", boxStyleModified);
        GUI.backgroundColor = Color.white;
        // myTarget.showUtilities = EditorGUILayout.BeginToggleGroup(" Utilities", myTarget.showUtilities);
        myTarget.showUtilities = GUILayout.Toggle(myTarget.showUtilities, "Utilities", headerFoldout);
        if (myTarget.showUtilities)
        {
            GUILayout.BeginVertical("Export Sky to HDR Cubemap", boxStyleModified);
            GUILayout.Space(20);
            EditorGUILayout.LabelField("Cubemap Resolution");
            myTarget.skyBaking.resolution = EditorGUILayout.IntPopup(myTarget.skyBaking.resolution, bakingResNames, bakingResValues);
            GUILayout.Space(5);
            if (GUILayout.Button("Bake to Cubemap"))
            {
                SelectPathForBaking(myTarget.skyBaking.resolution);
            }
            GUILayout.EndVertical();
        }
        GUILayout.EndVertical();
        // EditorGUILayout.EndToggleGroup();
#endif
        GUILayout.EndVertical();
    }
Ejemplo n.º 20
0
        public override void OnInspectorGUI()
        {
            if (actor.ropeBlueprint != null && pathEditor == null)
            {
                pathEditor = new ObiPathEditor(actor.ropeBlueprint, actor.ropeBlueprint.path, false);
            }

            if (editLabelStyle == null)
            {
                editLabelStyle           = new GUIStyle(GUI.skin.label);
                editLabelStyle.alignment = TextAnchor.MiddleLeft;
            }

            serializedObject.UpdateIfRequiredOrScript();

            if (pathEditor != null)
            {
                pathEditor.ResizeCPArrays();
            }

            using (new EditorGUI.DisabledScope(editMode))
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(ropeBlueprint, new GUIContent("Blueprint"));
                if (EditorGUI.EndChangeCheck())
                {
                    foreach (var t in targets)
                    {
                        (t as ObiRope).RemoveFromSolver();
                        (t as ObiRope).ClearState();
                    }
                    serializedObject.ApplyModifiedProperties();
                    foreach (var t in targets)
                    {
                        (t as ObiRope).AddToSolver();
                    }
                }
            }

            DoEditButton();


            if (actor.sourceBlueprint != null && actor.ropeBlueprint.path.ControlPointCount < 2)
            {
                actor.ropeBlueprint.GenerateImmediate();
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Collisions", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(collisionMaterial, new GUIContent("Collision material"));
            EditorGUILayout.PropertyField(selfCollisions, new GUIContent("Self collisions"));

            EditorGUILayout.Space();
            ObiEditorUtils.DoToggleablePropertyGroup(tearingEnabled, new GUIContent("Tearing"),
                                                     () =>
            {
                EditorGUILayout.PropertyField(tearResistanceMultiplier, new GUIContent("Tear resistance"));
                EditorGUILayout.PropertyField(tearRate, new GUIContent("Tear rate"));
            });
            ObiEditorUtils.DoToggleablePropertyGroup(distanceConstraintsEnabled, new GUIContent("Distance Constraints", Resources.Load <Texture2D>("Icons/ObiDistanceConstraints Icon")),
                                                     () =>
            {
                EditorGUILayout.PropertyField(stretchingScale, new GUIContent("Stretching scale"));
                EditorGUILayout.PropertyField(stretchCompliance, new GUIContent("Stretch compliance"));
                EditorGUILayout.PropertyField(maxCompression, new GUIContent("Max compression"));
            });

            ObiEditorUtils.DoToggleablePropertyGroup(bendConstraintsEnabled, new GUIContent("Bend Constraints", Resources.Load <Texture2D>("Icons/ObiBendConstraints Icon")),
                                                     () =>
            {
                EditorGUILayout.PropertyField(bendCompliance, new GUIContent("Bend compliance"));
                EditorGUILayout.PropertyField(maxBending, new GUIContent("Max bending"));
            });


            if (GUI.changed)
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
    public override void OnInspectorGUI()
    {
        #if UNITY_2019_4_OR_NEWER
        Texture2D imageInspector = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/AllIn1SpriteShader/Textures/CustomEditorImage2.png", typeof(Texture2D));
        #else
        Texture2D imageInspector = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/AllIn1SpriteShader/Textures/CustomEditorImage.png", typeof(Texture2D));
        #endif

        if (imageInspector)
        {
            Rect  rect;
            float imageHeight = imageInspector.height;
            float imageWidth  = imageInspector.width;
            float aspectRatio = imageHeight / imageWidth;
            rect = GUILayoutUtility.GetRect(imageHeight, aspectRatio * Screen.width * 0.7f);
            EditorGUI.DrawTextureTransparent(rect, imageInspector);
        }

        AllIn1Shader myScript = (AllIn1Shader)target;

        SetCurrentShaderType(myScript);

        if (GUILayout.Button("Deactivate All Effects"))
        {
            for (int i = 0; i < targets.Length; i++)
            {
                (targets[i] as AllIn1Shader).ClearAllKeywords();
            }
        }


        if (GUILayout.Button("New Clean Material"))
        {
            for (int i = 0; i < targets.Length; i++)
            {
                (targets[i] as AllIn1Shader).TryCreateNew();
            }
        }


        if (GUILayout.Button("Create New Material With Same Properties (SEE DOC)"))
        {
            for (int i = 0; i < targets.Length; i++)
            {
                (targets[i] as AllIn1Shader).MakeCopy();
            }
        }

        if (GUILayout.Button("Save Material To Folder (SEE DOC)"))
        {
            for (int i = 0; i < targets.Length; i++)
            {
                (targets[i] as AllIn1Shader).SaveMaterial();
            }
        }

        if (GUILayout.Button("Apply Material To All Children"))
        {
            for (int i = 0; i < targets.Length; i++)
            {
                (targets[i] as AllIn1Shader).ApplyMaterialToHierarchy();
            }
        }

        if (myScript.shaderTypes != AllIn1Shader.ShaderTypes.Urp2dRenderer)
        {
            if (GUILayout.Button("Render Material To Image"))
            {
                for (int i = 0; i < targets.Length; i++)
                {
                    (targets[i] as AllIn1Shader).RenderToImage();
                }
            }
        }

        bool   isUrp = false;
        Shader temp  = Resources.Load("AllIn1Urp2dRenderer", typeof(Shader)) as Shader;
        if (temp != null)
        {
            isUrp = true;
        }
        EditorGUILayout.BeginHorizontal();
        {
            GUILayout.Label("Change Shader Variant:", GUILayout.MaxWidth(140));
            int previousShaderType = (int)myScript.shaderTypes;
            myScript.shaderTypes = (AllIn1Shader.ShaderTypes)EditorGUILayout.EnumPopup(myScript.shaderTypes);
            if (previousShaderType != (int)myScript.shaderTypes)
            {
                for (int i = 0; i < targets.Length; i++)
                {
                    (targets[i] as AllIn1Shader).CheckIfValidTarget();
                }
                if (myScript == null)
                {
                    return;
                }
                if (isUrp || myScript.shaderTypes != AllIn1Shader.ShaderTypes.Urp2dRenderer)
                {
                    Debug.Log(myScript.gameObject.name + " shader variant has been changed to: " + myScript.shaderTypes);
                    myScript.SetSceneDirty();

                    Renderer sr = myScript.GetComponent <Renderer>();
                    if (sr != null)
                    {
                        if (sr.sharedMaterial != null)
                        {
                            if (myScript.shaderTypes == AllIn1Shader.ShaderTypes.Default)
                            {
                                sr.sharedMaterial.shader = Resources.Load("AllIn1SpriteShader", typeof(Shader)) as Shader;
                            }
                            else if (myScript.shaderTypes == AllIn1Shader.ShaderTypes.ScaledTime)
                            {
                                sr.sharedMaterial.shader = Resources.Load("AllIn1SpriteShaderScaledTime", typeof(Shader)) as Shader;
                            }
                            else if (myScript.shaderTypes == AllIn1Shader.ShaderTypes.MaskedUI)
                            {
                                sr.sharedMaterial.shader = Resources.Load("AllIn1SpriteShaderUiMask", typeof(Shader)) as Shader;
                            }
                            else if (myScript.shaderTypes == AllIn1Shader.ShaderTypes.Urp2dRenderer)
                            {
                                sr.sharedMaterial.shader = Resources.Load("AllIn1Urp2dRenderer", typeof(Shader)) as Shader;
                            }
                            else
                            {
                                SetCurrentShaderType(myScript);
                            }
                        }
                    }
                    else
                    {
                        Image img = myScript.GetComponent <Image>();
                        if (img != null && img.material != null)
                        {
                            if (myScript.shaderTypes == AllIn1Shader.ShaderTypes.Default)
                            {
                                img.material.shader = Resources.Load("AllIn1SpriteShader", typeof(Shader)) as Shader;
                            }
                            else if (myScript.shaderTypes == AllIn1Shader.ShaderTypes.ScaledTime)
                            {
                                img.material.shader = Resources.Load("AllIn1SpriteShaderScaledTime", typeof(Shader)) as Shader;
                            }
                            else if (myScript.shaderTypes == AllIn1Shader.ShaderTypes.MaskedUI)
                            {
                                img.material.shader = Resources.Load("AllIn1SpriteShaderUiMask", typeof(Shader)) as Shader;
                            }
                            else if (myScript.shaderTypes == AllIn1Shader.ShaderTypes.Urp2dRenderer)
                            {
                                img.material.shader = Resources.Load("AllIn1Urp2dRenderer", typeof(Shader)) as Shader;
                            }
                            else
                            {
                                SetCurrentShaderType(myScript);
                            }
                        }
                    }
                }
                else if (!isUrp && myScript.shaderTypes == AllIn1Shader.ShaderTypes.Urp2dRenderer)
                {
                    myScript.shaderTypes = (AllIn1Shader.ShaderTypes)previousShaderType;
                    showUrpWarning       = true;
                    warningTime          = EditorApplication.timeSinceStartup + 5;
                }
            }
        }
        EditorGUILayout.EndHorizontal();

        if (warningTime < EditorApplication.timeSinceStartup)
        {
            showUrpWarning = false;
        }
        if (isUrp)
        {
            showUrpWarning = false;
        }
        if (showUrpWarning)
        {
            EditorGUILayout.HelpBox(
                "You can't set the URP 2D Renderer variant since you didn't import the URP package available in the asset root folder (SEE DOCUMENTATION)",
                MessageType.Error,
                true);
        }

        if (isUrp && myScript.shaderTypes == AllIn1Shader.ShaderTypes.Urp2dRenderer)
        {
            EditorGUILayout.Space();
            DrawLine(Color.grey, 1, 3);
            EditorGUILayout.Space();

            if (GUILayout.Button("Create And Add Normal Map"))
            {
                for (int i = 0; i < targets.Length; i++)
                {
                    (targets[i] as AllIn1Shader).CreateAndAssignNormalMap();
                }
            }
            serializedObject.Update();
            EditorGUILayout.PropertyField(m_NormalStrength, new GUIContent("Normal Strength"), GUILayout.Height(20));
            EditorGUILayout.PropertyField(m_NormalSmoothing, new GUIContent("Normal Blur"), GUILayout.Height(20));
            if (myScript.computingNormal)
            {
                EditorGUILayout.LabelField("Normal Map is currently being created, be patient", EditorStyles.boldLabel, GUILayout.Height(40));
            }
            serializedObject.ApplyModifiedProperties();

            EditorGUILayout.Space();
        }

        DrawLine(Color.grey, 1, 3);
        EditorGUILayout.Space();

        if (GUILayout.Button("Sprite Atlas Auto Setup"))
        {
            for (int i = 0; i < targets.Length; i++)
            {
                (targets[i] as AllIn1Shader).ToggleSetAtlasUvs(true);
            }
        }
        if (GUILayout.Button("Remove Sprite Atlas Configuration"))
        {
            for (int i = 0; i < targets.Length; i++)
            {
                (targets[i] as AllIn1Shader).ToggleSetAtlasUvs(false);
            }
        }

        EditorGUILayout.Space();
        DrawLine(Color.grey, 1, 3);

        if (GUILayout.Button("REMOVE COMPONENT AND MATERIAL"))
        {
            for (int i = 0; i < targets.Length; i++)
            {
                (targets[i] as AllIn1Shader).CleanMaterial();
            }
            for (int i = targets.Length - 1; i >= 0; i--)
            {
                DestroyImmediate(targets[i] as AllIn1Shader);
            }
        }
    }
Ejemplo n.º 22
0
    void OnGUI()
    {
        // ----------------------------------------------------------------------------------------------------
        // ------ Tile Converter Data
        // ----------------------------------------------------------------------------------------------------

        EditorGUILayout.Space();
        GUILayout.Label(editorData.tileconverterHeader);

        _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition);

        EditorGUILayout.LabelField("Tile Converter Settings", EditorStyles.boldLabel);

        // ----------------------------------------------------------------------------------------------------
        // ------ Folder Settings
        // ----------------------------------------------------------------------------------------------------

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Select Tile Prefab Destination Folder", EditorStyles.boldLabel);

        EditorGUILayout.BeginVertical("box");

        EditorGUILayout.LabelField("Select Source Prefab Folders");

        if (GUILayout.Button("Prefab Source Folder", GUILayout.Height(30)))
        {
            userSettings.c_sourceFolder = EditorUtility.OpenFolderPanel("Tile Prefab Source Folder", "", "");

            if (userSettings.c_sourceFolder == "")
            {
                userSettings.c_sourceFolder = "Assets/";
            }
        }

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Select Tile Destination Folder");

        if (GUILayout.Button("Tile Destination", GUILayout.Height(30)))
        {
            userSettings.c_destinationFolder = EditorUtility.OpenFolderPanel("Tile Prefab Destination Folder", "", "");

            if (userSettings.c_destinationFolder == "")
            {
                userSettings.c_destinationFolder = "Assets/";
            }
        }

        userSettings.c_destinationFolder = YuTools_Utils.shortenAssetPath(userSettings.c_destinationFolder);

        EditorGUILayout.Space();
        EditorGUILayout.EndVertical();

        userSettings.c_sourceFolder = YuTools_Utils.shortenAssetPath(userSettings.c_sourceFolder);

        // ----------------------------------------------------------------------------------------------------
        // ------ Name Settings
        // ----------------------------------------------------------------------------------------------------

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Tile Set Name", EditorStyles.boldLabel);

        EditorGUILayout.BeginVertical("box");

        userSettings.c_name = EditorGUILayout.TextField("Set Tile Set Name", userSettings.c_name);

        EditorGUILayout.EndVertical();

        // ----------------------------------------------------------------------------------------------------
        // ------ Scale Settings
        // ----------------------------------------------------------------------------------------------------

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Scale Adjustment", EditorStyles.boldLabel);

        EditorGUILayout.BeginVertical("box");

        userSettings.c_scale = EditorGUILayout.FloatField("Rescale Factor", userSettings.c_scale);

        EditorGUILayout.EndVertical();

        // ----------------------------------------------------------------------------------------------------
        // ------ Offset Settings
        // ----------------------------------------------------------------------------------------------------

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Offset Adjustment", EditorStyles.boldLabel);

        EditorGUILayout.BeginVertical("box");

        userSettings.c_offset = EditorGUILayout.Vector3Field("Offset Values", userSettings.c_offset);

        EditorGUILayout.EndVertical();

        // ----------------------------------------------------------------------------------------------------
        // ------ Append Settings
        // ----------------------------------------------------------------------------------------------------

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Custom Append Label", EditorStyles.boldLabel);

        EditorGUILayout.BeginVertical("box");

        userSettings.c_appendName = EditorGUILayout.TextField("Append to Tile Name", userSettings.c_appendName);

        EditorGUILayout.EndVertical();

        // ----------------------------------------------------------------------------------------------------
        // ------ Import Button
        // ----------------------------------------------------------------------------------------------------

        EditorGUILayout.Space();

        if (userSettings.c_sourceFolder != "" && userSettings.c_destinationFolder != "")
        {
            if (GUILayout.Button("Convert Tileset", GUILayout.Height(40)))
            {
                bool tileDestinationFolderWarning = true;

                if (userSettings.c_destinationFolder == "Assets/")
                {
                    tileDestinationFolderWarning = EditorUtility.DisplayDialog("Tile Prefabs will be created in the root Assets Folder",
                                                                               "Are you sure you want create the tile prefabs in the root Asset/ folder?", "OK", "Cancel");
                }

                if (tileDestinationFolderWarning)
                {
                    createTileSet(false);
                    recreateCustomBrushes(userSettings.c_destinationFolder);
                    cleanUpImport();
                }
            }
        }
        else
        {
            EditorGUILayout.HelpBox("Set a source and destination directories to start conversion", MessageType.Warning);
        }

        // ----------------------------------------------------------------------------------------------------
        // ------ Reimport Button
        // ----------------------------------------------------------------------------------------------------

        //EditorGUILayout.Space();

        if (userSettings.c_sourceFolder != "" && userSettings.c_destinationFolder != "")
        {
            EditorGUILayout.HelpBox("Use reimport if you are happy with your scale settings but wish to add new tiles to the exisiting set.", MessageType.Info);
            if (GUILayout.Button("Reimport Tileset", GUILayout.Height(40)))
            {
                bool tileDestinationFolderWarning = true;

                if (userSettings.c_destinationFolder == "Assets/")
                {
                    tileDestinationFolderWarning = EditorUtility.DisplayDialog("Tile Prefabs will be created in the root Assets Folder",
                                                                               "Are you sure you want create the tile prefabs in the root Asset/ folder?", "OK", "Cancel");
                }

                if (tileDestinationFolderWarning)
                {
                    createTileSet(true);
                    recreateCustomBrushes(userSettings.c_destinationFolder);
                    cleanUpImport();
                }
            }
        }
        else
        {
            EditorGUILayout.HelpBox("Set a source and destination directories to start conversion", MessageType.Warning);
        }

        // ----------------------------------------------------------------------------------------------------
        // ------ Output Folder Information
        // ----------------------------------------------------------------------------------------------------

        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical("box");

        EditorGUILayout.LabelField("Source Prefab Folder:", EditorStyles.boldLabel);
        EditorGUILayout.LabelField(userSettings.c_sourceFolder);
        EditorGUILayout.LabelField("Tile Output Folder:", EditorStyles.boldLabel);
        EditorGUILayout.LabelField(userSettings.c_destinationFolder);

        EditorGUILayout.EndVertical();

        EditorGUILayout.EndScrollView();

        // ----------------------------------------------------------------------------------------------------
        // ------ GUI Changed
        // ----------------------------------------------------------------------------------------------------

        if (GUI.changed)
        {
            EditorUtility.SetDirty(userSettings);
        }
    }
Ejemplo n.º 23
0
    private void drawExpandedComponentTypeSelection(SerializedProperty componentPool)
    {
        EditorGUI.indentLevel++;
        using (new EditorGUILayout.VerticalScope("box"))
        {
            using (new EditorGUILayout.VerticalScope("box"))
            {
                SerializedProperty specialComponentTypeProperty = componentPool.FindPropertyRelative("SpecialComponentType");
                int oldSpecialComponentType = specialComponentTypeProperty.intValue;
                EditorGUILayout.PropertyField(specialComponentTypeProperty);
                if (specialComponentTypeProperty.intValue != oldSpecialComponentType)
                {
                    componentPool.FindPropertyRelative("ComponentTypes").ClearArray();
                    componentPool.FindPropertyRelative("ModTypes").ClearArray();
                }
                SerializedProperty allowedSourcesProperty = componentPool.FindPropertyRelative("AllowedSources");
                allowedSourcesProperty.intValue = EditorGUILayout.IntPopup("Source:", allowedSourcesProperty.intValue, new string[] { "Base", "Mods", "Base and Mods" }, new int[] { (int)KMComponentPool.ComponentSource.Base, (int)KMComponentPool.ComponentSource.Mods, (int)(KMComponentPool.ComponentSource.Base | KMComponentPool.ComponentSource.Mods) });
            }

            using (new EditorGUILayout.VerticalScope("box"))
            {
                GUILayout.Label("Specific types:");

                using (new EditorGUILayout.VerticalScope())
                {
                    using (new EditorGUILayout.HorizontalScope())
                    {
                        //Here we make an assumption that ComponentTypeFlags has individual solvable components,
                        //followed by individual needy components
                        Array componentTypes = Enum.GetValues(typeof(KMComponentPool.ComponentTypeEnum));

                        //Solvable
                        EditorGUILayout.BeginVertical();
                        EditorGUILayout.LabelField("Solvable:");
                        for (int i = 0; i < componentTypes.Length; i++)
                        {
                            KMComponentPool.ComponentTypeEnum componentType = (KMComponentPool.ComponentTypeEnum)componentTypes.GetValue(i);
                            if ((componentType >= KMComponentPool.ComponentTypeEnum.Wires) && (componentType < KMComponentPool.ComponentTypeEnum.NeedyVentGas))
                            {
                                drawToggle(componentPool, componentType);
                            }
                        }
                        EditorGUILayout.EndVertical();

                        //Needy
                        EditorGUILayout.BeginVertical();
                        EditorGUILayout.LabelField("Needy:");
                        for (int i = 0; i < componentTypes.Length; i++)
                        {
                            KMComponentPool.ComponentTypeEnum componentType = (KMComponentPool.ComponentTypeEnum)componentTypes.GetValue(i);
                            if (componentType >= KMComponentPool.ComponentTypeEnum.NeedyVentGas && componentType <= KMComponentPool.ComponentTypeEnum.NeedyKnob)
                            {
                                drawToggle(componentPool, componentType);
                            }
                        }
                        EditorGUILayout.EndVertical();
                    }

                    SerializedProperty modTypesProperty = componentPool.FindPropertyRelative("ModTypes");
                    EditorGUILayout.PropertyField(modTypesProperty, true);
                    for (int i = 0; i < modTypesProperty.arraySize; i++)
                    {
                        SerializedProperty element = modTypesProperty.GetArrayElementAtIndex(i);
                        element.stringValue = element.stringValue.Trim();
                    }

                    if (componentPool.FindPropertyRelative("ModTypes").arraySize != 0)
                    {
                        componentPool.FindPropertyRelative("SpecialComponentType").intValue = (int)KMComponentPool.SpecialComponentTypeEnum.None;
                    }
                }
            }
        }
        EditorGUILayout.Separator();
        EditorGUI.indentLevel--;
    }
Ejemplo n.º 24
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        MonoBehaviourAdapter.Adaptor clr = target as MonoBehaviourAdapter.Adaptor;
        var instance = clr.ILInstance;

        if (instance != null)
        {
            EditorGUILayout.LabelField("Script", clr.ILInstance.Type.Name);

            //如果JBehaviour
            var JBehaviourType = Init.appdomain.LoadedTypes["JEngine.Core.JBehaviour"];
            var t = instance.Type.ReflectionType;
            if (t.IsSubclassOf(JBehaviourType.ReflectionType))
            {
                var f  = t.GetField("_instanceID", BindingFlags.NonPublic);
                var id = f.GetValue(instance).ToString();
                EditorGUILayout.TextField("InstanceID", id);

                this.fadeGroup[0].target = EditorGUILayout.Foldout(this.fadeGroup[0].target,
                                                                   "JBehaviour Stats", true);
                if (EditorGUILayout.BeginFadeGroup(this.fadeGroup[0].faded))
                {
                    var  fm        = t.GetField("FrameMode", BindingFlags.Public);
                    bool frameMode = EditorGUILayout.Toggle("FrameMode", (bool)fm.GetValue(instance));
                    fm.SetValue(instance, frameMode);

                    var fq        = t.GetField("Frequency", BindingFlags.Public);
                    int frequency = EditorGUILayout.IntField("Frequency", (int)fq.GetValue(instance));
                    fq.SetValue(instance, frequency);

                    GUI.enabled = false;

                    var paused = t.GetField("Paused", BindingFlags.NonPublic);
                    EditorGUILayout.Toggle("Paused", (bool)paused.GetValue(instance));

                    var totalTime = t.GetField("TotalTime", BindingFlags.Public);
                    EditorGUILayout.FloatField("TotalTime", (float)totalTime.GetValue(instance));

                    var loopDeltaTime = t.GetField("LoopDeltaTime", BindingFlags.Public);
                    EditorGUILayout.FloatField("LoopDeltaTime", (float)loopDeltaTime.GetValue(instance));

                    var loopCounts = t.GetField("LoopCounts", BindingFlags.Public);
                    EditorGUILayout.LongField("LoopCounts", (long)loopCounts.GetValue(instance));

                    GUI.enabled = true;

                    var timeScale = t.GetField("TimeScale", BindingFlags.Public);
                    var ts        = EditorGUILayout.FloatField("TimeScale", (float)timeScale.GetValue(instance));
                    timeScale.SetValue(instance, ts);
                }
                EditorGUILayout.EndFadeGroup();

                if (instance.Type.FieldMapping.Count > 0)
                {
                    EditorGUILayout.Space(10);
                    EditorGUILayout.HelpBox($"{t.Name} variables", MessageType.Info);
                }
            }

            int index = 0;
            foreach (var i in instance.Type.FieldMapping)
            {
                //这里是取的所有字段,没有处理不是public的
                var name = i.Key;
                var type = instance.Type.FieldTypes[index];
                index++;

                var    cType = type.TypeForCLR;
                object obj   = instance[i.Value];
                if (cType.IsPrimitive) //如果是基础类型
                {
                    try
                    {
                        if (cType == typeof(float))
                        {
                            instance[i.Value] = EditorGUILayout.FloatField(name, (float)instance[i.Value]);
                        }
                        else if (cType == typeof(double))
                        {
                            instance[i.Value] = EditorGUILayout.DoubleField(name, (float)instance[i.Value]);
                        }
                        else if (cType == typeof(int))
                        {
                            instance[i.Value] = EditorGUILayout.IntField(name, (int)instance[i.Value]);
                        }
                        else if (cType == typeof(long))
                        {
                            instance[i.Value] = EditorGUILayout.LongField(name, (long)instance[i.Value]);
                        }
                        else if (cType == typeof(bool))
                        {
                            var result = bool.TryParse(instance[i.Value].ToString(), out var value);
                            if (!result)
                            {
                                value = instance[i.Value].ToString() == "1";
                            }
                            instance[i.Value] = EditorGUILayout.Toggle(name, value);
                        }
                        else
                        {
                            EditorGUILayout.LabelField(name, instance[i.Value].ToString());
                        }
                    }
                    catch (Exception e)
                    {
                        Log.PrintError($"无法序列化{name},{e.Message}");
                        EditorGUILayout.LabelField(name, instance[i.Value].ToString());
                    }
                }
                else
                {
                    if (cType == typeof(string))
                    {
                        if (obj != null)
                        {
                            instance[i.Value] = EditorGUILayout.TextField(name, (string)instance[i.Value]);
                        }
                        else
                        {
                            instance[i.Value] = EditorGUILayout.TextField(name, "");
                        }
                    }
                    else if (cType == typeof(JsonData))//可以折叠显示Json数据
                    {
                        if (instance[i.Value] != null)
                        {
                            this.fadeGroup[1].target = EditorGUILayout.Foldout(this.fadeGroup[1].target, name, true);
                            if (EditorGUILayout.BeginFadeGroup(this.fadeGroup[1].faded))
                            {
                                instance[i.Value] = EditorGUILayout.TextArea(
                                    ((JsonData)instance[i.Value]).ToString()
                                    );
                            }
                            EditorGUILayout.EndFadeGroup();
                            EditorGUILayout.Space();
                        }
                        else
                        {
                            EditorGUILayout.LabelField(name, "暂无值的JsonData");
                        }
                    }
                    else if (typeof(UnityEngine.Object).IsAssignableFrom(cType))
                    {
                        if (obj == null && cType == typeof(MonoBehaviourAdapter.Adaptor))
                        {
                            EditorGUILayout.LabelField(name, "未赋值的热更类");
                            break;
                        }

                        if (cType == typeof(MonoBehaviourAdapter.Adaptor))
                        {
                            try
                            {
                                var clrInstance = ClassBindMgr.FindObjectsOfTypeAll <MonoBehaviourAdapter.Adaptor>()
                                                  .Find(adaptor =>
                                                        adaptor.ILInstance == instance[i.Value]);
                                GUI.enabled = true;
                                EditorGUILayout.ObjectField(name, clrInstance.gameObject, typeof(GameObject), true);
                                GUI.enabled = false;
                            }
                            catch
                            {
                                EditorGUILayout.LabelField(name, "未赋值的热更类");
                            }

                            break;
                        }

                        //处理Unity类型
                        var res = EditorGUILayout.ObjectField(name, obj as UnityEngine.Object, cType, true);
                        instance[i.Value] = res;
                    }
                    //可绑定值,可以尝试更改
                    else if (type.ReflectionType.ToString().Contains("BindableProperty") && obj != null)
                    {
                        PropertyInfo fi  = type.ReflectionType.GetProperty("Value");
                        object       val = fi.GetValue(obj);

                        string genericTypeStr = type.ReflectionType.ToString().Split('`')[1].Replace("1<", "")
                                                .Replace(">", "");
                        Type genericType = Type.GetType(genericTypeStr);
                        if (genericType == null || (!genericType.IsPrimitive && genericType != typeof(string))) //不是基础类型或字符串
                        {
                            EditorGUILayout.LabelField(name, val.ToString());                                   //只显示字符串
                        }
                        else
                        {
                            //可更改
                            var data = ConvertSimpleType(EditorGUILayout.TextField(name, val.ToString()), genericType);
                            if (data != null)//尝试更改
                            {
                                fi.SetValue(obj, data);
                            }
                        }
                    }
                    else
                    {
                        //其他类型现在没法处理
                        if (obj != null)
                        {
                            var clrInstance = ClassBindMgr.FindObjectsOfTypeAll <MonoBehaviourAdapter.Adaptor>()
                                              .Find(adaptor =>
                                                    adaptor.ILInstance.Equals(instance[i.Value]));
                            if (clrInstance != null)
                            {
                                GUI.enabled = true;
                                EditorGUILayout.ObjectField(name, clrInstance.gameObject, typeof(GameObject), true);
                                GUI.enabled = false;
                            }
                            else
                            {
                                EditorGUILayout.LabelField(name, obj.ToString());
                            }
                        }
                        else
                        {
                            EditorGUILayout.LabelField(name, "(null)");
                        }
                    }
                }
            }
        }

        // 应用属性修改
        this.serializedObject.ApplyModifiedProperties();
    }
Ejemplo n.º 25
0
 /// <summary>
 /// Begins drawing a box with a label header (scroll version).
 /// </summary>
 /// <param name="scroll"></param>
 /// <param name="label"></param>
 /// <returns></returns>
 public static Vector2 BeginBox(Vector2 scroll, string label)
 {
     BeginBoxHeader();
     EditorGUILayout.LabelField(Label(label), Styles.Header);
     return(EndBoxHeaderBeginContent(scroll));
 }
Ejemplo n.º 26
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            SerializedProperty serverUrl = serializedObject.FindProperty("ServerUrl");

            serverUrl.stringValue = BacktraceConfiguration.UpdateServerUrl(serverUrl.stringValue);
            EditorGUILayout.PropertyField(serverUrl, new GUIContent(BacktraceConfigurationLabels.LABEL_SERVER_URL));
            if (!BacktraceConfiguration.ValidateServerUrl(serverUrl.stringValue))
            {
                EditorGUILayout.HelpBox("Please insert valid Backtrace server url!", MessageType.Error);
            }

            EditorGUILayout.PropertyField(
                serializedObject.FindProperty("HandleUnhandledExceptions"),
                new GUIContent(BacktraceConfigurationLabels.LABEL_HANDLE_UNHANDLED_EXCEPTION));

            EditorGUILayout.PropertyField(
                serializedObject.FindProperty("ReportPerMin"),
                new GUIContent(BacktraceConfigurationLabels.LABEL_REPORT_PER_MIN));

            GUIStyle clientAdvancedSettingsFoldout = new GUIStyle(EditorStyles.foldout);

            showClientAdvancedSettings = EditorGUILayout.Foldout(showClientAdvancedSettings, "Client advanced settings", clientAdvancedSettingsFoldout);
            if (showClientAdvancedSettings)
            {
#if UNITY_2018_4_OR_NEWER
                EditorGUILayout.PropertyField(
                    serializedObject.FindProperty("IgnoreSslValidation"),
                    new GUIContent(BacktraceConfigurationLabels.LABEL_IGNORE_SSL_VALIDATION));
#endif
#if UNITY_ANDROID || UNITY_IOS
                EditorGUILayout.PropertyField(
                    serializedObject.FindProperty("HandleANR"),
                    new GUIContent(BacktraceConfigurationLabels.LABEL_HANDLE_ANR));

                EditorGUILayout.PropertyField(
                    serializedObject.FindProperty("OomReports"),
                    new GUIContent(BacktraceConfigurationLabels.LABEL_HANDLE_OOM));

#if UNITY_2019_2_OR_NEWER && UNITY_ANDROID
                EditorGUILayout.PropertyField(
                    serializedObject.FindProperty("SymbolsUploadToken"),
                    new GUIContent(BacktraceConfigurationLabels.LABEL_SYMBOLS_UPLOAD_TOKEN));
#endif
#endif
                EditorGUILayout.PropertyField(
                    serializedObject.FindProperty("UseNormalizedExceptionMessage"),
                    new GUIContent(BacktraceConfigurationLabels.LABEL_USE_NORMALIZED_EXCEPTION_MESSAGE));
#if UNITY_STANDALONE_WIN
                EditorGUILayout.PropertyField(
                    serializedObject.FindProperty("SendUnhandledGameCrashesOnGameStartup"),
                    new GUIContent(BacktraceConfigurationLabels.LABEL_SEND_UNHANDLED_GAME_CRASHES_ON_STARTUP));
#endif

                EditorGUILayout.PropertyField(
                    serializedObject.FindProperty("ReportFilterType"),
                    new GUIContent(BacktraceConfigurationLabels.LABEL_REPORT_FILTER));

                EditorGUILayout.PropertyField(
                    serializedObject.FindProperty("NumberOfLogs"),
                    new GUIContent(BacktraceConfigurationLabels.LABEL_NUMBER_OF_LOGS));

                EditorGUILayout.PropertyField(
                    serializedObject.FindProperty("PerformanceStatistics"),
                    new GUIContent(BacktraceConfigurationLabels.LABEL_PERFORMANCE_STATISTICS));

                EditorGUILayout.PropertyField(
                    serializedObject.FindProperty("DestroyOnLoad"),
                    new GUIContent(BacktraceConfigurationLabels.LABEL_DESTROY_CLIENT_ON_SCENE_LOAD));

                EditorGUILayout.PropertyField(
                    serializedObject.FindProperty("Sampling"),
                    new GUIContent(BacktraceConfigurationLabels.LABEL_SAMPLING));

                SerializedProperty gameObjectDepth = serializedObject.FindProperty("GameObjectDepth");
                EditorGUILayout.PropertyField(gameObjectDepth, new GUIContent(BacktraceConfigurationLabels.LABEL_GAME_OBJECT_DEPTH));

                if (gameObjectDepth.intValue < -1)
                {
                    EditorGUILayout.HelpBox("Please insert value greater or equal -1", MessageType.Error);
                }
            }
#if !UNITY_SWITCH
            SerializedProperty enabled = serializedObject.FindProperty("Enabled");
            EditorGUILayout.PropertyField(enabled, new GUIContent(BacktraceConfigurationLabels.LABEL_ENABLE_DATABASE));
            bool databaseEnabled = enabled.boolValue;
#else
            bool databaseEnabled = false;
#endif
            if (databaseEnabled)
            {
                SerializedProperty databasePath = serializedObject.FindProperty("DatabasePath");
                EditorGUILayout.PropertyField(databasePath, new GUIContent(BacktraceConfigurationLabels.LABEL_PATH));
                if (string.IsNullOrEmpty(databasePath.stringValue))
                {
                    EditorGUILayout.HelpBox("Please insert valid Backtrace database path!", MessageType.Error);
                }


                GUIStyle databaseFoldout = new GUIStyle(EditorStyles.foldout);
                showDatabaseSettings = EditorGUILayout.Foldout(showDatabaseSettings, "Advanced database settings", databaseFoldout);
                if (showDatabaseSettings)
                {
                    EditorGUILayout.PropertyField(
                        serializedObject.FindProperty("DeduplicationStrategy"),
                        new GUIContent(BacktraceConfigurationLabels.LABEL_DEDUPLICATION_RULES));

#if UNITY_STANDALONE_WIN
                    EditorGUILayout.PropertyField(
                        serializedObject.FindProperty("MinidumpType"),
                        new GUIContent(BacktraceConfigurationLabels.LABEL_MINIDUMP_SUPPORT));
#endif

#if UNITY_STANDALONE_LINUX || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                    EditorGUILayout.PropertyField(
                        serializedObject.FindProperty("AddUnityLogToReport"),
                        new GUIContent(BacktraceConfigurationLabels.LABEL_ADD_UNITY_LOG));
#endif

#if UNITY_ANDROID || UNITY_IOS
                    EditorGUILayout.PropertyField(
                        serializedObject.FindProperty("CaptureNativeCrashes"),
                        new GUIContent(BacktraceConfigurationLabels.CAPTURE_NATIVE_CRASHES));
#endif
                    EditorGUILayout.PropertyField(
                        serializedObject.FindProperty("AutoSendMode"),
                        new GUIContent(BacktraceConfigurationLabels.LABEL_AUTO_SEND_MODE));

                    EditorGUILayout.PropertyField(
                        serializedObject.FindProperty("CreateDatabase"),
                        new GUIContent(BacktraceConfigurationLabels.LABEL_CREATE_DATABASE_DIRECTORY));

                    EditorGUILayout.PropertyField(
                        serializedObject.FindProperty("GenerateScreenshotOnException"),
                        new GUIContent(BacktraceConfigurationLabels.LABEL_GENERATE_SCREENSHOT_ON_EXCEPTION));

                    SerializedProperty maxRecordCount = serializedObject.FindProperty("MaxRecordCount");
                    EditorGUILayout.PropertyField(maxRecordCount, new GUIContent(BacktraceConfigurationLabels.LABEL_MAX_REPORT_COUNT));

                    SerializedProperty maxDatabaseSize = serializedObject.FindProperty("MaxDatabaseSize");
                    EditorGUILayout.PropertyField(maxDatabaseSize, new GUIContent(BacktraceConfigurationLabels.LABEL_MAX_DATABASE_SIZE));

                    SerializedProperty retryInterval = serializedObject.FindProperty("RetryInterval");
                    EditorGUILayout.PropertyField(retryInterval, new GUIContent(BacktraceConfigurationLabels.LABEL_RETRY_INTERVAL));

                    EditorGUILayout.LabelField("Backtrace database require at least one retry.");
                    SerializedProperty retryLimit = serializedObject.FindProperty("RetryLimit");
                    EditorGUILayout.PropertyField(retryLimit, new GUIContent(BacktraceConfigurationLabels.LABEL_RETRY_LIMIT));

                    SerializedProperty retryOrder = serializedObject.FindProperty("RetryOrder");
                    EditorGUILayout.PropertyField(retryOrder, new GUIContent(BacktraceConfigurationLabels.LABEL_RETRY_ORDER));
                }
            }
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 27
0
        void DrawBezierPathInspector()
        {
            using (var check = new EditorGUI.ChangeCheckScope())
            {
                // Path options:
                Data.showPathOptions = EditorGUILayout.Foldout(Data.showPathOptions, new GUIContent("Bézier Path Options"), true, boldFoldoutStyle);
                if (Data.showPathOptions)
                {
                    BezierPath.Space            = (PathSpace)EditorGUILayout.Popup("Space", (int)BezierPath.Space, spaceNames);
                    BezierPath.ControlPointMode = (BezierPath.ControlMode)EditorGUILayout.EnumPopup(new GUIContent("Control Mode"), BezierPath.ControlPointMode);
                    if (BezierPath.ControlPointMode == BezierPath.ControlMode.Automatic)
                    {
                        BezierPath.AutoControlLength = EditorGUILayout.Slider(new GUIContent("Control Spacing"), BezierPath.AutoControlLength, 0, 1);
                    }

                    BezierPath.IsClosed    = EditorGUILayout.Toggle("Closed Path", BezierPath.IsClosed);
                    Data.showTransformTool = EditorGUILayout.Toggle(new GUIContent("Enable Transforms"), Data.showTransformTool);

                    Tools.hidden = !Data.showTransformTool;

                    // Check if out of bounds (can occur after undo operations)
                    if (handleIndexToDisplayAsTransform >= BezierPath.NumPoints)
                    {
                        handleIndexToDisplayAsTransform = -1;
                    }

                    // If a point has been selected
                    if (handleIndexToDisplayAsTransform != -1)
                    {
                        EditorGUILayout.LabelField("Selected Point:");

                        using (new EditorGUI.IndentLevelScope())
                        {
                            var currentPosition = creator.BezierPath[handleIndexToDisplayAsTransform];
                            var newPosition     = EditorGUILayout.Vector3Field("Position", currentPosition);
                            if (newPosition != currentPosition)
                            {
                                Undo.RecordObject(creator, "Move point");
                                creator.BezierPath.MovePoint(handleIndexToDisplayAsTransform, newPosition);
                            }
                            // Don't draw the angle field if we aren't selecting an anchor point/not in 3d space
                            if (handleIndexToDisplayAsTransform % 3 == 0 && creator.BezierPath.Space == PathSpace.xyz)
                            {
                                var anchorIndex  = handleIndexToDisplayAsTransform / 3;
                                var currentAngle = creator.BezierPath.GetAnchorNormalAngle(anchorIndex);
                                var newAngle     = EditorGUILayout.FloatField("Angle", currentAngle);
                                if (newAngle != currentAngle)
                                {
                                    Undo.RecordObject(creator, "Set Angle");
                                    creator.BezierPath.SetAnchorNormalAngle(anchorIndex, newAngle);
                                }
                            }
                        }
                    }

                    if (Data.showTransformTool & (handleIndexToDisplayAsTransform == -1))
                    {
                        if (GUILayout.Button("Centre Transform"))
                        {
                            Vector3 worldCentre  = BezierPath.CalculateBoundsWithTransform(creator.transform).center;
                            Vector3 transformPos = creator.transform.position;

                            if (BezierPath.Space == PathSpace.xy)
                            {
                                transformPos = new Vector3(transformPos.x, transformPos.y, 0);
                            }
                            else if (BezierPath.Space == PathSpace.xz)
                            {
                                transformPos = new Vector3(transformPos.x, 0, transformPos.z);
                            }

                            Vector3 worldCentreToTransform = transformPos - worldCentre;

                            if (worldCentre != creator.transform.position)
                            {
                                //Undo.RecordObject (creator, "Centralize Transform");
                                if (worldCentreToTransform != Vector3.zero)
                                {
                                    Vector3 localCentreToTransform = MathUtility.InverseTransformVector(worldCentreToTransform, creator.transform, BezierPath.Space);
                                    for (int i = 0; i < BezierPath.NumPoints; i++)
                                    {
                                        BezierPath.SetPoint(i, BezierPath.GetPoint(i) + localCentreToTransform, true);
                                    }
                                }

                                creator.transform.position = worldCentre;
                                BezierPath.NotifyPathModified();
                            }
                        }
                    }

                    if (GUILayout.Button("Reset Path"))
                    {
                        Undo.RecordObject(creator, "Reset Path");
                        bool in2DEditorMode = EditorSettings.defaultBehaviorMode == EditorBehaviorMode.Mode2D;
                        Data.ResetBezierPath(creator.transform.position, in2DEditorMode);
                        EditorApplication.QueuePlayerLoopUpdate();
                    }

                    GUILayout.Space(inspectorSectionSpacing);
                }

                Data.showNormals = EditorGUILayout.Foldout(Data.showNormals, new GUIContent("Normals Options"), true, boldFoldoutStyle);
                if (Data.showNormals)
                {
                    BezierPath.FlipNormals = EditorGUILayout.Toggle(new GUIContent("Flip Normals"), BezierPath.FlipNormals);
                    if (BezierPath.Space == PathSpace.xyz)
                    {
                        BezierPath.GlobalNormalsAngle = EditorGUILayout.Slider(new GUIContent("Global Angle"), BezierPath.GlobalNormalsAngle, 0, 360);

                        if (GUILayout.Button("Reset Normals"))
                        {
                            Undo.RecordObject(creator, "Reset Normals");
                            BezierPath.FlipNormals = false;
                            BezierPath.ResetNormalAngles();
                        }
                    }
                    GUILayout.Space(inspectorSectionSpacing);
                }

                // Editor display options
                Data.showDisplayOptions = EditorGUILayout.Foldout(Data.showDisplayOptions, new GUIContent("Display Options"), true, boldFoldoutStyle);
                if (Data.showDisplayOptions)
                {
                    Data.showPathBounds       = GUILayout.Toggle(Data.showPathBounds, new GUIContent("Show Path Bounds"));
                    Data.showPerSegmentBounds = GUILayout.Toggle(Data.showPerSegmentBounds, new GUIContent("Show Segment Bounds"));
                    Data.displayAnchorPoints  = GUILayout.Toggle(Data.displayAnchorPoints, new GUIContent("Show Anchor Points"));

                    if (!(BezierPath.ControlPointMode == BezierPath.ControlMode.Automatic && GlobalDisplaySettings.hideAutoControls))
                    {
                        Data.displayControlPoints = GUILayout.Toggle(Data.displayControlPoints, new GUIContent("Show Control Points"));
                    }

                    Data.keepConstantHandleSize = GUILayout.Toggle(Data.keepConstantHandleSize, new GUIContent("Constant Point Size", constantSizeTooltip));
                    Data.bezierHandleScale      = Mathf.Max(0, EditorGUILayout.FloatField(new GUIContent("Handle Scale"), Data.bezierHandleScale));
                    DrawGlobalDisplaySettingsInspector();
                }

                if (check.changed)
                {
                    SceneView.RepaintAll();
                    EditorApplication.QueuePlayerLoopUpdate();
                }
            }
        }
Ejemplo n.º 28
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            head                      = serializedObject.FindProperty("head");
            handLeft                  = serializedObject.FindProperty("handLeft");
            handRight                 = serializedObject.FindProperty("handRight");
            handLeftModel             = serializedObject.FindProperty("handLeftModel");
            handRightModel            = serializedObject.FindProperty("handRightModel");
            mainHand                  = serializedObject.FindProperty("mainHand");
            gestureButton             = serializedObject.FindProperty("gestureButton");
            menuButton                = serializedObject.FindProperty("menuButton");
            displayGestureTrail       = serializedObject.FindProperty("displayGestureTrail");
            useCustomControllerModels = serializedObject.FindProperty("useCustomControllerModels");
            //playerID = serializedObject.FindProperty("playerID");

            VRGestureRig vrGestureRig = (VRGestureRig)target;

            EditorGUILayout.LabelField("HINT: Float over variable names for tooltips");

            #if EDWON_VR_OCULUS || EDWON_VR_STEAM
            if (GUILayout.Button(new GUIContent("Auto Setup",
                                                "Press Auto Setup to automatically fill in the needed variables from the camera rig")))
            {
                vrGestureRig.AutoSetup();
            }
            #endif

            EditorGUILayout.PropertyField(head, new GUIContent("Head",
                                                               "the head transform on the VR camera rig"));
            EditorGUILayout.PropertyField(handLeft, new GUIContent("Hand Left",
                                                                   "the left hand transform on the VR camera rig"));
            EditorGUILayout.PropertyField(handRight, new GUIContent("Hand Right",
                                                                    "the right hand transform on the VR camera rig"));
            EditorGUILayout.PropertyField(mainHand, new GUIContent("Main Hand",
                                                                   "hand to record (single handed) gestures with, the VR UI will show up on the opposite hand of this one"));
            EditorGUILayout.PropertyField(gestureButton, new GUIContent("Gesture Button",
                                                                        "button to record/capture gestures with, see documentation for button mappings on Oculus vs. Vive"));
            EditorGUILayout.PropertyField(menuButton, new GUIContent("Menu Button",
                                                                     "button to use for clicking on the VRUI menu, see documentation for button mappings on Oculus vs. Vive"));
            //EditorGUILayout.PropertyField(playerID, new GUIContent("Player ID",
            //    "Used for multiplayer support, coming soon, for now this should always be zero"));

            EditorGUILayout.PropertyField(displayGestureTrail, new GUIContent("Display Gesture Trail",
                                                                              "toggle this to turn off the default line that is drawn while recording/capturing gestures, see documentation for instructions on creating a custom trail"));

            vrGestureRig.spawnControllerModels = EditorGUILayout.Toggle(new GUIContent("Spawn Controller Models",
                                                                                       "spawns controllers models (included with this plugin) so players can see their controllers in VR, unecessary if you want to use custom controller models or the platform defaults"),
                                                                        vrGestureRig.spawnControllerModels);

            if (vrGestureRig.spawnControllerModels)
            {
                EditorGUILayout.PropertyField(useCustomControllerModels, new GUIContent("Use Custom Controller Models",
                                                                                        "You can use your own custom models, just toggle this on and drop your controller models in the fields below"));
                if (vrGestureRig.useCustomControllerModels)
                {
                    EditorGUILayout.PropertyField(handLeftModel);
                    EditorGUILayout.PropertyField(handRightModel);
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
    public override void OnInspectorGUI()
    {
        FFMPEGImagesToVideo script = target as FFMPEGImagesToVideo;

        serializedObject.Update();

        EditorGUILayout.BeginVertical("HelpBox");
        EditorGUILayout.LabelField("Video Settings", EditorStyles.boldLabel);

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PropertyField(workingDirectory);
        if (GUILayout.Button("Browse"))
        {
            workingDirectory.stringValue = EditorUtility.OpenFolderPanel("Images Folder", "", "");
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.PropertyField(inputName);
        EditorGUILayout.PropertyField(outputName);

        if (!overwrite.boolValue && File.Exists(workingDirectory.stringValue + "/" + outputName.stringValue))
        {
            EditorGUILayout.HelpBox("A file with that name already exists.", MessageType.Warning);
        }

        EditorGUILayout.PropertyField(overwrite);

        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical("HelpBox");

        EditorGUILayout.LabelField("Audio Settings", EditorStyles.boldLabel);

        EditorGUILayout.PropertyField(useAudio);

        if (useAudio.boolValue)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(audioPath);
            if (GUILayout.Button("Browse"))
            {
                audioPath.stringValue = EditorUtility.OpenFilePanel("Audio File", "", "");
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.PropertyField(audioStartTime);
        }

        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical("HelpBox");

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Conversion Settings", EditorStyles.boldLabel);

        EditorGUILayout.PropertyField(startingFrameNumber);
        EditorGUILayout.PropertyField(framerate);
        EditorGUILayout.IntSlider(compression, 0, 51);

        EditorGUILayout.Space();

        EditorGUILayout.PropertyField(convertOnQuit);
        if (GUILayout.Button("Convert Now"))
        {
            script.FFMPEGConvertImagesToVideo();
        }

        EditorGUILayout.EndVertical();

        serializedObject.ApplyModifiedProperties();
    }
        public override void OnInspectorGUI()
        {
            var exportSettings = ((ExportModelSettings)target).info;

            EditorGUIUtility.labelWidth = LabelWidth;

            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Export Format", "Export the FBX file in the standard binary format." +
                                                      " Select ASCII to export the FBX file in ASCII format."), GUILayout.Width(LabelWidth - FieldOffset));
            exportSettings.SetExportFormat((ExportSettings.ExportFormat)EditorGUILayout.Popup((int)exportSettings.ExportFormat, exportFormatOptions));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Include", "Select whether to export models, animation or both."), GUILayout.Width(LabelWidth - FieldOffset));
            EditorGUI.BeginDisabledGroup(disableIncludeDropdown);
            exportSettings.SetModelAnimIncludeOption((ExportSettings.Include)EditorGUILayout.Popup((int)exportSettings.ModelAnimIncludeOption, includeOptions));
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("LOD level", "Select which LOD to export."), GUILayout.Width(LabelWidth - FieldOffset));
            // greyed out if animation only
            EditorGUI.BeginDisabledGroup(exportSettings.ModelAnimIncludeOption == ExportSettings.Include.Anim);
            exportSettings.SetLODExportType((ExportSettings.LODExportType)EditorGUILayout.Popup((int)exportSettings.LODExportType, lodOptions));
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Object(s) Position", "Select an option for exporting object's transform."), GUILayout.Width(LabelWidth - FieldOffset));
            // greyed out if animation only
            EditorGUI.BeginDisabledGroup(exportSettings.ModelAnimIncludeOption == ExportSettings.Include.Anim);
            exportSettings.SetObjectPosition((ExportSettings.ObjectPosition)EditorGUILayout.Popup((int)exportSettings.ObjectPosition, objPositionOptions));
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Animated Skinned Mesh",
                                                      "If checked, animation on objects with skinned meshes will be exported"), GUILayout.Width(LabelWidth - FieldOffset));
            // greyed out if model
            EditorGUI.BeginDisabledGroup(exportSettings.ModelAnimIncludeOption == ExportSettings.Include.Model);
            exportSettings.SetAnimatedSkinnedMesh(EditorGUILayout.Toggle(exportSettings.AnimateSkinnedMesh));
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Compatible Naming",
                                                      "In Maya some symbols such as spaces and accents get replaced when importing an FBX " +
                                                      "(e.g. \"foo bar\" becomes \"fooFBXASC032bar\"). " +
                                                      "On export, convert the names of GameObjects so they are Maya compatible." +
                                                      (exportSettings.UseMayaCompatibleNames ? "" :
                                                       "\n\nWARNING: Disabling this feature may result in lost material connections," +
                                                       " and unexpected character replacements in Maya.")),
                                       GUILayout.Width(LabelWidth - FieldOffset));
            exportSettings.SetUseMayaCompatibleNames(EditorGUILayout.Toggle(exportSettings.UseMayaCompatibleNames));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Export Unrendered",
                                                      "If checked, meshes will be exported even if they don't have a Renderer component."), GUILayout.Width(LabelWidth - FieldOffset));
            // greyed out if animation only
            EditorGUI.BeginDisabledGroup(exportSettings.ModelAnimIncludeOption == ExportSettings.Include.Anim);
            exportSettings.SetExportUnredererd(EditorGUILayout.Toggle(exportSettings.ExportUnrendered));
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Preserve Import Settings",
                                                      "If checked, the import settings from the overwritten FBX will be carried over to the new version."), GUILayout.Width(LabelWidth - FieldOffset));
            // greyed out if exporting outside assets folder
            EditorGUI.BeginDisabledGroup(m_exportingOutsideProject);
            exportSettings.SetPreserveImportSettings(EditorGUILayout.Toggle(exportSettings.PreserveImportSettings));
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Keep Instances",
                                                      "If enabled, instances will be preserved as instances in the FBX file. This can cause issues with e.g. Blender if different instances have different materials assigned."),
                                       GUILayout.Width(LabelWidth - FieldOffset));
            exportSettings.SetKeepInstances(EditorGUILayout.Toggle(exportSettings.KeepInstances));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Embed Textures",
                                                      "If enabled, textures are embedded into the resulting FBX file instead of referenced."), GUILayout.Width(LabelWidth - FieldOffset));
            exportSettings.SetEmbedTextures(EditorGUILayout.Toggle(exportSettings.EmbedTextures));
            GUILayout.EndHorizontal();
        }