Skip to content

Commit 90cc9c2

Browse files
committed
Merge branch 'wip'
2 parents c6008cd + b9baa7c commit 90cc9c2

31 files changed

Lines changed: 837 additions & 368 deletions

Assets/StandaloneFileBrowser.meta

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/StandaloneFileBrowser/Plugins.meta

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
336 Bytes
Binary file not shown.

Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle.meta

Lines changed: 28 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents.meta

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/Info.plist

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plist version="1.0">
44
<dict>
55
<key>BuildMachineOSBuild</key>
6-
<string>16G29</string>
6+
<string>18A391</string>
77
<key>CFBundleDevelopmentRegion</key>
88
<string>English</string>
99
<key>CFBundleExecutable</key>
@@ -31,16 +31,16 @@
3131
<key>DTCompiler</key>
3232
<string>com.apple.compilers.llvm.clang.1_0</string>
3333
<key>DTPlatformBuild</key>
34-
<string>9A235</string>
34+
<string>10A255</string>
3535
<key>DTPlatformVersion</key>
3636
<string>GM</string>
3737
<key>DTSDKBuild</key>
38-
<string>17A360</string>
38+
<string>18A384</string>
3939
<key>DTSDKName</key>
40-
<string>macosx10.13</string>
40+
<string>macosx10.14</string>
4141
<key>DTXcode</key>
42-
<string>0900</string>
42+
<string>1000</string>
4343
<key>DTXcodeBuild</key>
44-
<string>9A235</string>
44+
<string>10A255</string>
4545
</dict>
4646
</plist>

Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS.meta

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
var StandaloneFileBrowserWebGLPlugin = {
22
// Open file.
3-
// gameObjectNamePtr: GameObject name required for calling back unity side with SendMessage. And it should be unique
4-
// filter(disabled): Filter files. Example filters:
3+
// gameObjectNamePtr: Unique GameObject name. Required for calling back unity with SendMessage.
4+
// methodNamePtr: Callback method name on given GameObject.
5+
// filter: Filter files. Example filters:
56
// Match all image files: "image/*"
67
// Match all video files: "video/*"
78
// Match all audio files: "audio/*"
8-
// Custom: ".plist,.xml,.yaml"
9-
// multiselect(disabled): Allows multiple file selection
10-
UploadFile: function(gameObjectNamePtr/*, filter, multiselect*/) {
9+
// Custom: ".plist, .xml, .yaml"
10+
// multiselect: Allows multiple file selection
11+
UploadFile: function(gameObjectNamePtr, methodNamePtr, filterPtr, multiselect) {
1112
gameObjectName = Pointer_stringify(gameObjectNamePtr);
13+
methodName = Pointer_stringify(methodNamePtr);
14+
filter = Pointer_stringify(filterPtr);
1215

1316
// Delete if element exist
1417
var fileInput = document.getElementById(gameObjectName)
@@ -21,23 +24,24 @@ var StandaloneFileBrowserWebGLPlugin = {
2124
fileInput.setAttribute('type', 'file');
2225
fileInput.setAttribute('style','display:none;');
2326
fileInput.setAttribute('style','visibility:hidden;');
24-
// if (multiselect) {
25-
// fileInput.setAttribute('multiple', multiselect);
26-
// }
27-
// if (filter) {
28-
// fileInput.setAttribute('accept', filter);
29-
// }
27+
if (multiselect) {
28+
fileInput.setAttribute('multiple', '');
29+
}
30+
if (filter) {
31+
fileInput.setAttribute('accept', filter);
32+
}
3033
fileInput.onclick = function (event) {
3134
// File dialog opened
3235
this.value = null;
3336
};
3437
fileInput.onchange = function (event) {
3538
// multiselect works
36-
// for (var i = 0; i < event.target.files.length; i++) {
37-
// console.log(URL.createObjectURL(event.target.files[i]));
38-
// }
39+
var urls = [];
40+
for (var i = 0; i < event.target.files.length; i++) {
41+
urls.push(URL.createObjectURL(event.target.files[i]));
42+
}
3943
// File selected
40-
SendMessage(gameObjectName, 'OnFileUploaded', URL.createObjectURL(event.target.files[0]));
44+
SendMessage(gameObjectName, methodName, urls.join());
4145

4246
// Remove after file selected
4347
document.body.removeChild(fileInput);
@@ -50,21 +54,16 @@ var StandaloneFileBrowserWebGLPlugin = {
5054
}
5155
},
5256

53-
// Open folder. - NOT IMPLEMENTED
54-
UploadFolder: function(gameObjectNamePtr) {
55-
gameObjectName = Pointer_stringify(gameObjectNamePtr);
56-
SendMessage(gameObjectName, 'OnFolderUploaded', '');
57-
},
58-
5957
// Save file
6058
// DownloadFile method does not open SaveFileDialog like standalone builds, its just allows user to download file
61-
// gameObjectNamePtr: GameObject name required for calling back unity side with SendMessage. And it should be unique
62-
// DownloadFile does not return any info, just calls 'OnFileDownloaded' without any parameter
59+
// gameObjectNamePtr: Unique GameObject name. Required for calling back unity with SendMessage.
60+
// methodNamePtr: Callback method name on given GameObject.
6361
// filenamePtr: Filename with extension
6462
// byteArray: byte[]
6563
// byteArraySize: byte[].Length
66-
DownloadFile: function(gameObjectNamePtr, filenamePtr, byteArray, byteArraySize) {
64+
DownloadFile: function(gameObjectNamePtr, methodNamePtr, filenamePtr, byteArray, byteArraySize) {
6765
gameObjectName = Pointer_stringify(gameObjectNamePtr);
66+
methodName = Pointer_stringify(methodNamePtr);
6867
filename = Pointer_stringify(filenamePtr);
6968

7069
var bytes = new Uint8Array(byteArraySize);
@@ -83,7 +82,7 @@ var StandaloneFileBrowserWebGLPlugin = {
8382
document.body.removeChild(downloader);
8483
document.onmouseup = null;
8584

86-
SendMessage(gameObjectName, 'OnFileDownloaded');
85+
SendMessage(gameObjectName, methodName);
8786
}
8887
}
8988
};

Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib.meta

Lines changed: 84 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)