コード例 #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
    }
コード例 #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);
     }
 }
コード例 #3
0
    //Native File Picker Save (for Android and iOS)
    public void NativeFileBrowserSavePalette()
    {
        if (pc.currentPalette == null)
        {
            Debug.LogWarning("No Palette selected! Cannot save."); return;
        }
        //Create temporary file path to create a CSV:
        string filePath = Path.Combine(Application.temporaryCachePath, pc.currentPalette.title + ".csv");

        SaveCSVPalette(pc.currentPalette, filePath);

        // Export the selected file to the target directory
        NativeFilePicker.Permission permission = NativeFilePicker.ExportFile(filePath, (success) => Debug.Log("File exported: " + success));
        Debug.Log("Permission result: " + permission);
    }
コード例 #4
0
ファイル: UIAudioClipsView.cs プロジェクト: tomas-dots/Pixels
    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
    }
コード例 #5
0
    // public static void Print(string name)
    // {
    //     string savePath = Application.persistentDataPath;

    //     string full_path = savePath + "/" + name;


    //     Debug.Log(string.Format("<color=yellow>Saving file path is {0}</color>", full_path));
    // }

    public static void SaveHTML_IOS_Android(string html_as_string, string _fileName)
    {
        string fileName = "Агриферт_" + _fileName;

        // string day = System.DateTime.Now.ToString("dd/MM/yy");
        System.DateTime dateTime = System.DateTime.Now;

        fileName += "_" + dateTime.Day.ToString() + "_" + dateTime.Month.ToString() + "_" + dateTime.Year.ToString() + ".html";

        //fileName += "_" + day + ".html";
        //fileName += "_" + day + ".html";

        string filePath = Path.Combine(Application.temporaryCachePath, fileName);

        File.WriteAllText(filePath, html_as_string);

        NativeFilePicker.Permission permission = NativeFilePicker.ExportFile(filePath, (success) => Debug.Log("File exported: " + success));


        Debug.Log("Permission result: " + permission);
    }
コード例 #6
0
 public static void LoadGpx()
 {
     _filesLeftToProcess = 1;
     NativeFilePicker.PickFile(ProcessFile,
                               new string[] { GpxFiletype, ZipFiletype });
 }