Exemple #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            Character t = target as Character;

            EditorGUILayout.PropertyField(nameTextProp, new GUIContent("Name Text", "Name of the character display in the dialog"));
            EditorGUILayout.PropertyField(nameColorProp, new GUIContent("Name Color", "Color of name text display in the dialog"));
            EditorGUILayout.PropertyField(soundEffectProp, new GUIContent("Sound Effect", "Sound to play when the character is talking. Overrides the setting in the Dialog."));
            EditorGUILayout.PropertyField(descriptionProp, new GUIContent("Description", "Notes about this story character (personality, attibutes, etc.)"));
            if (t.portraits != null &&
                t.portraits.Count > 0)
            {
                t.profileSprite = t.portraits[0];
            }
            else
            {
                t.profileSprite = null;
            }

            if (t.profileSprite != null)
            {
                Texture2D characterTexture = t.profileSprite.texture;
                float     aspect           = (float)characterTexture.width / (float)characterTexture.height;
                Rect      previewRect      = GUILayoutUtility.GetAspectRect(aspect, GUILayout.Width(100), GUILayout.ExpandWidth(true));
                if (characterTexture != null)
                {
                    GUI.DrawTexture(previewRect, characterTexture, ScaleMode.ScaleToFit, true, aspect);
                }
            }
            ReorderableListGUI.Title(new GUIContent("Portraits", "Character image sprites to display in the dialog"));
            ReorderableListGUI.ListField(portraitsProp);
            string[] facingArrows = new string[]
            {
                "FRONT",
                "<--",
                "-->",
            };
            portraitsFaceProp.enumValueIndex = EditorGUILayout.Popup("Portraits Face", (int)portraitsFaceProp.enumValueIndex, facingArrows);

            EditorGUILayout.Separator();

            EditorUtility.SetDirty(t);

            serializedObject.ApplyModifiedProperties();
        }
        //---------------------------------------------------------------------
        // Helpers
        //---------------------------------------------------------------------

        private void CustomGUILayout()
        {
            EditorGUILayout.Space();

            // Sky

            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.LabelField("Sky", EditorStyles.boldLabel);
            EditorGUILayout.EndVertical();

            _showSkyDotParams = EditorGUILayout.Foldout(_showSkyDotParams, _skyParamsLabel);
            EditorGUILayout.Space();
            if (_showSkyDotParams)
            {
                SkyParamsHeader();
                ReorderableListGUI.ListField(_skyDotParams);
            }

            // Stars

            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.LabelField("Stars", EditorStyles.boldLabel);
            EditorGUILayout.EndVertical();

            _showStarsDotParams = EditorGUILayout.Foldout(_showStarsDotParams, _starsParamsLabel);
            EditorGUILayout.Space();
            if (_showStarsDotParams)
            {
                StarsParamsHeader();
                ReorderableListGUI.ListField(_starsDotParams);
            }

            // Clouds

            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.LabelField("Clouds", EditorStyles.boldLabel);
            EditorGUILayout.EndVertical();

            _showCloudsDotParams = EditorGUILayout.Foldout(_showCloudsDotParams, _cloudsParamsLabel);
            EditorGUILayout.Space();
            if (_showCloudsDotParams)
            {
                CloudsParamsHeader();
                ReorderableListGUI.ListField(_cloudsDotParams);
            }
        }
        protected override void OnServiceUI()
        {
            using (new SA_WindowBlockWithSpace(new GUIContent("Customization"))) {
                EditorGUILayout.HelpBox("A notification is a message that Android displays outside your app's UI " +
                                        "to provide the user with reminders, communication from other people, or other timely information " +
                                        "from your app. Users can tap the notification to open your app or take an action directly from the notification.",
                                        MessageType.Info);

                ReorderableListGUI.Title("Custom Icons (*" + k_RequiredIconExtension + ")");
                ReorderableListGUI.ListField(AN_EditorSettings.Instance.NotificationIcons, DrawIconField, DrawEmptyIcons);
                ValidateAssets(AN_EditorSettings.Instance.NotificationIcons, AN_Settings.ANDROID_DRAWABLE_PATH, k_RequiredIconExtension);
                EditorGUILayout.Space();

                ReorderableListGUI.Title("Custom Sounds (*" + k_RequiredSoundExtension + ")");
                ReorderableListGUI.ListField(AN_EditorSettings.Instance.NotificationAlertSounds, DrawSoundField, DrawEmptySounds);
                ValidateAssets(AN_EditorSettings.Instance.NotificationAlertSounds, AN_Settings.ANDROID_RAW_PATH, k_RequiredSoundExtension);
            }
        }
        private void DrawToolsTab()
        {
            EditorGUI.BeginChangeCheck();
            ReorderableListGUI.Title(TileLang.Text("Tool Palette:"));
            ReorderableListGUI.ListField(this.toolsAdaptor, ReorderableListFlags.HideAddButton | ReorderableListFlags.HideRemoveButtons);
            if (EditorGUI.EndChangeCheck())
            {
                ToolManagementSettings.SaveToolOrdering();
                ToolUtility.RepaintToolPalette();
            }

            ExtraEditorGUI.TrailingTip(TileLang.Text("Specify which tools appear in the tools palette."));
            GUILayout.Space(5);

            RtsPreferences.AutoShowToolPalette.Value = EditorGUILayout.ToggleLeft(TileLang.Text("Automatically show tool palette upon activating tool"), RtsPreferences.AutoShowToolPalette);

            GUILayout.Space(5);
        }
