private void UpdateFromScenes()
    {
        QuickStartEditorComponent quickStart = null;

        for (int i = 0; i < EditorSceneManager.sceneCount; i++)
        {
            foreach (GameObject rooGO in EditorSceneManager.GetSceneAt(i).GetRootGameObjects())
            {
                if (rooGO.TryGetComponent(out quickStart))
                {
                    break;
                }
            }
            if (quickStart != null)
            {
                break;
            }
        }

        if (quickStart != null && quickStart.OverrideLevel)
        {
            _elementLevel.SetEnabled(!quickStart.OverrideLevel);
            _elementLevel.label    = "Level (set by scene)";
            _elementLevel.value    = quickStart.Level.name;
            EditorLaunchData.level = quickStart.Level.name;
        }
        else
        {
            _elementLevel.SetEnabled(true);
            _elementLevel.label = "Level";
        }
    }
 public void ResetDrawPackageVersionUI()
 {
     _tagsList.Clear();
     _tagsList.Add("-select version-");
     _versionTagsPopupField.value = _tagsList[0];
     _versionTagsPopupField.SetEnabled(false);
     _changeVersionButton.SetEnabled(false);
 }
        public override VisualElement CreateInspectorGUI()
        {
            var root = new VisualElement();

            var button    = (ScreenTransitionButton)target;
            var uiManager = button.GetComponentInParent <UIManager>();
            var screens   = uiManager.GetScreens();

            var nextScreenProperty = serializedObject.FindProperty("nextScreen");

            // Obtain the currently selected screen
            var selectedIndex  = 0;
            var selectedScreen = nextScreenProperty.objectReferenceValue as Screen;

            if (selectedScreen)
            {
                if (screens.Contains(selectedScreen))
                {
                    selectedIndex = screens.IndexOf(selectedScreen);
                }
            }
            else
            {
                nextScreenProperty.objectReferenceValue = screens[0];
                nextScreenProperty.serializedObject.ApplyModifiedProperties();
            }

            string StringFormatCallback(Screen screen) => screen.Name == string.Empty ? "<unnamed>" : screen.Name;

            var popup = new PopupField <Screen>("Next screen", screens, selectedIndex)
            {
                // bindingPath = "nextScreen",
                formatListItemCallback      = StringFormatCallback,
                formatSelectedValueCallback = StringFormatCallback
            };

            popup.RegisterValueChangedCallback(evt => {
                nextScreenProperty.objectReferenceValue = evt.newValue;
                nextScreenProperty.serializedObject.ApplyModifiedProperties();
            });

            var backToggle = new Toggle("Back to previous")
            {
                bindingPath = "back"
            };

            backToggle.RegisterValueChangedCallback(evt => { popup.SetEnabled(!evt.newValue); });

            popup.SetEnabled(!serializedObject.FindProperty("back").boolValue);

            root.Add(backToggle);
            root.Add(popup);

            return(root);
        }
        internal override void Apply(VisualElement container)
        {
            /// <sample>
            // Note: PopupField has no UXML support because it is a generic type.

            var choices = new List <string> {
                "First", "Second", "Third"
            };

            // Create a new field and assign it its value.
            var normalField = new PopupField <string>("Normal Field", choices, 0);

            normalField.value = "Second";
            container.Add(normalField);

            // Create a new field, disable it, and give it a style class.
            var styledField = new PopupField <string>("Styled Field", choices, 0);

            styledField.SetEnabled(false);
            styledField.AddToClassList("some-styled-field");
            styledField.value = normalField.value;
            container.Add(styledField);

            // Mirror value of uxml field into the C# field.
            normalField.RegisterCallback <ChangeEvent <string> >((evt) =>
            {
                styledField.value = evt.newValue;
            });
            /// </sample>
        }
        private void InitPackageVersion()
        {
            _packageVersionRoot = new VisualElement {
                name = "package_version_root"
            };
            Add(_packageVersionRoot);

            // 插件版本UI用代码生成,不用uxml的原因是PopupField组件不能用uxml
            _getGitTagsButton = new Button {
                name = "get_git_tags", text = "获取版本信息"
            };
            _packageVersionRoot.Add(_getGitTagsButton);

            _tagsList = new List <string> {
                "-select version-"
            };
            _versionTagsPopupField = new PopupField <string>("Version:", _tagsList, 0)
            {
                value = "-select version-"
            };
            _versionTagsPopupField.SetEnabled(false);
            _packageVersionRoot.Add(_versionTagsPopupField);

            _changeVersionButton = new Button {
                name = "change_version", text = "切换版本"
            };
            _changeVersionButton.SetEnabled(false);
            _packageVersionRoot.Add(_changeVersionButton);
        }
