예제 #1
0
        public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
        {
            EditorGUILayout.HelpBox("Extract Shared Assets: Extract shared assets between asset bundles and add bundle configurations.", MessageType.Info);
            editor.UpdateNodeName(node);

            GUILayout.Space(10f);

            var newValue = EditorGUILayout.TextField("Bundle Name Template", m_bundleNameTemplate);

            if (newValue != m_bundleNameTemplate)
            {
                using (new RecordUndoScope("Bundle Name Template Change", node, true)) {
                    m_bundleNameTemplate = newValue;
                    onValueChanged();
                }
            }

            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_groupExtractedAssets[editor.CurrentEditingGroup] = m_groupExtractedAssets.DefaultValue;
                            m_groupSizeByte[editor.CurrentEditingGroup]        = m_groupSizeByte.DefaultValue;
                            m_groupingType[editor.CurrentEditingGroup]         = m_groupingType.DefaultValue;
                        }
                        else
                        {
                            m_groupExtractedAssets.Remove(editor.CurrentEditingGroup);
                            m_groupSizeByte.Remove(editor.CurrentEditingGroup);
                            m_groupingType.Remove(editor.CurrentEditingGroup);
                        }
                        onValueChanged();
                    }
                });

                using (disabledScope) {
                    var useGroup = EditorGUILayout.ToggleLeft("Subgroup shared assets by size", m_groupExtractedAssets [editor.CurrentEditingGroup] != 0);
                    if (useGroup != (m_groupExtractedAssets [editor.CurrentEditingGroup] != 0))
                    {
                        using (new RecordUndoScope("Change Grouping Type", node, true)){
                            m_groupExtractedAssets[editor.CurrentEditingGroup] = (useGroup)? 1:0;
                            onValueChanged();
                        }
                    }

                    using (new EditorGUI.DisabledScope(!useGroup)) {
                        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();
                            }
                        }
                    }
                }
            }

            EditorGUILayout.HelpBox("Bundle Name Template replaces \'*\' with number.", MessageType.Info);
        }