public static ListView ( |
||
state | ||
style | ||
return | ListViewShared.ListViewElementsEnumerator |
private void DoProjectsGUI() { GUILayout.BeginVertical(constants.groupBox, new GUILayoutOption[0]); GUILayout.Label("Projects on Server", constants.title, new GUILayoutOption[0]); IEnumerator enumerator = ListViewGUILayout.ListView(this.projectsLv, constants.background, new GUILayoutOption[0]).GetEnumerator(); try { while (enumerator.MoveNext()) { ListViewElement current = (ListViewElement)enumerator.Current; if ((current.row == this.projectsLv.row) && (Event.current.type == EventType.Repaint)) { constants.entrySelected.Draw(current.position, false, false, false, false); } GUILayout.Label(this.projectsList[current.row], constants.element, new GUILayoutOption[0]); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } if (this.projectsLv.selectionChanged) { this.projectName = this.projectsList[this.projectsLv.row]; } GUILayout.EndVertical(); }
private int DoListColumn(ListViewState listView, List <ColumnViewElement> columnViewElements, int columnIndex, int selectedIndex, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction) { if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return && listView.row > -1) { if (this.isSearching && selectedSearchItemFunction != null) { this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElements[selectedIndex].value); } if (!this.isSearching && GUIUtility.keyboardControl == listView.ID && selectedRegularItemFunction != null) { ColumnView.DoItemSelectedEvent(selectedRegularItemFunction, columnViewElements[selectedIndex].value); } } if (GUIUtility.keyboardControl == listView.ID && Event.current.type == EventType.KeyDown && !this.isSearching) { KeyCode keyCode = Event.current.keyCode; if (keyCode != KeyCode.RightArrow) { if (keyCode == KeyCode.LeftArrow) { this.m_ColumnToFocusKeyboard = columnIndex - 1; Event.current.Use(); } } else { this.m_ColumnToFocusKeyboard = columnIndex + 1; Event.current.Use(); } } foreach (ListViewElement element in ListViewGUILayout.ListView(listView, ColumnView.s_Styles.background, new GUILayoutOption[] { GUILayout.Width(this.columnWidth) })) { ColumnViewElement columnViewElement = columnViewElements[element.row]; if (element.row == listView.row && Event.current.type == EventType.Repaint) { Rect position = element.position; position.x += 1f; position.y += 1f; ColumnView.s_Styles.selected.Draw(position, false, true, true, GUIUtility.keyboardControl == listView.ID); } GUILayout.Label(columnViewElement.name, new GUILayoutOption[0]); if (columnViewElement.value is List <ColumnViewElement> ) { Rect position2 = element.position; position2.x = position2.xMax - (float)ColumnView.s_Styles.categoryArrowIcon.width - 5f; position2.y += 2f; GUI.Label(position2, ColumnView.s_Styles.categoryArrowIcon); } this.DoDoubleClick(element, columnViewElement, selectedSearchItemFunction, selectedRegularItemFunction); ColumnView.DoDragAndDrop(listView, element, columnViewElements, getDataForDraggingFunction); } if (Event.current.type == EventType.Layout) { selectedIndex = listView.row; } return(selectedIndex); }
private void OnGUI() { if (PragmaFixingWindow.s_Styles == null) { PragmaFixingWindow.s_Styles = new PragmaFixingWindow.Styles(); base.minSize = new Vector2(450f, 300f); base.position = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y); } GUILayout.Space(10f); GUILayout.Label("#pragma implicit and #pragma downcast need to be added to following files\nfor backwards compatibility", new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(10f); IEnumerator enumerator = ListViewGUILayout.ListView(this.m_LV, PragmaFixingWindow.s_Styles.box, new GUILayoutOption[0]).GetEnumerator(); try { while (enumerator.MoveNext()) { ListViewElement listViewElement = (ListViewElement)enumerator.Current; if (listViewElement.row == this.m_LV.row && Event.current.type == EventType.Repaint) { PragmaFixingWindow.s_Styles.selected.Draw(listViewElement.position, false, false, false, false); } GUILayout.Label(this.m_Paths[listViewElement.row], new GUILayoutOption[0]); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Fix now", PragmaFixingWindow.s_Styles.button, new GUILayoutOption[0])) { base.Close(); PragmaFixing30.FixFiles(this.m_Paths); GUIUtility.ExitGUI(); } if (GUILayout.Button("Ignore", PragmaFixingWindow.s_Styles.button, new GUILayoutOption[0])) { base.Close(); GUIUtility.ExitGUI(); } if (GUILayout.Button("Quit", PragmaFixingWindow.s_Styles.button, new GUILayoutOption[0])) { EditorApplication.Exit(0); GUIUtility.ExitGUI(); } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); }
void OnGUI() { if (s_Styles == null) { s_Styles = new Styles(); minSize = new Vector2(450, 300); position = new Rect(position.x, position.y, minSize.x, minSize.y); } GUILayout.Space(10); GUILayout.Label("#pragma implicit and #pragma downcast need to be added to following files\nfor backwards compatibility"); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Space(10); foreach (ListViewElement el in ListViewGUILayout.ListView(m_LV, s_Styles.box)) { if (el.row == m_LV.row && Event.current.type == EventType.Repaint) { s_Styles.selected.Draw(el.position, false, false, false, false); } GUILayout.Label(m_Paths[el.row]); } GUILayout.Space(10); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Fix now", s_Styles.button)) { Close(); PragmaFixing30.FixFiles(m_Paths); // bugfix (377429): do not call AssetDatabase.Refresh here as that screws up project upgrading. // When this script is invoked from Application::InitializeProject, the assets will be refreshed anyway. GUIUtility.ExitGUI(); } if (GUILayout.Button("Ignore", s_Styles.button)) { Close(); GUIUtility.ExitGUI(); } if (GUILayout.Button("Quit", s_Styles.button)) { EditorApplication.Exit(0); GUIUtility.ExitGUI(); } GUILayout.Space(10); GUILayout.EndHorizontal(); GUILayout.Space(10); }
private void OnGUI() { if (BumpMapSettingsFixingWindow.s_Styles == null) { BumpMapSettingsFixingWindow.s_Styles = new BumpMapSettingsFixingWindow.Styles(); base.minSize = new Vector2(400f, 300f); base.position = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y); } GUILayout.Space(5f); GUILayout.Label(BumpMapSettingsFixingWindow.s_Styles.overviewText, new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(10f); IEnumerator enumerator = ListViewGUILayout.ListView(this.m_LV, BumpMapSettingsFixingWindow.s_Styles.box, new GUILayoutOption[0]).GetEnumerator(); try { while (enumerator.MoveNext()) { ListViewElement listViewElement = (ListViewElement)enumerator.Current; if (listViewElement.row == this.m_LV.row && Event.current.type == EventType.Repaint) { BumpMapSettingsFixingWindow.s_Styles.selected.Draw(listViewElement.position, false, false, false, false); } GUILayout.Label(this.m_Paths[listViewElement.row], new GUILayoutOption[0]); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Fix now", BumpMapSettingsFixingWindow.s_Styles.button, new GUILayoutOption[0])) { InternalEditorUtility.BumpMapSettingsFixingWindowReportResult(1); base.Close(); } if (GUILayout.Button("Ignore", BumpMapSettingsFixingWindow.s_Styles.button, new GUILayoutOption[0])) { InternalEditorUtility.BumpMapSettingsFixingWindowReportResult(0); base.Close(); } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); }
private void OnGUI() { if (PragmaFixingWindow.s_Styles == null) { PragmaFixingWindow.s_Styles = new PragmaFixingWindow.Styles(); this.minSize = new Vector2(450f, 300f); this.position = new Rect(this.position.x, this.position.y, this.minSize.x, this.minSize.y); } GUILayout.Space(10f); GUILayout.Label("#pragma implicit and #pragma downcast need to be added to following files\nfor backwards compatibility"); GUILayout.Space(10f); GUILayout.BeginHorizontal(); GUILayout.Space(10f); foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.m_LV, PragmaFixingWindow.s_Styles.box)) { if (listViewElement.row == this.m_LV.row && Event.current.type == EventType.Repaint) { PragmaFixingWindow.s_Styles.selected.Draw(listViewElement.position, false, false, false, false); } GUILayout.Label(this.m_Paths[listViewElement.row]); } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Fix now", PragmaFixingWindow.s_Styles.button, new GUILayoutOption[0])) { this.Close(); PragmaFixing30.FixFiles(this.m_Paths); GUIUtility.ExitGUI(); } if (GUILayout.Button("Ignore", PragmaFixingWindow.s_Styles.button, new GUILayoutOption[0])) { this.Close(); GUIUtility.ExitGUI(); } if (GUILayout.Button("Quit", PragmaFixingWindow.s_Styles.button, new GUILayoutOption[0])) { EditorApplication.Exit(0); GUIUtility.ExitGUI(); } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); }
void OnGUI() { if (s_Styles == null) { s_Styles = new Styles(); minSize = new Vector2(400, 300); position = new Rect(position.x, position.y, minSize.x, minSize.y); } GUILayout.Space(5); GUILayout.Label(s_Styles.overviewText); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Space(10); foreach (ListViewElement el in ListViewGUILayout.ListView(m_LV, s_Styles.box)) { if (el.row == m_LV.row && Event.current.type == EventType.Repaint) { s_Styles.selected.Draw(el.position, false, false, false, false); } GUILayout.Label(m_Paths[el.row]); } GUILayout.Space(10); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Fix now", s_Styles.button)) { InternalEditorUtility.BumpMapSettingsFixingWindowReportResult(1); Close(); } if (GUILayout.Button("Ignore", s_Styles.button)) { InternalEditorUtility.BumpMapSettingsFixingWindowReportResult(0); Close(); } GUILayout.Space(10); GUILayout.EndHorizontal(); GUILayout.Space(10); }
private void DoProjectsGUI() { GUILayout.BeginVertical(ASConfigWindow.constants.groupBox, new GUILayoutOption[0]); GUILayout.Label("Projects on Server", ASConfigWindow.constants.title, new GUILayoutOption[0]); foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.projectsLv, ASConfigWindow.constants.background, new GUILayoutOption[0])) { if (listViewElement.row == this.projectsLv.row && Event.current.type == EventType.Repaint) { ASConfigWindow.constants.entrySelected.Draw(listViewElement.position, false, false, false, false); } GUILayout.Label(this.projectsList[listViewElement.row], ASConfigWindow.constants.element, new GUILayoutOption[0]); } if (this.projectsLv.selectionChanged) { this.projectName = this.projectsList[this.projectsLv.row]; } GUILayout.EndVertical(); }
private void OnGUI() { if (BumpMapSettingsFixingWindow.s_Styles == null) { BumpMapSettingsFixingWindow.s_Styles = new BumpMapSettingsFixingWindow.Styles(); base.minSize = new Vector2(400f, 300f); base.position = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y); } GUILayout.Space(5f); GUILayout.Label(BumpMapSettingsFixingWindow.s_Styles.overviewText, new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(10f); foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.m_LV, BumpMapSettingsFixingWindow.s_Styles.box, new GUILayoutOption[0])) { if (listViewElement.row == this.m_LV.row && Event.current.type == EventType.Repaint) { BumpMapSettingsFixingWindow.s_Styles.selected.Draw(listViewElement.position, false, false, false, false); } GUILayout.Label(this.m_Paths[listViewElement.row], new GUILayoutOption[0]); } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Fix now", BumpMapSettingsFixingWindow.s_Styles.button, new GUILayoutOption[0])) { InternalEditorUtility.BumpMapSettingsFixingWindowReportResult(1); base.Close(); } if (GUILayout.Button("Ignore", BumpMapSettingsFixingWindow.s_Styles.button, new GUILayoutOption[0])) { InternalEditorUtility.BumpMapSettingsFixingWindowReportResult(0); base.Close(); } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); }
public static ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, string dragTitle, GUIStyle style, params GUILayoutOption[] options) { return(ListViewGUILayout.ListView(state, (ListViewOptions)0, dragTitle, style, options)); }
private void OnGUI() { if (AssetSaveDialog.s_Styles == null) { AssetSaveDialog.s_Styles = new AssetSaveDialog.Styles(); base.minSize = new Vector2(500f, 300f); base.position = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y); } this.HandleKeyboard(); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.Label("Unity is about to save the following modified files. Unsaved changes will be lost!", new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(10f); int row = this.m_LV.row; int num = 0; foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.m_LV, AssetSaveDialog.s_Styles.box, new GUILayoutOption[0])) { if (this.m_SelectedItems[listViewElement.row] && Event.current.type == EventType.Repaint) { Rect position = listViewElement.position; position.x += 1f; position.y += 1f; position.width -= 1f; position.height -= 1f; AssetSaveDialog.s_Styles.selected.Draw(position, false, false, false, false); } GUILayout.Label(this.m_Content[listViewElement.row], new GUILayoutOption[0]); if (ListViewGUILayout.HasMouseUp(listViewElement.position)) { Event.current.command = true; Event.current.control = true; ListViewGUILayout.MultiSelection(row, listViewElement.row, ref this.m_InitialSelectedItem, ref this.m_SelectedItems); } if (this.m_SelectedItems[listViewElement.row]) { num++; } } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(10f); if (GUILayout.Button(AssetSaveDialog.s_Styles.close, AssetSaveDialog.s_Styles.button, new GUILayoutOption[] { GUILayout.Width(AssetSaveDialog.s_Styles.buttonWidth) })) { this.CloseWindow(); } GUILayout.FlexibleSpace(); GUI.enabled = (num > 0); bool flag = num == this.m_Assets.Count; if (GUILayout.Button(AssetSaveDialog.s_Styles.dontSave, AssetSaveDialog.s_Styles.button, new GUILayoutOption[] { GUILayout.Width(AssetSaveDialog.s_Styles.buttonWidth) })) { this.IgnoreSelectedAssets(); } if (GUILayout.Button((!flag) ? AssetSaveDialog.s_Styles.saveSelected : AssetSaveDialog.s_Styles.saveAll, AssetSaveDialog.s_Styles.button, new GUILayoutOption[] { GUILayout.Width(AssetSaveDialog.s_Styles.buttonWidth) })) { this.SaveSelectedAssets(); } if (this.m_Assets.Count == 0) { this.CloseWindow(); } GUI.enabled = true; GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); }
public bool DoGUI() { bool enabled = GUI.enabled; if (ASServerAdminWindow.constants == null) { ASServerAdminWindow.constants = new ASMainWindow.Constants(); ASServerAdminWindow.constants.toggleSize = ASServerAdminWindow.constants.toggle.CalcSize(new GUIContent("X")); } if (this.resetKeyboardControl) { this.resetKeyboardControl = false; GUIUtility.keyboardControl = 0; } GUILayout.BeginHorizontal(); GUILayout.BeginVertical(ASServerAdminWindow.constants.groupBox, new GUILayoutOption[0]); GUILayout.Box("Server Connection", ASServerAdminWindow.constants.title, new GUILayoutOption[0]); GUILayout.BeginVertical(ASServerAdminWindow.constants.contentBox, new GUILayoutOption[0]); Event current = Event.current; if (current.type == EventType.KeyDown && current.keyCode == KeyCode.Return && this.CanPerformCurrentAction()) { this.PerformCurrentAction(); } if (current.type == EventType.KeyDown && current.keyCode == KeyCode.Escape && this.currAction != ASServerAdminWindow.Action.Main) { this.currAction = ASServerAdminWindow.Action.Main; current.Use(); } GUILayout.BeginHorizontal(); this.server = EditorGUILayout.TextField("Server Address:", this.server, new GUILayoutOption[0]); this.ServersPopup(); GUILayout.EndHorizontal(); this.user = EditorGUILayout.TextField("User Name:", this.user, new GUILayoutOption[0]); this.password = EditorGUILayout.PasswordField("Password:"******"Connect", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0])) { this.PerformCurrentAction(); } GUI.enabled = enabled; GUILayout.EndHorizontal(); if (AssetServer.GetAssetServerError() != string.Empty) { GUILayout.Label(AssetServer.GetAssetServerError(), ASServerAdminWindow.constants.errorLabel, new GUILayoutOption[0]); } GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.BeginVertical(ASServerAdminWindow.constants.groupBox, new GUILayoutOption[0]); GUILayout.Box("Admin Actions", ASServerAdminWindow.constants.title, new GUILayoutOption[0]); GUILayout.BeginVertical(ASServerAdminWindow.constants.contentBox, new GUILayoutOption[0]); this.ActionBox(); GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(ASServerAdminWindow.constants.groupBox, new GUILayoutOption[0]); GUILayout.Box("Project", ASServerAdminWindow.constants.title, new GUILayoutOption[0]); foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.lv, ASServerAdminWindow.constants.background)) { if (listViewElement.row == this.lv.row && Event.current.type == EventType.Repaint) { ASServerAdminWindow.constants.entrySelected.Draw(listViewElement.position, false, false, false, false); } GUILayout.Label(this.databases[listViewElement.row].name); } if (this.lv.selectionChanged) { if (this.lv.row > -1) { this.projectSelected = true; } this.currAction = ASServerAdminWindow.Action.Main; this.DoGetUsers(); } GUILayout.EndVertical(); GUILayout.BeginVertical(ASServerAdminWindow.constants.groupBox, new GUILayoutOption[0]); SplitterGUILayout.BeginHorizontalSplit(this.lvSplit); GUILayout.Box(string.Empty, ASServerAdminWindow.constants.columnHeader, new GUILayoutOption[0]); GUILayout.Box("User", ASServerAdminWindow.constants.columnHeader, new GUILayoutOption[0]); GUILayout.Box("Full Name", ASServerAdminWindow.constants.columnHeader, new GUILayoutOption[0]); GUILayout.Box("Email", ASServerAdminWindow.constants.columnHeader, new GUILayoutOption[0]); SplitterGUILayout.EndHorizontalSplit(); int left = EditorStyles.label.margin.left; foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.lv2, ASServerAdminWindow.constants.background)) { if (listViewElement.row == this.lv2.row && Event.current.type == EventType.Repaint) { ASServerAdminWindow.constants.entrySelected.Draw(listViewElement.position, false, false, false, false); } bool flag1 = this.users[listViewElement.row].enabled != 0; bool flag2 = GUI.Toggle(new Rect(listViewElement.position.x + 2f, listViewElement.position.y - 1f, ASServerAdminWindow.constants.toggleSize.x, ASServerAdminWindow.constants.toggleSize.y), flag1, string.Empty); GUILayout.Space(ASServerAdminWindow.constants.toggleSize.x); if (flag1 != flag2 && AssetServer.AdminSetUserEnabled(this.databases[this.lv.row].dbName, this.users[listViewElement.row].userName, this.users[listViewElement.row].fullName, this.users[listViewElement.row].email, !flag2 ? 0 : 1)) { this.users[listViewElement.row].enabled = !flag2 ? 0 : 1; } GUILayout.Label(this.users[listViewElement.row].userName, new GUILayoutOption[1] { GUILayout.Width((float)(this.lvSplit.realSizes[1] - left)) }); GUILayout.Label(this.users[listViewElement.row].fullName, new GUILayoutOption[1] { GUILayout.Width((float)(this.lvSplit.realSizes[2] - left)) }); GUILayout.Label(this.users[listViewElement.row].email); } if (this.lv2.selectionChanged) { if (this.lv2.row > -1) { this.userSelected = true; } if (this.currAction == ASServerAdminWindow.Action.SetPassword) { this.currAction = ASServerAdminWindow.Action.Main; } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Space(10f); if (!this.splittersOk && Event.current.type == EventType.Repaint) { this.splittersOk = true; this.parentWin.Repaint(); } return(true); }
public bool DoGUI() { bool enabled = GUI.enabled; if (constants == null) { constants = new ASMainWindow.Constants(); constants.toggleSize = constants.toggle.CalcSize(new GUIContent("X")); } if (this.resetKeyboardControl) { this.resetKeyboardControl = false; GUIUtility.keyboardControl = 0; } GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.BeginVertical(constants.groupBox, new GUILayoutOption[0]); GUILayout.Box("Server Connection", constants.title, new GUILayoutOption[0]); GUILayout.BeginVertical(constants.contentBox, new GUILayoutOption[0]); Event current = Event.current; if (((current.type == EventType.KeyDown) && (current.keyCode == KeyCode.Return)) && this.CanPerformCurrentAction()) { this.PerformCurrentAction(); } if (((current.type == EventType.KeyDown) && (current.keyCode == KeyCode.Escape)) && (this.currAction != Action.Main)) { this.currAction = Action.Main; current.Use(); } GUILayout.BeginHorizontal(new GUILayoutOption[0]); this.server = EditorGUILayout.TextField("Server Address:", this.server, new GUILayoutOption[0]); this.ServersPopup(); GUILayout.EndHorizontal(); this.user = EditorGUILayout.TextField("User Name:", this.user, new GUILayoutOption[0]); this.password = EditorGUILayout.PasswordField("Password:"******"Connect", constants.smallButton, new GUILayoutOption[0])) { this.PerformCurrentAction(); } GUI.enabled = enabled; GUILayout.EndHorizontal(); if (AssetServer.GetAssetServerError() != string.Empty) { GUILayout.Label(AssetServer.GetAssetServerError(), constants.errorLabel, new GUILayoutOption[0]); } GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.BeginVertical(constants.groupBox, new GUILayoutOption[0]); GUILayout.Box("Admin Actions", constants.title, new GUILayoutOption[0]); GUILayout.BeginVertical(constants.contentBox, new GUILayoutOption[0]); this.ActionBox(); GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.BeginVertical(constants.groupBox, new GUILayoutOption[0]); GUILayout.Box("Project", constants.title, new GUILayoutOption[0]); IEnumerator enumerator = ListViewGUILayout.ListView(this.lv, constants.background, new GUILayoutOption[0]).GetEnumerator(); try { while (enumerator.MoveNext()) { ListViewElement element = (ListViewElement)enumerator.Current; if ((element.row == this.lv.row) && (Event.current.type == EventType.Repaint)) { constants.entrySelected.Draw(element.position, false, false, false, false); } GUILayout.Label(this.databases[element.row].name, new GUILayoutOption[0]); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } if (this.lv.selectionChanged) { if (this.lv.row > -1) { this.projectSelected = true; } this.currAction = Action.Main; this.DoGetUsers(); } GUILayout.EndVertical(); GUILayout.BeginVertical(constants.groupBox, new GUILayoutOption[0]); SplitterGUILayout.BeginHorizontalSplit(this.lvSplit, new GUILayoutOption[0]); GUILayout.Box("", constants.columnHeader, new GUILayoutOption[0]); GUILayout.Box("User", constants.columnHeader, new GUILayoutOption[0]); GUILayout.Box("Full Name", constants.columnHeader, new GUILayoutOption[0]); GUILayout.Box("Email", constants.columnHeader, new GUILayoutOption[0]); SplitterGUILayout.EndHorizontalSplit(); int left = EditorStyles.label.margin.left; IEnumerator enumerator2 = ListViewGUILayout.ListView(this.lv2, constants.background, new GUILayoutOption[0]).GetEnumerator(); try { while (enumerator2.MoveNext()) { ListViewElement element2 = (ListViewElement)enumerator2.Current; if ((element2.row == this.lv2.row) && (Event.current.type == EventType.Repaint)) { constants.entrySelected.Draw(element2.position, false, false, false, false); } bool flag2 = this.users[element2.row].enabled != 0; bool flag3 = GUI.Toggle(new Rect(element2.position.x + 2f, element2.position.y - 1f, constants.toggleSize.x, constants.toggleSize.y), flag2, ""); GUILayout.Space(constants.toggleSize.x); if ((flag2 != flag3) && AssetServer.AdminSetUserEnabled(this.databases[this.lv.row].dbName, this.users[element2.row].userName, this.users[element2.row].fullName, this.users[element2.row].email, !flag3 ? 0 : 1)) { this.users[element2.row].enabled = !flag3 ? 0 : 1; } GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width((float)(this.lvSplit.realSizes[1] - left)) }; GUILayout.Label(this.users[element2.row].userName, options); GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width((float)(this.lvSplit.realSizes[2] - left)) }; GUILayout.Label(this.users[element2.row].fullName, optionArray2); GUILayout.Label(this.users[element2.row].email, new GUILayoutOption[0]); } } finally { IDisposable disposable2 = enumerator2 as IDisposable; if (disposable2 != null) { disposable2.Dispose(); } } if (this.lv2.selectionChanged) { if (this.lv2.row > -1) { this.userSelected = true; } if (this.currAction == Action.SetPassword) { this.currAction = Action.Main; } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Space(10f); if (!this.splittersOk && (Event.current.type == EventType.Repaint)) { this.splittersOk = true; this.parentWin.Repaint(); } return(true); }
private int DoListColumn(ListViewState listView, List <ColumnViewElement> columnViewElements, int columnIndex, int selectedIndex, ObjectColumnFunction selectedSearchItemFunction, ObjectColumnFunction selectedRegularItemFunction, ObjectColumnGetDataFunction getDataForDraggingFunction) { if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return && listView.row > -1) { if (isSearching && selectedSearchItemFunction != null) { DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElements[selectedIndex].value); } if (!isSearching && GUIUtility.keyboardControl == listView.ID && selectedRegularItemFunction != null) { DoItemSelectedEvent(selectedRegularItemFunction, columnViewElements[selectedIndex].value); } } if (GUIUtility.keyboardControl == listView.ID && Event.current.type == EventType.KeyDown && !isSearching) { switch (Event.current.keyCode) { case KeyCode.LeftArrow: m_ColumnToFocusKeyboard = columnIndex - 1; Event.current.Use(); break; case KeyCode.RightArrow: m_ColumnToFocusKeyboard = columnIndex + 1; Event.current.Use(); break; } } foreach (ListViewElement element in ListViewGUILayout.ListView(listView, s_Styles.background, GUILayout.Width(columnWidth))) { var columnViewElement = columnViewElements[element.row]; if (element.row == listView.row) { if (Event.current.type == EventType.Repaint) { // FIXME: One Pixel offset is required when using OL Box style. Use a different style. var rect = element.position; rect.x++; rect.y++; s_Styles.selected.Draw(rect, false, true, true, GUIUtility.keyboardControl == listView.ID); } } GUILayout.Label(columnViewElement.name); if (columnViewElement.value is List <ColumnViewElement> ) { // TODO: Make a proper style. var arrowRect = element.position; arrowRect.x = arrowRect.xMax - s_Styles.categoryArrowIcon.width - 5; arrowRect.y += 2; GUI.Label(arrowRect, s_Styles.categoryArrowIcon); } DoDoubleClick(element, columnViewElement, selectedSearchItemFunction, selectedRegularItemFunction); DoDragAndDrop(listView, element, columnViewElements, getDataForDraggingFunction); } if (Event.current.type == EventType.Layout) { selectedIndex = listView.row; } return(selectedIndex); }
private void OnGUI() { if (s_Styles == null) { s_Styles = new Styles(); base.minSize = new Vector2(500f, 300f); base.position = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y); } this.HandleKeyboard(); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.Label("Unity is about to save the following modified files. Unsaved changes will be lost!", new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(10f); int row = this.m_LV.row; int num2 = 0; IEnumerator enumerator = ListViewGUILayout.ListView(this.m_LV, s_Styles.box, new GUILayoutOption[0]).GetEnumerator(); try { while (enumerator.MoveNext()) { ListViewElement current = (ListViewElement)enumerator.Current; if (this.m_SelectedItems[current.row] && (Event.current.type == EventType.Repaint)) { Rect position = current.position; position.x++; position.y++; position.width--; position.height--; s_Styles.selected.Draw(position, false, false, false, false); } GUILayout.Label(this.m_Content[current.row], new GUILayoutOption[0]); if (ListViewGUILayout.HasMouseUp(current.position)) { Event.current.command = true; Event.current.control = true; ListViewGUILayout.MultiSelection(row, current.row, ref this.m_InitialSelectedItem, ref this.m_SelectedItems); } if (this.m_SelectedItems[current.row]) { num2++; } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable == null) { } disposable.Dispose(); } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(10f); GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(s_Styles.buttonWidth) }; if (GUILayout.Button(s_Styles.close, s_Styles.button, options)) { this.CloseWindow(); } GUILayout.FlexibleSpace(); GUI.enabled = num2 > 0; bool flag = num2 == this.m_Assets.Count; GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(s_Styles.buttonWidth) }; if (GUILayout.Button(s_Styles.dontSave, s_Styles.button, optionArray2)) { this.IgnoreSelectedAssets(); } GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width(s_Styles.buttonWidth) }; if (GUILayout.Button(!flag ? s_Styles.saveSelected : s_Styles.saveAll, s_Styles.button, optionArray3)) { this.SaveSelectedAssets(); } if (this.m_Assets.Count == 0) { this.CloseWindow(); } GUI.enabled = true; GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(10f); }
private void DoNamingConflictsGUI() { bool enabled = GUI.enabled; bool shift = Event.current.shift; bool actionKey = EditorGUI.actionKey; GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.Label("The following assets have the same name as an existing asset on the server.\nPlease select which one to rename before continuing the update.", new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUI.enabled = (this.lv2HasSelection && enabled); if (GUILayout.Button(ASUpdateConflictResolveWindow.nameConflictButtonTexts[0], this.constants.ButtonLeft, new GUILayoutOption[0])) { this.ResolveSelectedNamingConflicts(NameConflictResolution.RenameLocal); } if (GUILayout.Button(ASUpdateConflictResolveWindow.nameConflictButtonTexts[1], this.constants.ButtonRight, new GUILayoutOption[0])) { this.ResolveSelectedNamingConflicts(NameConflictResolution.RenameRemote); } GUI.enabled = enabled; GUILayout.EndHorizontal(); GUILayout.Space(5f); SplitterGUILayout.BeginHorizontalSplit(this.lvHeaderSplit2, new GUILayoutOption[0]); GUILayout.Box("Action", this.constants.lvHeader, new GUILayoutOption[0]); GUILayout.Box("Asset", this.constants.lvHeader, new GUILayoutOption[0]); SplitterGUILayout.EndHorizontalSplit(); int row = this.lv2.row; bool flag = false; foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.lv2, this.constants.background, new GUILayoutOption[0])) { if (GUIUtility.keyboardControl == this.lv2.ID && Event.current.type == EventType.KeyDown && actionKey) { Event.current.Use(); } if (this.selectedLV2Items[listViewElement.row] && Event.current.type == EventType.Repaint) { this.constants.selected.Draw(listViewElement.position, false, false, false, false); } if (ListViewGUILayout.HasMouseUp(listViewElement.position)) { if (!shift && !actionKey) { flag |= ListViewGUILayout.MultiSelection(row, this.lv2.row, ref this.initialSelectedLV2Item, ref this.selectedLV2Items); } } else { if (ListViewGUILayout.HasMouseDown(listViewElement.position)) { if (!this.selectedLV2Items[listViewElement.row] || shift || actionKey) { flag |= ListViewGUILayout.MultiSelection(row, listViewElement.row, ref this.initialSelectedLV2Item, ref this.selectedLV2Items); } this.lv2.row = listViewElement.row; } } GUILayout.Label(this.namingResolutionString[(int)this.namingResolutions[listViewElement.row]], new GUILayoutOption[] { GUILayout.Width((float)this.lvHeaderSplit2.realSizes[0]), GUILayout.Height(18f) }); GUILayout.Label(new GUIContent(this.dNamingPaths[listViewElement.row], (!AssetServer.AssetIsDir(this.nameConflicts[listViewElement.row])) ? InternalEditorUtility.GetIconForFile(this.dNamingPaths[listViewElement.row]) : EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName)), new GUILayoutOption[] { GUILayout.Width((float)this.lvHeaderSplit2.realSizes[1]), GUILayout.Height(18f) }); } GUILayout.EndVertical(); if (GUIUtility.keyboardControl == this.lv2.ID) { if (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "SelectAll") { Event.current.Use(); } else { if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "SelectAll") { for (int i = 0; i < this.selectedLV2Items.Length; i++) { this.selectedLV2Items[i] = true; } flag = true; Event.current.Use(); } } if (this.lv2.selectionChanged && !actionKey) { flag |= ListViewGUILayout.MultiSelection(row, this.lv2.row, ref this.initialSelectedLV2Item, ref this.selectedLV2Items); } } if (this.lv2.selectionChanged || flag) { this.mySelection = true; AssetServer.SetSelectionFromGUIDs(this.GetSelectedNamingGUIDs()); this.lv2HasSelection = this.HasTrue(ref this.selectedLV2Items); } }
void OnGUI() { if (s_Styles == null) { s_Styles = new Styles(); minSize = new Vector2(500, 300); position = new Rect(position.x, position.y, minSize.x, minSize.y); } GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Space(10); GUILayout.Label("Unity is about to save the following modified files. Unsaved changes will be lost!"); GUILayout.Space(10); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Space(10); int prevSelectedRow = m_LV.row; int numSelected = 0; foreach (ListViewElement el in ListViewGUILayout.ListView(m_LV, s_Styles.box)) { if (m_SelectedItems[el.row] && Event.current.type == EventType.Repaint) { Rect box = el.position; box.x += 1; box.y += 1; box.width -= 1; box.height -= 1; s_Styles.selected.Draw(box, false, false, false, false); } GUILayout.Label(m_Content[el.row], s_Styles.labelHeight); if (ListViewGUILayout.HasMouseUp(el.position)) { Event.current.command = true; Event.current.control = true; ListViewGUILayout.MultiSelection(prevSelectedRow, el.row, ref m_InitialSelectedItem, ref m_SelectedItems); } if (m_SelectedItems[el.row]) numSelected++; } GUILayout.Space(10); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Space(10); if (GUILayout.Button(s_Styles.close, s_Styles.button, GUILayout.Width(s_Styles.buttonWidth))) { CloseWindow(); } GUILayout.FlexibleSpace(); GUI.enabled = numSelected > 0; bool allSelected = numSelected == m_Assets.Count; if (GUILayout.Button(s_Styles.dontSave, s_Styles.button, GUILayout.Width(s_Styles.buttonWidth))) { IgnoreSelectedAssets(); } if (GUILayout.Button(allSelected ? s_Styles.saveAll : s_Styles.saveSelected, s_Styles.button, GUILayout.Width(s_Styles.buttonWidth))) { SaveSelectedAssets(); } GUI.enabled = true; GUILayout.Space(10); GUILayout.EndHorizontal(); GUILayout.Space(10); if (m_Assets.Count == 0) CloseWindow(); }
public void UpdateGUI() { SplitterGUILayout.BeginHorizontalSplit(this.horSplit); GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]); GUILayout.Label(this.totalUpdates, this.constants.title, new GUILayoutOption[0]); foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.lv, GUIStyle.none)) { Rect position = listViewElement.position; ++position.x; ++position.y; if (Event.current.type == EventType.Repaint) { if (listViewElement.row % 2 == 0) { this.constants.entryEven.Draw(position, false, false, false, false); } else { this.constants.entryOdd.Draw(position, false, false, false, false); } } GUILayout.BeginVertical(listViewElement.row != this.lv.row ? this.constants.entryNormal : this.constants.entrySelected, new GUILayoutOption[0]); GUILayout.Label(this.messageFirstLines[listViewElement.row], this.constants.serverUpdateLog, new GUILayoutOption[1] { GUILayout.MinWidth(50f) }); GUILayout.BeginHorizontal(); GUILayout.Label(this.changesets[listViewElement.row].changeset.ToString() + " " + this.changesets[listViewElement.row].date, this.constants.serverUpdateInfo, new GUILayoutOption[1] { GUILayout.MinWidth(100f) }); GUILayout.Label(this.changesets[listViewElement.row].owner, this.constants.serverUpdateInfo, new GUILayoutOption[1] { GUILayout.Width((float)this.maxNickLength) }); GUILayout.EndHorizontal(); GUILayout.EndVertical(); } if (this.lv.selectionChanged) { this.SetSelectedRevisionLine(this.lv.row); } GUILayout.EndVertical(); SplitterGUILayout.BeginVerticalSplit(this.vertSplit); GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]); GUILayout.Label("Changeset", this.constants.title, new GUILayoutOption[0]); int folder1 = -1; int file = -1; foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.pv.lv, GUIStyle.none)) { if (folder1 == -1 && !this.pv.IndexToFolderAndFile(listViewElement.row, ref folder1, ref file)) { return; } ParentViewFolder folder2 = this.pv.folders[folder1]; if (ListViewGUILayout.HasMouseDown(listViewElement.position)) { if (Event.current.clickCount == 2) { if (!this.isDirSelected && this.selectedGUID != string.Empty) { this.DoShowDiff(false); GUIUtility.ExitGUI(); } } else { this.pv.lv.scrollPos = ListViewShared.ListViewScrollToRow((ListViewShared.InternalListViewState) this.pv.lv.ilvState, listViewElement.row); this.DoSelect(folder1, file, listViewElement.row); } } else if (ListViewGUILayout.HasMouseDown(listViewElement.position, 1)) { if (this.lv.row != listViewElement.row) { this.DoSelect(folder1, file, listViewElement.row); } if (!this.isDirSelected && this.selectedGUID != string.Empty) { GUIUtility.hotControl = 0; EditorUtility.DisplayCustomMenu(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f), this.dropDownMenuItems, (int[])null, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), (object)null); Event.current.Use(); } } if (listViewElement.row == this.pv.lv.row && Event.current.type == EventType.Repaint) { this.constants.entrySelected.Draw(listViewElement.position, false, false, false, false); } ChangeFlags changeFlags; if (file != -1) { Texture2D texture2D = AssetDatabase.GetCachedIcon(folder2.name + "/" + folder2.files[file].name) as Texture2D; if ((UnityEngine.Object)texture2D == (UnityEngine.Object)null) { texture2D = InternalEditorUtility.GetIconForFile(folder2.files[file].name); } GUILayout.Label(new GUIContent(folder2.files[file].name, (Texture)texture2D), this.constants.element, new GUILayoutOption[0]); changeFlags = folder2.files[file].changeFlags; } else { GUILayout.Label(folder2.name, this.constants.header, new GUILayoutOption[0]); changeFlags = folder2.changeFlags; } GUIContent content = (GUIContent)null; if (this.HasFlag(changeFlags, ChangeFlags.Undeleted) || this.HasFlag(changeFlags, ChangeFlags.Created)) { content = ASMainWindow.constants.badgeNew; } else if (this.HasFlag(changeFlags, ChangeFlags.Deleted)) { content = ASMainWindow.constants.badgeDelete; } else if (this.HasFlag(changeFlags, ChangeFlags.Renamed) || this.HasFlag(changeFlags, ChangeFlags.Moved)) { content = ASMainWindow.constants.badgeMove; } if (content != null && Event.current.type == EventType.Repaint) { Rect position = new Rect((float)((double)listViewElement.position.x + (double)listViewElement.position.width - (double)content.image.width - 5.0), listViewElement.position.y + listViewElement.position.height / 2f - (float)(content.image.height / 2), (float)content.image.width, (float)content.image.height); EditorGUIUtility.SetIconSize(Vector2.zero); GUIStyle.none.Draw(position, content, false, false, false, false); EditorGUIUtility.SetIconSize(this.iconSize); } this.pv.NextFileFolder(ref folder1, ref file); } if (this.pv.lv.selectionChanged && this.selectedGUID != string.Empty) { if (this.selectedGUID != AssetServer.GetRootGUID()) { AssetServer.SetSelectionFromGUID(this.selectedGUID); } else { AssetServer.SetSelectionFromGUID(string.Empty); } } if (GUIUtility.keyboardControl == this.pv.lv.ID && Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Return && !this.isDirSelected) && this.selectedGUID != string.Empty) { this.DoShowDiff(false); GUIUtility.ExitGUI(); } GUILayout.EndVertical(); GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]); GUILayout.Label("Update Message", this.constants.title, new GUILayoutOption[0]); GUILayout.TextArea(this.lv.row < 0 ? string.Empty : this.changesets[this.lv.row].message, this.constants.wwText, new GUILayoutOption[0]); GUILayout.EndVertical(); SplitterGUILayout.EndVerticalSplit(); SplitterGUILayout.EndHorizontalSplit(); }
public static ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, ListViewOptions lvOptions, GUIStyle style, params GUILayoutOption[] options) { return(ListViewGUILayout.ListView(state, lvOptions, string.Empty, style, options)); }
private int DoListColumn(ListViewState listView, List <ColumnViewElement> columnViewElements, int columnIndex, int selectedIndex, ObjectColumnFunction selectedSearchItemFunction, ObjectColumnFunction selectedRegularItemFunction, ObjectColumnGetDataFunction getDataForDraggingFunction) { if (((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Return)) && (listView.row > -1)) { if (this.isSearching && (selectedSearchItemFunction != null)) { this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElements[selectedIndex].value); } if ((!this.isSearching && (GUIUtility.keyboardControl == listView.ID)) && (selectedRegularItemFunction != null)) { DoItemSelectedEvent(selectedRegularItemFunction, columnViewElements[selectedIndex].value); } } if (((GUIUtility.keyboardControl == listView.ID) && (Event.current.type == EventType.KeyDown)) && !this.isSearching) { switch (Event.current.keyCode) { case KeyCode.LeftArrow: this.m_ColumnToFocusKeyboard = columnIndex - 1; Event.current.Use(); break; case KeyCode.RightArrow: this.m_ColumnToFocusKeyboard = columnIndex + 1; Event.current.Use(); break; } } GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(this.columnWidth) }; IEnumerator enumerator = ListViewGUILayout.ListView(listView, s_Styles.background, options).GetEnumerator(); try { while (enumerator.MoveNext()) { ListViewElement current = (ListViewElement)enumerator.Current; ColumnViewElement columnViewElement = columnViewElements[current.row]; if ((current.row == listView.row) && (Event.current.type == EventType.Repaint)) { Rect position = current.position; position.x++; position.y++; s_Styles.selected.Draw(position, false, true, true, GUIUtility.keyboardControl == listView.ID); } GUILayout.Label(columnViewElement.name, new GUILayoutOption[0]); if (columnViewElement.value is List <ColumnViewElement> ) { Rect rect2 = current.position; rect2.x = (rect2.xMax - s_Styles.categoryArrowIcon.width) - 5f; rect2.y += 2f; GUI.Label(rect2, s_Styles.categoryArrowIcon); } this.DoDoubleClick(current, columnViewElement, selectedSearchItemFunction, selectedRegularItemFunction); DoDragAndDrop(listView, current, columnViewElements, getDataForDraggingFunction); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } if (Event.current.type == EventType.Layout) { selectedIndex = listView.row; } return(selectedIndex); }
private void DoDownloadConflictsGUI() { bool enabled = GUI.enabled; bool shift = Event.current.shift; bool actionKey = EditorGUI.actionKey; GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.Label("The following assets have been changed both on the server and in the local project.\nPlease select a conflict resolution for each before continuing the update.", new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUI.enabled = (this.lv1HasSelection && enabled); if (GUILayout.Button(ASUpdateConflictResolveWindow.conflictButtonTexts[0], this.constants.ButtonLeft, new GUILayoutOption[0])) { this.ResolveSelectedDownloadConflicts(DownloadResolution.SkipAsset); } if (GUILayout.Button(ASUpdateConflictResolveWindow.conflictButtonTexts[1], this.constants.ButtonMiddle, new GUILayoutOption[0])) { this.ResolveSelectedDownloadConflicts(DownloadResolution.TrashMyChanges); } if (GUILayout.Button(ASUpdateConflictResolveWindow.conflictButtonTexts[2], this.constants.ButtonMiddle, new GUILayoutOption[0])) { this.ResolveSelectedDownloadConflicts(DownloadResolution.TrashServerChanges); } if (!this.enableMergeButton) { GUI.enabled = false; } if (GUILayout.Button(ASUpdateConflictResolveWindow.conflictButtonTexts[3], this.constants.ButtonRight, new GUILayoutOption[0])) { this.ResolveSelectedDownloadConflicts(DownloadResolution.Merge); } GUI.enabled = enabled; GUILayout.EndHorizontal(); GUILayout.Space(5f); SplitterGUILayout.BeginHorizontalSplit(this.lvHeaderSplit1, new GUILayoutOption[0]); GUILayout.Box("Action", this.constants.lvHeader, new GUILayoutOption[0]); GUILayout.Box("Asset", this.constants.lvHeader, new GUILayoutOption[0]); SplitterGUILayout.EndHorizontalSplit(); int row = this.lv1.row; bool flag = false; foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.lv1, this.constants.background, new GUILayoutOption[0])) { if (GUIUtility.keyboardControl == this.lv1.ID && Event.current.type == EventType.KeyDown && actionKey) { Event.current.Use(); } if (this.selectedLV1Items[listViewElement.row] && Event.current.type == EventType.Repaint) { this.constants.selected.Draw(listViewElement.position, false, false, false, false); } if (ListViewGUILayout.HasMouseUp(listViewElement.position)) { if (!shift && !actionKey) { flag |= ListViewGUILayout.MultiSelection(row, this.lv1.row, ref this.initialSelectedLV1Item, ref this.selectedLV1Items); } } else { if (ListViewGUILayout.HasMouseDown(listViewElement.position)) { if (Event.current.clickCount == 2 && !AssetServer.AssetIsDir(this.downloadConflicts[listViewElement.row])) { this.DoShowDiff(false); GUIUtility.ExitGUI(); } else { if (!this.selectedLV1Items[listViewElement.row] || shift || actionKey) { flag |= ListViewGUILayout.MultiSelection(row, listViewElement.row, ref this.initialSelectedLV1Item, ref this.selectedLV1Items); } this.lv1.row = listViewElement.row; } } else { if (ListViewGUILayout.HasMouseDown(listViewElement.position, 1)) { if (!this.selectedLV1Items[listViewElement.row]) { flag = true; for (int i = 0; i < this.selectedLV1Items.Length; i++) { this.selectedLV1Items[i] = false; } this.lv1.selectionChanged = true; this.selectedLV1Items[listViewElement.row] = true; this.lv1.row = listViewElement.row; } GUIUtility.hotControl = 0; Rect position = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f); EditorUtility.DisplayCustomMenu(position, this.dropDownMenuItems, null, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null); Event.current.Use(); } } } GUILayout.Label(this.downloadResolutionString[(int)this.downloadResolutions[listViewElement.row]], new GUILayoutOption[] { GUILayout.Width((float)this.lvHeaderSplit1.realSizes[0]), GUILayout.Height(18f) }); if (this.deletionConflict[listViewElement.row] && Event.current.type == EventType.Repaint) { GUIContent badgeDelete = ASMainWindow.constants.badgeDelete; Rect position2 = new Rect(listViewElement.position.x + (float)this.lvHeaderSplit1.realSizes[0] - (float)badgeDelete.image.width - 5f, listViewElement.position.y + listViewElement.position.height / 2f - (float)(badgeDelete.image.height / 2), (float)badgeDelete.image.width, (float)badgeDelete.image.height); EditorGUIUtility.SetIconSize(Vector2.zero); GUIStyle.none.Draw(position2, badgeDelete, false, false, false, false); EditorGUIUtility.SetIconSize(this.iconSize); } GUILayout.Label(new GUIContent(this.dConflictPaths[listViewElement.row], (!AssetServer.AssetIsDir(this.downloadConflicts[listViewElement.row])) ? InternalEditorUtility.GetIconForFile(this.dConflictPaths[listViewElement.row]) : EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName)), new GUILayoutOption[] { GUILayout.Width((float)this.lvHeaderSplit1.realSizes[1]), GUILayout.Height(18f) }); } GUILayout.EndVertical(); if (GUIUtility.keyboardControl == this.lv1.ID) { if (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "SelectAll") { Event.current.Use(); } else { if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "SelectAll") { for (int j = 0; j < this.selectedLV1Items.Length; j++) { this.selectedLV1Items[j] = true; } flag = true; Event.current.Use(); } } if (this.lv1.selectionChanged && !actionKey) { flag |= ListViewGUILayout.MultiSelection(row, this.lv1.row, ref this.initialSelectedLV1Item, ref this.selectedLV1Items); } else { if (GUIUtility.keyboardControl == this.lv1.ID && Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return && !AssetServer.AssetIsDir(this.downloadConflicts[this.lv1.row])) { this.DoShowDiff(false); GUIUtility.ExitGUI(); } } } if (this.lv1.selectionChanged || flag) { this.mySelection = true; AssetServer.SetSelectionFromGUIDs(this.GetSelectedGUIDs()); this.lv1HasSelection = this.HasTrue(ref this.selectedLV1Items); this.enableMergeButton = this.AtLeastOneSelectedAssetCanBeMerged(); } }
public void UpdateGUI() { SplitterGUILayout.BeginHorizontalSplit(this.horSplit, new GUILayoutOption[0]); GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]); GUILayout.Label(this.totalUpdates, this.constants.title, new GUILayoutOption[0]); IEnumerator enumerator = ListViewGUILayout.ListView(this.lv, GUIStyle.none, new GUILayoutOption[0]).GetEnumerator(); try { while (enumerator.MoveNext()) { ListViewElement current = (ListViewElement)enumerator.Current; Rect position = current.position; position.x++; position.y++; if (Event.current.type == EventType.Repaint) { if ((current.row % 2) == 0) { this.constants.entryEven.Draw(position, false, false, false, false); } else { this.constants.entryOdd.Draw(position, false, false, false, false); } } GUILayout.BeginVertical((current.row != this.lv.row) ? this.constants.entryNormal : this.constants.entrySelected, new GUILayoutOption[0]); GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(50f) }; GUILayout.Label(this.messageFirstLines[current.row], this.constants.serverUpdateLog, options); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.MinWidth(100f) }; GUILayout.Label(this.changesets[current.row].changeset.ToString() + " " + this.changesets[current.row].date, this.constants.serverUpdateInfo, optionArray2); GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width((float)this.maxNickLength) }; GUILayout.Label(this.changesets[current.row].owner, this.constants.serverUpdateInfo, optionArray3); GUILayout.EndHorizontal(); GUILayout.EndVertical(); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } if (this.lv.selectionChanged) { this.SetSelectedRevisionLine(this.lv.row); } GUILayout.EndVertical(); SplitterGUILayout.BeginVerticalSplit(this.vertSplit, new GUILayoutOption[0]); GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]); GUILayout.Label("Changeset", this.constants.title, new GUILayoutOption[0]); int num = -1; int file = -1; IEnumerator enumerator2 = ListViewGUILayout.ListView(this.pv.lv, GUIStyle.none, new GUILayoutOption[0]).GetEnumerator(); try { while (enumerator2.MoveNext()) { ChangeFlags changeFlags; ListViewElement element2 = (ListViewElement)enumerator2.Current; if ((num == -1) && !this.pv.IndexToFolderAndFile(element2.row, ref num, ref file)) { return; } ParentViewFolder folder = this.pv.folders[num]; if (ListViewGUILayout.HasMouseDown(element2.position)) { if (Event.current.clickCount == 2) { if (!this.isDirSelected && (this.selectedGUID != string.Empty)) { this.DoShowDiff(false); GUIUtility.ExitGUI(); } } else { this.pv.lv.scrollPos = ListViewShared.ListViewScrollToRow(this.pv.lv.ilvState, element2.row); this.DoSelect(num, file, element2.row); } } else if (ListViewGUILayout.HasMouseDown(element2.position, 1)) { if (this.lv.row != element2.row) { this.DoSelect(num, file, element2.row); } if (!this.isDirSelected && (this.selectedGUID != string.Empty)) { GUIUtility.hotControl = 0; Rect rect2 = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f); EditorUtility.DisplayCustomMenu(rect2, this.dropDownMenuItems, null, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null); Event.current.Use(); } } if ((element2.row == this.pv.lv.row) && (Event.current.type == EventType.Repaint)) { this.constants.entrySelected.Draw(element2.position, false, false, false, false); } if (file != -1) { Texture2D cachedIcon = AssetDatabase.GetCachedIcon(folder.name + "/" + folder.files[file].name) as Texture2D; if (cachedIcon == null) { cachedIcon = InternalEditorUtility.GetIconForFile(folder.files[file].name); } GUILayout.Label(new GUIContent(folder.files[file].name, cachedIcon), this.constants.element, new GUILayoutOption[0]); changeFlags = folder.files[file].changeFlags; } else { GUILayout.Label(folder.name, this.constants.header, new GUILayoutOption[0]); changeFlags = folder.changeFlags; } GUIContent badgeNew = null; if (this.HasFlag(changeFlags, ChangeFlags.Undeleted) || this.HasFlag(changeFlags, ChangeFlags.Created)) { badgeNew = ASMainWindow.constants.badgeNew; } else if (this.HasFlag(changeFlags, ChangeFlags.Deleted)) { badgeNew = ASMainWindow.constants.badgeDelete; } else if (this.HasFlag(changeFlags, ChangeFlags.Renamed) || this.HasFlag(changeFlags, ChangeFlags.Moved)) { badgeNew = ASMainWindow.constants.badgeMove; } if ((badgeNew != null) && (Event.current.type == EventType.Repaint)) { Rect rect3 = new Rect(((element2.position.x + element2.position.width) - badgeNew.image.width) - 5f, (element2.position.y + (element2.position.height / 2f)) - (badgeNew.image.height / 2), (float)badgeNew.image.width, (float)badgeNew.image.height); EditorGUIUtility.SetIconSize(Vector2.zero); GUIStyle.none.Draw(rect3, badgeNew, false, false, false, false); EditorGUIUtility.SetIconSize(this.iconSize); } this.pv.NextFileFolder(ref num, ref file); } } finally { IDisposable disposable2 = enumerator2 as IDisposable; if (disposable2 != null) { disposable2.Dispose(); } } if (this.pv.lv.selectionChanged && (this.selectedGUID != string.Empty)) { if (this.selectedGUID != AssetServer.GetRootGUID()) { AssetServer.SetSelectionFromGUID(this.selectedGUID); } else { AssetServer.SetSelectionFromGUID(string.Empty); } } if ((GUIUtility.keyboardControl == this.pv.lv.ID) && (((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Return)) && (!this.isDirSelected && (this.selectedGUID != string.Empty)))) { this.DoShowDiff(false); GUIUtility.ExitGUI(); } GUILayout.EndVertical(); GUILayout.BeginVertical(this.constants.box, new GUILayoutOption[0]); GUILayout.Label("Update Message", this.constants.title, new GUILayoutOption[0]); GUILayout.TextArea((this.lv.row < 0) ? "" : this.changesets[this.lv.row].message, this.constants.wwText, new GUILayoutOption[0]); GUILayout.EndVertical(); SplitterGUILayout.EndVerticalSplit(); SplitterGUILayout.EndHorizontalSplit(); }
private int DoListColumn(ListViewState listView, List <ColumnViewElement> columnViewElements, int columnIndex, int selectedIndex, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction) { if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return && listView.row > -1) { if (this.isSearching && selectedSearchItemFunction != null) { this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElements[selectedIndex].value); } if (!this.isSearching && GUIUtility.keyboardControl == listView.ID && selectedRegularItemFunction != null) { ColumnView.DoItemSelectedEvent(selectedRegularItemFunction, columnViewElements[selectedIndex].value); } } if (GUIUtility.keyboardControl == listView.ID && Event.current.type == EventType.KeyDown && !this.isSearching) { switch (Event.current.keyCode) { case KeyCode.RightArrow: this.m_ColumnToFocusKeyboard = columnIndex + 1; Event.current.Use(); break; case KeyCode.LeftArrow: this.m_ColumnToFocusKeyboard = columnIndex - 1; Event.current.Use(); break; } } ListViewState state = listView; GUIStyle background = ColumnView.s_Styles.background; GUILayoutOption[] guiLayoutOptionArray = new GUILayoutOption[1] { GUILayout.Width(this.columnWidth) }; foreach (ListViewElement element in ListViewGUILayout.ListView(state, background, guiLayoutOptionArray)) { ColumnViewElement columnViewElement = columnViewElements[element.row]; if (element.row == listView.row && Event.current.type == EventType.Repaint) { Rect position = element.position; ++position.x; ++position.y; ColumnView.s_Styles.selected.Draw(position, false, true, true, GUIUtility.keyboardControl == listView.ID); } GUILayout.Label(columnViewElement.name); if (columnViewElement.value is List <ColumnViewElement> ) { Rect position = element.position; position.x = (float)((double)position.xMax - (double)ColumnView.s_Styles.categoryArrowIcon.width - 5.0); position.y += 2f; GUI.Label(position, (Texture)ColumnView.s_Styles.categoryArrowIcon); } this.DoDoubleClick(element, columnViewElement, selectedSearchItemFunction, selectedRegularItemFunction); ColumnView.DoDragAndDrop(listView, element, columnViewElements, getDataForDraggingFunction); } if (Event.current.type == EventType.Layout) { selectedIndex = listView.row; } return(selectedIndex); }