Exemple #5
0
        /// <summary>
        /// Draws the settings window and the main translation view where all the keys are.
        /// </summary>
        void DrawMainTranslationView()
        {
            ReorderableListGUI.Title("Язык - " + thisLanguage);
            EditorGUILayout.Space();

            settingsContextMenu.Draw(settingsAdaptor);

            GUILayout.Label("Языковые значения", EditorStyles.boldLabel);

            bool shouldRepaintColumns = listColumns.DrawColumns();

            if (shouldRepaintColumns)
            {
                shouldRepaint = true;
            }

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
            localizedObjectContextMenu.Draw(localizedObjectAdaptor);
            EditorGUILayout.EndScrollView();

            if (guiChanged)
            {
                GUILayout.Label("- У вас есть несохраненные изменения", EditorStyles.miniLabel);
            }

            //If any changes to the gui is made
            if (GUI.changed)
            {
                guiChanged = true;
            }

            GUILayout.Label("Сохранить изменения", EditorStyles.boldLabel);
            GUILayout.Label("Не забывайте всегда нажимать сохранить, когда вы изменили значения", EditorStyles.miniLabel);
            if (GUILayout.Button("Сохранить/Восстановить"))
            {
                SaveAndRebuild();
            }

            if (shouldRepaint)
            {
                Repaint();
                shouldRepaint = false;
            }
        }
        /// <summary>
        /// Draws the settings window and the main translation view where all the keys are.
        /// </summary>
        void DrawMainTranslationView()
        {
            ReorderableListGUI.Title("Language - " + thisLanguage);
            EditorGUILayout.Space();

            settingsContextMenu.Draw(settingsAdaptor);

            GUILayout.Label("Language Values", EditorStyles.boldLabel);

            bool shouldRepaintColumns = listColumns.DrawColumns();

            if (shouldRepaintColumns)
            {
                shouldRepaint = true;
            }

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
            localizedObjectContextMenu.Draw(localizedObjectAdaptor);
            EditorGUILayout.EndScrollView();

            if (guiChanged)
            {
                GUILayout.Label("- You have unsaved changes", EditorStyles.miniLabel);
            }

            //If any changes to the gui is made
            if (GUI.changed)
            {
                guiChanged = true;
            }

            GUILayout.Label("Save Changes", EditorStyles.boldLabel);
            GUILayout.Label("Remember to always press save when you have changed values", EditorStyles.miniLabel);
            if (GUILayout.Button("Save/Rebuild"))
            {
                SaveAndRebuild();
            }

            if (shouldRepaint)
            {
                Repaint();
                shouldRepaint = false;
            }
        }
        private void DrawInheritedConfigurations()
        {
            EditorGUI.BeginChangeCheck();

            ReorderableListGUI.Title("Inherited Configurations");
            ReorderableListGUI.ListField(this.inheritedConfigurationsListAdaptor);

            if (EditorGUI.EndChangeCheck())
            {
                this.serializedObject.ApplyModifiedProperties();
                this.Refresh();
            }

            if (this.targetConfigurationObject.HasCyclicInheritance())
            {
                EditorGUILayout.HelpBox("Error: Cyclic Reference!\nOne or more inherited service configurations inherit the same configuration!", MessageType.Error);
                EditorGUILayout.Space();
            }
        }
