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(); } }
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(); } }