public override void OnGUI(Rect rect) { var exit = false; GUILayout.BeginArea(rect, m_WindowStyle); GUILayout.BeginHorizontal(); GUILayout.Label(m_WindowTitleContent, EditorStyles.boldLabel); if (GUILayout.Button(GUIContent.none, m_CacheServerOverflowMenuButtonStyle)) { var menu = new GenericMenu(); menu.AddItem(m_WindowOverflowMenuPreferencesButtonContent, false, () => { OpenPreferences(); }); menu.AddItem(m_WindowOverflowMenuProjectSettingsButtonContent, false, () => { OpenProjectSettings(); }); menu.ShowAsContext(); } GUILayout.EndHorizontal(); GUILayout.Space(k_Header_footer_vertical_padding); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(k_StatusText, ConnectionStatusText()); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(k_EndpointText, AssetDatabaseExperimental.GetCacheServerAddress()); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(k_NamespaceText, AssetDatabaseExperimental.GetCacheServerNamespacePrefix()); GUILayout.EndHorizontal(); GUILayout.Space(k_Header_footer_vertical_padding); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); OnGUIFooter(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndArea(); exit |= Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape; if (exit) { editorWindow.Close(); GUIUtility.ExitGUI(); } }
public override void OnGUI(Rect rect) { var exit = false; var labelStyle = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleRight }; GUILayout.BeginArea(rect, m_WindowStyle); GUILayout.BeginHorizontal(); GUILayout.Label(m_CacheServerTitleContent, EditorStyles.boldLabel); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(m_CacheServerStatusTextContent); if (!AssetDatabaseExperimental.IsCacheServerEnabled()) { GUILayout.Label(m_CacheServerStatusDisabledTextContent, labelStyle); } else if (!AssetDatabaseExperimental.IsConnectedToCacheServer()) { GUILayout.Label(m_CacheServerStatusDisconnectedTextContent, labelStyle); } else { GUILayout.Label(m_CacheServerStatusConnectedTextContent, labelStyle); } GUILayout.EndHorizontal(); using (new EditorGUI.DisabledScope(!AssetDatabaseExperimental.IsCacheServerEnabled())) { GUILayout.BeginHorizontal(); GUILayout.Label(m_CacheServerEndpointTextContent); GUILayout.Label(AssetDatabaseExperimental.GetCacheServerAddress(), labelStyle); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(m_CacheServerNamespaceTextContent); GUILayout.Label(AssetDatabaseExperimental.GetCacheServerNamespacePrefix(), labelStyle); GUILayout.EndHorizontal(); GUILayout.Space(10); // GUILayout.BeginHorizontal(); // if (GUILayout.Button(m_CacheServerDisableButtonContent)) // { // // TODO - Disable cache server // } // GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button(m_CacheServerReconnectButtonContent)) { AssetDatabaseExperimental.RefreshSettings(); } GUILayout.EndHorizontal(); } GUILayout.EndArea(); exit |= Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape; if (exit) { editorWindow.Close(); GUIUtility.ExitGUI(); } }