private void LoadEditorUserSettings()
        {
            var editorUserSettingsObjects = InternalEditorUtility.LoadSerializedFileAndForget(kEditorUserSettingsPath);
            foreach (var o in editorUserSettingsObjects)
            {
                if (o.GetType() == typeof(EditorUserSettings))
                {
                    m_EditorUserSettings = new SerializedObject(o);
                }
            }

            m_AssetPipelineMode = m_EditorUserSettings.FindProperty("m_AssetPipelineMode2");
            m_CacheServerMode = m_EditorUserSettings.FindProperty("m_CacheServerMode");
            m_CacheServers = m_EditorUserSettings.FindProperty("m_CacheServers");

            m_CacheServerConnectionState = CacheServerConnectionState.Unknown;
            s_ForcedAssetPipelineWarning = null;

            if (m_CacheServerList == null)
            {
                m_CacheServerList = new ReorderableList(serializedObject, m_CacheServers, true, false, true, true);
                m_CacheServerList.onReorderCallback = (ReorderableList list) => { serializedObject.ApplyModifiedProperties(); };
                m_CacheServerList.onAddCallback = (ReorderableList list) => { m_CacheServers.arraySize += 1; serializedObject.ApplyModifiedProperties(); };
                m_CacheServerList.onRemoveCallback = (ReorderableList list) => { ReorderableList.defaultBehaviours.DoRemoveButton(list); serializedObject.ApplyModifiedProperties(); };
                m_CacheServerList.onCanRemoveCallback = (ReorderableList list) => { return list.index < m_CacheServers.arraySize && list.index >= 0; };
                m_CacheServerList.drawElementCallback = DrawCacheServerListElement;
                m_CacheServerList.elementHeight = EditorGUIUtility.singleLineHeight + 2;
                m_CacheServerList.headerHeight = 3;
            }
        }