Exemple #6
0
        private void RefreshWindow()
        {
            var  buildMode     = AssetBundleBuilderSettingData.Setting.BuildMode;
            bool enableElement = buildMode == EBuildMode.ForceRebuild;

            _buildinTagsField.SetEnabled(enableElement);
            _encryptionField.SetEnabled(enableElement);
            _compressionField.SetEnabled(enableElement);
            _appendExtensionToggle.SetEnabled(enableElement);
            _copyBuildinTagFilesToggle.SetEnabled(buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild);
        }
Exemple #7
0
        public override VisualElement CreatePropertyGUI(SerializedProperty property)
        {
            var           settings    = ProjectUtility.GetProjectSettings <ActionGraphGlobalSettings>();
            var           definitions = ActionDefinitionAsset.LoadAll().ToArray();
            List <string> guids       = definitions.Select(a => a.id.guid).ToList();

            guids.Insert(0, string.Empty);
            var popup = new PopupField <string>(property.displayName, guids, property.FindPropertyRelative("guid").stringValue, (choice) => FormatCell(definitions, choice)
                                                , (choice) => FormatCell(definitions, choice)
                                                );

            popup.SetEnabled(settings != null);
            popup.BindProperty(property.FindPropertyRelative("guid"));
            return(popup);
        }
 internal ExportTextureNode() : base()
 {
     title         = "Export Texture";
     capabilities &= ~Capabilities.Deletable;
     AddInputPort <Vector4>("Color");
     RefreshPorts();
     m_WidthPopupField = new PopupField <int>(s_PopupValues, defaultValue: s_PopupValues[6])
     {
         name = "Width"
     };
     m_HeightPopupField = new PopupField <int>(s_PopupValues, defaultValue: s_PopupValues[6])
     {
         name = "Height"
     };
     m_HeightPopupField.SetEnabled(false);
     m_WidthPopupField.OnValueChanged(OnWidthValueChanged);
     extensionContainer.Add(UIElementsUtility.CreateLabeledElement("Width", m_WidthPopupField));
     extensionContainer.Add(UIElementsUtility.CreateLabeledElement("Height", m_HeightPopupField));
     RefreshExpandedState();
 }
        static VisualElement CreatePropertyGUI(SerializedProperty property, List <GimmickTarget> targetChoices)
        {
            var container = new VisualElement();

            var targetProperty = property.FindPropertyRelative("target");
            var targetField    = new PopupField <GimmickTarget>("Target", targetChoices, (GimmickTarget)targetProperty.enumValueIndex, FormatListItem, FormatListItem);

            targetField.SetEnabled(targetChoices.Count > 1);
            targetField.RegisterValueChangedCallback(e =>
            {
                targetProperty.enumValueIndex = (int)e.newValue;
                property.serializedObject.ApplyModifiedProperties();
            });

            var keyField = new PropertyField(property.FindPropertyRelative("key"));

            container.Add(targetField);
            container.Add(keyField);

            return(container);
        }
