A UnityEditor.VersionControl.Task is created almost everytime UnityEditor.VersionControl.Provider is ask to perform an action.
internal static void OnSubmitted(Task task) { WindowChange[] array = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[]; if (array.Length == 0) { return; } WindowChange windowChange = array[0]; windowChange.assetList = task.assetList; windowChange.submitResultCode = task.resultCode; windowChange.submitErrorMessage = null; if ((task.resultCode & 2) != 0) { string empty = string.Empty; Message[] messages = task.messages; for (int i = 0; i < messages.Length; i++) { Message message = messages[i]; if (message.severity == Message.Severity.Error) { WindowChange expr_77 = windowChange; expr_77.submitErrorMessage = expr_77.submitErrorMessage + empty + message.message; } } } if ((task.resultCode & 3) != 0) { WindowPending.UpdateAllWindows(); } windowChange.RefreshList(); }
public void OnEnable() { base.position = new Rect(100f, 100f, 700f, 395f); base.minSize = new Vector2(700f, 395f); this.submitList.ReadOnly = true; this.taskStatus = null; this.taskDesc = null; this.taskStat = null; this.taskSubmit = null; this.submitResultCode = 256; this.submitErrorMessage = null; }
public static void Revert(string path) { #if UNITY_VC if (HasVC()) { UnityEditor.VersionControl.Asset vcAsset = UnityEditor.VersionControl.Provider.GetAssetByPath(path); if (vcAsset != null) { UnityEditor.VersionControl.Task task = UnityEditor.VersionControl.Provider.Revert(vcAsset, UnityEditor.VersionControl.RevertMode.Normal); task.Wait(); AssetDatabase.Refresh(); } } #endif }
internal static void OnAdded(Task task) { WindowChange[] changeArray = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[]; if (changeArray.Length != 0) { WindowChange change = changeArray[0]; change.taskSubmit = null; change.submitResultCode = 0x100; change.submitErrorMessage = null; change.taskAdd = null; change.taskStatus = Provider.Status(change.assetList, false); change.assetList = null; WindowPending.UpdateAllWindows(); } }
public static bool CheckOut(string path) { #if UNITY_VC if (HasVC()) { UnityEditor.VersionControl.Asset vcAsset = UnityEditor.VersionControl.Provider.GetAssetByPath(path); if (vcAsset != null) { UnityEditor.VersionControl.Task task = UnityEditor.VersionControl.Provider.Checkout(vcAsset, UnityEditor.VersionControl.CheckoutMode.Both); task.Wait(); } } return(IsEditable(path)); #else return(true); #endif }
private void DoOpen(ChangeSet change, AssetList assets) { this.taskSubmit = null; this.submitResultCode = 256; this.submitErrorMessage = null; this.changeSet = change; this.description = string.Empty; this.assetList = null; if (change == null) { this.taskStatus = Provider.Status(assets); } else { this.taskDesc = Provider.ChangeSetDescription(change); this.taskStat = Provider.ChangeSetStatus(change); } }
private void DoOpen(ChangeSet change, AssetList assets) { this.taskSubmit = null; this.submitResultCode = 0x100; this.submitErrorMessage = null; this.changeSet = change; this.description = (change != null) ? this.SanitizeDescription(change.description) : ""; this.assetList = null; if (change == null) { this.taskStatus = Provider.Status(assets); } else { this.taskDesc = Provider.ChangeSetDescription(change); this.taskStat = Provider.ChangeSetStatus(change); } }
private void OnUnaddedFilesGUI() { AssetList assets = new AssetList(); string text = ""; foreach (Asset asset in this.assetList) { if ((!asset.IsState(Asset.States.OutOfSync) && !asset.IsState(Asset.States.Synced)) && !asset.IsState(Asset.States.AddedLocal)) { text = text + asset.prettyPath + "\n"; assets.Add(asset); } } GUILayout.Label("Files to add", EditorStyles.boldLabel, new GUILayoutOption[0]); GUILayout.Label("Some additional files need to be added:", new GUILayoutOption[0]); GUI.enabled = false; GUILayout.TextArea(text, new GUILayoutOption[0]); GUI.enabled = true; GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add files", new GUILayoutOption[0])) { this.taskAdd = Provider.Add(assets, false); this.taskAdd.SetCompletionAction(CompletionAction.OnAddedChangeWindow); } if (GUILayout.Button("Abort", new GUILayoutOption[0])) { this.ResetAndClose(); } GUILayout.EndHorizontal(); }
internal static void OnSubmitted(Task task) { WindowChange[] changeArray = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[]; if (changeArray.Length != 0) { WindowChange change = changeArray[0]; change.assetList = task.assetList; change.submitResultCode = task.resultCode; change.submitErrorMessage = null; if ((task.resultCode & 2) != 0) { string str = ""; foreach (Message message in task.messages) { if (message.severity == Message.Severity.Error) { change.submitErrorMessage = change.submitErrorMessage + str + message.message; } } } if ((task.resultCode & 3) != 0) { WindowPending.UpdateAllWindows(); if (change.changeSet == null) { Provider.Status("").Wait(); WindowPending.ExpandLatestChangeSet(); } } if ((task.resultCode & 1) != 0) { change.ResetAndClose(); } else { change.RefreshList(); } } }
private void OnSubmitGUI() { if (this.submitResultCode != 256) GUI.enabled = false; Event current = Event.current; if (current.isKey && current.keyCode == KeyCode.Escape) this.Close(); GUILayout.Label("Description", EditorStyles.boldLabel, new GUILayoutOption[0]); if (this.taskStatus != null && this.taskStatus.resultCode != 0) { this.assetList = this.taskStatus.assetList.Filter(1 != 0, Asset.States.CheckedOutLocal, Asset.States.DeletedLocal, Asset.States.AddedLocal); this.RefreshList(); this.taskStatus = (Task) null; } else if (this.taskDesc != null && this.taskDesc.resultCode != 0) { this.description = this.taskDesc.text.Length <= 0 ? string.Empty : this.taskDesc.text; if (this.description.Trim() == "<enter description here>") this.description = string.Empty; this.taskDesc = (Task) null; } else if (this.taskStat != null && this.taskStat.resultCode != 0) { this.assetList = this.taskStat.assetList; this.RefreshList(); this.taskStat = (Task) null; } Task task = this.taskStatus == null || this.taskStatus.resultCode != 0 ? (this.taskDesc == null || this.taskDesc.resultCode != 0 ? (this.taskStat == null || this.taskStat.resultCode != 0 ? this.taskSubmit : this.taskStat) : this.taskDesc) : this.taskStatus; GUI.enabled = (this.taskDesc == null || this.taskDesc.resultCode != 0) && this.submitResultCode == 256; this.description = EditorGUILayout.TextArea(this.description, GUILayout.Height(150f)).Trim(); if (this.m_TextAreaControlID == 0) this.m_TextAreaControlID = EditorGUIUtility.s_LastControlID; if (this.m_TextAreaControlID != 0) { GUIUtility.keyboardControl = this.m_TextAreaControlID; EditorGUIUtility.editingTextField = true; } GUI.enabled = true; GUILayout.Label("Files", EditorStyles.boldLabel, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); Rect screenRect = new Rect(6f, 206f, this.position.width - 12f, this.position.height - 248f); GUILayout.BeginArea(screenRect); GUILayout.Box(string.Empty, new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); GUILayout.EndArea(); this.submitList.OnGUI(new Rect(screenRect.x + 2f, screenRect.y + 2f, screenRect.width - 4f, screenRect.height - 4f), true); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); if (this.submitResultCode == 256) { if (task != null) { GUIContent content = GUIContent.Temp("Getting info"); content.image = WindowPending.StatusWheel.image; GUILayout.Label(content); content.image = (Texture) null; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Cancel")) this.ResetAndClose(); GUI.enabled = task == null && !string.IsNullOrEmpty(this.description); bool flag = current.isKey && current.shift && current.keyCode == KeyCode.Return; if (Provider.hasChangelistSupport && (GUILayout.Button("Save") || flag && !this.allowSubmit)) this.Save(false); if (this.allowSubmit) { bool enabled = GUI.enabled; GUI.enabled = this.assetList != null && this.assetList.Count > 0 && !string.IsNullOrEmpty(this.description); if (GUILayout.Button("Submit") || flag) this.Save(true); GUI.enabled = enabled; } } else { bool flag = (this.submitResultCode & 1) != 0; GUI.enabled = flag; string text = string.Empty; if (flag) text = "Finished successfully"; else if (task != null) { GUILayout.Label(WindowPending.StatusWheel); text = task.progressMessage; if (text.Length == 0) text = "Running..."; } GUILayout.Label(text); GUILayout.FlexibleSpace(); if (GUILayout.Button("Close")) this.ResetAndClose(); } GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.Space(12f); if (task == null) return; this.Repaint(); }
private void OnSubmitGUI() { if (this.submitResultCode != 0x100) { GUI.enabled = false; } Event current = Event.current; if (current.isKey && (current.keyCode == KeyCode.Escape)) { base.Close(); } GUILayout.Label("Description", EditorStyles.boldLabel, new GUILayoutOption[0]); if ((this.taskStatus != null) && (this.taskStatus.resultCode != 0)) { this.assetList = this.taskStatus.assetList.Filter(true, new Asset.States[] { Asset.States.CheckedOutLocal }); this.RefreshList(); this.taskStatus = null; } else if ((this.taskDesc != null) && (this.taskDesc.resultCode != 0)) { this.description = (this.taskDesc.text.Length <= 0) ? "" : this.taskDesc.text; if (this.description.Trim() == "<enter description here>") { this.description = string.Empty; } this.taskDesc = null; } else if ((this.taskStat != null) && (this.taskStat.resultCode != 0)) { this.assetList = this.taskStat.assetList; this.RefreshList(); this.taskStat = null; } Task task = ((this.taskStatus == null) || (this.taskStatus.resultCode != 0)) ? (((this.taskDesc == null) || (this.taskDesc.resultCode != 0)) ? (((this.taskStat == null) || (this.taskStat.resultCode != 0)) ? this.taskSubmit : this.taskStat) : this.taskDesc) : this.taskStatus; GUI.enabled = ((this.taskDesc == null) || (this.taskDesc.resultCode != 0)) && (this.submitResultCode == 0x100); GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Height(150f) }; this.description = EditorGUILayout.TextArea(this.description, options).Trim(); if (this.m_TextAreaControlID == 0) { this.m_TextAreaControlID = EditorGUIUtility.s_LastControlID; } if (this.m_TextAreaControlID != 0) { GUIUtility.keyboardControl = this.m_TextAreaControlID; EditorGUIUtility.editingTextField = true; } GUI.enabled = true; GUILayout.Label("Files", EditorStyles.boldLabel, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); Rect screenRect = new Rect(6f, 206f, base.position.width - 12f, base.position.height - 248f); GUILayout.BeginArea(screenRect); GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }; GUILayout.Box("", optionArray2); GUILayout.EndArea(); this.submitList.OnGUI(new Rect(screenRect.x + 2f, screenRect.y + 2f, screenRect.width - 4f, screenRect.height - 4f), true); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); if (this.submitResultCode == 0x100) { if (task != null) { GUIContent content = GUIContent.Temp("Getting info"); content.image = WindowPending.StatusWheel.image; GUILayout.Label(content, new GUILayoutOption[0]); content.image = null; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Cancel", new GUILayoutOption[0])) { this.ResetAndClose(); } GUI.enabled = (task == null) && !string.IsNullOrEmpty(this.description); bool flag2 = (current.isKey && current.shift) && (current.keyCode == KeyCode.Return); bool flag3 = flag2 && !this.allowSubmit; if (Provider.hasChangelistSupport && (GUILayout.Button("Save", new GUILayoutOption[0]) || flag3)) { this.Save(false); } if (this.allowSubmit) { bool enabled = GUI.enabled; GUI.enabled = ((this.assetList != null) && (this.assetList.Count > 0)) && !string.IsNullOrEmpty(this.description); if (GUILayout.Button("Submit", new GUILayoutOption[0]) || flag2) { this.Save(true); } GUI.enabled = enabled; } } else { bool flag5 = (this.submitResultCode & 1) != 0; GUI.enabled = flag5; string text = ""; if (flag5) { text = "Finished successfully"; } else if (task != null) { GUILayout.Label(WindowPending.StatusWheel, new GUILayoutOption[0]); text = task.progressMessage; if (text.Length == 0) { text = "Running..."; } } GUILayout.Label(text, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Close", new GUILayoutOption[0])) { this.ResetAndClose(); } } GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.Space(12f); if (task != null) { base.Repaint(); } }
private void OnChangeContents(Task task) { ListItem listItem = this.pendingList.FindItemWithIdentifier(task.userIdentifier); ListItem listItem2 = (listItem != null) ? listItem : this.incomingList.FindItemWithIdentifier(task.userIdentifier); if (listItem2 == null) { return; } ListControl listControl = (listItem != null) ? this.pendingList : this.incomingList; listItem2.RemoveAll(); AssetList assetList = task.assetList; if (assetList.Count == 0) { ListItem listItem3 = listControl.Add(listItem2, "Empty change list", null); listItem3.Dummy = true; } else { foreach (Asset current in assetList) { listControl.Add(listItem2, current.prettyPath, current); } } listControl.Refresh(false); base.Repaint(); }
internal static void OnAdded(Task task) { WindowChange[] objectsOfTypeAll = Resources.FindObjectsOfTypeAll(typeof (WindowChange)) as WindowChange[]; if (objectsOfTypeAll.Length == 0) return; WindowChange windowChange = objectsOfTypeAll[0]; windowChange.taskSubmit = (Task) null; windowChange.submitResultCode = 256; windowChange.submitErrorMessage = (string) null; windowChange.taskAdd = (Task) null; windowChange.taskStatus = Provider.Status(windowChange.assetList, false); windowChange.assetList = (AssetList) null; WindowPending.UpdateAllWindows(); }
private static void OnVCTaskCompletedEvent(Task task, CompletionAction completionAction) { WindowPending[] array = Resources.FindObjectsOfTypeAll(typeof(WindowPending)) as WindowPending[]; WindowPending[] array2 = array; for (int i = 0; i < array2.Length; i++) { WindowPending windowPending = array2[i]; if (completionAction == CompletionAction.UpdatePendingWindow) { windowPending.UpdateWindow(); } else { if (completionAction == CompletionAction.OnChangeContentsPendingWindow) { windowPending.OnChangeContents(task); } else { if (completionAction == CompletionAction.OnIncomingPendingWindow) { windowPending.OnIncoming(task); } else { if (completionAction == CompletionAction.OnChangeSetsPendingWindow) { windowPending.OnChangeSets(task); } else { if (completionAction == CompletionAction.OnGotLatestPendingWindow) { windowPending.OnGotLatest(task); } } } } } } if (completionAction == CompletionAction.OnSubmittedChangeWindow) { WindowChange.OnSubmitted(task); } else { if (completionAction == CompletionAction.OnAddedChangeWindow) { WindowChange.OnAdded(task); } } task.Dispose(); }
private void OnChangeSets(Task task) { this.CreateStaticResources(); this.PopulateListControl(this.pendingList, task, WindowPending.changeIcon); }
private void ResetAndClose() { this.taskSubmit = null; this.submitResultCode = 0x100; this.submitErrorMessage = null; base.Close(); }
private void OnUnaddedFilesGUI() { AssetList assets = new AssetList(); string text = string.Empty; using (List<Asset>.Enumerator enumerator = this.assetList.GetEnumerator()) { while (enumerator.MoveNext()) { Asset current = enumerator.Current; if (!current.IsState(Asset.States.OutOfSync) && !current.IsState(Asset.States.Synced) && !current.IsState(Asset.States.AddedLocal)) { text = text + current.prettyPath + "\n"; assets.Add(current); } } } GUILayout.Label("Files to add", EditorStyles.boldLabel, new GUILayoutOption[0]); GUILayout.Label("Some additional files need to be added:"); GUI.enabled = false; GUILayout.TextArea(text); GUI.enabled = true; GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add files")) { this.taskAdd = Provider.Add(assets, false); this.taskAdd.SetCompletionAction(CompletionAction.OnAddedChangeWindow); } if (GUILayout.Button("Abort")) this.ResetAndClose(); GUILayout.EndHorizontal(); }
internal static void OnAdded(Task task) { WindowChange[] array = Resources.FindObjectsOfTypeAll(typeof(WindowChange)) as WindowChange[]; if (array.Length == 0) { return; } WindowChange windowChange = array[0]; windowChange.taskSubmit = null; windowChange.submitResultCode = 256; windowChange.submitErrorMessage = null; windowChange.taskAdd = null; windowChange.taskStatus = Provider.Status(windowChange.assetList, false); windowChange.assetList = null; WindowPending.UpdateAllWindows(); }
private void OnChangeContents(Task task) { ListItem itemWithIdentifier = this.pendingList.FindItemWithIdentifier(task.userIdentifier); ListItem parent = itemWithIdentifier ?? this.incomingList.FindItemWithIdentifier(task.userIdentifier); if (parent == null) return; ListControl listControl = itemWithIdentifier != null ? this.pendingList : this.incomingList; parent.RemoveAll(); AssetList assetList = task.assetList; if (assetList.Count == 0) { listControl.Add(parent, "Empty change list", (Asset) null).Dummy = true; } else { using (List<Asset>.Enumerator enumerator = assetList.GetEnumerator()) { while (enumerator.MoveNext()) { Asset current = enumerator.Current; listControl.Add(parent, current.prettyPath, current); } } } listControl.Refresh(false); this.Repaint(); }
private void PopulateListControl(ListControl list, Task task, Texture2D icon) { ChangeSets changeSets = task.changeSets; ListItem listItem1 = list.Root.FirstChild; while (listItem1 != null) { // ISSUE: object of a compiler-generated type is created // ISSUE: reference to a compiler-generated method if (changeSets.Find(new Predicate<ChangeSet>(new WindowPending.\u003CPopulateListControl\u003Ec__AnonStoreyC1() { cs = listItem1.Item as ChangeSet }.\u003C\u003Em__230)) == null) { ListItem listItem2 = listItem1; listItem1 = listItem1.Next; list.Root.Remove(listItem2); } else listItem1 = listItem1.Next; } using (List<ChangeSet>.Enumerator enumerator = changeSets.GetEnumerator()) { while (enumerator.MoveNext()) { ChangeSet current = enumerator.Current; ListItem listItem2 = list.GetChangeSetItem(current); if (listItem2 != null) { listItem2.Item = (object) current; listItem2.Name = current.description; } else listItem2 = list.Add((ListItem) null, current.description, current); listItem2.Exclusive = true; listItem2.CanAccept = true; listItem2.Icon = (Texture) icon; } } list.Refresh(); this.Repaint(); }
private static void OnVCTaskCompletedEvent(Task task, CompletionAction completionAction) { foreach (WindowPending windowPending in Resources.FindObjectsOfTypeAll(typeof (WindowPending)) as WindowPending[]) { switch (completionAction) { case CompletionAction.UpdatePendingWindow: case CompletionAction.OnCheckoutCompleted: windowPending.UpdateWindow(); break; case CompletionAction.OnChangeContentsPendingWindow: windowPending.OnChangeContents(task); break; case CompletionAction.OnIncomingPendingWindow: windowPending.OnIncoming(task); break; case CompletionAction.OnChangeSetsPendingWindow: windowPending.OnChangeSets(task); break; case CompletionAction.OnGotLatestPendingWindow: windowPending.OnGotLatest(task); break; } } switch (completionAction) { case CompletionAction.OnSubmittedChangeWindow: WindowChange.OnSubmitted(task); break; case CompletionAction.OnAddedChangeWindow: WindowChange.OnAdded(task); break; case CompletionAction.OnCheckoutCompleted: if (EditorUserSettings.showFailedCheckout) { WindowCheckoutFailure.OpenIfCheckoutFailed(task.assetList); break; } break; } task.Dispose(); }
private void ResetAndClose() { this.taskSubmit = (Task) null; this.submitResultCode = 256; this.submitErrorMessage = (string) null; this.Close(); }
private void Save(bool submit) { if (this.description.Trim() == "") { Debug.LogError("Version control: Please enter a valid change description"); } else { AssetDatabase.SaveAssets(); this.taskSubmit = Provider.Submit(this.changeSet, this.assetList, this.description, !submit); this.submitResultCode = 0; this.submitErrorMessage = null; this.taskSubmit.SetCompletionAction(CompletionAction.OnSubmittedChangeWindow); } }
private void OnErrorGUI() { GUILayout.Label("Submit failed", EditorStyles.boldLabel, new GUILayoutOption[0]); string text = string.Empty; if (!string.IsNullOrEmpty(this.submitErrorMessage)) { text = this.submitErrorMessage + "\n"; } text += "See console for details. You can get more details by increasing log level in EditorSettings."; GUILayout.Label(text, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Close", new GUILayoutOption[0])) { this.taskSubmit = null; this.submitResultCode = 256; this.submitErrorMessage = null; base.Close(); WindowPending.UpdateAllWindows(); } GUILayout.EndHorizontal(); }
private void OnGotLatest(Task t) { this.UpdateWindow(); }
private void OnConflictingFilesGUI() { string text = string.Empty; foreach (Asset current in this.assetList) { if (current.IsState(Asset.States.Conflicted)) { text = text + current.prettyPath + "\n"; } } GUILayout.Label("Conflicting files", EditorStyles.boldLabel, new GUILayoutOption[0]); GUILayout.Label("Some files need to be resolved before submitting:", new GUILayoutOption[0]); GUI.enabled = false; GUILayout.TextArea(text, new GUILayoutOption[] { GUILayout.ExpandHeight(true) }); GUI.enabled = true; GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Close", new GUILayoutOption[0])) { this.taskSubmit = null; this.submitResultCode = 256; this.submitErrorMessage = null; base.Close(); } GUILayout.EndHorizontal(); }
private void OnIncoming(Task task) { this.CreateStaticResources(); this.PopulateListControl(this.incomingList, task, this.syncIcon); }
private void OnUnaddedFilesGUI() { AssetList assetList = new AssetList(); string text = string.Empty; foreach (Asset current in this.assetList) { if (!current.IsState(Asset.States.OutOfSync) && !current.IsState(Asset.States.Synced) && !current.IsState(Asset.States.AddedLocal)) { text = text + current.prettyPath + "\n"; assetList.Add(current); } } GUILayout.Label("Files to add", EditorStyles.boldLabel, new GUILayoutOption[0]); GUILayout.Label("Some additional files need to be added:", new GUILayoutOption[0]); GUI.enabled = false; GUILayout.TextArea(text, new GUILayoutOption[0]); GUI.enabled = true; GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add files", new GUILayoutOption[0])) { this.taskAdd = Provider.Add(assetList, false); this.taskAdd.SetCompletionAction(CompletionAction.OnAddedChangeWindow); } if (GUILayout.Button("Abort", new GUILayoutOption[0])) { this.taskSubmit = null; this.submitResultCode = 256; this.submitErrorMessage = null; base.Close(); } GUILayout.EndHorizontal(); }
private void PopulateListControl(ListControl list, Task task, Texture2D icon) { ChangeSets changeSets = task.changeSets; ListItem listItem = list.Root.FirstChild; while (listItem != null) { ChangeSet cs = listItem.Item as ChangeSet; if (changeSets.Find((ChangeSet elm) => elm.id == cs.id) == null) { ListItem listItem2 = listItem; listItem = listItem.Next; list.Root.Remove(listItem2); } else { listItem = listItem.Next; } } foreach (ChangeSet current in changeSets) { ListItem listItem3 = list.GetChangeSetItem(current); if (listItem3 != null) { listItem3.Item = current; } else { listItem3 = list.Add(null, current.description, current); } listItem3.Exclusive = true; listItem3.CanAccept = true; listItem3.Icon = icon; } list.Refresh(); base.Repaint(); }
private void Save(bool submit) { if (this.description.Trim() == string.Empty) { Debug.LogError("Version control: Please enter a valid change description"); return; } EditorApplication.SaveAssets(); this.taskSubmit = Provider.Submit(this.changeSet, this.assetList, this.description, !submit); this.submitResultCode = 0; this.submitErrorMessage = null; this.taskSubmit.SetCompletionAction(CompletionAction.OnSubmittedChangeWindow); }
internal static bool ProgressGUI(Rect rect, Task activeTask, bool descriptionTextFirst) { if (activeTask != null && (activeTask.progressPct != -1 || activeTask.secondsSpent != -1 || activeTask.progressMessage.Length != 0)) { string text = activeTask.progressMessage; Rect position = rect; GUIContent statusWheel = WindowPending.StatusWheel; position.width = position.height; position.x += 4f; position.y += 4f; GUI.Label(position, statusWheel); rect.x += position.width + 4f; text = ((text.Length != 0) ? text : activeTask.description); if (activeTask.progressPct == -1) { rect.width -= position.width + 4f; rect.y += 4f; GUI.Label(rect, text, EditorStyles.miniLabel); } else { rect.width = 120f; EditorGUI.ProgressBar(rect, (float)activeTask.progressPct, text); } return true; } return false; }
internal static void OnSubmitted(Task task) { WindowChange[] objectsOfTypeAll = Resources.FindObjectsOfTypeAll(typeof (WindowChange)) as WindowChange[]; if (objectsOfTypeAll.Length == 0) return; WindowChange windowChange1 = objectsOfTypeAll[0]; windowChange1.assetList = task.assetList; windowChange1.submitResultCode = task.resultCode; windowChange1.submitErrorMessage = (string) null; if ((task.resultCode & 2) != 0) { string empty = string.Empty; foreach (Message message in task.messages) { if (message.severity == Message.Severity.Error) { WindowChange windowChange2 = windowChange1; string str = windowChange2.submitErrorMessage + empty + message.message; windowChange2.submitErrorMessage = str; } } } if ((task.resultCode & 3) != 0) { WindowPending.UpdateAllWindows(); if (windowChange1.changeSet == null) { Provider.Status(string.Empty).Wait(); WindowPending.ExpandLatestChangeSet(); } } if ((task.resultCode & 1) != 0) windowChange1.ResetAndClose(); else windowChange1.RefreshList(); }