Ejemplo n.º 1
0
        private void LoadAsset()
        {
            if (!FileDialog.Open(out string path,
                                 filter:
                                 "All Image Files (*.bmp; *.jpg; *.jpeg; *.png; *.tif; *.tiff)\0*.bmp;*.jpg;*.jpeg;*.png;*.tif;*.tiff\0" +
                                 "PNG (*.png)\0*.png\0" +
                                 "JPG (*.jpg; *.jpeg)\0*.jpg;*.jpeg\0" +
                                 "BMP (*.bmp)\0*.bmp\0" +
                                 "GIF (*.gif)\0*.gif\0" +
                                 "TIFF (*.tif; *.tiff)\0*.tif;*.tiff\0" +
                                 "EXIF (*.exif)\0*.exif\0" +
                                 "All Files (*.*)\0*.*\0"))
            {
                return;
            }

            SelectedTextureAsset = new TextureAsset(path);
            SelectedTextureAsset.Load();
            textureAssets.Add(SelectedTextureAsset);

            selectedIndex = textureAssets.GetAll().Count - 1;
            selectedIndex = Math.Clamp(selectedIndex, 0, Math.Max(textureAssets.GetAll().Count - 1, 0));

            ResetView();
        }