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 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(); } }
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); } }
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(); }