private void OnGUIFooter() { using (new EditorGUIUtility.IconSizeScope(s_IconSize)) { if (AssetDatabaseExperimental.IsCacheServerEnabled()) { // Bad IP:Port. Direct the user to fix in Project Preferences. if (!AssetDatabaseExperimental.CanConnectToCacheServer(AssetDatabaseExperimental.GetCacheServerAddress(), AssetDatabaseExperimental.GetCacheServerPort())) { if (GUILayout.Button(m_CacheCannotConnectButtonContent, GUILayout.Width(k_ConnectionButtonWidth), GUILayout.Height(k_ConnectionButtonHeight))) { OpenProjectSettings(); } } // Give the option to 'reconnect' as the user may have changed the IP or Port within Project Preferences. else { if (GUILayout.Button(m_CacheCanReconnectButtonContent, GUILayout.Width(k_ConnectionButtonWidth), GUILayout.Height(k_ConnectionButtonHeight))) { AssetDatabaseExperimental.RefreshSettings(); } } } else { if (GUILayout.Button(m_CacheDisabledButtonContent, GUILayout.Width(k_ConnectionButtonWidth), GUILayout.Height(k_ConnectionButtonHeight))) { OpenProjectSettings(); } } } }
public override Vector2 GetWindowSize() { int lines = AssetDatabaseExperimental.IsCacheServerEnabled() ? 3 : 2; int heightOfLines = (int)Math.Ceiling(EditorGUI.kSingleLineHeight * lines); int heightOfWindowPadding = m_WindowStyle.padding.top + m_WindowStyle.padding.bottom; return(new Vector2(250, heightOfLines + heightOfWindowPadding)); }
public override void OnGUI(Rect rect) { var exit = false; GUILayout.BeginArea(rect, m_WindowStyle); if (AssetDatabaseExperimental.IsCacheServerEnabled()) { var iconPosition = new Rect(); iconPosition.x = rect.width - m_RefreshIcon.image.width - m_WindowStyle.padding.right; iconPosition.y = m_WindowStyle.padding.top; iconPosition.width = m_RefreshIcon.image.width; iconPosition.height = m_RefreshIcon.image.height; GUIStyle helpIconStyle = EditorStyles.iconButton; if (GUI.Button(iconPosition, m_RefreshIcon, helpIconStyle)) { AssetDatabaseExperimental.RefreshSettings(); } GUILayout.BeginHorizontal(); var style = new GUIStyle(); style.fontStyle = FontStyle.Bold; style.normal.textColor = EditorStyles.boldLabel.normal.textColor; if (!AssetDatabaseExperimental.IsConnectedToCacheServer()) { style.normal.textColor = new Color(0.97f, 0.32f, 0.31f); } EditorGUILayout.LabelField(AssetDatabaseExperimental.GetCacheServerAddress(), style); GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); var statusTextStyle = new GUIStyle() { normal = { textColor = Color.grey } }; EditorGUILayout.LabelField(ConnectionStatusText(), statusTextStyle); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button(m_OpenProjectSettings, "ControlLabel")) { OpenProjectSettings(); } GUILayout.EndHorizontal(); GUILayout.EndArea(); exit |= Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape; if (exit) { editorWindow.Close(); GUIUtility.ExitGUI(); } }
private GUIContent GetStatusContent() { if (!AssetDatabaseExperimental.IsCacheServerEnabled()) { return(m_CacheServerNotEnabledContent); } if (!AssetDatabaseExperimental.IsConnectedToCacheServer()) { return(m_CacheServerDisconnectedContent); } return(m_CacheServerConnectedContent); }
private string ConnectionStatusText() { string status = k_StatusConnectedText; if (!AssetDatabaseExperimental.IsCacheServerEnabled()) { status = k_StatusDisabledText; } else if (!AssetDatabaseExperimental.IsConnectedToCacheServer()) { status = k_StatusDisconnectedText; } return(status); }
private GUIContent ConnectionStatusText() { GUIContent status = m_StatusMessageConnected; if (!AssetDatabaseExperimental.IsCacheServerEnabled()) { status = m_StatusMessageDisabled; } else if (!AssetDatabaseExperimental.IsConnectedToCacheServer()) { status = m_StatusMessageError; } return(status); }
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(); } }