/// <summary>
 /// Initializes a new instance of the <see cref="TextureReferenceChangedEventArgs"/> class.
 /// </summary>
 /// <param name="emitter">The emitter.</param>
 /// <param name="textureReference">The texture reference.</param>
 public TextureReferenceChangedEventArgs(Emitter emitter, TextureReference textureReference)
     : base(emitter)
 {
     this.TextureReference = textureReference;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TextureReferenceChangedEventArgs"/> class.
 /// </summary>
 /// <param name="emitter">The emitter.</param>
 /// <param name="textureReference">The texture reference.</param>
 public TextureReferenceChangedEventArgs(AbstractEmitter emitter, TextureReference textureReference)
     : base(emitter)
 {
     this.TextureReference = textureReference;
 }
Esempio n. 3
0
        /// <summary>
        /// Handles the TextureReferenceAdded event of the Interface.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ProjectMercury.EffectEditor.NewTextureReferenceEventArgs"/> instance containing the event data.</param>
        private void Interface_TextureReferenceAdded(Object sender, NewTextureReferenceEventArgs e)
        {
            Trace.WriteLine("Adding new texture reference...", "CORE");

            using (new TraceIndenter())
            {
                Trace.WriteLine("Filepath: " + e.FilePath);
            }

            try
            {
                TextureReference reference = new TextureReference(e.FilePath);

                e.AddedTextureReference = reference;

                this.TextureReferences.Add(reference);

                e.Result = CoreOperationResult.OK;
            }
            catch (Exception error)
            {
                e.Result = new CoreOperationResult(error);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Loads the default texture references.
        /// </summary>
        private List<TextureReference> LoadDefaultTextureReferences()
        {
            Trace.WriteLine("Loading default texture references...", "CORE");

            List<TextureReference> references = new List<TextureReference>();

            DirectoryInfo texturesDirectory = new DirectoryInfo("Textures");

            if (texturesDirectory.Exists)
            {
                foreach (FileInfo file in texturesDirectory.GetFiles())
                {
                    if (file.Extension == ".bmp" || file.Extension == ".jpg" || file.Extension == ".png")
                    {
                        try
                        {
                            TextureReference reference = new TextureReference(file.FullName);

                            references.Add(reference);

                            using (new TraceIndenter())
                            {
                                Trace.WriteLine("File: " + file.FullName);
                            }
                        }
                        catch (Exception e)
                        {
                            Trace.TraceError(e.Message);

                            continue;
                        }
                    }
                }
            }

            return references;
        }
Esempio n. 5
0
        /// <summary>
        /// Handles the TextureReferenceAdded event of the Interface.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ProjectMercury.EffectEditor.NewTextureReferenceEventArgs"/> instance containing the event data.</param>
        private void Interface_TextureReferenceAdded(object sender, NewTextureReferenceEventArgs e)
        {
            TextureReference reference = new TextureReference(e.FilePath);

            e.AddedTextureReference = reference;

            this.TextureReferences.Add(reference);
        }
Esempio n. 6
0
        /// <summary>
        /// Loads the default texture references.
        /// </summary>
        private List<TextureReference> LoadDefaultTextureReferences()
        {
            List<TextureReference> references = new List<TextureReference>();

            DirectoryInfo texturesDirectory = new DirectoryInfo("Textures");

            if (texturesDirectory.Exists)
            {
                foreach (FileInfo file in texturesDirectory.GetFiles())
                {
                    if (file.Extension == ".bmp" || file.Extension == ".jpg" || file.Extension == ".png")
                    {
                        try
                        {
                            TextureReference reference = new TextureReference(file.FullName);

                            references.Add(reference);
                        }
                        catch
                        {
                            continue;
                        }
                    }
                }
            }

            return references;
        }