public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            this.ConfigureSettings();

            if (_disallowFoldout)
            {
                this.OnGUIStart(property, label);
                _lst.DoList(position);
                this.OnGUIEnd();
            }
            else
            {
                if (property.isExpanded)
                {
                    this.OnGUIStart(property, label);
                    var foldoutRect = new Rect(position.xMin, position.yMin, 20f, EditorGUIUtility.singleLineHeight);
                    property.isExpanded = EditorGUI.Foldout(foldoutRect, property.isExpanded, GUIContent.none);
                    _lst.DoList(position);
                    this.OnGUIEnd();
                }
                else
                {
                    property.isExpanded = EditorGUI.Foldout(position, property.isExpanded, GUIContent.none);
                    ReorderableListHelper.DrawRetractedHeader(position, label);
                }
            }
        }
Example #2
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            using (new EditorGUI.PropertyScope(position, label, property)) {
                serializedObject.Update();

                if (EditorGUIUtility.hierarchyMode)
                {
                    int num = EditorStyles.foldout.padding.left - EditorStyles.label.padding.left;
                    position.xMin += num - 4;
                }

                Rect foldoutRect = new Rect(position)
                {
                    height = SingleLineHeight + StandardSpacing,
                };

                listWrapperProperty.isExpanded = EditorGUI.Foldout(foldoutRect, listWrapperProperty.isExpanded,
                                                                   listWrapperProperty.displayName, true);

                if (!listWrapperProperty.isExpanded)
                {
                    return;
                }

                position.y += SingleLineHeight + StandardSpacing;
                //position.x += 32;
                position.width -= 32;

                reorderableList.DoList(position);

                HandleDragAndDrop();

                serializedObject.ApplyModifiedProperties();
            }
        }
 // 描画
 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
 {
     if (prop == null)
     {
         prop = property;
     }
     if (prop != null)
     {
         position.height = height;
         // 折りたたみ切り替え
         foldout = EditorGUI.Foldout(position, foldout, prop.displayName);
         // リスト作成
         reorder = GetList(prop.FindPropertyRelative("m_list"));
         if (!callbackAdd)
         {
             reorder.drawHeaderCallback  += DrawHeader;
             reorder.drawElementCallback += DrawElement;
             callbackAdd = true;
         }
         // 折りたたみ分岐
         if (foldout)
         {
             prop.serializedObject.Update();
             position.y = position.y + height;
             reorder.DoList(position);
             prop.serializedObject.ApplyModifiedProperties();
         }
     }
 }
Example #4
0
        void DoShaderPassesList(ref Rect rect)
        {
            Rect shaderPassesRect = rect;

            shaderPassesRect.x     += EditorGUI.indentLevel * Styles.indentSpaceInPixels;
            shaderPassesRect.width -= EditorGUI.indentLevel * Styles.indentSpaceInPixels;

            var mat = m_OverrideMaterial.objectReferenceValue as Material;

            // We only draw the shader passes if we don't know which type of shader is used (aka user shaders)
            if (IsUnlitShader())
            {
                EditorGUI.HelpBox(shaderPassesRect, Styles.unlitShaderMessage, MessageType.Info);
                rect.y += Styles.defaultLineSpace;
            }
            else if (IsHDRPShader())
            {
                // Lit HDRP shader not supported
                EditorGUI.HelpBox(shaderPassesRect, Styles.hdrpLitShaderMessage, MessageType.Warning);
                rect.y += Styles.defaultLineSpace;
            }
            else
            {
                m_ShaderPassesList.DoList(shaderPassesRect);
                rect.y += m_ShaderPassesList.GetHeight();
            }
        }
