Exemplo n.º 1
0
        public override void OnActivate(string searchContext, VisualElement rootElement)
        {
            base.OnActivate(searchContext, rootElement);

            MetadataMapProperty = SerializedObject.FindProperty(MetadataMapPropertyName);
            MetadataMapEditor   = new MetadataMapEditor(SerializedObject, MetadataMapProperty, typeof(TMeta), EditorTitle, lockedActorIds);
            DefaultMetadata     = SerializedObject.FindProperty(DefaultMetadataPropertyName).GetGenericValue <TMeta>();

            MetadataMapEditor.OnElementModified += HandleMetadataElementModified;
        }
Exemplo n.º 2
0
        public override void OnGUI(string searchContext)
        {
            if (editMainRequested)
            {
                editMainRequested = false;
                MetadataMapEditor.SelectEditedMetadata(BackgroundsConfiguration.MainActorId);
            }

            base.OnGUI(searchContext);
        }
Exemplo n.º 3
0
        public override void OnActivate(string searchContext, VisualElement rootElement)
        {
            base.OnActivate(searchContext, rootElement);

            overrideDrawers     = OverrideMetaDrawers();
            lockedActorIds      = LockedActorIds;
            FromMetaButtonLabel = new GUIContent($"< Back To {EditorTitle} List");

            MetadataMapProperty = SerializedObject.FindProperty(MetadataMapPropertyName);
            MetadataMapEditor   = new MetadataMapEditor(SerializedObject, MetadataMapProperty, typeof(TMeta), EditorTitle, lockedActorIds);
            DefaultMetadata     = SerializedObject.FindProperty(DefaultMetadataPropertyName).GetGenericValue <TMeta>();

            MetadataMapEditor.OnElementModified += HandleMetadataElementModified;
        }
Exemplo n.º 4
0
        protected virtual void DrawMetaEditor(SerializedProperty metaProperty)
        {
            var actorTitle = MetadataMapEditor.SelectedActorId.InsertCamel();

            EditorGUILayout.LabelField($"{actorTitle} Metadata", EditorStyles.boldLabel);
            DrawDefaultMetaEditor(metaProperty);

            EditorGUILayout.Space();

            EditorGUILayout.LabelField(actorTitle + (AllowMultipleResources ? " Resources" : " Resource"), EditorStyles.boldLabel);
            ResourcesEditor.DrawGUILayout(ResourcesCategoryId, ResourcesPathPrefix, ResourceName, ResourcesTypeConstraint, ResourcesSelectionTooltip);

            // Return to meta list when pressing return key and no text fields are edited.
            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Backspace && !EditorGUIUtility.editingTextField)
            {
                MetadataMapEditor.ResetEditedMetadata();
                Event.current.Use();
            }
        }
Exemplo n.º 5
0
        protected override void DrawConfigurationEditor()
        {
            if (ShowResourcesEditor)
            {
                if (IsEditingMetadata)
                {
                    if (GUILayout.Button(FromMetaButtonLabel, GUIStyles.NavigationButton))
                    {
                        MetadataMapEditor.ResetEditedMetadata();
                    }
                    else
                    {
                        EditorGUILayout.Space();
                        DrawMetaEditor(MetadataMapEditor.EditedMetadataProperty);
                    }
                }
                else
                {
                    if (GUILayout.Button(FromResourcesButtonContent, GUIStyles.NavigationButton))
                    {
                        ShowResourcesEditor = false;
                    }
                    else
                    {
                        EditorGUILayout.Space();
                        MetadataMapEditor.DrawGUILayout();
                    }
                }
            }
            else
            {
                DrawDefaultEditor();

                EditorGUILayout.Space();
                if (GUILayout.Button(ToResourcesButtonContent, GUIStyles.NavigationButton))
                {
                    ShowResourcesEditor = true;
                }
            }
        }