Exemple #8
0
 public override void OnInspectorGUI()
 {
     serializedObject.Update();
     if (isSort())
     {
         GUIContent cont = new GUIContent("sort", "Check to enable loading of progress made in leveling and perk unlocking from previous save");
         setSort(EditorGUILayout.Toggle(cont, isSort()));
         foreach (SerializedProperty sp in _listPropertys)
         {
             ReorderableListGUI.Title(sp.name);
             ReorderableListGUI.ListField(sp, ReorderableListFlags.ShowIndices);
         }
     }
     else
     {
         onDrawDefaultInspector();
     }
     serializedObject.ApplyModifiedProperties();
 }
Exemple #9
0
    /// <summary>
    /// 绘制预解析CSV
    /// </summary>
    void DrawCSVDataUI()
    {
        GUI.Box(csvDataRect, "");
        GUILayout.BeginArea(csvDataRect);
        Rect listRect = new Rect(0, 0, csvDataRect.width, csvDataRect.height);

        GUILayout.Label(curCSVPath);
        csvDataScrollViewPos = EditorGUILayout.BeginScrollView(csvDataScrollViewPos);

        EditorGUI.BeginChangeCheck();
        ReorderableListGUI.ListField <CsvData>(data, DrawWidget, 30, ReorderableListFlags.HideAddButton | ReorderableListFlags.DisableAutoScroll);
        if (EditorGUI.EndChangeCheck())
        {
            CreateModelClass();
            CreateModelParseCode();
        }
        EditorGUILayout.EndScrollView();
        GUILayout.EndArea();
    }
Exemple #10
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            DialogInput t = target as DialogInput;

            EditorGUILayout.PropertyField(clickModeProp);
            EditorGUILayout.PropertyField(nextClickDelayProp);

            EditorGUILayout.PropertyField(keyPressModeProp);
            if (t.keyPressMode == DialogInput.KeyPressMode.KeyPressed)
            {
                EditorGUILayout.PropertyField(shiftKeyEnabledProp);
                ReorderableListGUI.Title(new GUIContent("Key List", "Keycodes to check for user input"));
                ReorderableListGUI.ListField(keyListProp);
            }

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            var flowchart = target as Flowchart;

            flowchart.UpdateHideFlags();

            EditorGUILayout.PropertyField(descriptionProp);
            EditorGUILayout.PropertyField(colorCommandsProp);
            EditorGUILayout.PropertyField(hideComponentsProp);
            EditorGUILayout.PropertyField(stepPauseProp);
            EditorGUILayout.PropertyField(saveSelectionProp);
            EditorGUILayout.PropertyField(localizationIdProp);
            EditorGUILayout.PropertyField(showLineNumbersProp);
            EditorGUILayout.PropertyField(luaEnvironmentProp);
            EditorGUILayout.PropertyField(luaBindingNameProp);

            // Show list of commands to hide in Add Command menu
            ReorderableListGUI.Title(new GUIContent(hideCommandsProp.displayName, hideCommandsProp.tooltip));
            ReorderableListGUI.ListField(hideCommandsProp);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(new GUIContent("Open Flowchart Window", "Opens the Flowchart Window")))
            {
                EditorWindow.GetWindow(typeof(FlowchartWindow), false, "Flowchart");
            }

            GUILayout.Space(10);

            if (GUILayout.Button(new GUIContent("Center View", "Centers the window view at the center of all blocks in the Flowchart")))
            {
                // Reset the zoom so we don't have adjust the center position depending on zoom
                flowchart.ScrollPos = flowchart.CenterPosition;
                flowchart.Zoom      = FlowchartWindow.maxZoomValue;
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            serializedObject.ApplyModifiedProperties();
        }
