private void OnGUI() { if (EditorSettings.externalVersionControl != ExternalVersionControl.Disabled && EditorSettings.externalVersionControl != ExternalVersionControl.AssetServer) { GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Asset Server is disabled when external version control is used. Go to 'Edit -> Project Settings -> Editor' to re-enable it."); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); } else { if (ASMainWindow.constants == null) ASMainWindow.constants = new ASMainWindow.Constants(); if (!this.m_CheckedMaint && Event.current.type != EventType.Layout) { if (!InternalEditorUtility.HasTeamLicense()) { this.Close(); GUIUtility.ExitGUI(); } this.m_CheckedMaint = true; } if (this.maxNickLength == 1 && this.sharedChangesets != null) { for (int index = 0; index < this.sharedChangesets.Length; ++index) { int x = (int) ASMainWindow.constants.serverUpdateInfo.CalcSize(new GUIContent(this.sharedChangesets[index].owner)).x; if (x > this.maxNickLength) this.maxNickLength = x; } this.changesetContents = new GUIContent[this.sharedChangesets.Length]; ParentViewState st = new ParentViewState(); for (int index = 0; index < this.changesetContents.Length; ++index) { int num1 = 15; Changeset sharedChangeset = this.sharedChangesets[index]; string str1 = sharedChangeset.message.Split('\n')[0]; string str2 = str1.Length >= 45 ? str1.Substring(0, 42) + "..." : str1; string tooltip = string.Format("[{0} {1}] {2}", (object) sharedChangeset.date, (object) sharedChangeset.owner, (object) str2); int num2 = num1 - 1; st.Clear(); st.AddAssetItems(sharedChangeset); for (int f = 0; f < st.folders.Length; ++f) { if (--num2 == 0 && !this.IsLastOne(f, 0, st)) { tooltip += "\n(and more...)"; break; } tooltip = tooltip + "\n" + st.folders[f].name; for (int fl = 0; fl < st.folders[f].files.Length; ++fl) { if (--num2 == 0 && !this.IsLastOne(f, fl, st)) { tooltip += "\n(and more...)"; break; } tooltip = tooltip + "\n\t" + st.folders[f].files[fl].name; } if (num2 == 0) break; } this.changesetContents[index] = new GUIContent(this.sharedChangesets[index].message.Split('\n')[0], tooltip); } if (this.maxNickLength == 1) this.maxNickLength = 0; } if (AssetServer.IsControllerBusy() != 0) { this.Repaint(); } else { if (this.isInitialUpdate) { this.isInitialUpdate = false; this.SwitchSelectedPage(ASMainWindow.Page.Overview); } if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "Find") { this.SetShownSearchField(this.m_SearchToShow); Event.current.Use(); } GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); int num = -1; bool enabled = GUI.enabled; if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Overview, this.pageTitles[0], EditorStyles.toolbarButton)) num = 0; GUI.enabled = !this.needsSetup && this.sharedChangesets != null && this.sharedChangesets.Length != 0 && enabled; if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Update, this.pageTitles[1], EditorStyles.toolbarButton)) num = 1; GUI.enabled = !this.needsSetup && this.pv.lv.totalRows != 0 && enabled; if (this.selectedPage > ASMainWindow.Page.Commit) { if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Commit, this.pageTitles[2], EditorStyles.toolbarButton)) num = 2; GUI.enabled = enabled; if (this.ToolbarToggle(this.selectedPage > ASMainWindow.Page.Commit, this.pageTitles[3], EditorStyles.toolbarButton)) num = 3; } else { if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Commit, this.pageTitles[2], EditorStyles.toolbarButton)) num = 2; GUI.enabled = enabled; } if (num != -1 && (ASMainWindow.Page) num != this.selectedPage) { if (this.selectedPage == ASMainWindow.Page.Commit) this.NotifyClosingCommit(); if (num <= 2) { this.SwitchSelectedPage((ASMainWindow.Page) num); GUIUtility.ExitGUI(); } } GUILayout.FlexibleSpace(); if (this.selectedPage == ASMainWindow.Page.History) this.DoSearchToggle(ASMainWindow.ShowSearchField.HistoryList); if (!this.needsSetup) { switch (this.selectedPage) { case ASMainWindow.Page.Overview: case ASMainWindow.Page.Update: case ASMainWindow.Page.History: if (GUILayout.Button("Refresh", EditorStyles.toolbarButton, new GUILayoutOption[0])) { this.ActionRefresh(); GUIUtility.ExitGUI(); break; } break; } } GUILayout.EndHorizontal(); EditorGUIUtility.SetIconSize(this.iconSize); this.DoSelectedPageGUI(); EditorGUIUtility.SetIconSize(Vector2.zero); if (Event.current.type != EventType.ContextClick) return; GUIUtility.hotControl = 0; EditorUtility.DisplayCustomMenu(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f), !this.needsSetup ? this.dropDownMenuItems : this.unconfiguredDropDownMenuItems, (int[]) null, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), (object) null); Event.current.Use(); } } }
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; }
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() { if (constants == null) { constants = new ASMainWindow.Constants(); } 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]); this.DoConfigGUI(); if (AssetServer.GetAssetServerError() != string.Empty) { GUILayout.Space(10f); GUILayout.Label(AssetServer.GetAssetServerError(), constants.errorLabel, new GUILayoutOption[0]); GUILayout.Space(10f); } GUILayout.EndVertical(); GUILayout.EndVertical(); this.DoProjectsGUI(); GUILayout.EndHorizontal(); return true; }
private void OnGUI() { if (EditorSettings.externalVersionControl != ExternalVersionControl.Disabled && EditorSettings.externalVersionControl != ExternalVersionControl.AssetServer) { GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.Label("Asset Server is disabled when external version control is used. Go to 'Edit -> Project Settings -> Editor' to re-enable it.", new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); return; } if (ASMainWindow.constants == null) { ASMainWindow.constants = new ASMainWindow.Constants(); } if (!this.m_CheckedMaint && Event.current.type != EventType.Layout) { if (!InternalEditorUtility.HasPro()) { base.Close(); GUIUtility.ExitGUI(); } this.m_CheckedMaint = true; } if (this.maxNickLength == 1 && this.sharedChangesets != null) { for (int i = 0; i < this.sharedChangesets.Length; i++) { int num = (int)ASMainWindow.constants.serverUpdateInfo.CalcSize(new GUIContent(this.sharedChangesets[i].owner)).x; if (num > this.maxNickLength) { this.maxNickLength = num; } } this.changesetContents = new GUIContent[this.sharedChangesets.Length]; ParentViewState parentViewState = new ParentViewState(); for (int j = 0; j < this.changesetContents.Length; j++) { int num2 = 15; Changeset changeset = this.sharedChangesets[j]; string text = changeset.message.Split(new char[] { '\n' })[0]; text = ((text.Length >= 45) ? (text.Substring(0, 42) + "...") : text); string text2 = string.Format("[{0} {1}] {2}", changeset.date, changeset.owner, text); num2--; parentViewState.Clear(); parentViewState.AddAssetItems(changeset); for (int k = 0; k < parentViewState.folders.Length; k++) { if (--num2 == 0 && !this.IsLastOne(k, 0, parentViewState)) { text2 += "\n(and more...)"; break; } text2 = text2 + "\n" + parentViewState.folders[k].name; for (int l = 0; l < parentViewState.folders[k].files.Length; l++) { if (--num2 == 0 && !this.IsLastOne(k, l, parentViewState)) { text2 += "\n(and more...)"; break; } text2 = text2 + "\n\t" + parentViewState.folders[k].files[l].name; } if (num2 == 0) { break; } } this.changesetContents[j] = new GUIContent(this.sharedChangesets[j].message.Split(new char[] { '\n' })[0], text2); } if (this.maxNickLength == 1) { this.maxNickLength = 0; } } if (AssetServer.IsControllerBusy() != 0) { base.Repaint(); return; } if (this.isInitialUpdate) { this.isInitialUpdate = false; this.SwitchSelectedPage(ASMainWindow.Page.Overview); } if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "Find") { this.SetShownSearchField(this.m_SearchToShow); Event.current.Use(); } GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); int num3 = -1; bool enabled = GUI.enabled; if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Overview, this.pageTitles[0], EditorStyles.toolbarButton)) { num3 = 0; } GUI.enabled = (!this.needsSetup && this.sharedChangesets != null && this.sharedChangesets.Length != 0 && enabled); if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Update, this.pageTitles[1], EditorStyles.toolbarButton)) { num3 = 1; } GUI.enabled = (!this.needsSetup && this.pv.lv.totalRows != 0 && enabled); if (this.selectedPage > ASMainWindow.Page.Commit) { if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Commit, this.pageTitles[2], EditorStyles.toolbarButton)) { num3 = 2; } GUI.enabled = enabled; if (this.ToolbarToggle(this.selectedPage > ASMainWindow.Page.Commit, this.pageTitles[3], EditorStyles.toolbarButton)) { num3 = 3; } } else { if (this.ToolbarToggle(this.selectedPage == ASMainWindow.Page.Commit, this.pageTitles[2], EditorStyles.toolbarButton)) { num3 = 2; } GUI.enabled = enabled; } if (num3 != -1 && num3 != (int)this.selectedPage) { if (this.selectedPage == ASMainWindow.Page.Commit) { this.NotifyClosingCommit(); } if (num3 <= 2) { this.SwitchSelectedPage((ASMainWindow.Page)num3); GUIUtility.ExitGUI(); } } GUILayout.FlexibleSpace(); if (this.selectedPage == ASMainWindow.Page.History) { this.DoSearchToggle(ASMainWindow.ShowSearchField.HistoryList); } if (!this.needsSetup) { switch (this.selectedPage) { case ASMainWindow.Page.Overview: case ASMainWindow.Page.Update: case ASMainWindow.Page.History: if (GUILayout.Button("Refresh", EditorStyles.toolbarButton, new GUILayoutOption[0])) { this.ActionRefresh(); GUIUtility.ExitGUI(); } break; } } GUILayout.EndHorizontal(); EditorGUIUtility.SetIconSize(this.iconSize); this.DoSelectedPageGUI(); EditorGUIUtility.SetIconSize(Vector2.zero); if (Event.current.type == EventType.ContextClick) { GUIUtility.hotControl = 0; Rect position = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 1f, 1f); EditorUtility.DisplayCustomMenu(position, (!this.needsSetup) ? this.dropDownMenuItems : this.unconfiguredDropDownMenuItems, null, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null); Event.current.Use(); } }