Ejemplo n.º 1
0
    public void ImportPattern()
    {
        void FileSelected(string filePath)
        {
            // Load the pattern from JSON
            AppDataSet.Instance.ImportAnimation(filePath);
        }

#if UNITY_EDITOR
        FileSelected(UnityEditor.EditorUtility.OpenFilePanel("Select pattern json", "", "json"));
#elif UNITY_STANDALONE_WIN
        // Set filters (optional)
        // It is sufficient to set the filters just once (instead of each time before showing the file browser dialog),
        // if all the dialogs will be using the same filters
        FileBrowser.SetFilters(true, new FileBrowser.Filter("JSON", ".json"));

        // Set default filter that is selected when the dialog is shown (optional)
        // Returns true if the default filter is set successfully
        // In this case, set Images filter as the default filter
        FileBrowser.SetDefaultFilter(".json");
        FileBrowser.ShowLoadDialog((paths) => FileSelected(paths[0]), null, FileBrowser.PickMode.Files, false, null, null, "Select JSON", "Select");
#else
        //NativeGallery.GetImageFromGallery(FileSelected, "Select Pattern JSON");
        NativeFilePicker.PickFile(FileSelected, new string[] { NativeFilePicker.ConvertExtensionToFileType("json") });
#endif
    }
Ejemplo n.º 2
0
 //Native File Picker Load (for Android and iOS)
 public void NativeFileBrowserLoadPalette()
 {
     string[] allowedFileTypes = { NativeFilePicker.ConvertExtensionToFileType("csv") };
     NativeFilePicker.PickFile(LoadCSVPalette, allowedFileTypes);
     if (pc.currentPalette.buttons.Count == 0)
     {
         pc.deletePalette(pc.currentPalette);
     }
 }
Ejemplo n.º 3
0
    void AddNewClip()
    {
#if UNITY_EDITOR
        FileSelected(UnityEditor.EditorUtility.OpenFilePanel("Select audio file", "", "wav"));
#elif UNITY_STANDALONE_WIN
        // Set filters (optional)
        // It is sufficient to set the filters just once (instead of each time before showing the file browser dialog),
        // if all the dialogs will be using the same filters
        FileBrowser.SetFilters(true, new FileBrowser.Filter("Audio files", ".wav"));

        // Set default filter that is selected when the dialog is shown (optional)
        // Returns true if the default filter is set successfully
        // In this case, set Images filter as the default filter
        FileBrowser.SetDefaultFilter(".wav");
        FileBrowser.ShowLoadDialog((paths) => FileSelected(paths[0]), null, FileBrowser.PickMode.Files, false, null, null, "Select audio file", "Select");
#else
        NativeFilePicker.PickFile(FileSelected, new string[] { NativeFilePicker.ConvertExtensionToFileType("wav"), NativeFilePicker.ConvertExtensionToFileType("mp3") });
#endif
    }