Exemple #12
0
        public virtual void DrawCommandGUI()
        {
            Command t = target as Command;

            // Code below was copied from here
            // http://answers.unity3d.com/questions/550829/how-to-add-a-script-field-in-custom-inspector.html

            // Users should not be able to change the MonoScript for the command using the usual Script field.
            // Doing so could cause block.commandList to contain null entries.
            // To avoid this we manually display all properties, except for m_Script.
            serializedObject.Update();
            SerializedProperty iterator = serializedObject.GetIterator();
            bool enterChildren          = true;

            while (iterator.NextVisible(enterChildren))
            {
                enterChildren = false;

                if (iterator.name == "m_Script")
                {
                    continue;
                }

                if (!t.IsPropertyVisible(iterator.name))
                {
                    continue;
                }

                if (iterator.isArray &&
                    t.IsReorderableArray(iterator.name))
                {
                    ReorderableListGUI.Title(new GUIContent(iterator.displayName, iterator.tooltip));
                    ReorderableListGUI.ListField(iterator);
                }
                else
                {
                    EditorGUILayout.PropertyField(iterator, true, new GUILayoutOption[0]);
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
    private void OnGUI()
    {
        GUILayout.BeginHorizontal();

        var columnWidth = GUILayout.Width(position.width / 2f - 6);

        // Draw list control on left side of the window.
        GUILayout.BeginVertical(columnWidth);
        ReorderableListGUI.Title("Shopping List");
        ReorderableListGUI.ListField(_shoppingListAdaptor);
        GUILayout.EndVertical();

        // Draw list control on right side of the window.
        GUILayout.BeginVertical(columnWidth);
        ReorderableListGUI.Title("Purchase List");
        ReorderableListGUI.ListField(_purchaseListAdaptor);
        GUILayout.EndVertical();

        GUILayout.EndHorizontal();
    }
Exemple #14
0
        protected override void OnServiceUI()
        {
            using (new SA_WindowBlockWithSpace(new GUIContent("Editor Testing")))
            {
                using (new SA_GuiBeginHorizontal())
                {
                    GUILayout.FlexibleSpace();
                    var click = m_LearnMoreLink.DrawWithCalcSize();
                    if (click)
                    {
                        Application.OpenURL("https://unionassets.com/ultimate-mobile-pro/test-inside-the-editor-793#restore-purchases");
                    }
                }

                ReorderableListGUI.Title("Products Restore Emulation");
                ReorderableListGUI.ListField(UM_Settings.Instance.TestRestoreProducts,
                                             (position, text) => { return(EditorGUI.TextField(position, text)); },
                                             () => { EditorGUILayout.LabelField("All configured products will be restored by default."); }
                                             );
            }
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            var headerRect = GUILayoutUtility.GetRect(0.0f, 7.0f);

            headerRect.y     += 5.0f;
            headerRect.width  = headerTexture.width;
            headerRect.height = headerTexture.height;
            GUILayout.Space(headerRect.height);
            GUI.DrawTexture(headerRect, headerTexture);

            invertYAxis.boolValue    = EditorGUILayout.ToggleLeft("Invert Y Axis", invertYAxis.boolValue);
            enableXInput.boolValue   = EditorGUILayout.ToggleLeft("Enable XInput (Windows)", enableXInput.boolValue);
            useFixedUpdate.boolValue = EditorGUILayout.ToggleLeft("Use Fixed Update", useFixedUpdate.boolValue);

            ReorderableListGUI.Title("Custom Profiles");
            ReorderableListGUI.ListField(customProfiles);

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var nameRect = new Rect(position.x, position.y, position.width * 0.8f, EditorGUIUtility.singleLineHeight);
            var typeRect = new Rect(position.x + position.width * 0.8f, position.y, position.width * 0.2f, EditorGUIUtility.singleLineHeight);

            GUI.color = Color.green;
            EditorGUI.PropertyField(nameRect, stateNameProp);
            GUI.color = Color.white;
            catchItemsProp.boolValue = EditorGUI.ToggleLeft(typeRect, "Catch", catchItemsProp.boolValue);

            var rectLeft = new Rect(position.x, position.y + EditorGUIUtility.singleLineHeight * 1.3f, position.width, position.height - EditorGUIUtility.singleLineHeight);

            ReorderableListGUI.ListFieldAbsolute(rectLeft, dragAdapt);
            DrawSubStates(position);
            var loadRect = new Rect(position.x + position.width * 0.8f, position.y + position.height - EditorGUIUtility.singleLineHeight, position.width * 0.1f, EditorGUIUtility.singleLineHeight);

            if (GUI.Button(loadRect, "O", EditorStyles.miniButtonRight))
            {
                LoadObjectsToProperty();
            }
        }
    public override void OnInspectorGUI()
    {
//        var actionSet = (ActionSet) target;
//
//        actionType = (ActionType) EditorGUILayout.EnumPopup("Type: ", actionType);
//        if(GUILayout.Button("Create"))
//        {
//            switch (actionType) {
//                case ActionType.BehaviorTree:
//                    actionSet.actions.Add(new ActionWithBT());
//                    break;
//            }
//        }


        serializedObject.Update();
        ReorderableListGUI.Title("Actions");
        ReorderableListGUI.ListField(actions);

        serializedObject.ApplyModifiedProperties();
    }
Exemple #18
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            var flowchart = target as Flowchart;

            flowchart.UpdateHideFlags();

            EditorGUILayout.PropertyField(descriptionProp);
            EditorGUILayout.PropertyField(colorCommandsProp);
            EditorGUILayout.PropertyField(hideComponentsProp);
            EditorGUILayout.PropertyField(stepPauseProp);
            EditorGUILayout.PropertyField(saveSelectionProp);
            EditorGUILayout.PropertyField(localizationIdProp);
            EditorGUILayout.PropertyField(showLineNumbersProp);
            EditorGUILayout.PropertyField(luaEnvironmentProp);
            EditorGUILayout.PropertyField(luaBindingNameProp);

            // Show list of commands to hide in Add Command menu
            ReorderableListGUI.Title(new GUIContent(hideCommandsProp.displayName, hideCommandsProp.tooltip));
            ReorderableListGUI.ListField(hideCommandsProp);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(new GUIContent("Open Flowchart Window", "Opens the Flowchart Window")))
            {
                EditorWindow.GetWindow(typeof(FlowchartWindow), false, "Flowchart");
            }


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

            serializedObject.ApplyModifiedProperties();

            //Show the variables in the flowchart inspector
            GUILayout.Space(20);

            DrawVariablesGUI(false, Mathf.FloorToInt(EditorGUIUtility.currentViewWidth) - VariableListAdaptor.ReorderListSkirts);
        }
Exemple #19
0
    /// <summary>
    /// This is how you draw to the inspector. You aren't really limited to any specific thing
    /// as images can be drawn. The only limit is how terrible is it to try to place everything
    /// just so. Not to mention you still have to figure out the height of the stuff you just
    /// drew. Probably the worst API I've seen from Unity.
    /// </summary>
    /// <param name="a_Position"> The position this property should start drawing to </param>
    /// <param name="a_Property"> The property to be drawn </param>
    /// <param name="a_Label"> The name of the property. Seems useless </param>
    public override void OnGUI(Rect a_Position, SerializedProperty a_Property, GUIContent a_Label)
    {
        // Store the value of the original indent to be restored later
        int originalIndent = EditorGUI.indentLevel;

        // Let Unity know you are starting this property
        EditorGUI.BeginProperty(a_Position, a_Label, a_Property);
        {
            string name = a_Property.isExpanded ? " " : a_Property.displayName;

            // Setup the Rect 'foldoutRect' with the current value of 'a_Position'
            Rect foldoutRect = a_Position;

            // Set the size of the foldout, create it, and store its return value into this property
            foldoutRect.size      = new Vector2(Globals.FOLDOUT_WIDTH, Globals.DEFAULT_HEIGHT);
            a_Property.isExpanded = EditorGUI.Foldout(
                foldoutRect, a_Property.isExpanded, name);

            // if the foldout is expanded by the user
            if (a_Property.isExpanded)
            {
                // Move to the 'AnimationLayer' array: 'animationLayers'
                a_Property.Next(true);

                a_Position.height = ReorderableListGUI.DefaultItemHeight;
                ReorderableListGUI.Title(a_Position, a_Property.displayName);

                EditorGUI.indentLevel = 1;

                a_Position.y     += ReorderableListGUI.DefaultItemHeight;
                a_Position.height = ReorderableListGUI.CalculateListFieldHeight(a_Property);
                ReorderableListGUI.ListFieldAbsolute(a_Position, a_Property);
            }
        }
        // Let Unity know you are finished with the property
        EditorGUI.EndProperty();

        // Restore the original indent value
        EditorGUI.indentLevel = originalIndent;
    }
        void ProviderListDrawer(AdType adType, List <ProviderID> networkIds)
        {
            EditorGUILayout.BeginHorizontal();
            ReorderableListGUI.Title(adType.ToString());

            var allIds = Enum.GetValues(typeof(ProviderID));

            if (GUILayout.Button("Add", GUILayout.Width(70)))
            {
                foreach (ProviderID networkId in allIds)
                {
                    if (IsSuportAd(networkId, adType) && !networkIds.Contains(networkId))
                    {
                        networkIds.Add(networkId);
                        break;
                    }
                }
            }
            EditorGUILayout.EndHorizontal();

            ReorderableListGUI.ListField(networkIds, ProviderItemDrawer, DrawEmptyProvider, ReorderableListFlags.HideAddButton);
        }
Exemple #21
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(volumeProp);
            EditorGUILayout.PropertyField(loopProp);
            EditorGUILayout.PropertyField(targetAudioSourceProp);
            EditorGUILayout.PropertyField(inputSoundProp);

            EditorGUILayout.PropertyField(audioModeProp);
            if ((AudioMode)audioModeProp.enumValueIndex == AudioMode.Beeps)
            {
                ReorderableListGUI.Title(new GUIContent("Beep Sounds", "A list of beep sounds to play at random"));
                ReorderableListGUI.ListField(beepSoundsProp);
            }
            else
            {
                EditorGUILayout.PropertyField(soundEffectProp);
            }

            serializedObject.ApplyModifiedProperties();
        }
