AssetBundleGraph.NodeGUIEditor.DoInspectorBundleBuilderGUI C# (CSharp) Method

DoInspectorBundleBuilderGUI() private method

private DoInspectorBundleBuilderGUI ( NodeGUI node ) : void
node NodeGUI
return void
        private void DoInspectorBundleBuilderGUI(NodeGUI node)
        {
            if (node.Data.BundleBuilderBundleOptions == null) {
                return;
            }

            EditorGUILayout.HelpBox("BundleBuilder: Build asset bundles with given asset bundle settings.", MessageType.Info);
            UpdateNodeName(node);

            GUILayout.Space(10f);

            //Show target configuration tab
            DrawPlatformSelector(node);
            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                var disabledScope = DrawOverrideTargetToggle(node, node.Data.BundleBuilderBundleOptions.ContainsValueOf(currentEditingGroup), (bool enabled) => {
                    using(new RecordUndoScope("Remove Target Bundle Options", node, true)){
                        if(enabled) {
                            node.Data.BundleBuilderBundleOptions[currentEditingGroup] = node.Data.BundleBuilderBundleOptions.DefaultValue;
                        }  else {
                            node.Data.BundleBuilderBundleOptions.Remove(currentEditingGroup);
                        }
                    }
                } );

                using (disabledScope) {
                    int bundleOptions = node.Data.BundleBuilderBundleOptions[currentEditingGroup];

                    bool isDisableWriteTypeTreeEnabled  = 0 < (bundleOptions & (int)BuildAssetBundleOptions.DisableWriteTypeTree);
                    bool isIgnoreTypeTreeChangesEnabled = 0 < (bundleOptions & (int)BuildAssetBundleOptions.IgnoreTypeTreeChanges);

                    // buildOptions are validated during loading. Two flags should not be true at the same time.
                    UnityEngine.Assertions.Assert.IsFalse(isDisableWriteTypeTreeEnabled && isIgnoreTypeTreeChangesEnabled);

                    bool isSomethingDisabled = isDisableWriteTypeTreeEnabled || isIgnoreTypeTreeChangesEnabled;

                    foreach (var option in AssetBundleGraphSettings.BundleOptionSettings) {

                        // contains keyword == enabled. if not, disabled.
                        bool isEnabled = (bundleOptions & (int)option.option) != 0;

                        bool isToggleDisabled =
                            (option.option == BuildAssetBundleOptions.DisableWriteTypeTree  && isIgnoreTypeTreeChangesEnabled) ||
                            (option.option == BuildAssetBundleOptions.IgnoreTypeTreeChanges && isDisableWriteTypeTreeEnabled);

                        using(new EditorGUI.DisabledScope(isToggleDisabled)) {
                            var result = EditorGUILayout.ToggleLeft(option.description, isEnabled);
                            if (result != isEnabled) {
                                using(new RecordUndoScope("Change Bundle Options", node, true)){
                                    bundleOptions = (result) ?
                                        ((int)option.option | bundleOptions) :
                                        (((~(int)option.option)) & bundleOptions);
                                    node.Data.BundleBuilderBundleOptions[currentEditingGroup] = bundleOptions;
                                }
                            }
                        }
                    }
                    if(isSomethingDisabled) {
                        EditorGUILayout.HelpBox("'Disable Write Type Tree' and 'Ignore Type Tree Changes' can not be used together.", MessageType.Info);
                    }
                }
            }
        }