コード例 #1
0
        void OnSettingsModification(AddressableAssetSettings s, AddressableAssetSettings.ModificationEvent e, object o)
        {
            if (m_EntryTree == null)
            {
                return;
            }

            switch (e)
            {
            case AddressableAssetSettings.ModificationEvent.GroupAdded:
            case AddressableAssetSettings.ModificationEvent.GroupRemoved:
            case AddressableAssetSettings.ModificationEvent.EntryAdded:
            case AddressableAssetSettings.ModificationEvent.EntryMoved:
            case AddressableAssetSettings.ModificationEvent.EntryRemoved:
            case AddressableAssetSettings.ModificationEvent.GroupRenamed:
            case AddressableAssetSettings.ModificationEvent.EntryModified:
            case AddressableAssetSettings.ModificationEvent.BatchModification:
                m_EntryTree.Reload();
                if (window != null)
                {
                    window.Repaint();
                }
                break;
            }
        }
コード例 #2
0
        public bool OnGUI(Rect pos)
        {
            if (settings == null)
            {
                return(false);
            }

            if (!m_ModificationRegistered)
            {
                m_ModificationRegistered = true;
                settings.OnModification -= OnSettingsModification; //just in case...
                settings.OnModification += OnSettingsModification;
            }



            if (m_EntryTree == null)
            {
                if (m_TreeState == null)
                {
                    m_TreeState = new TreeViewState();
                }

                var headerState = AddressableAssetEntryTreeView.CreateDefaultMultiColumnHeaderState();
                if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_Mchs, headerState))
                {
                    MultiColumnHeaderState.OverwriteSerializedFields(m_Mchs, headerState);
                }
                m_Mchs = headerState;

                m_SearchField = new SearchField();
                m_EntryTree   = new AddressableAssetEntryTreeView(m_TreeState, m_Mchs, this);
                m_EntryTree.Reload();
            }

            HandleVerticalResize(pos);
            var inRectY    = pos.height;
            var searchRect = new Rect(pos.xMin, pos.yMin, pos.width, k_SearchHeight);
            var treeRect   = new Rect(pos.xMin, pos.yMin + k_SearchHeight, pos.width, inRectY - k_SearchHeight);

            TopToolbar(searchRect);
            m_EntryTree.OnGUI(treeRect);
            return(m_ResizingVerticalSplitter);
        }