private void DrawTitle() { GUILayout.BeginVertical(); GUILayout.Space(10); GUI.skin.label.fontSize = 15; GUI.skin.label.alignment = TextAnchor.UpperLeft; //不再重新赋值是为了防止误点,所以,如果想要选择别的game object只能重新打开 if (_selectedObj == null && Selection.activeGameObject != null) { _selectedObj = this.GetSelectionObj(); } if (_selectedObj != null) { GUILayout.Label("Selected Name:" + _selectedObj.name); } else { GUILayout.Label("please selected UI in hierarchy"); } if (GUILayout.Button("切换根节点", GUILayout.Width(100), GUILayout.Height(20))) { _treeViews = null; Utils.SelectedDic.Clear(); this._uiCompleteList.Clear(); _selectedObj = this.GetSelectionObj(); } }
/// <summary> /// 绘制预设包含的UI组件 /// </summary> private void DrawUIEles() { if (this.selectedObj != null) { GameObject[] rects = Utils.GetAllUIChild(this.selectedObj.gameObject); if (treeViews == null) { treeViews = new PrefabsTreeViews(treeViewState); if (this.uiCompleteList == null) { this.uiCompleteList = new List <GameObject>(); } } this.treeViews.ParentTransform = this.selectedObj; this.treeViews.Reload(); this.treeViews.OnGUI(new Rect(0, 50, 300, 500)); this.UpdateUIDict(rects); } }
private void DrawUIEles() { if (this._selectedObj != null) { GameObject[] rects = Utils.GetAllUIChild(this._selectedObj.gameObject); if (_treeViews == null) { _treeViews = new PrefabsTreeViews(_treeViewState); this._treeViews.ParentTransform = this._selectedObj; this._treeViews.Reload(); this.UpdateUIDict(rects); } this._treeViews.RefhreshSelectedState(); this._treeViews.Repaint(); this._treeViews.OnGUI(new Rect(0, 50, 400, 900)); } }