Example #5
0
    void OnGUI()
    {
        incompArea = new Rect(position.width - 450, 0, 300, position.height);
        //compArea = new Rect(position.width - 130, 0, 130, position.height);

        scrollPos = GUI.BeginScrollView(incompArea, scrollPos, new Rect(0, 0, 0, position.height));
        GUI.BeginGroup(new Rect(0, 0, 300, position.height));
        incompSpells.DoList(new Rect(0, 10, 250, position.height - 40));

        if (GUI.Button(new Rect(0, position.height - 20, 100, 20), "Save"))
        {
            spellDB.SaveSpell();
        }

        GUI.EndGroup();
        GUI.EndScrollView();

        //GUI.BeginGroup(compArea);
        //EditorGUI.LabelField(new Rect(5, 5, 100, 20), "<size=12><color=green><b>Complete /Spells<//b></color></size>", guiStyle);
        //compScroll = GUI.BeginScrollView(compScRect, compScroll, new Rect(0, 20, 100, (25 * //complete.Count)));
        //
        //for (int i = 0; i < complete.Count; i++)
        //{
        //    GUI.Box(compNRect[i], complete[i]);
        //}
        //
        //GUI.EndScrollView();
        //GUI.EndGroup();
    }
        public override int OnEditorWindow(Rect rect, HorizontalCallback horizontal, VerticalCallback vertical, Dictionary <string, object> cache)
        {
            if (optionsEditor == null)
            {
                optionsEditor = new ReorderableList(Options, typeof(string), true, true, true, true);
                optionsEditor.drawHeaderCallback = r =>
                {
                    EditorGUI.LabelField(r, "Options");
                    if (GUI.Button(new Rect(r.x + r.width - 30, r.y, 30, EditorGUIUtility.singleLineHeight), (Texture2D)EditorGUIUtility.Load("icons/SettingsIcon.png"), EditorStyles.toolbarButton))
                    {
                        var menu = new GenericMenu();
                        menu.AddItem(new GUIContent("Copy"), false, () => cache["options"] = Options);
                        if (cache.ContainsKey("options"))
                        {
                            menu.AddItem(new GUIContent("Paste"), false, () => { optionsEditor.list = Options = ((List <string>)cache["options"]).ToList(); });
                            menu.AddItem(new GUIContent("Paste (linked)"), false, () => { optionsEditor.list = Options = (List <string>)cache["options"]; });
                        }
                        menu.AddItem(new GUIContent("Unlink"), false, () => optionsEditor.list = Options = Options.ToList());
                        menu.ShowAsContext();
                    }
                };
                optionsEditor.onAddCallback       = x => x.list.Add(string.Empty);
                optionsEditor.drawElementCallback = (r, i, a, f) => optionsEditor.list[i] = EditorGUI.TextField(new Rect(r.x, r.y, r.width, EditorGUIUtility.singleLineHeight), (string)optionsEditor.list[i]);
            }

            vertical(rect, 1,
                     (r) => Value = EditorGUI.Popup(r, "Selected", Value, Options.ToArray()),
                     (r) => optionsEditor.DoList(r));
            return(optionsEditor.count + 3);
        }
Example #7
0
        private void DrawReorderableList(Rect position, SerializedProperty property, GUIContent label)
        {
            var labelRect = new Rect(position.xMin, position.yMin, position.width, 0f);

            if (_labelOption == DNAEvaluatorList.ConfigAttribute.LabelOptions.drawLabelAsFoldout)
            {
                labelRect           = new Rect(position.xMin, position.yMin, position.width, EditorGUIUtility.singleLineHeight);
                property.isExpanded = EditorGUI.Foldout(labelRect, property.isExpanded, label);
            }
            else if (_labelOption == DNAEvaluatorList.ConfigAttribute.LabelOptions.drawExpandedWithLabel)
            {
                labelRect = new Rect(position.xMin, position.yMin, position.width, EditorGUIUtility.singleLineHeight);
                EditorGUI.LabelField(labelRect, label);
            }
            if (property.isExpanded || _labelOption == DNAEvaluatorList.ConfigAttribute.LabelOptions.drawExpandedWithLabel || _labelOption == DNAEvaluatorList.ConfigAttribute.LabelOptions.drawExpandedNoLabel)
            {
                var contentRect = EditorGUI.IndentedRect(position);
                contentRect.yMin   = labelRect.yMax + _padding;
                contentRect.height = contentRect.height - labelRect.height;

                var dnaEvalListProp = property.FindPropertyRelative(DNAEVALUATORSPROPERTY);

                _dnaEvaluatorList = CachedReorderableList.GetListDrawer(dnaEvalListProp, DrawHeaderCallback, null, DrawElementCallback, DrawFooterCallback);

                _dnaEvaluatorList.DoList(contentRect);
            }
        }