Exemple #22
0
    public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
    {
        var height = position.height;

        position.height = 18;
        var requirement = prop.FindPropertyRelative("requirement");

        EditorGUI.PropertyField(position, requirement);
        position.y += 22;

        EditorGUI.LabelField(position, "Possible slots", LabelHelper.HeaderStyle);
        position.y     += 18;
        position.height = height - 45;
        var possibleSlots = prop.FindPropertyRelative("possibleSlots");

        //ReorderableListGUI.Title("Possible Slots");
        ReorderableListGUI.ListFieldAbsolute(position, possibleSlots, (pos) =>
        {
            pos.height = 20;
            EditorGUI.LabelField(pos, "No slots");
        }, ReorderableListFlags.DisableReordering);
    }
Exemple #23
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(nameTextProp, new GUIContent("Name Text", "Name of the character display in the dialog"));
            EditorGUILayout.PropertyField(nameColorProp, new GUIContent("Name Color", "Color of name text display in the dialog"));
            EditorGUILayout.PropertyField(soundEffectProp, new GUIContent("Sound Effect", "Sound to play when the character is talking. Overrides the setting in the Dialog."));

            ReorderableListGUI.Title(new GUIContent("Portraits", "Character image sprites to display in the dialog"));
            ReorderableListGUI.ListField(portraitsProp);

            EditorGUILayout.PropertyField(notesProp, new GUIContent("Notes", "Notes about this story character (personality, attibutes, etc.)"));

            EditorGUILayout.Separator();

            Character t = target as Character;

            if (t.portraits != null &&
                t.portraits.Count > 0)
            {
                t.profileSprite = t.portraits[0];
            }
            else
            {
                t.profileSprite = null;
            }

            if (t.profileSprite != null &&
                spriteMaterial != null)
            {
                float aspect           = (float)t.profileSprite.texture.width / (float)t.profileSprite.texture.height;
                Rect  imagePreviewRect = GUILayoutUtility.GetAspectRect(aspect, GUILayout.Width(100), GUILayout.ExpandWidth(true));

                DrawPreview(imagePreviewRect, t.profileSprite.texture);
            }

            serializedObject.ApplyModifiedProperties();
        }
