Ejemplo n.º 1
0
        private static void CreateParticleSystemWithSubContent(ContentIconAndName content)
        {
            var particleSystem           = ContentLoader.Load <ParticleSystemData>(content.Name);
            var emitterNames             = particleSystem.MetaData.Get("EmitterNames", "emitter");
            var particleSystemSubContent = new ObservableCollection <ContentIconAndName>();

            for (int i = 0; i < emitterNames.Split(new[] { ',', ' ' }).Length; i++)
            {
                var newEmitterName = emitterNames.Split(new[] { ',', ' ' })[i];
                RemoveContentFromContentList(newEmitterName);
                if (string.IsNullOrEmpty(newEmitterName))
                {
                    continue;
                }
                particleSystemSubContent.Add(
                    new ContentIconAndName(
                        ContentIconAndName.GetContentTypeIcon(ContentType.ParticleEmitter), newEmitterName));
            }
            var contentIndex = contentList.IndexOf(content);

            contentList.RemoveAt(contentIndex);
            contentList.Insert(contentIndex,
                               new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(ContentType.ParticleSystem),
                                                      content.Name, particleSystemSubContent));
        }
Ejemplo n.º 2
0
 private static ContentIconAndName GetAnimationSubContent(string animationName)
 {
     RemoveContentFromContentList(animationName);
     return
         (new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(ContentType.MeshAnimation),
                                 animationName));
 }
Ejemplo n.º 3
0
 public void Init(Service service)
 {
     DataContext             = contentManagerViewModel = new ContentManagerViewModel(service);
     service.ContentUpdated += (type, name) =>
     {
         AddContentToContentList(type, name);
         ContentLoader.RemoveResource(name);
         if (isContentReadyForUse)
         {
             Dispatcher.Invoke(
                 new Action(
                     () =>
                     contentManagerViewModel.SelectedContent =
                         new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(type), name)));
         }
     };
     service.ContentDeleted += name =>
     {
         DeleteContentFromContentList(name);
         ContentLoader.RemoveResource(name);
     };
     service.ProjectChanged += () =>
     {
         isContentReadyForUse = false;
         RefreshContentList();
     };
     service.ContentReady += () =>
     {
         Dispatcher.Invoke(new Action(contentManagerViewModel.ShowStartContent));
         isContentReadyForUse = true;
     };
     contentManagerViewModel.RefreshContentList();
 }
        public void AddNewContent(string contentName)
        {
            var contentType = service.GetTypeOfContent(contentName);
            var newContent  = new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(contentType),
                                                     contentName);

            ContentList.Add(newContent);
        }
        public void AddContentToContentList(ContentType type, string name)
        {
            RemoveContentFromContentLists(name);
            var newContent = new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(type), name);

            DisplayContentList.Add(newContent);
            ContentList.Add(newContent);
            SubContentManager.AddSubContentAndRemoveDuplicateContent(DisplayContentList, service,
                                                                     newContent);
            RaisePropertyChanged("ContentList");
        }
Ejemplo n.º 6
0
        private static void CreateSpriteSheetWithSubContent(ContentIconAndName content)
        {
            var spriteSheetAnimation = ContentLoader.Load <SpriteSheetAnimation>(content.Name);
            var image = spriteSheetAnimation.MetaData.Get("ImageName", "image");
            var spriteSheetSubContent = new ObservableCollection <ContentIconAndName>
            {
                new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(ContentType.Image), image)
            };
            var contentIndex = contentList.IndexOf(content);

            contentList.RemoveAt(contentIndex);
            contentList.Insert(contentIndex,
                               new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(ContentType.ImageAnimation),
                                                      content.Name, spriteSheetSubContent));
        }
Ejemplo n.º 7
0
        private static void CreateFontWithSubContent(ContentIconAndName content)
        {
            var fontSubContent = new ObservableCollection <ContentIconAndName>
            {
                new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(ContentType.Image),
                                       content.Name + "Font")
            };

            RemoveContentFromContentList(content.Name + "Font");
            var contentIndex = contentList.IndexOf(content);

            contentList.RemoveAt(contentIndex);
            contentList.Insert(contentIndex,
                               new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(ContentType.Font),
                                                      content.Name, fontSubContent));
        }
Ejemplo n.º 8
0
        private static ContentIconAndName GetMaterialSubContent(string contentName, bool isSubContent)
        {
            if (isSubContent)
            {
                RemoveContentFromContentList(contentName);
            }
            var material           = ContentLoader.Load <Material>(contentName);
            var images             = material.MetaData.Get("ImageOrAnimationName", "image");
            var materialSubContent = new ObservableCollection <ContentIconAndName>();

            materialSubContent.Add(
                new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(ContentType.Image), images));
            RemoveContentFromContentList(images);
            return(new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(ContentType.Material),
                                          contentName, materialSubContent));
        }
Ejemplo n.º 9
0
        private static ContentIconAndName GetMeshSubContent(string meshName, bool isSubContent)
        {
            if (isSubContent)
            {
                RemoveContentFromContentList(meshName);
            }
            var mesh             = ContentLoader.Load <Mesh>(meshName);
            var aditionalContent = new ObservableCollection <ContentIconAndName>();
            var geometryName     = mesh.MetaData.Get("GeometryName", "geometry");

            aditionalContent.Add(GetGeometrySubContent(geometryName));
            var animationName = mesh.MetaData.Get("AnimationName", "animation");

            aditionalContent.Add(GetAnimationSubContent(animationName));
            var meshSubContent = new ObservableCollection <ContentIconAndName>();
            var materialName   = mesh.MetaData.Get("MaterialName", "material");

            meshSubContent.Add(GetMaterialSubContent(materialName, true));
            return(new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(ContentType.Mesh),
                                          meshName, meshSubContent, aditionalContent));
        }
Ejemplo n.º 10
0
        private static void CreateImageAnimationWithSubContent(ContentIconAndName content)
        {
            var imageAnimation           = ContentLoader.Load <ImageAnimation>(content.Name);
            var images                   = imageAnimation.MetaData.Get("ImageNames", "image");
            var imageAnimationSubContent = new ObservableCollection <ContentIconAndName>();

            for (int i = 0; i < images.Split(new[] { ',', ' ' }).Length; i++)
            {
                var newMeshName = images.Split(new[] { ',', ' ' })[i];
                if (string.IsNullOrEmpty(newMeshName))
                {
                    continue;
                }
                imageAnimationSubContent.Add(
                    new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(ContentType.Image),
                                           newMeshName));
            }
            var contentIndex = contentList.IndexOf(content);

            contentList.RemoveAt(contentIndex);
            contentList.Insert(contentIndex,
                               new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(ContentType.ImageAnimation),
                                                      content.Name, imageAnimationSubContent));
        }
Ejemplo n.º 11
0
 private static ContentIconAndName GetGeometrySubContent(string geometryName)
 {
     RemoveContentFromContentList(geometryName);
     return(new ContentIconAndName(ContentIconAndName.GetContentTypeIcon(ContentType.Geometry),
                                   geometryName));
 }