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 static void WritePreferences() { // Don't change anything if there's a command line override if (GetCommandLineRemoteAddressOverride() != null) { return; } CacheServerMode oldMode = (CacheServerMode)EditorPrefs.GetInt(kModeKey); var oldPath = EditorPrefs.GetString(LocalCacheServer.PathKey); var oldCustomPath = EditorPrefs.GetBool(LocalCacheServer.CustomPathKey); bool changedDir = false; if (oldMode != s_CacheServerMode && oldMode == CacheServerMode.Local) { changedDir = true; } if (s_EnableCustomPath && oldPath != s_CachePath) { changedDir = true; } if (s_EnableCustomPath != oldCustomPath && s_CachePath != LocalCacheServer.GetCacheLocation() && s_CachePath != "") { changedDir = true; } if (changedDir) { var message = s_CacheServerMode == CacheServerMode.Local ? "You have changed the location of the local cache storage." : "You have disabled the local cache."; message += " Do you want to delete the old locally cached data at " + LocalCacheServer.GetCacheLocation() + "?"; if (EditorUtility.DisplayDialog("Delete old Cache", message, "Delete", "Don't Delete")) { LocalCacheServer.Clear(); } } EditorPrefs.SetInt(kAssetPipelineVersionForNewProjects, (int)s_AssetPipelineVersionForNewProjects); EditorPrefs.SetString(kIPAddress2Key, s_CacheServer2IPAddress); EditorPrefs.SetInt(kMode2Key, (int)s_CacheServer2Mode); EditorPrefs.SetString(kIPAddressKey, s_CacheServerIPAddress); EditorPrefs.SetInt(kModeKey, (int)s_CacheServerMode); EditorPrefs.SetInt(LocalCacheServer.SizeKey, s_LocalCacheServerSize); EditorPrefs.SetString(LocalCacheServer.PathKey, s_CachePath); EditorPrefs.SetBool(LocalCacheServer.CustomPathKey, s_EnableCustomPath); LocalCacheServer.Setup(); if (AssetDatabase.IsV2Enabled()) { AssetDatabaseExperimental.RefreshSettings(); } if (changedDir) { //Call ExitGUI after bringing up a dialog to avoid an exception EditorGUIUtility.ExitGUI(); } }
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(); } }
public void OnDisable() { DevDeviceList.Changed -= OnDeviceListChanged; AssetDatabaseExperimental.RefreshSettings(); }
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(); } }