public void Save()
        {
            if (NewMaterial == null || materialName == "")
            {
                return;
            }
            if (materialName == selectedImage)             //ncrunch: no coverage start
            {
                if (GetDialogResultToRenameMaterial())
                {
                    MaterialName += "Material";
                }
                else
                {
                    return;
                }
            }
            if (MaterialList.Contains(MaterialName))
            {
                if (!GetDialogResultToSaveMaterial())
                {
                    return;
                }
            }
            var             metaDataCreator = new ContentMetaDataCreator();
            ContentMetaData contentMetaData = metaDataCreator.CreateMetaDataFromMaterial(materialName,
                                                                                         NewMaterial);

            service.UploadContent(contentMetaData);
        }
 public void RefreshOnAddedContent(ContentType type, string name)
 {
     if (type == ContentType.Material && !MaterialList.Contains(name))
     {
         MaterialList.Add(name);
     }
     if ((type == ContentType.Image || type == ContentType.ImageAnimation ||
          type == ContentType.SpriteSheetAnimation) && !ImageList.Contains(name))
     {
         ImageList.Add(name);
     }
 }
Beispiel #3
0
        /// <summary>
        /// デフォルト名を生成する。
        /// </summary>
        /// <param name="materialList">素材リスト</param>
        /// <returns>デフォルト名</returns>
        private string GenerateName(MaterialList materialList)
        {
            var baseName = materialList.SubDirectoryName;

            for (int i = 0; i < 999; i++)
            {
                var name = $"{baseName}{i.ToString("000")}";
                if (!materialList.Contains(name))
                {
                    return(name);
                }
            }
            return("");
        }
Beispiel #4
0
        //ncrunch: no coverage end

        public void UpdateOnContentChange(ContentType type, string addedName)
        {
            if (type == ContentType.ParticleSystem && !EffectsInProject.Contains(addedName))
            {
                EffectsInProject.Add(addedName);
                RaisePropertyChanged("EffectsInProject");
            }
            if (type == ContentType.ParticleEmitter && !EmittersInProject.Contains(addedName))
            {
                EmittersInProject.Add(addedName);
                RaisePropertyChanged("EmittersInProject");
            }
            if (type == ContentType.Material && !MaterialList.Contains(addedName))
            {
                MaterialList.Add(addedName);
                RaisePropertyChanged("MaterialList");
            }
        }
Beispiel #5
0
        /// <summary>
        /// 素材名が有効かどうかを確認する。
        /// 正しくない場合には例外がスルーされる。
        /// </summary>
        /// <param name="materialList">マテリアルリスト</param>
        /// <param name="name">素材名</param>
        private void CheckMaterialName(MaterialList materialList, string name)
        {
            if (name.Length == 0)
            {
                throw new Exception(Resources.MessageMaterialNameNotSpecified);
            }
            // 使用不可能な文字が使われていないか?
            if (!MaterialEntryFile.IsValidName(name))
            {
                throw new Exception(Resources.MessageInvalidMaterialNameCharacter);
            }

            // 同名のファイルが存在しないか?
            if (materialList.Contains(name))
            {
                throw new Exception(Resources.MessageMaterialNameUsed);
            }
        }
Beispiel #6
0
 public void UpdateOnContentDeletion(string removedName)
 {
     if (EffectsInProject.Contains(removedName))
     {
         EffectsInProject.Remove(removedName);
     }
     else if (EmittersInProject.Contains(removedName))
     {
         EmittersInProject.Remove(removedName);
     }
     else if (MaterialList.Contains(removedName))
     {
         MaterialList.Remove(removedName);
         foreach (var emitter in currentEffect.AttachedEmitters)
         {
             if (emitter.EmitterData.ParticleMaterial.Name.Equals(removedName))
             {
                 emitter.EmitterData.ParticleMaterial = ContentExtensions.CreateDefaultMaterial2D();                         //ncrunch: no coverage
             }
         }
     }
     RaisePropertyChanged("EffectsInProject");
 }