public void DrawView(GTEditorSubView context) { if (Components == null || Components.Count == 0) { return; } if (Width <= 0) { return; } if (Height <= 0) { GUILayout.BeginHorizontal("box", GUILayout.Width(Width)); } else { GUILayout.BeginHorizontal("box", GUILayout.Width(Width), GUILayout.Height(Height)); } for (int i = 0; i < Components.Count; i++) { GTEditorToolbarViewComponent com = Components[i]; if (com == null) { continue; } com.Draw(this); } GUILayout.EndHorizontal(); }
public override void Draw(GTEditorSubView varView) { base.Draw(varView); GUILayout.BeginHorizontal(GUILayout.Width(FieldShowTypeWidth + ObjectFieldWidth + MarginLeft)); GUILayout.Space(MarginLeft); if (Width <= 0) { return; } FieldShowType = (ShowType)EditorGUILayout.EnumPopup(FieldShowType, GUILayout.Width(FieldShowTypeWidth)); LastFilePath = CurrentFilePath; switch (FieldShowType) { case ShowType.CurrentEdit: EditorGUILayout.ObjectField(CurrentAsset, typeof(TextAsset), false, GUILayout.Width(ObjectFieldWidth)); break; case ShowType.FileNamePop: ShowFileNamePop(); break; default: break; } GUILayout.EndHorizontal(); }
public GTEditorSubView GetSubViewByID(int viewID) { if (AllSubViews == null || AllSubViews.Count == 0) { return(null); } GTEditorSubView subView = null; AllSubViews.TryGetValue(viewID, out subView); return(subView); }
public void RemoveSubView(GTEditorSubView view) { if (view == null) { return; } if (AllSubViews == null || AllSubViews.Count == 0) { return; } view.OnDestroy(); AllSubViews.Remove(view.ViewID); }
public void AddSubView(GTEditorSubView view) { if (AllSubViews == null) { AllSubViews = new Dictionary <int, GTEditorSubView>(); } if (view == null) { return; } GTEditorSubView subView = null; if (AllSubViews.TryGetValue(view.ViewID, out subView)) { return; } AllSubViews.Add(view.ViewID, view); }
public virtual void GoToSubView(int viewID, GTEditorSubView context, object param = null) { if (AllSubViews == null || AllSubViews.Count == 0) { Helper.LogError("GTEditorView GoToSubView:Error caused by null subview collection"); return; } GTEditorSubView view = null; if (AllSubViews.TryGetValue(viewID, out view)) { if (context != null) { context.OnInActive(view); } CurrentActiveView = view; LastActiveView = context; CurrentActiveView.OnActive(context, param); } }
public virtual void Draw(GTEditorSubView context) { }
public virtual void OnInActive(GTEditorSubView context, object param = null) { Active = false; }
public void NotityAllSubView(EditorWindowEvtType evtType, object param) { if (AllSubViews != null && AllSubViews.Count > 0) { Dictionary <int, GTEditorSubView> .Enumerator em = AllSubViews.GetEnumerator(); for (int i = 0; i < AllSubViews.Count; i++) { em.MoveNext(); KeyValuePair <int, GTEditorSubView> kvp = em.Current; GTEditorSubView subView = kvp.Value; if (subView == null) { continue; } switch (evtType) { case EditorWindowEvtType.OnGUI: subView.OnGUI(); break; case EditorWindowEvtType.Update: subView.Update(); break; case EditorWindowEvtType.OnInspectorUpdate: subView.OnInspectorUpdate(); break; case EditorWindowEvtType.OnSelectionChange: subView.OnSelectionChange(); break; case EditorWindowEvtType.OnFocus: subView.OnFoucs(); break; case EditorWindowEvtType.OnLostFocus: subView.OnLostFocus(); break; case EditorWindowEvtType.OnHierarchyChange: subView.OnHierarchyChange(); break; case EditorWindowEvtType.OnProjectChange: subView.OnProjectChange(); break; case EditorWindowEvtType.OnEnable: subView.OnEnable(); break; case EditorWindowEvtType.OnDisable: subView.OnDisable(); break; case EditorWindowEvtType.OnDestroy: subView.OnDestroy(); break; default: break; } } } }