Exemple #10
0
        /// <summary>
        /// To attach a project an existing project, we must collect all orgs the current user is a member of.
        /// In addition the current user may be a guest of a specific project, in which case we must also look at
        /// all projects to find organizations.
        /// </summary>
        /// <param name="organizationField"></param>
        /// <param name="projectIdField"></param>
        void LoadReuseOrganizationField(PopupField <string> organizationField, PopupField <string> projectIdField = null)
        {
            ServicesConfiguration.instance.RequestCurrentUserApiUrl(currentUserApiUrl =>
            {
                var getOrganizationsRequest = new UnityWebRequest(currentUserApiUrl + "?include=orgs,projects",
                                                                  UnityWebRequest.kHttpVerbGET)
                {
                    downloadHandler = new DownloadHandlerBuffer()
                };
                getOrganizationsRequest.suppressErrorsToConsole = true;
                getOrganizationsRequest.SetRequestHeader("AUTHORIZATION", $"Bearer {UnityConnect.instance.GetUserInfo().accessToken}");
                var operation        = getOrganizationsRequest.SendWebRequest();
                operation.completed += op =>
                {
                    try
                    {
                        if (ServicesUtils.IsUnityWebRequestReadyForJsonExtract(getOrganizationsRequest))
                        {
                            var jsonParser = new JSONParser(getOrganizationsRequest.downloadHandler.text);
                            var json       = jsonParser.Parse();
                            try
                            {
                                m_OrgIdByName.Clear();
                                var sortedOrganizationNames = new List <string>();
                                foreach (var rawOrg in json.AsDict()[k_JsonOrgsNodeName].AsList())
                                {
                                    var org = rawOrg.AsDict();
                                    if (k_AnyRoleFilter.Contains(org[k_JsonRoleNodeName].AsString()))
                                    {
                                        sortedOrganizationNames.Add(org[k_JsonNameNodeName].AsString());
                                        m_OrgIdByName.Add(org[k_JsonNameNodeName].AsString(), org[k_JsonIdNodeName].AsString());
                                    }
                                }

                                foreach (var rawProject in json.AsDict()[k_JsonProjectsNodeName].AsList())
                                {
                                    var project = rawProject.AsDict();
                                    if (!project[k_JsonArchivedNodeName].AsBool() &&
                                        !sortedOrganizationNames.Contains(project[k_JsonOrgNameNodeName].AsString()))
                                    {
                                        sortedOrganizationNames.Add(project[k_JsonOrgNameNodeName].AsString());
                                        m_OrgIdByName.Add(project[k_JsonOrgNameNodeName].AsString(), project[k_JsonOrgIdNodeName].AsString());
                                    }
                                }

                                sortedOrganizationNames.Sort();
                                var popUpChoices = new List <string> {
                                    L10n.Tr(k_SelectOrganizationText)
                                };
                                organizationField.SetEnabled(true);
                                popUpChoices.AddRange(sortedOrganizationNames);
                                organizationField.choices = popUpChoices;
                                organizationField.SetValueWithoutNotify(organizationField.choices[0]);
                                if (projectIdField != null)
                                {
                                    projectIdField.choices = new List <string> {
                                        L10n.Tr(k_SelectProjectText)
                                    };
                                    projectIdField.SetValueWithoutNotify(L10n.Tr(k_SelectProjectText));
                                    projectIdField.SetEnabled(false);
                                }
                            }
                            catch (Exception ex)
                            {
                                if (exceptionCallback != null)
                                {
                                    exceptionCallback.Invoke(ex);
                                }
                                else
                                {
                                    //If there is no exception callback, we have to at least log it
                                    Debug.LogException(ex);
                                }
                            }
                        }
                        else
                        {
                            var ex = new UnityConnectWebRequestException(L10n.Tr(k_CouldNotObtainOrganizationsMessage))
                            {
                                error           = getOrganizationsRequest.error,
                                method          = getOrganizationsRequest.method,
                                timeout         = getOrganizationsRequest.timeout,
                                url             = getOrganizationsRequest.url,
                                responseHeaders = getOrganizationsRequest.GetResponseHeaders(),
                                responseCode    = getOrganizationsRequest.responseCode,
                                isHttpError     = (getOrganizationsRequest.result == UnityWebRequest.Result.ProtocolError),
                                isNetworkError  = (getOrganizationsRequest.result == UnityWebRequest.Result.ConnectionError),
                            };
                            if (exceptionCallback != null)
                            {
                                exceptionCallback.Invoke(ex);
                            }
                            else
                            {
                                //If there is no exception callback, we have to at least log it
                                Debug.LogException(ex);
                            }
                        }
                    }
                    finally
                    {
                        getOrganizationsRequest.Dispose();
                    }
                };
            });
        }