Exemple #24
0
        public override void OnInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();

            serializedObject.Update();
            ReorderableListGUI.Title("References");
            ReorderableListGUI.ListField <ReferenceContainer.Reference>(((ReferenceContainer)target).m_references, ReferenceContainerReferenceDrawer, ReorderableListFlags.ShowIndices);
            // Were any changes made to the state of `GUI.changed`?
            if (EditorGUI.EndChangeCheck())
            {
                // Determine whether changes were made to a specific list item.
                if (ReorderableListGUI.IndexOfChangedItem != -1)
                {
                    EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
                }
                else
                {
                    // Changes were made outside of an item drawer.
                    // for example, an item was added, removed, moved, etc.
                }
            }
            serializedObject.ApplyModifiedProperties();
        }
Exemple #25
0
        public override void Render(Action preRender = null)
        {
            base.Render(preRender);

            if (!checkedIfReadOnly)
            {
                isReadOnly        = (AttributeHelper.GetAttribute <ReadOnlyAttribute>(entityInfo.fieldInfo) != null);
                checkedIfReadOnly = true;
            }

            ReorderableListGUI.Title(label);
            if (isReadOnly)
            {
                ReorderableListGUI.ListField(serializedProperty, ReorderableListFlags.DisableReordering
                                             | ReorderableListFlags.DisableContextMenu
                                             | ReorderableListFlags.HideAddButton
                                             | ReorderableListFlags.HideRemoveButtons);
            }
            else
            {
                ReorderableListGUI.ListField(serializedProperty);
            }
        }
