Пример #1
0
        void OnGUI()
        {
            if (m_bundleTree == null)
            {
                if (m_selectionTreeState == null)
                {
                    m_selectionTreeState = new TreeViewState();
                }
                m_selectionList = new SelectionListTree(m_selectionTreeState);
                m_selectionList.Reload();

                if (m_assetListState == null)
                {
                    m_assetListState    = new TreeViewState();
                    m_assetListMCHState = new MultiColumnHeaderState(AssetListTree.GetColumns());
                }
                m_assetList = new AssetListTree(m_assetListState, m_assetListMCHState, m_selectionList);
                m_assetList.Reload();


                if (m_bundleTreeState == null)
                {
                    m_bundleTreeState = new TreeViewState();
                }
                m_bundleTree = new AssetBundleTree(m_bundleTreeState, m_assetList);
                m_bundleTree.Refresh();
                Repaint();
            }

            HandleHorizontalResize();
            HandleVerticalResize();

            if (GUI.Button(new Rect(0, kToolbarHeight, m_horizontalSplitterRect.x / 2, 25), new GUIContent("New Bundle")))
            {
                AssetBundleState.GetBundle(null);
            }
            // if (GUI.Button(new Rect(m_horizontalSplitterRect.x / 2, kToolbarHeight, m_horizontalSplitterRect.x / 2, 25), new GUIContent("New Folder")))
            //    ;// m_bundleTree.Add
            //    if (GUI.Button(new Rect(m_horizontalSplitterRect.x / 2, kToolbarHeight, m_horizontalSplitterRect.x/2, 25), new GUIContent("RESET")))
            //        AssetBundleState.Rebuild();

            m_bundleTree.OnGUI(new Rect(0, kToolbarHeight + 25 + kSplitterWidth, m_horizontalSplitterRect.x, position.height - (kToolbarHeight * 2 + kSplitterWidth * 2 + 25)));
            float panelLeft   = m_horizontalSplitterRect.x + kSplitterWidth;
            float panelWidth  = (position.width - m_horizontalSplitterRect.x) - kSplitterWidth * 2;
            float panelHeight = m_verticalSplitterRect.y - kToolbarHeight;

            m_assetList.OnGUI(new Rect(panelLeft, kToolbarHeight, panelWidth, panelHeight));
            m_selectionList.OnGUI(new Rect(panelLeft, m_verticalSplitterRect.y + kSplitterWidth, panelWidth, (position.height - m_verticalSplitterRect.y) - kSplitterWidth * 2));

            if (m_resizingHorizontalSplitter || m_resizingVerticalSplitter)
            {
                Repaint();
            }
        }
        void OnGUI()
        {
            if (m_bundleTree == null)
            {
                if (m_selectionTreeState == null)
                {
                    m_selectionTreeState = new TreeViewState();
                }
                m_selectionList = new SelectionListTree(m_selectionTreeState);

                if (m_assetListState == null)
                {
                    m_assetListState = new TreeViewState();
                }
                m_assetList = new AssetListTree(m_assetListState, m_selectionList);

                if (m_bundleTreeState == null)
                {
                    m_bundleTreeState = new TreeViewState();
                }
                m_bundleTree = new AssetBundleTree(m_bundleTreeState, m_assetList);
            }

            HandleHorizontalResize();
            HandleVerticalResize();

            m_bundleTree.OnGUI(new Rect(0, 0, m_horizontalSplitterRect.x, position.height));
            float panelLeft  = m_horizontalSplitterRect.x + 5;
            float panelWidth = (position.width - m_horizontalSplitterRect.x) - 5;

            m_assetList.OnGUI(new Rect(panelLeft, 0, panelWidth, m_verticalSplitterRect.y));
            m_selectionList.OnGUI(new Rect(panelLeft, m_verticalSplitterRect.y + 5, panelWidth, (position.height - m_verticalSplitterRect.y) - 5));

            if (m_resizingHorizontalSplitter || m_resizingVerticalSplitter)
            {
                Repaint();
            }
        }
