Esempio n. 1
0
 /// <summary>
 /// Add materials(full path)
 /// </summary>
 public void AddMaterials(string[] materials)
 {
     foreach (string material in materials)
     {
         this.Add(material, ContentService.GetMaterial() + Path.GetFileNameWithoutExtension(material), null, "TextureProcessor");
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Загружает custom-материал.
        /// </summary>
        private void LoadMaterial()
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Title = "Load Material";

            fileDialog.Filter = "Image Files (*.jpg;*.png)|*.jpg;*.png|" +
                                "All Files (*.*)|*.*";

            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    Cursor = Cursors.WaitCursor;

                    string filename   = Path.GetFileNameWithoutExtension(fileDialog.FileName);
                    string sourceFile = fileDialog.FileName;
                    string destFile   = "Content\\" + ContentService.GetMaterial(Path.GetFileName(fileDialog.FileName));

                    File.Copy(sourceFile, destFile);
                    _assetCreator.LoadMaterial(filename, ContentService.GetContentService().LoadTexture(destFile));
                    materialBox.Items.Add(filename);
                }
                finally
                {
                    Cursor = Cursors.Arrow;
                }
            }
        }