Exemple #11
0
        void LoadProjectField(string organizationName, PopupField <string> projectIdField)
        {
            ServicesConfiguration.instance.RequestOrganizationProjectsApiUrl(m_OrgIdByName[organizationName], organizationProjectsApiUrl =>
            {
                var getProjectsRequest = new UnityWebRequest(organizationProjectsApiUrl,
                                                             UnityWebRequest.kHttpVerbGET)
                {
                    downloadHandler = new DownloadHandlerBuffer()
                };
                getProjectsRequest.suppressErrorsToConsole = true;
                getProjectsRequest.SetRequestHeader("AUTHORIZATION", $"Bearer {UnityConnect.instance.GetUserInfo().accessToken}");
                var operation        = getProjectsRequest.SendWebRequest();
                operation.completed += op =>
                {
                    try
                    {
                        if (ServicesUtils.IsUnityWebRequestReadyForJsonExtract(getProjectsRequest))
                        {
                            var jsonParser = new JSONParser(getProjectsRequest.downloadHandler.text);
                            var json       = jsonParser.Parse();
                            try
                            {
                                m_ProjectInfoByName = new Dictionary <string, ProjectInfoData>();

                                var jsonProjects = json.AsDict()[k_JsonProjectsNodeName].AsList();
                                foreach (var jsonProject in jsonProjects)
                                {
                                    if (!jsonProject.AsDict()[k_JsonArchivedNodeName].AsBool())
                                    {
                                        var projectInfo = ExtractProjectInfoFromJson(jsonProject);
                                        m_ProjectInfoByName.Add(projectInfo.name, projectInfo);
                                    }
                                }

                                var projectNames = new List <string> {
                                    L10n.Tr(k_SelectProjectText)
                                };
                                var sortedProjectNames = new List <string>(m_ProjectInfoByName.Keys);
                                sortedProjectNames.Sort();
                                projectNames.AddRange(sortedProjectNames);
                                projectIdField.choices = projectNames;
                                projectIdField.SetEnabled(true);
                            }
                            catch (Exception ex)
                            {
                                if (exceptionCallback != null)
                                {
                                    exceptionCallback.Invoke(ex);
                                }
                                else
                                {
                                    //If there is no exception callback, we have to at least log it
                                    Debug.LogException(ex);
                                }
                            }
                        }
                        else
                        {
                            var ex = new UnityConnectWebRequestException(L10n.Tr(k_CouldNotObtainProjectMessage))
                            {
                                error           = getProjectsRequest.error,
                                method          = getProjectsRequest.method,
                                timeout         = getProjectsRequest.timeout,
                                url             = getProjectsRequest.url,
                                responseHeaders = getProjectsRequest.GetResponseHeaders(),
                                responseCode    = getProjectsRequest.responseCode,
                                isHttpError     = (getProjectsRequest.result == UnityWebRequest.Result.ProtocolError),
                                isNetworkError  = (getProjectsRequest.result == UnityWebRequest.Result.ConnectionError),
                            };
                            if (exceptionCallback != null)
                            {
                                exceptionCallback.Invoke(ex);
                            }
                            else
                            {
                                //If there is no exception callback, we have to at least log it
                                Debug.LogException(ex);
                            }
                        }
                    }
                    finally
                    {
                        getProjectsRequest.Dispose();
                    }
                };
            });
        }
        public static VisualElement Create <TEnum>(string label, SerializedProperty property, List <TEnum> choices, TEnum defaultValue, Func <TEnum, string> format, Action <TEnum> onValueChanged = null)
            where TEnum : struct, Enum
        {
            // Enum の SerializedProperty type が int になることがある(深さによって発生する)
            //Assert.AreEqual(property.propertyType, SerializedPropertyType.Enum);
            var container = new VisualElement
            {
                style = { flexGrow = new StyleFloat(1) }
            };

            void UpdateProperty(TEnum value)
            {
                var newValue = (int)(object)value;

                if (property.intValue == newValue)
                {
                    return;
                }
                property.intValue = newValue;
                property.serializedObject.ApplyModifiedProperties();
            }

            UpdateProperty(defaultValue);

            var popupField = new PopupField <TEnum>(label, choices, defaultValue, format, format)
            {
                style = { flexGrow = new StyleFloat(1) }
            };

            popupField.RegisterValueChangedCallback(e =>
            {
                UpdateProperty(e.newValue);
#if !UNITY_2019_3_OR_NEWER
                onValueChanged?.Invoke(e.newValue);
#endif
            });
            popupField.SetEnabled(choices.Count > 1);
            container.Add(popupField);

            VisualElement CreateFieldAsEnum()
            {
                Assert.AreEqual(property.propertyType, SerializedPropertyType.Enum);
                var enumField = CreateAsStringPopupField <TEnum>(property, newValue =>
                {
                    popupField.SetValueWithoutNotify(newValue);
                    onValueChanged?.Invoke(newValue);
                });

                return(enumField);
            }

            VisualElement CreateFieldAsInt()
            {
                Assert.AreEqual(property.propertyType, SerializedPropertyType.Integer);
                var intField = new IntegerField
                {
                    bindingPath = property.propertyPath
                };

                intField.Bind(property.serializedObject);
                intField.RegisterValueChangedCallback(e =>
                {
                    var newValue = (TEnum)(object)e.newValue;
                    popupField.SetValueWithoutNotify(newValue);
                    onValueChanged?.Invoke(newValue);
                });
                return(intField);
            }

            VisualElement CreateFieldByType()
            {
                switch (property.propertyType)
                {
                case SerializedPropertyType.Enum:
                {
                    return(CreateFieldAsEnum());
                }

                // HACK: Enum の SerializedProperty type が int になることがある(深さによって発生する)
                case SerializedPropertyType.Integer:
                {
                    return(CreateFieldAsInt());
                }

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            var field = CreateFieldByType();
            field.style.display = new StyleEnum <DisplayStyle>(DisplayStyle.None);
            container.Add(field);

            return(container);
        }
        private void OnMaterialsDropped(Material[] droppedMaterials)
        {
            remappingRoot.Clear();

            DisposeOfSerializedObjects();

            //Construct a dictionary between shaders and their materials
            shadersToMaterials = new Dictionary <Shader, List <SerializedObject> >();
            foreach (Material material in droppedMaterials)
            {
                if (!shadersToMaterials.TryGetValue(material.shader, out var list))
                {
                    list = new List <SerializedObject>();
                    shadersToMaterials.Add(material.shader, list);
                }

                list.Add(new SerializedObject(material));
            }

            foreach (var pair in shadersToMaterials)
            {
                Box shaderRoot = new Box();
                shaderRoot.AddToClassList("innerPadding");
                remappingRoot.Add(shaderRoot);

                Shader      shader      = pair.Key;
                ObjectField shaderField = new ObjectField {
                    objectType = typeof(Shader), value = shader
                };
                shaderField.SetEnabled(false);
                shaderRoot.Add(shaderField);

                //RemapType, to a set of keys referring to values that could be remapped.
                var remapsFrom = new Dictionary <RemapType, HashSet <string> >();
                var remapsTo   = new Dictionary <RemapType, HashSet <string> >();

                List <SerializedObject> materials = pair.Value;
                foreach (SerializedObject materialSO in materials)
                {
                    SerializedProperty savedProperties = materialSO.FindProperty("m_SavedProperties");

                    //Textures -------------------------------------------------------------------------
                    SerializedProperty texEnvsArray = savedProperties.FindPropertyRelative("m_TexEnvs");
                    var textureKeys = new HashSet <string>();
                    remapsTo.Add(RemapType.Texture, textureKeys);
                    var textureKeysFrom = new HashSet <string>();
                    remapsFrom.Add(RemapType.Texture, textureKeysFrom);
                    for (int i = 0; i < texEnvsArray.arraySize; i++)
                    {
                        SerializedProperty texEnv  = texEnvsArray.GetArrayElementAtIndex(i);
                        SerializedProperty key     = texEnv.FindPropertyRelative("first");
                        SerializedProperty texture = texEnv.FindPropertyRelative("second.m_Texture");

                        textureKeys.Add(key.stringValue);
                        //Only add to the "from", if there is a key with a meaningful value in it.
                        if (texture.objectReferenceValue != null)
                        {
                            textureKeysFrom.Add(key.stringValue);
                        }
                    }
                    //-----------------------------------------------------------------------------------

                    //Floats ----------------------------------------------------------------------------
                    SerializedProperty floatsArray = savedProperties.FindPropertyRelative("m_Floats");
                    //floats have no way of telling if they're not set, so they can use the same set
                    var floatKeys = new HashSet <string>();
                    remapsTo.Add(RemapType.Float, floatKeys);
                    remapsFrom.Add(RemapType.Float, floatKeys);
                    for (int i = 0; i < floatsArray.arraySize; i++)
                    {
                        SerializedProperty @float = floatsArray.GetArrayElementAtIndex(i);
                        SerializedProperty key    = @float.FindPropertyRelative("first");
                        floatKeys.Add(key.stringValue);
                    }
                    //-----------------------------------------------------------------------------------

                    //Vectors and Colors ----------------------------------------------------------------
                    SerializedProperty colorsArray = savedProperties.FindPropertyRelative("m_Colors");
                    //colors have no way of telling if they're not set, so they can use the same set
                    var vectorKeys = new HashSet <string>();
                    remapsTo.Add(RemapType.VectorOrColor, vectorKeys);
                    remapsFrom.Add(RemapType.VectorOrColor, vectorKeys);
                    for (int i = 0; i < colorsArray.arraySize; i++)
                    {
                        SerializedProperty vector = colorsArray.GetArrayElementAtIndex(i);
                        SerializedProperty key    = vector.FindPropertyRelative("first");
                        vectorKeys.Add(key.stringValue);
                    }

                    //-----------------------------------------------------------------------------------
                }

                //CONTROLS
                var remapTypeField = new EnumField("Remap Type", RemapType.None)
                {
                    name = remapTypeName
                };
                remapTypeField.RegisterCallback <ChangeEvent <Enum> >(SelectedRemapType);
                shaderRoot.Add(remapTypeField);

                PopupField <string> popupFromField = new PopupField <string>(fromKeyLabel, noneList, 0)
                {
                    name = fromKeyPopupName
                };
                popupFromField.SetEnabled(false);
                shaderRoot.Add(popupFromField);

                PopupField <string> popupToField = new PopupField <string>(toKeyLabel, noneList, 0)
                {
                    name = toKeyPopupName
                };
                popupToField.SetEnabled(false);
                shaderRoot.Add(popupToField);

                Button remapButton = new Button {
                    text = "Remap", name = remapButtonName
                };
                remapButton.SetEnabled(false);
                shaderRoot.Add(remapButton);


                void SelectedRemapType(ChangeEvent <Enum> remapEvt)
                {
                    if (remapEvt == null)
                    {
                        throw new ArgumentNullException(nameof(remapEvt));
                    }

                    RemapType value = (RemapType)remapEvt.newValue;

                    if (value == RemapType.None)
                    {
                        GetButton().SetEnabled(false);
                        GetRemapTo().SetEnabled(false);
                        GetRemapFrom().SetEnabled(false);
                        return;
                    }

                    PopupField <string> child = GetRemapFrom();
                    int index = shaderRoot.IndexOf(child);

                    child.RemoveFromHierarchy();

                    List <string> choicesFrom = remapsFrom[value].ToList();

                    choicesFrom.Insert(0, none);
                    popupFromField = new PopupField <string>(fromKeyLabel, choicesFrom, none)
                    {
                        name = fromKeyPopupName
                    };
                    shaderRoot.Insert(index, popupFromField);
                    popupFromField.RegisterCallback <ChangeEvent <string> >(SelectedRemapFrom);
                }

                void SelectedRemapFrom(ChangeEvent <string> popupFromEvt)
                {
                    string remapFromKey = popupFromEvt.newValue;

                    if (remapFromKey == none)
                    {
                        GetButton().SetEnabled(false);
                        GetRemapTo().SetEnabled(false);
                        return;
                    }

                    PopupField <string> child = GetRemapTo();
                    int index = shaderRoot.IndexOf(child);

                    child.RemoveFromHierarchy();

                    List <string> choicesTo = remapsTo[(RemapType)remapTypeField.value].ToList();

                    choicesTo.Insert(0, none);
                    popupToField = new PopupField <string>(toKeyLabel, choicesTo, none)
                    {
                        name = toKeyPopupName
                    };
                    shaderRoot.Insert(index, popupToField);
                    popupToField.RegisterCallback <ChangeEvent <string>, (PopupField <string>, string)>(SelectedRemapTo, (popupToField, remapFromKey));
                }

                void SelectedRemapTo(ChangeEvent <string> popupToEvt, (PopupField <string> popupToField, string remapFromKey) args)
                {
                    string        remapToKey = popupToEvt.newValue;
                    VisualElement background = args.popupToField.Q(null, PopupField <string> .inputUssClassName);

                    if (remapToKey == none)
                    {
                        GetButton().SetEnabled(false);
                        background.style.unityBackgroundImageTintColor = default;
                        return;
                    }

                    if (remapToKey == args.remapFromKey)
                    {
                        background.style.unityBackgroundImageTintColor = new Color(1f, 0.46f, 0.51f);
                        return;
                    }

                    background.style.unityBackgroundImageTintColor = default;

                    var button = GetButton();

                    button.SetEnabled(true);
                    button.RemoveManipulator(button.clickable);
                    button.clickable = new Clickable(() => PerformRemap(shader, (RemapType)GetRemapType().value, args.remapFromKey, remapToKey));
                    button.AddManipulator(button.clickable);
                }

                Button GetButton() => shaderRoot.Q <Button>(remapButtonName);
                EnumField GetRemapType() => shaderRoot.Q <EnumField>(remapTypeName);
                PopupField <string> GetRemapFrom() => shaderRoot.Q <PopupField <string> >(fromKeyPopupName);
                PopupField <string> GetRemapTo() => shaderRoot.Q <PopupField <string> >(toKeyPopupName);
            }
        }