Пример #3
0
        public void OnGUI(Rect pos)
        {
            m_Position = pos;

            if (m_BundleTree == null)
            {
                if (m_AssetListState == null)
                {
                    m_AssetListState = new TreeViewState();
                }

                var headerState = AssetListTree.CreateDefaultMultiColumnHeaderState();// multiColumnTreeViewRect.width);
                if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_AssetListMCHState, headerState))
                {
                    MultiColumnHeaderState.OverwriteSerializedFields(m_AssetListMCHState, headerState);
                }
                m_AssetListMCHState = headerState;


                m_AssetList = new AssetListTree(m_AssetListState, m_AssetListMCHState, this);
                m_AssetList.Reload();
                m_MessageList = new MessageList();

                if (m_BundleDetailState == null)
                {
                    m_BundleDetailState = new TreeViewState();
                }
                m_DetailsList = new BundleDetailList(m_BundleDetailState);
                m_DetailsList.Reload();

                if (m_BundleTreeState == null)
                {
                    m_BundleTreeState = new TreeViewState();
                }
                m_BundleTree = new AssetBundleTree(m_BundleTreeState, this);
                m_BundleTree.Refresh();
                m_Parent.Repaint();
            }

            HandleHorizontalResize();
            HandleVerticalResize();


            if (AssetBundleModel.Model.BundleListIsEmpty())
            {
                m_BundleTree.OnGUI(m_Position);
                var style = GUI.skin.label;
                style.alignment = TextAnchor.MiddleCenter;
                style.wordWrap  = true;
                GUI.Label(
                    new Rect(m_Position.x + 1f, m_Position.y + 1f, m_Position.width - 2f, m_Position.height - 2f),
                    new GUIContent(AssetBundleModel.Model.GetEmptyMessage()),
                    style);
            }
            else
            {
                //Left half
                var bundleTreeRect = new Rect(
                    m_Position.x,
                    m_Position.y,
                    m_HorizontalSplitterRect.x,
                    m_VerticalSplitterRectLeft.y - m_Position.y);
                m_BundleTree.OnGUI(bundleTreeRect);
                m_DetailsList.OnGUI(new Rect(
                                        bundleTreeRect.x,
                                        bundleTreeRect.y + bundleTreeRect.height + k_SplitterWidth,
                                        bundleTreeRect.width,
                                        m_Position.height - bundleTreeRect.height - k_SplitterWidth * 2));


                //Right half.
                float panelLeft   = m_HorizontalSplitterRect.x + k_SplitterWidth;
                float panelWidth  = m_VerticalSplitterRectRight.width - k_SplitterWidth * 2;
                float panelHeight = m_VerticalSplitterRectRight.y - m_Position.y;
                m_AssetList.OnGUI(new Rect(
                                      panelLeft,
                                      m_Position.y,
                                      panelWidth,
                                      panelHeight));
                m_MessageList.OnGUI(new Rect(
                                        panelLeft,
                                        m_Position.y + panelHeight + k_SplitterWidth,
                                        panelWidth,
                                        (m_Position.height - panelHeight) - k_SplitterWidth * 2));

                if (m_ResizingHorizontalSplitter || m_ResizingVerticalSplitterRight || m_ResizingVerticalSplitterLeft)
                {
                    m_Parent.Repaint();
                }
            }
        }
Пример #4
0
        public void OnGUI(Rect pos)
        {
            m_position = pos;
            if (m_bundleTree == null)
            {
                if (m_messageList == null)
                {
                    m_messageList = new MessageList();
                }


                if (m_assetListState == null)
                {
                    m_assetListState    = new TreeViewState();
                    m_assetListMCHState = new MultiColumnHeaderState(AssetListTree.GetColumns());
                }
                m_assetList = new AssetListTree(m_assetListState, m_assetListMCHState, this);
                m_assetList.Reload();


                if (m_bundleTreeState == null)
                {
                    m_bundleTreeState = new TreeViewState();
                }
                m_bundleTree = new AssetBundleTree(m_bundleTreeState, this);
                m_bundleTree.Refresh();
                m_parent.Repaint();
            }

            HandleHorizontalResize();
            HandleVerticalResize();

            var bundleTreeRect = new Rect(
                m_position.x,
                m_position.y,
                m_horizontalSplitterRect.x,
                m_position.height - kSplitterWidth);

            m_bundleTree.OnGUI(bundleTreeRect);
            if (AssetBundleModel.Model.BundleListIsEmpty())
            {
                var style = GUI.skin.label;
                style.alignment = TextAnchor.MiddleCenter;
                style.wordWrap  = true;
                GUI.Label(
                    new Rect(bundleTreeRect.x + 1f, bundleTreeRect.y + 1f, bundleTreeRect.width - 2f, bundleTreeRect.height - 2f),
                    new GUIContent("Drag assets here or right-click to begin creating bundles."),
                    style);
            }

            float panelLeft   = m_horizontalSplitterRect.x + kSplitterWidth;
            float panelWidth  = m_verticalSplitterRect.width - kSplitterWidth * 2;
            float panelHeight = m_verticalSplitterRect.y - m_position.y;

            m_assetList.OnGUI(new Rect(
                                  panelLeft,
                                  m_position.y,
                                  panelWidth,
                                  panelHeight));
            m_messageList.OnGUI(new Rect(
                                    panelLeft,
                                    m_position.y + panelHeight + kSplitterWidth,
                                    panelWidth,
                                    (m_position.height - panelHeight) - kSplitterWidth * 2));

            if (m_resizingHorizontalSplitter || m_resizingVerticalSplitter)
            {
                m_parent.Repaint();
            }
        }