public bool DoGUI(bool hasFocus) { bool enabled = GUI.enabled; if (ASHistoryWindow.ms_Style == null) { ASHistoryWindow.ms_Style = new ASHistoryWindow.Constants(); ASHistoryWindow.ms_Style.entryEven = new GUIStyle(ASHistoryWindow.ms_Style.entryEven); ASHistoryWindow.ms_Style.entryEven.padding.left = 3; ASHistoryWindow.ms_Style.entryOdd = new GUIStyle(ASHistoryWindow.ms_Style.entryOdd); ASHistoryWindow.ms_Style.entryOdd.padding.left = 3; ASHistoryWindow.ms_Style.label = new GUIStyle(ASHistoryWindow.ms_Style.label); ASHistoryWindow.ms_Style.boldLabel = new GUIStyle(ASHistoryWindow.ms_Style.boldLabel); ASHistoryWindow.ms_Style.label.padding.left = 3; ASHistoryWindow.ms_Style.boldLabel.padding.left = 3; ASHistoryWindow.ms_Style.boldLabel.padding.top = 0; ASHistoryWindow.ms_Style.boldLabel.padding.bottom = 0; this.DoLocalSelectionChange(); } EditorGUIUtility.SetIconSize(ASHistoryWindow.ms_IconSize); if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape) { this.CancelShowCustomDiff(); Event.current.Use(); } SplitterGUILayout.BeginHorizontalSplit(this.m_HorSplit); GUILayout.BeginVertical(); Rect rect = GUILayoutUtility.GetRect(0.0f, 0.0f, new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); this.m_FileViewWin.DoGUI(this, rect, hasFocus); GUILayout.EndVertical(); GUILayout.BeginVertical(); this.WebLikeHistory(hasFocus); GUILayout.EndVertical(); SplitterGUILayout.EndHorizontalSplit(); if (Event.current.type == EventType.Repaint) { Handles.color = Color.black; Handles.DrawLine(new Vector3((float) (this.m_HorSplit.realSizes[0] - 1), rect.y, 0.0f), new Vector3((float) (this.m_HorSplit.realSizes[0] - 1), rect.yMax, 0.0f)); Handles.DrawLine(new Vector3(0.0f, rect.yMax, 0.0f), new Vector3((float) Screen.width, rect.yMax, 0.0f)); } GUILayout.BeginHorizontal(); GUI.enabled = this.m_FileViewWin.SelType == ASHistoryFileView.SelectionType.DeletedItems && enabled; if (GUILayout.Button(EditorGUIUtility.TextContent("Recover"), ASHistoryWindow.ms_Style.button, new GUILayoutOption[0])) this.m_FileViewWin.DoRecover(); GUILayout.FlexibleSpace(); if (this.m_InRevisionSelectMode) { GUI.enabled = enabled; GUILayout.Label(EditorGUIUtility.TextContent("Select revision to compare to"), ASHistoryWindow.ms_Style.boldLabel, new GUILayoutOption[0]); } GUILayout.Space(10f); GUI.enabled = this.IsComparableAssetSelected() && enabled; if (GUILayout.Button(EditorGUIUtility.TextContent("Compare to Local Version"), ASHistoryWindow.ms_Style.button, new GUILayoutOption[0])) { this.DoShowDiff(false, this.ChangeLogSelectionRev, -1); GUIUtility.ExitGUI(); } GUI.enabled = this.ChangeLogSelectionRev > 0 && this.m_ChangeLogSelectionGUID != string.Empty && enabled; if (GUILayout.Button(EditorGUIUtility.TextContent("Download Selected File"), ASHistoryWindow.ms_Style.button, new GUILayoutOption[0])) this.DownloadFile(); GUILayout.Space(10f); GUI.enabled = this.ChangeLogSelectionRev > 0 && enabled; if (GUILayout.Button(this.ChangeLogSelectionRev <= 0 ? "Revert Entire Project" : "Revert Entire Project to " + (object) this.ChangeLogSelectionRev, ASHistoryWindow.ms_Style.button, new GUILayoutOption[0])) this.DoRevertProject(); GUI.enabled = enabled; GUILayout.EndHorizontal(); GUILayout.Space(10f); if (!this.m_SplittersOk && Event.current.type == EventType.Repaint) { this.m_SplittersOk = true; HandleUtility.Repaint(); } EditorGUIUtility.SetIconSize(Vector2.zero); return true; }
public bool DoGUI(bool hasFocus) { bool enabled = GUI.enabled; if (ASHistoryWindow.ms_Style == null) { ASHistoryWindow.ms_Style = new ASHistoryWindow.Constants(); ASHistoryWindow.ms_Style.entryEven = new GUIStyle(ASHistoryWindow.ms_Style.entryEven); ASHistoryWindow.ms_Style.entryEven.padding.left = 3; ASHistoryWindow.ms_Style.entryOdd = new GUIStyle(ASHistoryWindow.ms_Style.entryOdd); ASHistoryWindow.ms_Style.entryOdd.padding.left = 3; ASHistoryWindow.ms_Style.label = new GUIStyle(ASHistoryWindow.ms_Style.label); ASHistoryWindow.ms_Style.boldLabel = new GUIStyle(ASHistoryWindow.ms_Style.boldLabel); ASHistoryWindow.ms_Style.label.padding.left = 3; ASHistoryWindow.ms_Style.boldLabel.padding.left = 3; ASHistoryWindow.ms_Style.boldLabel.padding.top = 0; ASHistoryWindow.ms_Style.boldLabel.padding.bottom = 0; this.DoLocalSelectionChange(); } EditorGUIUtility.SetIconSize(ASHistoryWindow.ms_IconSize); if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape) { this.CancelShowCustomDiff(); Event.current.Use(); } SplitterGUILayout.BeginHorizontalSplit(this.m_HorSplit, new GUILayoutOption[0]); GUILayout.BeginVertical(new GUILayoutOption[0]); Rect rect = GUILayoutUtility.GetRect(0f, 0f, new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); this.m_FileViewWin.DoGUI(this, rect, hasFocus); GUILayout.EndVertical(); GUILayout.BeginVertical(new GUILayoutOption[0]); this.WebLikeHistory(hasFocus); GUILayout.EndVertical(); SplitterGUILayout.EndHorizontalSplit(); if (Event.current.type == EventType.Repaint) { Handles.color = Color.black; Handles.DrawLine(new Vector3((float)(this.m_HorSplit.realSizes[0] - 1), rect.y, 0f), new Vector3((float)(this.m_HorSplit.realSizes[0] - 1), rect.yMax, 0f)); Handles.DrawLine(new Vector3(0f, rect.yMax, 0f), new Vector3((float)Screen.width, rect.yMax, 0f)); } GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUI.enabled = (this.m_FileViewWin.SelType == ASHistoryFileView.SelectionType.DeletedItems && enabled); if (GUILayout.Button(EditorGUIUtility.TextContent("Recover"), ASHistoryWindow.ms_Style.button, new GUILayoutOption[0])) { this.m_FileViewWin.DoRecover(); } GUILayout.FlexibleSpace(); if (this.m_InRevisionSelectMode) { GUI.enabled = enabled; GUILayout.Label(EditorGUIUtility.TextContent("Select revision to compare to"), ASHistoryWindow.ms_Style.boldLabel, new GUILayoutOption[0]); } GUILayout.Space(10f); GUI.enabled = (this.IsComparableAssetSelected() && enabled); if (GUILayout.Button(EditorGUIUtility.TextContent("Compare to Local Version"), ASHistoryWindow.ms_Style.button, new GUILayoutOption[0])) { this.DoShowDiff(false, this.ChangeLogSelectionRev, -1); GUIUtility.ExitGUI(); } GUI.enabled = (this.ChangeLogSelectionRev > 0 && this.m_ChangeLogSelectionGUID != string.Empty && enabled); if (GUILayout.Button(EditorGUIUtility.TextContent("Download Selected File"), ASHistoryWindow.ms_Style.button, new GUILayoutOption[0])) { this.DownloadFile(); } GUILayout.Space(10f); GUI.enabled = (this.ChangeLogSelectionRev > 0 && enabled); if (GUILayout.Button((this.ChangeLogSelectionRev <= 0) ? "Revert Entire Project" : ("Revert Entire Project to " + this.ChangeLogSelectionRev), ASHistoryWindow.ms_Style.button, new GUILayoutOption[0])) { this.DoRevertProject(); } GUI.enabled = enabled; GUILayout.EndHorizontal(); GUILayout.Space(10f); if (!this.m_SplittersOk && Event.current.type == EventType.Repaint) { this.m_SplittersOk = true; HandleUtility.Repaint(); } EditorGUIUtility.SetIconSize(Vector2.zero); return(true); }