示例#2
0
        public void OnEnable()
        {
            DevDeviceList.Changed += OnDeviceListChanged;
            BuildRemoteDeviceList();

            m_EnableTextureStreamingInPlayMode = serializedObject.FindProperty("m_EnableTextureStreamingInPlayMode");
            m_EnableTextureStreamingInEditMode = serializedObject.FindProperty("m_EnableTextureStreamingInEditMode");

            m_AsyncShaderCompilation = serializedObject.FindProperty("m_AsyncShaderCompilation");

            m_CacheServerConnectionState = CacheServerConnectionState.Unknown;
            s_ForcedAssetPipelineWarning = null;
        }
        public void OnEnable()
        {
            Plugin[] availvc = Plugin.availablePlugins;

            List <PopupElement> popupArray = new List <PopupElement>(vcDefaultPopupList);

            foreach (var plugin in availvc)
            {
                popupArray.Add(new PopupElement(plugin.name, true));
            }


            vcPopupList = popupArray.ToArray();

            DevDeviceList.Changed += OnDeviceListChanged;
            BuildRemoteDeviceList();

            m_EnableTextureStreamingInPlayMode = serializedObject.FindProperty("m_EnableTextureStreamingInPlayMode");
            m_EnableTextureStreamingInEditMode = serializedObject.FindProperty("m_EnableTextureStreamingInEditMode");

            m_AsyncShaderCompilation = serializedObject.FindProperty("m_AsyncShaderCompilation");


            LoadEditorUserSettings();

            m_AssetPipelineMode = m_EditorUserSettings.FindProperty("m_AssetPipelineMode");
            m_CacheServerMode   = m_EditorUserSettings.FindProperty("m_CacheServerMode");
            m_CacheServers      = m_EditorUserSettings.FindProperty("m_CacheServers");


            m_CacheServerConnectionState = CacheServerConnectionState.Unknown;
            s_ForcedAssetPipelineWarning = null;

            if (m_CacheServerList == null)
            {
                m_CacheServerList = new ReorderableList(serializedObject, m_CacheServers, true, false, true, true);
                m_CacheServerList.onReorderCallback   = (ReorderableList list) => { serializedObject.ApplyModifiedProperties(); };
                m_CacheServerList.onAddCallback       = (ReorderableList list) => { m_CacheServers.arraySize += 1; serializedObject.ApplyModifiedProperties(); };
                m_CacheServerList.onRemoveCallback    = (ReorderableList list) => { ReorderableList.defaultBehaviours.DoRemoveButton(list); serializedObject.ApplyModifiedProperties(); };
                m_CacheServerList.onCanRemoveCallback = (ReorderableList list) => { return(list.index < m_CacheServers.arraySize && list.index >= 0); };
                m_CacheServerList.drawElementCallback = DrawCacheServerListElement;
                m_CacheServerList.elementHeight       = EditorGUIUtility.singleLineHeight + 2;
                m_CacheServerList.headerHeight        = 3;
            }
        }
        private void DoCacheServerSettings()
        {
            GUILayout.Space(10);
            GUILayout.Label(Content.cacheServer, EditorStyles.boldLabel);

            var overrideAddress = CacheServerPreferences.GetCommandLineRemoteAddressOverride();

            if (overrideAddress != null)
            {
                EditorGUILayout.HelpBox("Cache Server remote address forced via command line argument. To use the cache server address specified here please restart Unity without the -CacheServerIPAddress command line argument.", MessageType.Info, true);
            }

            int index = Mathf.Clamp((int)EditorSettings.cacheServerMode, 0, cacheServerModePopupList.Length - 1);

            CreatePopupMenu(Content.mode.text, cacheServerModePopupList, index, SetCacheServerMode);

            if (index != (int)CacheServerMode.Disabled)
            {
                bool isCacheServerEnabled = true;

                if (index == (int)CacheServerMode.AsPreferences)
                {
                    if (CacheServerPreferences.IsCacheServerV2Enabled)
                    {
                        var cacheServerIP = CacheServerPreferences.CachesServerV2Address;
                        cacheServerIP = string.IsNullOrEmpty(cacheServerIP) ? "Not set in preferences" : cacheServerIP;
                        EditorGUILayout.HelpBox(cacheServerIP, MessageType.None, false);
                    }
                    else
                    {
                        isCacheServerEnabled = false;
                        EditorGUILayout.HelpBox("Disabled", MessageType.None, false);
                    }
                }

                if (isCacheServerEnabled)
                {
                    var oldEndpoint = EditorSettings.cacheServerEndpoint;
                    var newEndpoint = EditorGUILayout.TextField(Content.cacheServerIPLabel, oldEndpoint);
                    if (newEndpoint != oldEndpoint)
                    {
                        EditorSettings.cacheServerEndpoint = newEndpoint;
                    }

                    EditorGUILayout.BeginHorizontal();

                    if (GUILayout.Button("Check Connection", GUILayout.Width(150)))
                    {
                        if (AssetDatabase.IsV2Enabled())
                        {
                            var    address = EditorSettings.cacheServerEndpoint.Split(':');
                            var    ip      = address[0];
                            UInt16 port    = 0; // If 0, will use the default set port
                            if (address.Length == 2)
                            {
                                port = Convert.ToUInt16(address[1]);
                            }

                            if (AssetDatabaseExperimental.CanConnectToCacheServer(ip, port))
                            {
                                m_CacheServerConnectionState = CacheServerConnectionState.Success;
                            }
                            else
                            {
                                m_CacheServerConnectionState = CacheServerConnectionState.Failure;
                            }
                        }
                        else
                        {
                            if (InternalEditorUtility.CanConnectToCacheServer())
                            {
                                m_CacheServerConnectionState = CacheServerConnectionState.Success;
                            }
                            else
                            {
                                m_CacheServerConnectionState = CacheServerConnectionState.Failure;
                            }
                        }
                    }

                    GUILayout.Space(25);

                    switch (m_CacheServerConnectionState)
                    {
                    case CacheServerConnectionState.Success:
                        EditorGUILayout.HelpBox("Connection successful.", MessageType.Info, true);
                        break;

                    case CacheServerConnectionState.Failure:
                        EditorGUILayout.HelpBox("Connection failed.", MessageType.Warning, true);
                        break;

                    case CacheServerConnectionState.Unknown:
                        GUILayout.Space(44);
                        break;
                    }

                    EditorGUILayout.EndHorizontal();

                    var old      = EditorSettings.cacheServerNamespacePrefix;
                    var newvalue = EditorGUILayout.TextField(Content.cacheServerNamespacePrefixLabel, old);
                    if (newvalue != old)
                    {
                        EditorSettings.cacheServerNamespacePrefix = newvalue;
                    }

                    EditorGUI.BeginChangeCheck();
                    bool enableDownload = EditorSettings.cacheServerEnableDownload;
                    enableDownload = EditorGUILayout.Toggle(Content.cacheServerEnableDownloadLabel, enableDownload);
                    if (EditorGUI.EndChangeCheck())
                    {
                        EditorSettings.cacheServerEnableDownload = enableDownload;
                    }

                    EditorGUI.BeginChangeCheck();
                    bool enableUpload = EditorSettings.cacheServerEnableUpload;
                    enableUpload = EditorGUILayout.Toggle(Content.cacheServerEnableUploadLabel, enableUpload);
                    if (EditorGUI.EndChangeCheck())
                    {
                        EditorSettings.cacheServerEnableUpload = enableUpload;
                    }

                    bool enableAuth = EditorSettings.cacheServerEnableAuth;
                    using (new EditorGUI.DisabledScope(enableAuth))
                    {
                        EditorGUI.BeginChangeCheck();
                        bool enableTls = EditorSettings.cacheServerEnableTls;
                        enableTls = EditorGUILayout.Toggle(Content.cacheServerEnableTlsLabel, enableTls);
                        if (EditorGUI.EndChangeCheck())
                        {
                            EditorSettings.cacheServerEnableTls = enableTls;
                        }
                    }

                    EditorGUI.BeginChangeCheck();
                    enableAuth = EditorGUILayout.Toggle(Content.cacheServerEnableAuthLabel, enableAuth);
                    if (EditorGUI.EndChangeCheck())
                    {
                        EditorSettings.cacheServerEnableAuth = enableAuth;
                        if (enableAuth)
                        {
                            EditorSettings.cacheServerEnableTls = true;
                        }
                    }

                    EditorGUI.indentLevel++;
                    using (new EditorGUI.DisabledScope(!enableAuth))
                    {
                        int authModeIndex = Convert.ToInt32(EditorUserSettings.GetConfigValue("cacheServerAuthMode"));
                        CreatePopupMenu(Content.mode.text, cacheServerAuthMode, authModeIndex, SetCacheServerAuthMode);

                        string oldUserVal = EditorUserSettings.GetConfigValue("cacheServerAuthUser");
                        var    newUserVal = EditorGUILayout.TextField(Content.cacheServerAuthUserLabel, oldUserVal);
                        if (newUserVal != oldUserVal)
                        {
                            EditorUserSettings.SetConfigValue("cacheServerAuthUser", newUserVal);
                        }

                        var oldPasswordVal = EditorUserSettings.GetConfigValue("cacheServerAuthPassword");
                        var newPasswordVal = EditorGUILayout.PasswordField(Content.cacheServerAuthPasswordLabel, oldPasswordVal);
                        if (newPasswordVal != oldPasswordVal)
                        {
                            EditorUserSettings.SetPrivateConfigValue("cacheServerAuthPassword", newPasswordVal);
                        }
                    }
                    EditorGUI.indentLevel--;
                }
            }
        }
