public void AddDynamicSubWindowWithToolBar(string title, EWSubWindowIcon icon, EWSubWindowToolbarType toolbar, Action <Rect, Rect> action) { if (toolbar != EWSubWindowToolbarType.None) { AddDynamicSubWindowInternal(title, icon, toolbar, SubWindowHelpBoxType.None, action); } }
private void AddDynamicSubWindowInternal(string title, string icon, EWSubWindowToolbarType toolbar, SubWindowHelpBoxType helpbox, Delegate action) { if (m_WindowTree != null) { m_WindowTree.AddDynamicWindow(title, icon, toolbar, helpbox, action); } }
public void AddDynamicFullSubWindow(string title, EWSubWindowIcon icon, EWSubWindowToolbarType toolbar, SubWindowHelpBoxType helpBoxType, Action <Rect, Rect, Rect> action) { if (helpBoxType != SubWindowHelpBoxType.None && toolbar == EWSubWindowToolbarType.None) { AddDynamicSubWindowInternal(title, icon, toolbar, helpBoxType, action); } }
public SubWindow(string title, string icon, bool defaultOpen, MethodInfo method, System.Object target, EWSubWindowToolbarType toolbar, SubWindowHelpBoxType helpbox) { this.DefaultOpen = defaultOpen; this.m_Drawer = new SubWindowMethodDrawer(title, icon, method, target, toolbar, helpbox); this.m_Drawer.Init(); }
public override void DrawMainWindow(Rect mainRect) { base.DrawMainWindow(mainRect); if (GUI.Button(new Rect(mainRect.x, mainRect.y, mainRect.width, 20), "改变标题")) { m_Title = new GUIContent("新的标题"); } if (GUI.Button(new Rect(mainRect.x, mainRect.y + 20, mainRect.width, 20), "显示Toolbar")) { m_ToolBar = EWSubWindowToolbarType.Normal; } if (GUI.Button(new Rect(mainRect.x, mainRect.y + 40, mainRect.width, 20), "关闭Toolbar")) { m_ToolBar = EWSubWindowToolbarType.None; } if (GUI.Button(new Rect(mainRect.x, mainRect.y + 60, mainRect.width, 20), "显示HelpBox")) { SetSubWindowHelpBoxType(SubWindowHelpBoxType.Locker); } if (GUI.Button(new Rect(mainRect.x, mainRect.y + 80, mainRect.width, 20), "关闭HelpBox")) { SetSubWindowHelpBoxType(SubWindowHelpBoxType.None); } if (GUI.Button(new Rect(mainRect.x, mainRect.y + 100, mainRect.width, 20), "访问容器窗体")) { ((TestWinE)container).TestFunc(); } valueA = EditorGUI.TextField(new Rect(mainRect.x, mainRect.y + 120, mainRect.width, 20), "Value:", valueA); valueB = EditorGUI.Vector3Field(new Rect(mainRect.x, mainRect.y + 140, mainRect.width, 20), "ValueB:", valueB); }
/// <summary> /// 检查子窗口绘制函数的参数是否合法 /// </summary> /// <param name="infos">绘制方法的参数数组</param> /// <returns></returns> private static bool CheckSubWindowParameters(MethodInfo method, EWSubWindowToolbarType toolbar, SubWindowHelpBoxType helpbox) { ParameterInfo[] infos = method.GetParameters(); if (toolbar != EWSubWindowToolbarType.None && helpbox != SubWindowHelpBoxType.None) { if (infos.Length != 3) { return(false); } } else if ((toolbar != EWSubWindowToolbarType.None && helpbox == SubWindowHelpBoxType.None) || (toolbar == EWSubWindowToolbarType.None && helpbox != SubWindowHelpBoxType.None)) { if (infos.Length != 2) { return(false); } } else if (toolbar == EWSubWindowToolbarType.None && helpbox == SubWindowHelpBoxType.None) { if (infos.Length != 1) { return(false); } } for (int i = 0; i < infos.Length; i++) { if (infos[i].ParameterType != typeof(Rect)) { return(false); } } return(true); }
/// <summary> /// 添加带工具栏的子窗体 /// </summary> /// <param name="title">标题</param> /// <param name="icon">图标</param> /// <param name="action">方法</param> public void AddDynamicSubWindowWithToolBar(string title, EWSubWindowIcon icon, EWSubWindowToolbarType toolbar, SubWindowActionHalf action) { if (toolbar == EWSubWindowToolbarType.None) { return; } this.AddDynamicSubWindowInternal(title, icon, toolbar, SubWindowHelpBoxType.None, action); }
/// <summary> /// /// </summary> /// <param name="title">标题</param> /// <param name="icon">图标</param> /// <param name="active">初始是否激活</param> /// <param name="windowStyle">窗口样式</param> /// <param name="toolbar">是否显示工具栏</param> /// <param name="helpBox">帮助栏样式</param> public EWSubWindowAttribute(string title, string icon, bool active = true, SubWindowStyle windowStyle = SubWindowStyle.Default, EWSubWindowToolbarType toolbar = EWSubWindowToolbarType.None, SubWindowHelpBoxType helpBox = SubWindowHelpBoxType.None) { this.title = title; this.active = active; this.windowStyle = windowStyle; this.toolbar = toolbar; this.helpBox = helpBox; this.iconPath = icon; }
/// <summary> /// 添加完整窗口 /// </summary> /// <param name="title">标题</param> /// <param name="icon">图标</param> /// <param name="helpBoxType">帮助栏</param> /// <param name="action">方法</param> public void AddDynamicFullSubWindow(string title, EWSubWindowIcon icon, EWSubWindowToolbarType toolbar, SubWindowHelpBoxType helpBoxType, SubWindowActionFull action) { if (helpBoxType == SubWindowHelpBoxType.None) { return; } if (toolbar == EWSubWindowToolbarType.None) { return; } this.AddDynamicSubWindowInternal(title, icon, toolbar, helpBoxType, action); }
public SubWindowMethodDrawer(string title, string icon, MethodInfo method, System.Object target, EWSubWindowToolbarType toolbar, SubWindowHelpBoxType helpbox) { this.m_Title = CreateTitle(title, icon); this.m_Method = method; this.m_ToolBar = toolbar; this.m_HelpBox = SubWindowHelpBox.CreateHelpBox(helpbox); this.m_Target = target; this.m_Id = GetMethodID(method, target); if (this.m_Method != null) { ParameterInfo[] p = this.m_Method.GetParameters(); m_Params = new System.Object[p.Length]; } }
public void AddDynamicWindow(string title, string icon, EWSubWindowToolbarType toolbar, SubWindowHelpBoxType helpbox, Delegate method) { if (method == null) { return; } string id = SubWindowMethodDrawer.GetMethodID(method.Method, method.Target); if (ContainWindowID(id)) { return; } SubWindow window = new SubWindow(title, icon, true, method.Method, method.Target, toolbar, helpbox); window.isDynamic = true; m_SubWindowList.Add(window); window.Open(); this.InsertWindow(window); }
private void AddDynamicSubWindowInternal(string title, EWSubWindowIcon icon, EWSubWindowToolbarType toolbar, SubWindowHelpBoxType helpbox, Delegate action) { AddDynamicSubWindowInternal(title, GUIEx.GetIconPath(icon), toolbar, helpbox, action); }
public PreviewSubWindow(string title, string icon, bool defaultOpen, MethodInfo method, System.Object target, EWSubWindowToolbarType toolbar, SubWindowHelpBoxType helpbox) : base(title, icon, defaultOpen, method, target, toolbar, helpbox) { }
public static SubWindow CreateSubWindow(SubWindowStyle style, string title, string iconPath, bool defaultOpen, MethodInfo method, System.Object target, EWSubWindowToolbarType toolbar, SubWindowHelpBoxType helpbox) { if (!CheckSubWindowParameters(method, toolbar, helpbox)) { return(null); } if (subWindowClass == null) { GetSubWinodwStyleClasses(); } else if (!subWindowClass.ContainsKey(style)) { GetSubWinodwStyleClasses(); } if (subWindowClass == null || !subWindowClass.ContainsKey(style)) { return(null); } System.Type type = subWindowClass[style]; return ((SubWindow)System.Activator.CreateInstance(type, title, iconPath, defaultOpen, method, target, toolbar, helpbox)); }