private void OnGUI() { this.InitStyles(); if (!WindowPending.s_DidReload) { WindowPending.s_DidReload = true; this.UpdateWindow(); } this.CreateResources(); Event current = Event.current; float fixedHeight = EditorStyles.toolbar.fixedHeight; GUILayout.BeginArea(new Rect(0f, 0f, base.position.width, fixedHeight)); GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); int num = (this.incomingList.Root != null) ? this.incomingList.Root.ChildCount : 0; this.m_ShowIncoming = !GUILayout.Toggle(!this.m_ShowIncoming, "Outgoing", EditorStyles.toolbarButton, new GUILayoutOption[0]); GUIContent content = GUIContent.Temp("Incoming" + ((num != 0) ? (" (" + num.ToString() + ")") : string.Empty)); this.m_ShowIncoming = GUILayout.Toggle(this.m_ShowIncoming, content, EditorStyles.toolbarButton, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); EditorGUI.BeginDisabledGroup(Provider.activeTask != null); CustomCommand[] customCommands = Provider.customCommands; for (int i = 0; i < customCommands.Length; i++) { CustomCommand customCommand = customCommands[i]; if (customCommand.context == CommandContext.Global && GUILayout.Button(customCommand.label, EditorStyles.toolbarButton, new GUILayoutOption[0])) { customCommand.StartTask(); } } EditorGUI.EndDisabledGroup(); bool flag = Mathf.FloorToInt(base.position.width - this.s_ToolbarButtonsWidth) > 0; if (flag && GUILayout.Button("Settings", EditorStyles.toolbarButton, new GUILayoutOption[0])) { EditorApplication.ExecuteMenuItem("Edit/Project Settings/Editor"); EditorWindow.FocusWindowIfItsOpen <InspectorWindow>(); GUIUtility.ExitGUI(); } Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.5f); bool flag2 = GUILayout.Button(this.refreshIcon, EditorStyles.toolbarButton, new GUILayoutOption[0]); GUI.color = color; if (current.isKey && GUIUtility.keyboardControl == 0 && current.type == EventType.KeyDown && current.keyCode == KeyCode.F5) { flag2 = true; current.Use(); } if (flag2) { Provider.InvalidateCache(); if (Provider.isActive && Provider.onlineState == OnlineState.Online) { Task task = Provider.ChangeSets(); task.SetCompletionAction(CompletionAction.OnChangeSetsPendingWindow); Task task2 = Provider.Incoming(); task2.SetCompletionAction(CompletionAction.OnIncomingPendingWindow); } else { Provider.UpdateSettings(); } } GUILayout.EndArea(); Rect rect = new Rect(0f, fixedHeight, base.position.width, base.position.height - fixedHeight - 17f); bool flag3 = false; GUILayout.EndHorizontal(); if (!Provider.isActive) { Color color2 = GUI.color; GUI.color = new Color(0.8f, 0.5f, 0.5f); rect.height = fixedHeight; GUILayout.BeginArea(rect); GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); string text = "DISABLED"; if (Provider.enabled) { if (Provider.onlineState == OnlineState.Updating) { GUI.color = new Color(0.8f, 0.8f, 0.5f); text = "CONNECTING..."; } else { text = "OFFLINE"; } } GUILayout.Label(text, EditorStyles.miniLabel, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndArea(); rect.y += rect.height; if (!string.IsNullOrEmpty(Provider.offlineReason)) { GUI.Label(rect, Provider.offlineReason); } GUI.color = color2; flag3 = false; } else { if (this.m_ShowIncoming) { flag3 |= this.incomingList.OnGUI(rect, base.hasFocus); } else { flag3 |= this.pendingList.OnGUI(rect, base.hasFocus); } rect.y += rect.height; rect.height = 17f; GUI.Label(rect, GUIContent.none, WindowPending.s_Styles.bottomBarBg); GUIContent content2 = new GUIContent("Apply All Incoming Changes"); Vector2 vector = EditorStyles.miniButton.CalcSize(content2); Rect rect2 = new Rect(rect.x, rect.y - 2f, rect.width - vector.x - 5f, rect.height); WindowPending.ProgressGUI(rect2, Provider.activeTask, false); if (this.m_ShowIncoming) { Rect position = rect; position.width = vector.x; position.height = vector.y; position.y = rect.y + 2f; position.x = base.position.width - vector.x - 5f; EditorGUI.BeginDisabledGroup(this.incomingList.Size == 0); if (GUI.Button(position, content2, EditorStyles.miniButton)) { Asset item = new Asset(string.Empty); Task latest = Provider.GetLatest(new AssetList { item }); latest.SetCompletionAction(CompletionAction.OnGotLatestPendingWindow); } EditorGUI.EndDisabledGroup(); } } if (flag3) { base.Repaint(); } }
private void OnGUI() { this.InitStyles(); if (!WindowPending.s_DidReload) { WindowPending.s_DidReload = true; this.UpdateWindow(); } this.CreateResources(); Event current = Event.current; float fixedHeight = EditorStyles.toolbar.fixedHeight; bool flag1 = false; GUILayout.BeginArea(new Rect(0.0f, 0.0f, this.position.width, fixedHeight)); GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); int num = this.incomingList.Root != null ? this.incomingList.Root.ChildCount : 0; this.m_ShowIncoming = !GUILayout.Toggle(!this.m_ShowIncoming, "Outgoing", EditorStyles.toolbarButton, new GUILayoutOption[0]); this.m_ShowIncoming = GUILayout.Toggle(this.m_ShowIncoming, GUIContent.Temp("Incoming" + (num != 0 ? " (" + num.ToString() + ")" : string.Empty)), EditorStyles.toolbarButton, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { flag1 = true; } GUILayout.FlexibleSpace(); EditorGUI.BeginDisabledGroup(Provider.activeTask != null); foreach (CustomCommand customCommand in Provider.customCommands) { if (customCommand.context == CommandContext.Global && GUILayout.Button(customCommand.label, EditorStyles.toolbarButton, new GUILayoutOption[0])) { customCommand.StartTask(); } } EditorGUI.EndDisabledGroup(); if (Mathf.FloorToInt(this.position.width - this.s_ToolbarButtonsWidth - this.s_SettingsButtonWidth - this.s_DeleteChangesetsButtonWidth) > 0 && this.HasEmptyPendingChangesets() && GUILayout.Button("Delete Empty Changesets", EditorStyles.toolbarButton, new GUILayoutOption[0])) { this.DeleteEmptyPendingChangesets(); } if (Mathf.FloorToInt(this.position.width - this.s_ToolbarButtonsWidth - this.s_SettingsButtonWidth) > 0 && GUILayout.Button("Settings", EditorStyles.toolbarButton, new GUILayoutOption[0])) { EditorApplication.ExecuteMenuItem("Edit/Project Settings/Editor"); EditorWindow.FocusWindowIfItsOpen <InspectorWindow>(); GUIUtility.ExitGUI(); } Color color1 = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.5f); bool flag2 = GUILayout.Button((Texture)this.refreshIcon, EditorStyles.toolbarButton, new GUILayoutOption[0]); bool flag3 = flag1 || flag2; GUI.color = color1; if (current.isKey && GUIUtility.keyboardControl == 0 && (current.type == EventType.KeyDown && current.keyCode == KeyCode.F5)) { flag3 = true; current.Use(); } if (flag3) { if (flag2) { Provider.InvalidateCache(); } this.UpdateWindow(); } GUILayout.EndArea(); Rect rect = new Rect(0.0f, fixedHeight, this.position.width, (float)((double)this.position.height - (double)fixedHeight - 17.0)); bool flag4 = false; GUILayout.EndHorizontal(); bool flag5; if (!Provider.isActive) { Color color2 = GUI.color; GUI.color = new Color(0.8f, 0.5f, 0.5f); rect.height = fixedHeight; GUILayout.BeginArea(rect); GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); string text = "DISABLED"; if (Provider.enabled) { if (Provider.onlineState == OnlineState.Updating) { GUI.color = new Color(0.8f, 0.8f, 0.5f); text = "CONNECTING..."; } else { text = "OFFLINE"; } } GUILayout.Label(text, EditorStyles.miniLabel, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndArea(); rect.y += rect.height; if (!string.IsNullOrEmpty(Provider.offlineReason)) { GUI.Label(rect, Provider.offlineReason); } GUI.color = color2; flag5 = false; } else { flag5 = !this.m_ShowIncoming ? flag4 | this.pendingList.OnGUI(rect, this.hasFocus) : flag4 | this.incomingList.OnGUI(rect, this.hasFocus); rect.y += rect.height; rect.height = 17f; GUI.Label(rect, GUIContent.none, WindowPending.s_Styles.bottomBarBg); GUIContent content = new GUIContent("Apply All Incoming Changes"); Vector2 vector2 = EditorStyles.miniButton.CalcSize(content); WindowPending.ProgressGUI(new Rect(rect.x, rect.y - 2f, (float)((double)rect.width - (double)vector2.x - 5.0), rect.height), Provider.activeTask, false); if (this.m_ShowIncoming) { Rect position = rect; position.width = vector2.x; position.height = vector2.y; position.y = rect.y + 2f; position.x = (float)((double)this.position.width - (double)vector2.x - 5.0); EditorGUI.BeginDisabledGroup(this.incomingList.Size == 0); if (GUI.Button(position, content, EditorStyles.miniButton)) { Asset asset = new Asset(string.Empty); AssetList assets = new AssetList(); assets.Add(asset); Provider.GetLatest(assets).SetCompletionAction(CompletionAction.OnGotLatestPendingWindow); } EditorGUI.EndDisabledGroup(); } } if (!flag5) { return; } this.Repaint(); }