Example #8
0
        public static void DrawList(ReorderableList list, EditorUtils editorUtils)
        {
            Rect maskRect;

            maskRect = EditorGUILayout.GetControlRect(true, list.GetHeight());
            list.DoList(maskRect);
        }
Example #9
0
        private bool DrawAllTranslations(ref Rect rect)
        {
            bool isFoldedOut = false;

            // Draw the fold out
            rect.height = EditorGUIUtility.singleLineHeight;
            ShowAllTranslationsList.target = EditorGUI.Foldout(rect, ShowAllTranslationsList.target, "Translations");
            rect.y += rect.height;

            // Check if we want to draw the list
            isFoldedOut = ((ShowAllTranslationsList.target == true) || (ShowAllTranslationsList.isAnimating == true));
            if (isFoldedOut == true)
            {
                // Expand the list to the left
                rect.width += ExpandTranslationsLeft;
                rect.x     -= ExpandTranslationsLeft;

                // Calculate range of list
                float previewHeight = translationsList.GetHeight();
                rect.height = previewHeight * ShowAllTranslationsList.faded;

                // Draw the translations list
                GUI.BeginGroup(rect);
                Rect previewBox = new Rect(0, 0, rect.width, previewHeight);
                UpdateAllTranslationsEditors();
                translationsList.DoList(previewBox);
                GUI.EndGroup();

                // Adjust the rectangle
                rect.width -= ExpandTranslationsLeft;
                rect.x     += ExpandTranslationsLeft;
                rect.y     += rect.height;
            }
            return(isFoldedOut);
        }
Example #10
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        if (SerializedPropertyUtility.IsArrayElement(property))
        {
            if (SerializedPropertyUtility.IndexOfArrayElement(property) == 0)
            {
                //EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight), property, true);
                //position.y += EditorGUIUtility.singleLineHeight;

                firstProperty = property;
                SerializedProperty parentProp = SerializedPropertyUtility.GetArrayParentProperty(property);

                if (list == null || list.serializedProperty.propertyPath != parentProp.propertyPath)
                {
                    list = new ReorderableList(parentProp.serializedObject, parentProp, true, true, true, true);

                    list.drawElementCallback   += DrawElement;
                    list.elementHeightCallback += ElementHeightCallback;
                    list.drawHeaderCallback    += DrawHeader;
                    //list.drawFooterCallback += DrawFooter;
                }

                if (list != null)
                {
                    list.elementHeight = maxHeight;
                    //list.DoLayoutList();
                    list.DoList(new Rect(position.x, position.y, position.width, maxHeight));
                }
            }
        }
    }
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        Init(property);

        m_PropertyName = label.text;
        m_ReorderableList.DoList(position);
    }
Example #12
0
 private void DrawReorderableList()
 {
     _scrollViewRect.height = menuReorderableList.GetHeight();
     _scrollPos             = GUI.BeginScrollView(menuScrollRect, _scrollPos, _scrollViewRect);
     menuReorderableList.DoList(_reorderableListRect);
     GUI.EndScrollView();
 }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            property.serializedObject.Update();

            var list = property.FindPropertyRelative("values");

            if (list == null)
            {
                return;
            }

            var indentLevel = EditorGUI.indentLevel;

            InitList(list, property);

            if (list.arraySize > 0)
            {
                reorderableList.elementHeight = EditorGUI.GetPropertyHeight(list.GetArrayElementAtIndex(0));
            }

            if (position.height <= 0)
            {
                return;
            }

            lastHeight = reorderableList.GetHeight();

            reorderableList.DoList(position);

            EditorGUI.indentLevel = indentLevel;

            property.serializedObject.ApplyModifiedProperties();
        }
