예제 #1
0
        public MetaContentEditorShell Create(MetaData data)
        {
            MetaContentEditorShell result = Instantiate(_shellPrefab);
            MetaContentEditor      editor = createEditor(data, result);

            result.SetEditor(editor);
            return(result);
        }
        private void addMetaEditor(MetaData data)
        {
            MetaContentEditorShell editor = _factory.Create(data);

            editor.Base.SetParent(_editorsHook);
            editor.Base.localScale = Vector3.one;
            _typeToShells.Add(data.Type, editor);
            reorder();
        }
예제 #3
0
        private MetaContentEditor createEditor(MetaData data, MetaContentEditorShell shell)
        {
            switch (data.Type)
            {
            case MetaDataType.Title:
                shell.ViewToggle.Toggle(true);
                TitleEditor result = Instantiate(_titleEditorPrefab);
                result.Data = data as TitleData;
                return(result);

            case MetaDataType.Tags:
                shell.ViewToggle.Toggle(true);
                TagsEditor tagsEditor = Instantiate(_tagsEditorPrefab);
                tagsEditor.Data = data as TagsData;
                return(tagsEditor);

            case MetaDataType.CreationDate:
                shell.ViewToggle.Toggle(false);
                CreationDateEditor creationDateEditor = Instantiate(_creationDateEditor);
                creationDateEditor.Data = data as CreationDateData;
                return(creationDateEditor);

            case MetaDataType.LastChangedDate:
                shell.ViewToggle.Toggle(false);
                LastChangeDateEditor lastChangeDate = Instantiate(_lastChangeDateEditor);
                lastChangeDate.Data = data as LastChangeDateData;
                return(lastChangeDate);

            case MetaDataType.Comment:
                shell.ViewToggle.Toggle(true);
                CommentEditor commentEditor = Instantiate(_commentEditor);
                commentEditor.Data = data as CommentData;
                return(commentEditor);

            case MetaDataType.Description:
                shell.ViewToggle.Toggle(true);
                DescriptionEditor descriptionEditor = Instantiate(_descriptionEditor);
                descriptionEditor.Data = data as DescriptionData;
                return(descriptionEditor);

            case MetaDataType.PreviewImage:
                shell.ViewToggle.Toggle(true);
                PreviewImageEditor previewImageEditor = Instantiate(_previewImageEditor);
                previewImageEditor.Data = data as PreviewImageData;
                return(previewImageEditor);

            case MetaDataType.Author:
                shell.ViewToggle.Toggle(true);
                AuthorsEditor authorsEditor = Instantiate(_authorsEditor);
                authorsEditor.Data = data as AuthorData;
                return(authorsEditor);

            default:
                throw new NotImplementedException();
            }
        }
        private void removeMetaContent(MetaData data)
        {
            if (!_typeToShells.ContainsKey(data.Type))
            {
                throw new InvalidOperationException();
            }
            MetaContentEditorShell editor = _typeToShells[data.Type];

            _typeToShells.Remove(data.Type);
            Destroy(editor.Base.gameObject);
            reorder();
        }