-
Notifications
You must be signed in to change notification settings - Fork 0
/
FileBrowserDemo.cs
129 lines (121 loc) · 4.21 KB
/
FileBrowserDemo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
using UnityEngine;
using System;
using UnityEngine.Video;
public class FileBrowserDemo : MonoBehaviour
{
private string m_LabelContent;
[SerializeField]
private VideoPlayer mVideoPlayer;
[SerializeField]
private VideoPlayerManager mVideoPlayerManager;
[SerializeField]
private OpenCVUpdateLoop openCVUpdateloop;
public void OpenVideoPath(){
mVideoPlayer.Stop();
FileBrowser.OpenFilePanel ("Open file Title", Environment.GetFolderPath (Environment.SpecialFolder.Desktop), null, null, (bool canceled, string filePath) => {
if (canceled) {
m_LabelContent = "[Open File] Canceled";
Debug.Log ("[Open File] Canceled");
mVideoPlayer.Play();
return;
}
m_LabelContent = "[Open File] Selected file: " + filePath;
Debug.Log ("[Open File] Selected file: " + filePath);
//mVideoPlayer.Pause();
mVideoPlayerManager.sURL_Video = filePath;
openCVUpdateloop.ResetLoop ();
mVideoPlayerManager.initVideo();
});
}
//
//
//
//
// void OnGUI()
// {
// GUI.Label(new Rect(220, 10, Screen.width - 230, Screen.height - 20), m_LabelContent);
//
// if (GUI.Button(new Rect(10, 10, 200, 50), "Open File"))
// {
// FileBrowser.OpenFilePanel("Open file Title", Environment.GetFolderPath(Environment.SpecialFolder.Desktop), null, null, (bool canceled, string filePath) => {
// if (canceled)
// {
// m_LabelContent = "[Open File] Canceled";
// Debug.Log("[Open File] Canceled");
// return;
// }
//
// m_LabelContent = "[Open File] Selected file: " + filePath;
// Debug.Log("[Open File] Selected file: " + filePath);
// });
// }
//
// if (GUI.Button(new Rect(10, 70, 200, 50), "Open Multiple Files"))
// {
// FileBrowser.OpenMultipleFilesPanel("Open multiple files Title", Environment.GetFolderPath(Environment.SpecialFolder.Desktop), new string[] { "jpg", "png" }, "Open multiple", (bool canceled, string[] filePathArray) => {
// if (canceled)
// {
// m_LabelContent = "[Open Multiple Files] Canceled";
// Debug.Log("[Open Multiple Files] Canceled");
// return;
// }
//
// m_LabelContent = "";
// for (int i = 0; i < filePathArray.Length; i++)
// {
// m_LabelContent += "[Open Multiple Files] Selected file #" + i + ": " + filePathArray[i] + "\n";
// Debug.Log("[Open Multiple Files] Selected file #" + i + ": " + filePathArray[i]);
// }
// });
// }
//
// if (GUI.Button(new Rect(10, 130, 200, 50), "Open Folder"))
// {
// FileBrowser.OpenFolderPanel("Open folder Title", Environment.GetFolderPath(Environment.SpecialFolder.Desktop), null, (bool canceled, string folderPath) => {
// if (canceled)
// {
// m_LabelContent = "[Open Folder] Canceled";
// Debug.Log("[Open Folder] Canceled");
// return;
// }
//
// m_LabelContent = "[Open Folder] Selected folder: " + folderPath;
// Debug.Log("[Open Folder] Selected folder: " + folderPath);
// });
// }
//
// if (GUI.Button(new Rect(10, 190, 200, 50), "Open Multiple Folders"))
// {
// FileBrowser.OpenMultipleFoldersPanel("Open multiple folders Title", Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Open folders", (bool canceled, string[] folderPathArray) => {
// if (canceled)
// {
// m_LabelContent = "[Open Multiple Folders] Canceled";
// Debug.Log("[Open Multiple Folders] Canceled");
// return;
// }
//
// m_LabelContent = "";
// for (int i = 0; i < folderPathArray.Length; i++)
// {
// m_LabelContent += "[Open Multiple Folders] Selected folder #" + i + ": " + folderPathArray[i] + "\n";
// Debug.Log("[Open Multiple Folders] Selected folder #" + i + ": " + folderPathArray[i]);
// }
// });
// }
//
// if (GUI.Button(new Rect(10, 250, 200, 50), "Save File"))
// {
// FileBrowser.SaveFilePanel("Save file Title", "Type here your message...", Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Default Name", new string[] { "jpg", "png" }, null, (bool canceled, string filePath) => {
// if (canceled)
// {
// m_LabelContent = "[Save File] Canceled";
// Debug.Log("[Save File] Canceled");
// return;
// }
//
// m_LabelContent = "[Save File] You can now save the file to the path: " + filePath;
// Debug.Log("[Save File] You can now save the file to the path: " + filePath);
// });
// }
// }
}