public static void Open(AutoTestEditor owner, Vector2 position, float buttonWidth) { var rect = new Rect(position, new Vector2(300, 800)); if (m_AddScriptEditor == null) { m_AddScriptEditor = EditorWindow.GetWindowWithRect <AddAutoTestScript>(rect, true, "添加测试脚本"); } else { m_AddScriptEditor.position = rect; } m_AddScriptEditor.m_Owner = owner; m_AddScriptEditor.m_ButtonWidth = buttonWidth; m_AddScriptEditor.Show(); }
// 左侧脚本列表 bool DrawScriptList() { GUILayout.BeginArea(new Rect(Edge, Edge, LeftWidth, m_AutoTestEditor.position.height - Edge * 2), GUI.skin.GetStyle("AS TextArea")); m_LeftScrollPos = EditorGUILayout.BeginScrollView(m_LeftScrollPos); if (GUILayout.Button("添加脚本", GUILayout.ExpandWidth(true))) { AddAutoTestScript.Open(this, new Vector2(LeftWidth, Edge), ButtonWidth); } EditorGUILayout.Space(); // 所有脚本列表 var files = new string[m_FileList.Count]; for (int i = 0; i < m_FileList.Count; ++i) { files[i] = m_FileList[i].Name; } int oldIndex = m_SelectScriptIndex; m_SelectScriptIndex = GUILayout.SelectionGrid(m_SelectScriptIndex, files, 1); if (oldIndex != m_SelectScriptIndex) { PrepareCurrentScript(); } EditorGUILayout.EndScrollView(); GUILayout.EndArea(); return(false); }