diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta new file mode 100755 index 0000000..894faf1 --- /dev/null +++ b/Assets/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7a5208056b259b94c93011f559630e34 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta new file mode 100755 index 0000000..894faf1 --- /dev/null +++ b/Assets/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7a5208056b259b94c93011f559630e34 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/JSInterop.jslib.meta b/Assets/Plugins/JSInterop.jslib.meta new file mode 100755 index 0000000..f373dda --- /dev/null +++ b/Assets/Plugins/JSInterop.jslib.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 4c3ee90d2efb6644bb8823cd8d90c454 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta new file mode 100755 index 0000000..894faf1 --- /dev/null +++ b/Assets/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7a5208056b259b94c93011f559630e34 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/JSInterop.jslib.meta b/Assets/Plugins/JSInterop.jslib.meta new file mode 100755 index 0000000..f373dda --- /dev/null +++ b/Assets/Plugins/JSInterop.jslib.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 4c3ee90d2efb6644bb8823cd8d90c454 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/WebSocket.jslib b/Assets/Plugins/WebSocket.jslib new file mode 100755 index 0000000..f9b1765 --- /dev/null +++ b/Assets/Plugins/WebSocket.jslib @@ -0,0 +1,82 @@ +mergeInto(LibraryManager.library, { + Constructor: function (urlPtr) + { + var url = Pointer_stringify(urlPtr); + if (window.unity_sockets === undefined) + { + window.unity_sockets = {next_socket_id: 0}; + } + var socketId = window.unity_sockets.next_socket_id++; + var key = "socket" + socketId; + + var ws = new WebSocket(url); + var events = []; + + ws.onclose = function(event) + { + }; + ws.onerror = function(event) + { + }; + ws.onmessage = function(event) + { + }; + ws.onopen = function(event) + { + }; + + window.unity_sockets[key] = {ws: ws, events:events}; + + return socketId; + }, + + ReadyState: function (socketId) + { + var key = "socket" + socketId; + if (window.unity_sockets === undefined || window.unity_sockets[key] === undefined) return -1; + + var ws = window.unity_sockets[key].ws; + return ws.readyState; + } + + Poll: function(socketId) + { + var key = "socket" + socketId; + if (window.unity_sockets === undefined || window.unity_sockets[key] === undefined) return 0; + + var events = window.unity_sockets[key].events; + if (events.length == 0) return 0; + + return events[0].event_type; + } + + /* + PrintFloatArray: function (array, size) + { + for(var i = 0; i < size; i++) + { + console.log(HEAPF32[(array >> 2) + i]); + } + }, + + AddNumbers: function (x, y) + { + return x + y; + }, + + StringReturnValueFunction: function () + { + var returnStr = "bla"; + var bufferSize = lengthBytesUTF8(returnStr) + 1; + var buffer = _malloc(bufferSize); + stringToUTF8(returnStr, buffer, bufferSize); + return buffer; + }, + + BindWebGLTexture: function (texture) + { + GLctx.bindTexture(GLctx.TEXTURE_2D, GL.textures[texture]); + }, + */ + +}); \ No newline at end of file diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta new file mode 100755 index 0000000..894faf1 --- /dev/null +++ b/Assets/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7a5208056b259b94c93011f559630e34 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/JSInterop.jslib.meta b/Assets/Plugins/JSInterop.jslib.meta new file mode 100755 index 0000000..f373dda --- /dev/null +++ b/Assets/Plugins/JSInterop.jslib.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 4c3ee90d2efb6644bb8823cd8d90c454 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/WebSocket.jslib b/Assets/Plugins/WebSocket.jslib new file mode 100755 index 0000000..f9b1765 --- /dev/null +++ b/Assets/Plugins/WebSocket.jslib @@ -0,0 +1,82 @@ +mergeInto(LibraryManager.library, { + Constructor: function (urlPtr) + { + var url = Pointer_stringify(urlPtr); + if (window.unity_sockets === undefined) + { + window.unity_sockets = {next_socket_id: 0}; + } + var socketId = window.unity_sockets.next_socket_id++; + var key = "socket" + socketId; + + var ws = new WebSocket(url); + var events = []; + + ws.onclose = function(event) + { + }; + ws.onerror = function(event) + { + }; + ws.onmessage = function(event) + { + }; + ws.onopen = function(event) + { + }; + + window.unity_sockets[key] = {ws: ws, events:events}; + + return socketId; + }, + + ReadyState: function (socketId) + { + var key = "socket" + socketId; + if (window.unity_sockets === undefined || window.unity_sockets[key] === undefined) return -1; + + var ws = window.unity_sockets[key].ws; + return ws.readyState; + } + + Poll: function(socketId) + { + var key = "socket" + socketId; + if (window.unity_sockets === undefined || window.unity_sockets[key] === undefined) return 0; + + var events = window.unity_sockets[key].events; + if (events.length == 0) return 0; + + return events[0].event_type; + } + + /* + PrintFloatArray: function (array, size) + { + for(var i = 0; i < size; i++) + { + console.log(HEAPF32[(array >> 2) + i]); + } + }, + + AddNumbers: function (x, y) + { + return x + y; + }, + + StringReturnValueFunction: function () + { + var returnStr = "bla"; + var bufferSize = lengthBytesUTF8(returnStr) + 1; + var buffer = _malloc(bufferSize); + stringToUTF8(returnStr, buffer, bufferSize); + return buffer; + }, + + BindWebGLTexture: function (texture) + { + GLctx.bindTexture(GLctx.TEXTURE_2D, GL.textures[texture]); + }, + */ + +}); \ No newline at end of file diff --git a/Assets/WebGLTemplates/WebApp/game.html b/Assets/WebGLTemplates/WebApp/game.html index 2769707..1cf23f7 100755 --- a/Assets/WebGLTemplates/WebApp/game.html +++ b/Assets/WebGLTemplates/WebApp/game.html @@ -4,6 +4,17 @@ Blackout +