Example #14
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            if (label != GUIContent.none)
            {
                EditorGUI.LabelField(position, label);
            }



            if (__variablesReordableList == null)
            {
                //SerializedProperty keysList= property.FindPropertyRelative("Keys");
                __variablesReordableList = new ReorderableList(property.serializedObject, property,
                                                               false, false, true, true);
                __variablesReordableList.drawElementCallback = onDrawElement;
                __variablesReordableList.onAddCallback       = onAddElement;
                __variablesReordableList.onRemoveCallback    = onRemoveElement;
            }
            else
            {
                __variablesReordableList.serializedProperty = property;
            }



            if (__variablesReordableList != null)
            {
                //position.width
                position.y += 16f;
                __variablesReordableList.DoList(position);
            }
        }
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        if (list == null)
        {
            var listProp = property.FindPropertyRelative("list");
            list = new ReorderableList(property.serializedObject, listProp, true, false, true, true);
            list.drawElementCallback = DrawListItems;
        }

        var firstLine = position;

        firstLine.height = EditorGUIUtility.singleLineHeight;
        EditorGUI.PropertyField(firstLine, property, label);

        if (property.isExpanded)
        {
            position.y += firstLine.height;

            if (elementIndex == null)
            {
                elementIndex = new GUIContent();
            }

            list.DoList(position);
        }
    }
Example #16
0
        public virtual void Draw(ref float y, float width)
        {
            var height = _edited.GetHeight();

            _edited.DoList(new Rect(0, y, width, height));
            y += height;
        }
        protected virtual void DrawStylePropertiesListInternal(ReorderableList p_stylePropertiesList)
        {
            //Force Create DefaultBehaviour
            if (ReorderableList.defaultBehaviours == null)
            {
                p_stylePropertiesList.DoList(Rect.zero);
            }

            if (p_stylePropertiesList.serializedProperty.isExpanded)
            {
                p_stylePropertiesList.DoLayoutList();
            }
            else
            {
                GUILayout.Label("", GUILayout.ExpandWidth(true), GUILayout.Height(p_stylePropertiesList.headerHeight));
                var v_lastRect = GUILayoutUtility.GetLastRect();

                if (Event.current.type == EventType.Repaint)
                {
                    ReorderableList.defaultBehaviours.headerBackground.Draw(v_lastRect, false, false, false, false);
                }
                v_lastRect.x      += 6;
                v_lastRect.width  += 6;
                v_lastRect.y      += 1;
                v_lastRect.height -= 1;
                p_stylePropertiesList.drawHeaderCallback.Invoke(v_lastRect);
                GUILayout.Space(5);
            }
            GUILayout.Space(2);
        }
Example #18
0
        void DrawCustomPassReorderableList()
        {
            if (targets.OfType <CustomPassVolume>().Count() > 1)
            {
                EditorGUILayout.HelpBox("Custom Pass List UI is not supported with multi-selection", MessageType.Warning, true);
                return;
            }

            // Sanitize list:
            for (int i = 0; i < m_SerializedPassVolume.customPasses.arraySize; i++)
            {
                if (m_SerializedPassVolume.customPasses.GetArrayElementAtIndex(i) == null)
                {
                    m_SerializedPassVolume.customPasses.DeleteArrayElementAtIndex(i);
                    serializedObject.ApplyModifiedProperties();
                    i++;
                }
            }

            float customPassListHeight = m_CustomPassList.GetHeight();
            var   customPassRect       = EditorGUILayout.GetControlRect(false, customPassListHeight);

            EditorGUI.BeginProperty(customPassRect, GUIContent.none, m_SerializedPassVolume.customPasses);
            {
                EditorGUILayout.BeginVertical();
                m_CustomPassList.DoList(customPassRect);
                EditorGUILayout.EndVertical();
            }
            EditorGUI.EndProperty();
        }
        void DrawList(ref Rect rect)
        {
            EditorGUIUtility.labelWidth = 80f;
            EditorGUIUtility.fieldWidth = 80f;

            list.DoList(rect);
        }