示例#5
0
        public void OnEnable()
        {
            DevDeviceList.Changed += OnDeviceListChanged;
            BuildRemoteDeviceList();

            m_EnableTextureStreamingInPlayMode = serializedObject.FindProperty("m_EnableTextureStreamingInPlayMode");
            m_EnableTextureStreamingInEditMode = serializedObject.FindProperty("m_EnableTextureStreamingInEditMode");

            m_AsyncShaderCompilation    = serializedObject.FindProperty("m_AsyncShaderCompilation");
            m_CachingShaderPreprocessor = serializedObject.FindProperty("m_CachingShaderPreprocessor");

            m_DefaultBehaviorMode = serializedObject.FindProperty("m_DefaultBehaviorMode");
            Assert.IsNotNull(m_DefaultBehaviorMode);

            m_SerializationMode = serializedObject.FindProperty("m_SerializationMode");
            Assert.IsNotNull(m_SerializationMode);

            m_SerializeInlineMappingsOnOneLine = serializedObject.FindProperty("m_SerializeInlineMappingsOnOneLine");
            Assert.IsNotNull(m_SerializeInlineMappingsOnOneLine);

            m_PrefabRegularEnvironment = serializedObject.FindProperty("m_PrefabRegularEnvironment");
            Assert.IsNotNull(m_PrefabRegularEnvironment);

            m_PrefabUIEnvironment = serializedObject.FindProperty("m_PrefabUIEnvironment");
            Assert.IsNotNull(m_PrefabUIEnvironment);

            m_UseLegacyProbeSampleCount = serializedObject.FindProperty("m_UseLegacyProbeSampleCount");
            Assert.IsNotNull(m_UseLegacyProbeSampleCount);

            m_DisableCookiesInLightmapper = serializedObject.FindProperty("m_DisableCookiesInLightmapper");
            Assert.IsNotNull(m_DisableCookiesInLightmapper);

            m_SpritePackerMode = serializedObject.FindProperty("m_SpritePackerMode");
            Assert.IsNotNull(m_SpritePackerMode);

            m_EtcTextureCompressorBehavior = serializedObject.FindProperty("m_EtcTextureCompressorBehavior");
            Assert.IsNotNull(m_EtcTextureCompressorBehavior);

            m_EtcTextureFastCompressor = serializedObject.FindProperty("m_EtcTextureFastCompressor");
            Assert.IsNotNull(m_EtcTextureFastCompressor);

            m_EtcTextureNormalCompressor = serializedObject.FindProperty("m_EtcTextureNormalCompressor");
            Assert.IsNotNull(m_EtcTextureNormalCompressor);

            m_EtcTextureBestCompressor = serializedObject.FindProperty("m_EtcTextureBestCompressor");
            Assert.IsNotNull(m_EtcTextureBestCompressor);

            m_LineEndingsForNewScripts = serializedObject.FindProperty("m_LineEndingsForNewScripts");
            Assert.IsNotNull(m_LineEndingsForNewScripts);

            m_EnterPlayModeOptionsEnabled = serializedObject.FindProperty("m_EnterPlayModeOptionsEnabled");
            Assert.IsNotNull(m_EnterPlayModeOptionsEnabled);

            m_EnterPlayModeOptions = serializedObject.FindProperty("m_EnterPlayModeOptions");
            Assert.IsNotNull(m_EnterPlayModeOptions);

            m_ProjectGenerationIncludedExtensions = serializedObject.FindProperty("m_ProjectGenerationIncludedExtensions");
            Assert.IsNotNull(m_ProjectGenerationIncludedExtensions);

            m_ProjectGenerationRootNamespace = serializedObject.FindProperty("m_ProjectGenerationRootNamespace");
            Assert.IsNotNull(m_ProjectGenerationRootNamespace);

            m_CacheServerConnectionState = CacheServerConnectionState.Unknown;
            s_ForcedAssetPipelineWarning = null;

            m_IsGlobalSettings = EditorSettings.GetEditorSettings() == target;
        }
        private void DoCacheServerSettings()
        {
            GUILayout.Space(10);
            GUILayout.Label(Content.cacheServer, EditorStyles.boldLabel);

            var overrideAddress = CacheServerPreferences.GetCommandLineRemoteAddressOverride();

            if (overrideAddress != null)
            {
                EditorGUILayout.HelpBox("Cache Server remote address forced via command line argument. To use the cache server address specified here please restart Unity without the -CacheServerIPAddress command line argument.", MessageType.Info, true);
            }

            int index = Mathf.Clamp((int)m_CacheServerMode.intValue, 0, cacheServerModePopupList.Length - 1);

            CreatePopupMenu(Content.mode.text, cacheServerModePopupList, index, SetCacheServerMode);

            if (index != (int)CacheServerMode.Disabled)
            {
                bool isCacheServerEnabled = true;

                if (index == (int)CacheServerMode.AsPreferences)
                {
                    if (CacheServerPreferences.IsCacheServerV2Enabled)
                    {
                        var cacheServerIP = CacheServerPreferences.CachesServerV2Address;
                        cacheServerIP = string.IsNullOrEmpty(cacheServerIP) ? "Not set in preferences" : cacheServerIP;
                        EditorGUILayout.HelpBox(cacheServerIP, MessageType.None, false);
                    }
                    else
                    {
                        isCacheServerEnabled = false;
                        EditorGUILayout.HelpBox("Disabled", MessageType.None, false);
                    }
                }

                if (isCacheServerEnabled)
                {
                    m_CacheServerList.DoLayoutList();

                    EditorGUILayout.BeginHorizontal();

                    if (GUILayout.Button("Check Connection", GUILayout.Width(150)))
                    {
                        if (InternalEditorUtility.CanConnectToCacheServer())
                        {
                            m_CacheServerConnectionState = CacheServerConnectionState.Success;
                        }
                        else
                        {
                            m_CacheServerConnectionState = CacheServerConnectionState.Failure;
                        }
                    }

                    GUILayout.Space(25);

                    switch (m_CacheServerConnectionState)
                    {
                    case CacheServerConnectionState.Success:
                        EditorGUILayout.HelpBox("Connection successful.", MessageType.Info, true);
                        break;

                    case CacheServerConnectionState.Failure:
                        EditorGUILayout.HelpBox("Connection failed.", MessageType.Warning, true);
                        break;

                    case CacheServerConnectionState.Unknown:
                        GUILayout.Space(44);
                        break;
                    }

                    EditorGUILayout.EndHorizontal();
                }
            }
        }