コード例 #1
0
        private static ExtensionFilter[] getFilter(params string[] extensions)
        {
            if (extensions != null && extensions.Length > 0)
            {
                ExtensionFilter[] filter = new ExtensionFilter[extensions.Length];

                for (int ii = 0; ii < extensions.Length; ii++)
                {
                    var extension = string.IsNullOrEmpty(extensions[ii]) ? "*" : extensions[ii];

                    if (extension.Equals("*"))
                    {
                        filter[ii] = new ExtensionFilter(Util.Constants.TEXT_ALL_FILES, Util.Helper.isMacOSEditor ? string.Empty : extension);
                    }
                    else
                    {
                        filter[ii] = new ExtensionFilter(extension, extension);
                    }
                }

                if (Util.Config.DEBUG)
                {
                    Debug.Log("getFilter: " + filter.CTDump());
                }

                return(filter);
            }

            return(null);
        }
コード例 #2
0
        private static ExtensionFilter[] getFilter(params string[] extensions)
        {
            if (extensions != null && extensions.Length > 0)
            {
                ExtensionFilter[] filter = new ExtensionFilter[extensions.Length];

                string extension;

                for (int ii = 0; ii < extensions.Length; ii++)
                {
                    /*
                     #if UNITY_EDITOR
                     * extension = string.IsNullOrEmpty(extensions[ii]) || extensions[ii].Equals("*") ? null : extensions[ii];
                     * filter[ii] = new ExtensionFilter("*." + (extension == null ? "*" : extension), extension);
                     #else
                     * extension = string.IsNullOrEmpty(extensions[ii]) ? "*" : extensions[ii];
                     * filter[ii] = new ExtensionFilter("*." + extension, extension);
                     #endif
                     */
                    extension  = string.IsNullOrEmpty(extensions[ii]) ? "*" : extensions[ii];
                    filter[ii] = new ExtensionFilter(extension.Equals("*") ? Util.Constants.TEXT_ALL_FILES : extension, extension);
                }

                if (Util.Config.DEBUG)
                {
                    Debug.Log("getFilter: " + filter.CTDump());
                }

                return(filter);
            }

            return(null);
        }
コード例 #3
0
    void OnUploadClicked()
    {
#if USE_FILEBROWSER
        Crosstales.FB.ExtensionFilter[] filters = new Crosstales.FB.ExtensionFilter[] {
            new Crosstales.FB.ExtensionFilter("PNG files", "png"),
            new Crosstales.FB.ExtensionFilter("JPG files", "jpg"),
        };
        var paths = Crosstales.FB.FileBrowser.OpenFiles("Upload image", "", filters);
        OnSelectedFileToUpload(paths);
#else
        popups.ShowTextInput("Enter full path of PNG or JPG image:", "", path => OnSelectedFileToUpload(new string[] { path }));
#endif
    }
コード例 #4
0
    void OnImportButtonClicked()
    {
#if USE_FILEBROWSER
        var      wavFilter = new Crosstales.FB.ExtensionFilter("WAV files", "wav");
        var      oggFilter = new Crosstales.FB.ExtensionFilter("OGG files", "ogg");
        string[] paths     = Crosstales.FB.FileBrowser.OpenFiles("Import sound", "", wavFilter, oggFilter);
        if (paths != null)
        {
            OnImportFileSelected(paths);
        }
#else
        popups.ShowTextInput("Enter the full path to a WAV or OGG file (such as C:\\my\\sounds\\foo.wav):", "", path =>
        {
            if (!path.IsNullOrEmpty() && File.Exists(path))
            {
                OnImportFileSelected(new string[] { path });
            }
        });
#endif
    }
コード例 #5
0
    void OnImportButtonClicked()
    {
#if USE_FILEBROWSER
        Crosstales.FB.ExtensionFilter[] filters = new Crosstales.FB.ExtensionFilter[] {
            new Crosstales.FB.ExtensionFilter("PNG files", "png"),
            new Crosstales.FB.ExtensionFilter("JPG files", "jpg"),
        };
        string selected = Crosstales.FB.FileBrowser.OpenSingleFile("Import image", "", filters);
        if (selected != null)
        {
            OnImportFileSelected(new string[] { selected });
        }
#else
        popups.ShowTextInput("Enter the full path to a PNG (such as C:\\my\\textures\\foo.png):", "", path =>
        {
            if (!path.IsNullOrEmpty() && File.Exists(path))
            {
                OnImportFileSelected(new string[] { path });
            }
        });
#endif
    }