void OnGUI()
        {
            switch (state)
            {
            case State.Uninitialized:
                act = FixRule;
                GatherAssetRules();
                state = State.GatheringRules;
                break;

            case State.GatheringRules:
                if (gatherAssetsComplete)
                {
                    GatherData();
                    state = State.GatheringData;
                }
                break;

            case State.GatheringData:
                if (gatherDataComplete)
                {
                    // Check if it already exists (deserialized from window layout file or scriptable object)
                    if (m_TreeViewState == null)
                    {
                        m_TreeViewState = new TreeViewState();
                    }

                    var headerState =
                        AssetAuditTreeView.CreateDefaultMultiColumnHeaderState(multiColumnTreeViewRect.width);
                    if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_MultiColumnHeaderState, headerState))
                    {
                        MultiColumnHeaderState.OverwriteSerializedFields(m_MultiColumnHeaderState, headerState);
                    }
                    m_MultiColumnHeaderState = headerState;

                    var multiColumnHeader = new MultiColumnHeader(headerState);
                    var treeModel         = new TreeModel <AssetAuditTreeElement>(elements);
                    m_TreeView = new AssetAuditTreeView(m_TreeViewState, multiColumnHeader, treeModel, act);
                    GUILayout.Label(" no asset rules have been found in the project");

                    state = State.Initialized;
                }
                break;

            case State.Initialized:
                DoRuleSelectionGUI();
                SearchBar(toolbarRect);
                DoTreeView(multiColumnTreeViewRect);
                BottomToolBar(bottomToolbarRect);
                break;

            case State.NoAssetRules:
                DoNoAssetRuleGUI();
                break;
            }

            DoProgressBar(progressBarRect);
        }
예제 #2
0
        public static IEnumerable <float> FixAll(AssetAuditTreeView treeView, AssetRule assetRule)
        {
            List <AssetAuditTreeElement> list = new List <AssetAuditTreeElement>();

            TreeElementUtility.TreeToList(treeView.treeModel.root, list);

            float progress = 0f;

            foreach (AssetAuditTreeElement assetAuditTreeElement in list)
            {
                if (assetAuditTreeElement.isAsset && !assetAuditTreeElement.conforms)
                {
                    FixRule(assetAuditTreeElement, assetRule);
                }

                progress += 1f;
                yield return(progress / list.Count);
            }
        }