s2-dungeonsandexploits/unity/game/Builds/WebGL/Build/WebGL.loader.js

1 line
20 KiB
JavaScript
Raw Normal View History

2022-11-18 09:04:33 +01:00
function createUnityInstance(e,t,n){function r(e,n){if(!r.aborted&&t.showBanner)return"error"==n&&(r.aborted=!0),t.showBanner(e,n);switch(n){case"error":console.error(e);break;case"warning":console.warn(e);break;default:console.log(e)}}function o(e){var t=e.reason||e.error,n=t?t.toString():e.message||e.reason||"",r=t&&t.stack?t.stack.toString():"";if(r.startsWith(n)&&(r=r.substring(n.length)),n+="\n"+r.trim(),n&&l.stackTraceRegExp&&l.stackTraceRegExp.test(n)){var o=e.filename||t&&(t.fileName||t.sourceURL)||"",a=e.lineno||t&&(t.lineNumber||t.line)||0;i(n,o,a)}}function a(e){e.preventDefault()}function i(e,t,n){if(e.indexOf("fullscreen error")==-1){if(l.startupErrorHandler)return void l.startupErrorHandler(e,t,n);if(!(l.errorHandler&&l.errorHandler(e,t,n)||(console.log("Invoking error handler due to\n"+e),"function"==typeof dump&&dump("Invoking error handler due to\n"+e),i.didShowErrorMessage))){var e="An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:\n"+e;e.indexOf("DISABLE_EXCEPTION_CATCHING")!=-1?e="An exception has occurred, but exception handling has been disabled in this build. If you are the developer of this content, enable exceptions in your project WebGL player settings to be able to catch the exception or see the stack trace.":e.indexOf("Cannot enlarge memory arrays")!=-1?e="Out of memory. If you are the developer of this content, try allocating more memory to your WebGL build in the WebGL player settings.":e.indexOf("Invalid array buffer length")==-1&&e.indexOf("Invalid typed array length")==-1&&e.indexOf("out of memory")==-1&&e.indexOf("could not allocate memory")==-1||(e="The browser could not allocate enough memory for the WebGL content. If you are the developer of this content, try allocating less memory to your WebGL build in the WebGL player settings."),alert(e),i.didShowErrorMessage=!0}}}function s(e,t){if("symbolsUrl"!=e){var r=l.downloadProgress[e];r||(r=l.downloadProgress[e]={started:!1,finished:!1,lengthComputable:!1,total:0,loaded:0}),"object"!=typeof t||"progress"!=t.type&&"load"!=t.type||(r.started||(r.started=!0,r.lengthComputable=t.lengthComputable),r.total=t.total,r.loaded=t.loaded,"load"==t.type&&(r.finished=!0));var o=0,a=0,i=0,s=0,u=0;for(var e in l.downloadProgress){var r=l.downloadProgress[e];if(!r.started)return 0;i++,r.lengthComputable?(o+=r.loaded,a+=r.total,s++):r.finished||u++}var c=i?(i-u-(a?s*(a-o)/a:0))/i:0;n(.9*c)}}function u(e){s(e);var t=l.cacheControl(l[e]),n=l.companyName&&l.productName?l.cachedFetch:l.fetchWithProgress,o=l[e],a=/file:\/\//.exec(o)?"same-origin":void 0,i=n(l[e],{method:"GET",companyName:l.companyName,productName:l.productName,productVersion:l.productVersion,control:t,mode:a,onProgress:function(t){s(e,t)}});return i.then(function(e){return e.parsedBody}).catch(function(t){var n="Failed to download file "+l[e];"file:"==location.protocol?r(n+". Loading web pages via a file:// URL without a web server is not supported by this browser. Please use a local development web server to host Unity content, or use the Unity Build and Run option.","error"):console.error(n)})}function c(){return new Promise(function(e,t){var n=document.createElement("script");n.src=l.frameworkUrl,n.onload=function(){if("undefined"==typeof unityFramework||!unityFramework){var t=[["br","br"],["gz","gzip"]];for(var o in t){var a=t[o];if(l.frameworkUrl.endsWith("."+a[0])){var i="Unable to parse "+l.frameworkUrl+"!";if("file:"==location.protocol)return void r(i+" Loading pre-compressed (brotli or gzip) content via a file:// URL without a web server is not supported by this browser. Please use a local development web server to host compressed Unity content, or use the Unity Build and Run option.","error");if(i+=' This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: '+a[1]+'" present. Check browser Console and Devtools Network tab to debug.',"br"==a[0]&&"http:"==location.protocol){var s=["localhost","127.0.0.1"