Exemple #26
0
        private static void DrawSerializedState(ISerializedObject behavior)
        {
            if (_editorShowSerializedState)
            {
                var flags = ReorderableListFlags.HideAddButton | ReorderableListFlags.DisableReordering;

                EditorGUILayout.HelpBox("The following is raw serialization data. Only change it " +
                                        "if you know what you're doing or you could corrupt your object!",
                                        MessageType.Warning);

                ReorderableListGUI.Title("Serialized Keys");
                ReorderableListGUI.ListField(new ListAdaptor <string>(
                                                 behavior.SerializedStateKeys, DrawItem, GetItemHeight, SerializedStateMetadata), flags);

                ReorderableListGUI.Title("Serialized Values");
                ReorderableListGUI.ListField(new ListAdaptor <string>(
                                                 behavior.SerializedStateValues, DrawItem, GetItemHeight, SerializedStateMetadata), flags);

                ReorderableListGUI.Title("Serialized Object References");
                ReorderableListGUI.ListField(new ListAdaptor <UnityObject>(
                                                 behavior.SerializedObjectReferences, DrawItem, GetItemHeight, SerializedStateMetadata), flags);
            }
        }
Exemple #27
0
        protected override void OnServiceUI()
        {
            using (new SA_WindowBlockWithSpace(new GUIContent("Local Notifications"))) {
                ReorderableListGUI.Title("Custom Sounds");
                ReorderableListGUI.ListField(ISN_EditorSettings.Instance.NotificationAlertSounds, DrawObjectField, DrawEmptySounds);

                UpdateDeploySettings();
            }

            using (new SA_WindowBlockWithSpace(new GUIContent("Apple Push Notification Service"))) {
                using (new SA_GuiBeginHorizontal()) {
                    GUILayout.Space(15);
                    EditorGUILayout.LabelField(m_APN_Description, SA_PluginSettingsWindowStyles.DescribtionLabelStyle);
                }

                EditorGUILayout.Space();

                using (new SA_GuiIndentLevel(1)) {
                    ISD_API.Capability.PushNotifications.Enabled     = SA_EditorGUILayout.ToggleFiled("API Status", ISD_API.Capability.PushNotifications.Enabled, SA_StyledToggle.ToggleType.EnabledDisabled);
                    ISD_API.Capability.PushNotifications.development = SA_EditorGUILayout.ToggleFiled("Development Environment", ISD_API.Capability.PushNotifications.development, SA_StyledToggle.ToggleType.EnabledDisabled);
                }
            }
        }