Example #20
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            if (EditorHelper.AssertMultiObjectEditingNotSupported(position, property, label))
            {
                return;
            }

            property.isExpanded = EditorGUI.Foldout(new Rect(position.xMin, position.yMin, position.width, EditorGUIUtility.singleLineHeight), property.isExpanded, GUIContent.none);

            if (property.isExpanded)
            {
                _keys = GetKeys(property);
                if (_keys == null)
                {
                    EditorGUI.LabelField(position, "Failed to determine enum key type.");
                    return;
                }

                var valuesProp = property.FindPropertyRelative(PROP_VALUES);
                if (valuesProp.arraySize != _keys.Length)
                {
                    valuesProp.arraySize = _keys.Length;
                }

                this.BeginProperty(property, label);
                _lst.DoList(position);
                this.EndProperty();
            }
            else
            {
                ReorderableListHelper.DrawRetractedHeader(position, label);
            }
        }
 public virtual void DoList(Rect rect)
 {
     if (reorderList != null)
     {
         reorderList.DoList(rect);
     }
 }
        private void HandleScriptableObject()
        {
            //if (m_VariableScriptableObject == null)
            {
                m_VariableScriptableObject = EditorGUILayout.ObjectField("Scriptable Objectzin", m_VariableScriptableObject, typeof(VariablesScriptableObject), false) as VariablesScriptableObject;
                //return;
            }


            if (m_SerializedObject == null)
            {
                m_SerializedObject = new SerializedObject(m_VariableScriptableObject);
                m_VariablesProp    = m_SerializedObject.FindProperty("variables");
                //m_VariablesProp.arra
                ConfigList();

                m_ReorderableList.DoLayoutList();
                m_ReorderableList.DoList(EditorGUI.IndentedRect(EditorGUILayout.GetControlRect()));
                m_SerializedObject.Update();
            }
            else
            {
                m_ReorderableList.DoLayoutList();
                //m_ReorderableList.DoList(EditorGUI.IndentedRect(EditorGUILayout.GetControlRect()));
                m_SerializedObject.Update();
            }
        }
Example #23
0
        private void OnGUI(Rect rect)
        {
            if (loaderProperty is null)
            {
                return;
            }

            label = EditorGUI.BeginProperty(rect, label, loaderProperty);

            loaderProperty.isExpanded = EditorGUI.Foldout(ToSingleLine(rect), loaderProperty.isExpanded, label, true);

            if (loaderProperty.isExpanded)
            {
                EditorGUI.indentLevel++;
                rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
                EditorGUI.PropertyField(ToSingleLine(rect), pathProperty);
                rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
                var listRect = EditorGUI.PrefixLabel(rect, listContent);
                reorderableList.DoList(listRect);
                rect.y += EditorGUIUtility.standardVerticalSpacing;
                EditorGUI.indentLevel--;
            }

            EditorGUI.EndProperty();
        }
Example #24
0
        protected override void OnSPInspectorGUI()
        {
            if (!EditorProjectPrefs.Local.GetBool(BaseSettings.SETTING_ADVANCEDANIMINSPECTOR_ACTIVE, true))
            {
                this.DrawDefaultStandardInspector();
                return;
            }

            this.serializedObject.Update();

            this.DrawPlayAnimPopup();

            //_animList.DoLayoutList();
            var rect = EditorGUILayout.GetControlRect(false, _animList.GetHeight());

            _animList.DoList(rect);

            rect = new Rect(rect.xMin, rect.yMax - EditorGUIUtility.singleLineHeight + 1f, Mathf.Min(EditorGUIUtility.labelWidth, 60f), EditorGUIUtility.singleLineHeight - 1f);
            if (GUI.Button(rect, "Clear All"))
            {
                _animList.serializedProperty.arraySize = 0;
            }


            this.DrawPropertyField(PROP_ANIMATE_PHYSICS);
            this.DrawPropertyField(PROP_CULLINGTYPE);

            this.serializedObject.ApplyModifiedProperties();
        }
