Пример #1
0
        public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
        {
            if (m_groupSizeByte == null)
            {
                return;
            }

            EditorGUILayout.HelpBox("Grouping by size: Create group of assets by size.", MessageType.Info);
            editor.UpdateNodeName(node);

            GUILayout.Space(10f);

            //Show target configuration tab
            editor.DrawPlatformSelector(node);
            using (new EditorGUILayout.VerticalScope(GUI.skin.box))
            {
                var disabledScope = editor.DrawOverrideTargetToggle(node, m_groupSizeByte.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) =>
                {
                    using (new RecordUndoScope("Remove Target Grouping Size Settings", node, true))
                    {
                        if (enabled)
                        {
                            m_groupSizeByte[editor.CurrentEditingGroup] = m_groupSizeByte.DefaultValue;
                            m_groupingType[editor.CurrentEditingGroup]  = m_groupingType.DefaultValue;
                        }
                        else
                        {
                            m_groupSizeByte.Remove(editor.CurrentEditingGroup);
                            m_groupingType.Remove(editor.CurrentEditingGroup);
                        }
                        onValueChanged();
                    }
                });
                EditorGUI.BeginDisabledGroup(disabledScope);
                #region DisableGroup
                var newType = (GroupingType)EditorGUILayout.EnumPopup("Grouping Type", (GroupingType)m_groupingType[editor.CurrentEditingGroup]);
                if (newType != (GroupingType)m_groupingType[editor.CurrentEditingGroup])
                {
                    using (new RecordUndoScope("Change Grouping Type", node, true))
                    {
                        m_groupingType[editor.CurrentEditingGroup] = (int)newType;
                        onValueChanged();
                    }
                }

                var newSizeText = EditorGUILayout.TextField("Size(KB)", m_groupSizeByte[editor.CurrentEditingGroup].ToString());
                int newSize     = 0;
                Int32.TryParse(newSizeText, out newSize);

                if (newSize != m_groupSizeByte[editor.CurrentEditingGroup])
                {
                    using (new RecordUndoScope("Change Grouping Size", node, true))
                    {
                        m_groupSizeByte[editor.CurrentEditingGroup] = newSize;
                        onValueChanged();
                    }
                }
                #endregion
                EditorGUI.EndDisabledGroup();
            }
        }