Exemple #28
0
        /// <summary>
        /// Shows the list of objects that you have chosen to combine
        /// </summary>
        private void ShowObjectsList()
        {
            if (GUILayout.Button(new GUIContent("Combined Objects" + (_isShowingObjectsList ? string.Empty : " (Hidden)")), ReorderableListGUI.defaultTitleStyle, GUILayout.Height(20f)))
            {
                _isShowingObjectsList = !_isShowingObjectsList;
            }

            if (_isShowingObjectsList)
            {
                GUILayout.Space(-6);
                EditorGUI.BeginChangeCheck();
                ReorderableListGUI.ListField <GameObject>(_combinedObjects, PropertyItemDrawer);
                if (EditorGUI.EndChangeCheck())
                {
                    if (!_combinedObjects.Contains(null))
                    {
                        Undo.RegisterCompleteObjectUndo(_combinedObjects.ToArray(), "UNDOOOOOO");
                        CombineSelectedObjects();
                    }
                    UpdateFoldoutsCount();
                }
            }
        }
        void ShowCreateAndSettingsActions()
        {
            float maxWidth = position.width * 0.5f;

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginVertical();
            Rect positionCheck = EditorGUILayout.GetControlRect(GUILayout.MaxWidth(maxWidth));

            ReorderableListGUI.Title(positionCheck, "Add / Update Languages");
            createScrollPosition = GUILayout.BeginScrollView(createScrollPosition, GUILayout.MaxHeight(350), GUILayout.MaxWidth(maxWidth));
            createListContextMenu.Draw(createListAdaptor);
            GUILayout.EndScrollView();
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical();
            positionCheck = EditorGUILayout.GetControlRect(GUILayout.MaxWidth(maxWidth));
            ReorderableListGUI.Title(positionCheck, "Settings");
            settingsContextMenu.Draw(settingsAdaptor);
            EditorGUILayout.EndVertical();

            EditorGUILayout.EndHorizontal();
        }
Exemple #30
0
        private void StarsGUILayout(bool starsEnabled)
        {
            GUI.enabled = starsEnabled;

            EditorGUILayout.BeginHorizontal("Box");
            EditorGUILayout.LabelField(_starsIcon, GUILayout.Width(16f));
            EditorGUILayout.LabelField("Stars", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();

            if (starsEnabled)
            {
                _showStarsDotParams = EditorGUILayout.Foldout(_showStarsDotParams, _starsParamsLabel);
                EditorGUILayout.Space();
                if (_showStarsDotParams)
                {
                    StarsParamsHeader();
                    ReorderableListGUI.ListField(_starsDotParams);
                }
            }
            else
            {
                EditorGUILayout.Space();
            }
        }