Example #25
0
        //-------------------------------------------------------------------------------------
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            SerializedProperty list = property.FindPropertyRelative("values");

            if (list == null)
            {
                return;
            }

            int indent_level = EditorGUI.indentLevel;

            initList(list, property);

            if (list.arraySize > 0)
            {
                reorderable_list.elementHeight = EditorGUI.GetPropertyHeight(list.GetArrayElementAtIndex(0));
            }

            if (position.height <= 0)
            {
                return;
            }

            last_height = reorderable_list.GetHeight();

            reorderable_list.DoList(position);

            EditorGUI.indentLevel = indent_level;
        }
        private void OnGUI_ItemsList(Rect position, string headerName, ReorderablePropertyData reorderableProperty)
        {
            ReorderableList    reorderable  = reorderableProperty.Reorderable;
            SerializedProperty listProperty = reorderableProperty.Property;

            reorderable.drawHeaderCallback = ( Rect headerPos ) =>
            {
                EditorGUI.LabelField(headerPos, headerName);
            };

            reorderable.drawElementCallback = (Rect elementPos, int index, bool isActive, bool isFocused) =>
            {
                SerializedProperty elementProperty = listProperty.GetArrayElementAtIndex(index);
                elementPos.height = EditorGUI.GetPropertyHeight(elementProperty);
                elementPos.y     += EditorGUIUtility.standardVerticalSpacing;

                EditorGUI.PropertyField(elementPos, elementProperty);
            };

            reorderable.elementHeightCallback = ( int index ) =>
            {
                SerializedProperty elementProperty = listProperty.GetArrayElementAtIndex(index);
                float height = EditorGUI.GetPropertyHeight(elementProperty);

                return(height + EditorGUIUtility.singleLineHeight / 2f);
            };

            reorderable.DoList(position);
        }
/*AUTO SCRIPT*/
/*AUTO SCRIPT*/ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
/*AUTO SCRIPT*/ {
/*AUTO SCRIPT*/ if (list == null)
/*AUTO SCRIPT*/ {
/*AUTO SCRIPT*/ list  = EditorUtility.GetPropertyObject <TimedFloatList>(property);
/*AUTO SCRIPT*/ rList = new ReorderableList(list, typeof(TimedFloat), true, false, true, true);
/*AUTO SCRIPT*/                         // rList.onAddCallback += data => { list.Add(defaultVal); };
/*AUTO SCRIPT*/                         // rList.onChangedCallback += data=> {
/*AUTO SCRIPT*/                         // };
/*AUTO SCRIPT*/ }
/*AUTO SCRIPT*/
/*AUTO SCRIPT*/ numLines = 3 + list.Count;
/*AUTO SCRIPT*/ var title  = new GUIContent($" {label.text}");
/*AUTO SCRIPT*/ var height = base.GetPropertyHeight(property, label);
/*AUTO SCRIPT*/ var rect   = new Rect(position.x, position.y, position.width, height);

/*AUTO SCRIPT*/ EditorGUI.BeginChangeCheck();
/*AUTO SCRIPT*/ rList.DoList(rect);
/*AUTO SCRIPT*/ EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), title);
/*AUTO SCRIPT*/
/*AUTO SCRIPT*/ if (EditorGUI.EndChangeCheck())
            {
/*AUTO SCRIPT*/ property.serializedObject.ApplyModifiedProperties();
            }
