ML-Agents-SoccerTwos / Build /SoccerTwos.loader.js
Thomas Simonini
Add Soccer Twos
49bd424
function createUnityInstance(r,n,l){function s(e,r){if(!s.aborted&&n.showBanner)return"error"==r&&(s.aborted=!0),n.showBanner(e,r);switch(r){case"error":console.error(e);break;case"warning":console.warn(e);break;default:console.log(e)}}function t(e){var r=e.reason||e.error,n=r?r.toString():e.message||e.reason||"",t=r&&r.stack?r.stack.toString():"";(n+="\n"+(t=t.startsWith(n)?t.substring(n.length):t).trim())&&c.stackTraceRegExp&&c.stackTraceRegExp.test(n)&&h(n,e.filename||r&&(r.fileName||r.sourceURL)||"",e.lineno||r&&(r.lineNumber||r.line)||0)}function e(e,r,n){var t=e[r];void 0!==t&&t||(console.warn('Config option "'+r+'" is missing or empty. Falling back to default value: "'+n+'". Consider updating your WebGL template to include the missing config option.'),e[r]=n)}l=l||function(){};var o,c={canvas:r,webglContextAttributes:{preserveDrawingBuffer:!1,powerPreference:2},streamingAssetsUrl:"StreamingAssets",downloadProgress:{},deinitializers:[],intervals:{},setInterval:function(e,r){e=window.setInterval(e,r);return this.intervals[e]=!0,e},clearInterval:function(e){delete this.intervals[e],window.clearInterval(e)},preRun:[],postRun:[],print:function(e){console.log(e)},printErr:function(e){console.error(e),"string"==typeof e&&-1!=e.indexOf("wasm streaming compile failed")&&(-1!=e.toLowerCase().indexOf("mime")?s('HTTP Response Header "Content-Type" configured incorrectly on the server for file '+c.codeUrl+' , should be "application/wasm". Startup time performance will suffer.',"warning"):s('WebAssembly streaming compilation failed! This can happen for example if "Content-Encoding" HTTP header is incorrectly enabled on the server for file '+c.codeUrl+", but the file is not pre-compressed on disk (or vice versa). Check the Network tab in browser Devtools to debug server header configuration.","warning"))},locateFile:function(e){return"build.wasm"==e?this.codeUrl:e},disabledCanvasEvents:["contextmenu","dragstart"]};for(o in e(n,"companyName","Unity"),e(n,"productName","WebGL Player"),e(n,"productVersion","1.0"),n)c[o]=n[o];c.streamingAssetsUrl=new URL(c.streamingAssetsUrl,document.URL).href;var i=c.disabledCanvasEvents.slice();function a(e){e.preventDefault()}i.forEach(function(e){r.addEventListener(e,a)}),window.addEventListener("error",t),window.addEventListener("unhandledrejection",t),c.deinitializers.push(function(){for(var e in c.disableAccessToMediaDevices(),i.forEach(function(e){r.removeEventListener(e,a)}),window.removeEventListener("error",t),window.removeEventListener("unhandledrejection",t),c.intervals)window.clearInterval(e);c.intervals={}}),c.QuitCleanup=function(){for(var e=0;e<c.deinitializers.length;e++)c.deinitializers[e]();c.deinitializers=[],"function"==typeof c.onQuit&&c.onQuit()};var d="",u="",f=(document.addEventListener("webkitfullscreenchange",function(e){document.webkitCurrentFullScreenElement===r?r.style.width&&(d=r.style.width,u=r.style.height,r.style.width="100%",r.style.height="100%"):d&&(r.style.width=d,r.style.height=u,u=d="")}),{Module:c,SetFullscreen:function(){if(c.SetFullscreen)return c.SetFullscreen.apply(c,arguments);c.print("Failed to set Fullscreen mode: Player not loaded yet.")},SendMessage:function(){if(c.SendMessage)return c.SendMessage.apply(c,arguments);c.print("Failed to execute SendMessage: Player not loaded yet.")},Quit:function(){return new Promise(function(e,r){c.shouldQuit=!0,c.onQuit=e})}});function h(e,r,n){-1==e.indexOf("fullscreen error")&&(c.startupErrorHandler?c.startupErrorHandler(e,r,n):c.errorHandler&&c.errorHandler(e,r,n)||(console.log("Invoking error handler due to\n"+e),"function"==typeof dump&&dump("Invoking error handler due to\n"+e),h.didShowErrorMessage||(-1!=(e="An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:\n"+e).indexOf("DISABLE_EXCEPTION_CATCHING")?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.":-1!=e.indexOf("Cannot enlarge memory arrays")?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.":-1==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")||(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),h.didShowErrorMessage=!0)))}function g(e,r){if("symbolsUrl"!=e){var n=c.downloadProgress[e],t=(n=n||(c.downloadProgress[e]={started:!1,finished:!1,lengthComputable:!1,total:0,loaded:0}),"object"!=typeof r||"progress"!=r.type&&"load"!=r.type||(n.started||(n.started=!0,n.lengthComputable=r.lengthComputable),n.total=r.total,n.loaded=r.loaded,"load"==r.type&&(n.finished=!0)),0),o=0,i=0,a=0,s=0;for(e in c.downloadProgress){if(!(n=c.downloadProgress[e]).started)return;i++,n.lengthComputable?(t+=n.loaded,o+=n.total,a++):n.finished||s++}l(.9*(i?(i-s-(o?a*(o-t)/o:0))/i:0))}}function p(){new Promise(function(i,e){var a=document.createElement("script");a.src=c.frameworkUrl,a.onload=function(){if("undefined"==typeof unityFramework||!unityFramework){var e,r=[["br","br"],["gz","gzip"]];for(e in r){var n,t=r[e];if(c.frameworkUrl.endsWith("."+t[0]))return n="Unable to parse "+c.frameworkUrl+"!","file:"==location.protocol?void s(n+" 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"):(n+=' 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: '+t[1]+'" present. Check browser Console and Devtools Network tab to debug.',"br"==t[0]&&"http:"==location.protocol&&(t=-1!=["localhost","127.0.0.1"].indexOf(location.hostname)?"":"Migrate your server to use HTTPS.",n=/Firefox/.test(navigator.userAgent)?"Unable to parse "+c.frameworkUrl+'!<br>If using custom web server, verify that web server is sending .br files with HTTP Response Header "Content-Encoding: br". Brotli compression may not be supported in Firefox over HTTP connections. '+t+' See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1670675">https://bugzilla.mozilla.org/show_bug.cgi?id=1670675</a> for more information.':"Unable to parse "+c.frameworkUrl+'!<br>If using custom web server, verify that web server is sending .br files with HTTP Response Header "Content-Encoding: br". Brotli compression may not be supported over HTTP connections. Migrate your server to use HTTPS.'),void s(n,"error"))}s("Unable to parse "+c.frameworkUrl+"! The file is corrupt, or compression was misconfigured? (check Content-Encoding HTTP Response Header on web server)","error")}var o=unityFramework;unityFramework=null,a.onload=null,i(o)},a.onerror=function(e){s("Unable to load file "+c.frameworkUrl+"! Check that the file exists on the remote server. (also check browser Console and Devtools Network tab to debug)","error")},document.body.appendChild(a),c.deinitializers.push(function(){document.body.removeChild(a)})}).then(function(e){e(c)});g(n="dataUrl"),e=c.fetchWithProgress,r=c[n],r=/file:\/\//.exec(r)?"same-origin":void 0;var n,e,r,t=e(c[n],{method:"GET",companyName:c.companyName,productName:c.productName,control:"no-store",mode:r,onProgress:function(e){g(n,e)}}).then(function(e){return e.parsedBody}).catch(function(e){var r="Failed to download file "+c[n];"file:"==location.protocol?s(r+". 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(r)});c.preRun.push(function(){c.addRunDependency("dataUrl"),t.then(function(e){var r=new DataView(e.buffer,e.byteOffset,e.byteLength),n=0,t="UnityWebData1.0\0";if(!String.fromCharCode.apply(null,e.subarray(n,n+t.length))==t)throw"unknown data format";var o=r.getUint32(n+=t.length,!0);for(n+=4;n<o;){var i=r.getUint32(n,!0),a=(n+=4,r.getUint32(n,!0)),s=(n+=4,r.getUint32(n,!0)),l=(n+=4,String.fromCharCode.apply(null,e.subarray(n,n+s)));n+=s;for(var d=0,u=l.indexOf("/",d)+1;0<u;d=u,u=l.indexOf("/",d)+1)c.FS_createPath(l.substring(0,d),l.substring(d,u-1),!0,!0);c.FS_createDataFile(l,null,e.subarray(i,i+a),!0,!0,!0)}c.removeRunDependency("dataUrl")})})}return c.SystemInfo=function(){var e,r,n,t,o=navigator.userAgent+" ",i=[["Firefox","Firefox"],["OPR","Opera"],["Edg","Edge"],["SamsungBrowser","Samsung Browser"],["Trident","Internet Explorer"],["MSIE","Internet Explorer"],["Chrome","Chrome"],["CriOS","Chrome on iOS Safari"],["FxiOS","Firefox on iOS Safari"],["Safari","Safari"]];function a(e,r,n){return(e=RegExp(e,"i").exec(r))&&e[n]}for(var s=0;s<i.length;++s)if(r=a(i[s][0]+"[/ ](.*?)[ \\)]",o,1)){e=i[s][1];break}"Safari"==e&&(r=a("Version/(.*?) ",o,1)),"Internet Explorer"==e&&(r=a("rv:(.*?)\\)? ",o,1)||r);for(var l=[["Windows (.*?)[;)]","Windows"],["Android ([0-9_.]+)","Android"],["iPhone OS ([0-9_.]+)","iPhoneOS"],["iPad.*? OS ([0-9_.]+)","iPadOS"],["FreeBSD( )","FreeBSD"],["OpenBSD( )","OpenBSD"],["Linux|X11()","Linux"],["Mac OS X ([0-9_.]+)","MacOS"],["bot|google|baidu|bing|msn|teoma|slurp|yandex","Search Bot"]],d=0;d<l.length;++d)if(u=a(l[d][0],o,1)){n=l[d][1],u=u.replace(/_/g,".");break}var u={"NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"Server 2003","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 10.0":"10"}[u]||u,c=((c=document.createElement("canvas"))&&(gl=c.getContext("webgl2"),glVersion=gl?2:0,gl||(gl=c&&c.getContext("webgl"))&&(glVersion=1),gl&&(t=gl.getExtension("WEBGL_debug_renderer_info")&&gl.getParameter(37446)||gl.getParameter(7937))),"undefined"!=typeof SharedArrayBuffer),f="object"==typeof WebAssembly&&"function"==typeof WebAssembly.compile;return{width:screen.width,height:screen.height,userAgent:o.trim(),browser:e||"Unknown browser",browserVersion:r||"Unknown version",mobile:/Mobile|Android|iP(ad|hone)/.test(navigator.appVersion),os:n||"Unknown OS",osVersion:u||"Unknown OS Version",gpu:t||"Unknown GPU",language:navigator.userLanguage||navigator.language,hasWebGL:glVersion,hasCursorLock:!!document.body.requestPointerLock,hasFullscreen:!!document.body.requestFullscreen||!!document.body.webkitRequestFullscreen,hasThreads:c,hasWasm:f,hasWasmThreads:!1}}(),c.abortHandler=function(e){return h(e,"",0),!0},Error.stackTraceLimit=Math.max(Error.stackTraceLimit||0,50),c.fetchWithProgress=function(e,r){var c=function(){};return r&&r.onProgress&&(c=r.onProgress),fetch(e,r).then(function(r){var e=void 0!==r.body?r.body.getReader():void 0,i=void 0!==r.headers.get("Content-Length"),a=function(e,r){if(!r)return 0;var r=e.headers.get("Content-Encoding"),n=parseInt(e.headers.get("Content-Length"));switch(r){case"br":return Math.round(5*n);case"gzip":return Math.round(4*n);default:return n}}(r,i),s=new Uint8Array(a),l=[],d=0,u=0;return i||console.warn("[UnityCache] Response is served without Content-Length header. Please reconfigure server to include valid Content-Length for better download performance."),function o(){return void 0===e?r.arrayBuffer().then(function(e){return c({type:"progress",total:e.length,loaded:0,lengthComputable:i}),new Uint8Array(e)}):e.read().then(function(e){if(e.done){if(d===a)return s;if(d<a)return s.slice(0,d);for(var r=new Uint8Array(d),n=(r.set(s,0),u),t=0;t<l.length;++t)r.set(l[t],n),n+=l[t].length;return r}return d+e.value.length<=s.length?(s.set(e.value,d),u=d+e.value.length):l.push(e.value),d+=e.value.length,c({type:"progress",total:Math.max(a,d),loaded:d,lengthComputable:i}),o()})}().then(function(e){return c({type:"load",total:e.length,loaded:e.length,lengthComputable:i}),r.parsedBody=e,r})})},new Promise(function(e,r){c.SystemInfo.hasWebGL?c.SystemInfo.hasWasm?(1==c.SystemInfo.hasWebGL&&c.print('Warning: Your browser does not support "WebGL 2" Graphics API, switching to "WebGL 1"'),c.startupErrorHandler=r,l(0),c.postRun.push(function(){l(1),delete c.startupErrorHandler,e(f)}),p()):r("Your browser does not support WebAssembly."):r("Your browser does not support WebGL.")})}