/*AUTO SCRIPT*/
/*AUTO SCRIPT*/ }
        public void OnSceneGUI()
        {
            serializedObject.Update();

            Handles.BeginGUI();
            // clamp index to valid value
            m_selectedIndexProp.intValue  = Mathf.Clamp(m_selectedIndexProp.intValue, -1, m_target.Tilemaps.Count - 1);
            m_sceneViewTilemapRList.index = m_selectedIndexProp.intValue;
            GUI.color = new Color(.75f, .75f, 0.8f, 0.85f);
            float hOff = m_displayTilemapRList.boolValue? 40f : 20f;

            m_sceneViewTilemapRList.DoList(new Rect(Screen.width - 300f - 10f, Screen.height - m_sceneViewTilemapRList.GetHeight() - hOff, 300f, 1f));
            GUI.color = Color.white;
            Handles.EndGUI();

            TilemapEditor tilemapEditor = GetTilemapEditor();

            if (tilemapEditor)
            {
                (tilemapEditor as TilemapEditor).OnSceneGUI();
            }

            DoKeyboardChecks();
            serializedObject.ApplyModifiedProperties();
        }
Example #29
0
        private void AudioFieldsGUI(ref VerticalGUIRect guiRect, BlockData block)
        {
            block.DigAudio   = EditorAssetUtility.AssetPtrField(guiRect.Next, s_DigAudioContent, block.DigAudio, typeof(AudioClip));
            block.PlaceAudio = EditorAssetUtility.AssetPtrField(guiRect.Next, s_PlaceAudioContent, block.PlaceAudio, typeof(AudioClip));
            guiRect.Space(10);

            m_StepAudioList ??= new ReorderableList(null, typeof(AssetPtr), true, true, true, true)
            {
                elementHeight      = EditorGUIUtility.standardVerticalSpacing + EditorGUIUtility.singleLineHeight,
                drawHeaderCallback = (Rect pos) =>
                {
                    EditorGUI.LabelField(pos, s_StepAudiosContent);
                },
                drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
                {
                    rect.y     += EditorGUIUtility.standardVerticalSpacing;
                    rect.height = EditorGUIUtility.singleLineHeight;

                    AssetPtr asset = m_StepAudioList.list[index] as AssetPtr;
                    m_StepAudioList.list[index] = EditorAssetUtility.AssetPtrField(rect, GUIContent.none, asset, typeof(AudioClip));
                }
            };
            m_StepAudioList.list = block.StepAudios ??= new List <AssetPtr>();
            m_StepAudioList.DoList(guiRect.GetNext(m_StepAudioList.GetHeight(), true, true));
        }
    public static void OnGUI()
    {
        s_ListRect.size = new Vector2(EditorGUIUtility.currentViewWidth - 10.0f, 0);

        //-----
        guiStyle_RedBold16.fontSize         = 16;
        guiStyle_RedBold16.fontStyle        = FontStyle.Bold;
        guiStyle_RedBold16.normal.textColor = Color.red;

        guiStyle_GreenBold16.fontSize         = 16;
        guiStyle_GreenBold16.fontStyle        = FontStyle.Bold;
        guiStyle_GreenBold16.normal.textColor = Color.green;
        //-----


        scrollPosition = GUILayout.BeginScrollView(scrollPosition, true, true);


        if (_stepController == null)
        {
            EditorGUILayout.LabelField("Slide Controller NOT selected. Create or Find", guiStyle_RedBold16);
        }
        else
        {
            EditorGUILayout.LabelField("Slide Controller selected : " + _stepController.transform.name, guiStyle_GreenBold16);
        }

        GUILayout.Space(15);



        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("CREATE", GUILayout.MinHeight(EditorGUIUtility.singleLineHeight * 2f)))
        {
        }
        if (GUILayout.Button("FIND IN SCENE", GUILayout.MinHeight(EditorGUIUtility.singleLineHeight * 2f)))
        {
            OnInit();
        }
        EditorGUILayout.EndHorizontal();


        if (_stepController)
        {
            if (m_StepsSO != null)
            {
                m_StepsSO.Update();
                m_ReordableList.DoList(s_ListRect);
                m_StepsSO.ApplyModifiedProperties();
            }
            else
            {
                EditorGUI.HelpBox(s_HelpRect, HELP_TEXT, MessageType.Warning);
            }
        }


        GUILayout.EndScrollView();
    }