diff --git a/.github/demo/Release/.htaccess b/.github/demo/Release/.htaccess new file mode 100644 index 0000000..32c0a16 --- /dev/null +++ b/.github/demo/Release/.htaccess @@ -0,0 +1,23 @@ +Options +FollowSymLinks +RewriteEngine on + +RewriteCond %{HTTP:Accept-encoding} gzip +RewriteCond %{REQUEST_FILENAME}gz -f +RewriteRule ^(.*)\.js$ $1\.jsgz [L] + +RewriteCond %{HTTP:Accept-encoding} gzip +RewriteCond %{REQUEST_FILENAME}gz -f +RewriteRule ^(.*)\.data$ $1\.datagz [L] + +RewriteCond %{HTTP:Accept-encoding} gzip +RewriteCond %{REQUEST_FILENAME}gz -f +RewriteRule ^(.*)\.mem$ $1\.memgz [L] + +RewriteCond %{HTTP:Accept-encoding} gzip +RewriteCond %{REQUEST_FILENAME}gz -f +RewriteRule ^(.*)\.unity3d$ $1\.unity3dgz [L] + +AddEncoding gzip .jsgz +AddEncoding gzip .datagz +AddEncoding gzip .memgz +AddEncoding gzip .unity3dgz diff --git a/.github/demo/Release/UnityLoader.js b/.github/demo/Release/UnityLoader.js new file mode 100644 index 0000000..974c529 --- /dev/null +++ b/.github/demo/Release/UnityLoader.js @@ -0,0 +1,2 @@ +function CompatibilityCheck(){hasWebGL?mobile?confirm("Please note that Unity WebGL is not currently supported on mobiles. Press Ok if you wish to continue anyway.")||window.history.back():-1==browser.indexOf("Firefox")&&-1==browser.indexOf("Chrome")&&-1==browser.indexOf("Safari")&&(confirm("Please note that your browser is not currently supported for this Unity WebGL content. Try installing Firefox, or press Ok if you wish to continue anyway.")||window.history.back()):(alert("You need a browser which supports WebGL to run this content. Try installing Firefox."),window.history.back())}function SetFullscreen(e){if("undefined"==typeof JSEvents)return void console.log("Player not loaded yet.");var t=JSEvents.canPerformEventHandlerRequests;JSEvents.canPerformEventHandlerRequests=function(){return 1},Module.cwrap("SetFullscreen","void",["number"])(e),JSEvents.canPerformEventHandlerRequests=t}function LoadJSCodeBlob(e,t){var n=document.createElement("script");n.src=URL.createObjectURL(e),n.onload=t,document.body.appendChild(n)}function LoadJSCode(e,t){var n=new Blob([e],{type:"text/javascript"});if(Math.fround&&-1==browser.indexOf("Chrome"))LoadJSCodeBlob(n,t);else{console.log("optimizing out Math.fround calls");var o=new FileReader;o.onload=function(e){var n=e.target.result.replace(/Math_fround\(/g,"("),o=new Blob([n],{type:"text/javascript"});LoadJSCodeBlob(o,t)},o.readAsText(n)}}function DecompressAndLoadFile(e,t,n){tryServerCompression=!1,e+="gz";var o=new XMLHttpRequest;o.open("GET",e,!0),o.onprogress=n,o.responseType="arraybuffer",o.onload=function(){var n=new Uint8Array(o.response),i=(new Date).getTime(),a=pako.inflate(n),r=(new Date).getTime();console.log("Decompressed "+e+" in "+(r-i)+"ms. You can remove this delay if you configure your web server to host files using gzip compression."),t(a)},o.send(null)}function LoadCompressedFile(e,t,n){if(CompressionState.current==CompressionState.Unsupported)return void DecompressAndLoadFile(e,t);if(CompressionState.current==CompressionState.Pending)return void CompressionState.pendingServerRequests.push(function(){LoadCompressedFile(e,t,n)});CompressionState.current==CompressionState.Uninitialized&&(CompressionState.current=CompressionState.Pending);var o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="arraybuffer",o.onprogress=function(e){n&&n(e),CompressionState.current==CompressionState.Pending&&(0==o.status||200==o.status?CompressionState.Set(CompressionState.Supported):CompressionState.Set(CompressionState.Unsupported))},o.onload=function(){if(0==o.status||200==o.status){CompressionState.Set(CompressionState.Supported);var i=new Uint8Array(o.response);t(i)}else CompressionState.Set(CompressionState.Unsupported),DecompressAndLoadFile(e,t,n)},o.onerror=function(){CompressionState.Set(CompressionState.Unsupported),DecompressAndLoadFile(e,t,n)};try{o.send(null)}catch(i){CompressionState.Set(CompressionState.Unsupported),DecompressAndLoadFile(e,t,n)}}function LoadCompressedJS(e,t){LoadCompressedFile(e,function(e){LoadJSCode(e,t)})}function fetchRemotePackageWrapper(e,t,n,o){LoadCompressedFile(e,n,function(n){var o=e,i=t;if(n.total&&(i=n.total),n.loaded){Module.dataFileDownloads||(Module.dataFileDownloads={}),Module.dataFileDownloads[o]={loaded:n.loaded,total:i};var a=0,r=0,s=0;for(var l in Module.dataFileDownloads){var d=Module.dataFileDownloads[l];a+=d.total,r+=d.loaded,s++}a=Math.ceil(a*Module.expectedDataFileDownloads/s),Module.setStatus&&Module.setStatus("Downloading data... ("+r+"/"+a+")")}else Module.dataFileDownloads||Module.setStatus&&Module.setStatus("Downloading data...")})}var browser=function(){var e,t=navigator.userAgent,n=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(n[1])?(e=/\brv[ :]+(\d+)/g.exec(t)||[],"IE "+(e[1]||"")):"Chrome"===n[1]&&(e=t.match(/\bOPR\/(\d+)/),null!=e)?"Opera "+e[1]:(n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=t.match(/version\/(\d+)/i))&&n.splice(1,1,e[1]),n.join(" "))}(),hasWebGL=function(){if(!window.WebGLRenderingContext)return 0;var e=document.createElement("canvas"),t=e.getContext("webgl");return t||(t=e.getContext("experimental-webgl"))?1:0}(),mobile=function(e){return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}(navigator.userAgent||navigator.vendor||window.opera);Module.compatibilitycheck?Module.compatibilitycheck():CompatibilityCheck();var didShowErrorMessage=!1;"function"!=typeof window.onerror&&(window.onerror=function(e,t,n){return Module.errorhandler&&Module.errorhandler(e,t,n)||(console.log("Invoking error handler due to\n"+e),"function"==typeof dump&&dump("Invoking error handler due to\n"+e),didShowErrorMessage||-1!=e.indexOf("UnknownError")||-1!=e.indexOf("Program terminated with exit(0)"))?void 0:(didShowErrorMessage=!0,-1!=e.indexOf("DISABLE_EXCEPTION_CATCHING")?void alert("An exception has occured, but exception handling has been disabled in this build. If you are the developer of this content, enable exceptions in your project's WebGL player settings to be able to catch the exception or see the stack trace."):-1!=e.indexOf("Cannot enlarge memory arrays")?void alert("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("out of memory")?void alert("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."):-1!=e.indexOf("Script error.")&&0==document.URL.indexOf("file:")?void alert("It seems your browser does not support running Unity WebGL content from file:// urls. Please upload it to an http server, or try a different browser."):void alert("An error occured running the Unity content on this page. See your browser's JavaScript console for more info. The error was:\n"+e))}),Module.locateFile=function(e){return Module.dataUrl},Module.preRun=[],Module.postRun=[],Module.print=function(){return function(e){console.log(e)}}(),Module.printErr=function(e){console.error(e)},Module.canvas=document.getElementById("canvas"),Module.progress=null,Module.setStatus=function(e){if(null==this.progress){if("function"!=typeof UnityProgress)return;this.progress=new UnityProgress(canvas)}if(Module.setStatus.last||(Module.setStatus.last={time:Date.now(),text:""}),e!==Module.setStatus.text){this.progress.SetMessage(e);var t=e.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);t&&this.progress.SetProgress(parseInt(t[2])/parseInt(t[4])),""===e&&this.progress.Clear()}},Module.totalDependencies=0,Module.monitorRunDependencies=function(e){this.totalDependencies=Math.max(this.totalDependencies,e),Module.setStatus(e?"Preparing... ("+(this.totalDependencies-e)+"/"+this.totalDependencies+")":"All downloads complete.")},Module.setStatus("Downloading (0.0/1)");var CompressionState={Uninitialized:0,Pending:1,Unsupported:2,Supported:3,current:0,pendingServerRequests:[],Set:function(e){if(CompressionState.current==CompressionState.Pending){CompressionState.current=e;for(var t=0;ta;a++)e[i+a]=t[n+a]},flattenChunks:function(e){var t,n,o,i,a,r;for(o=0,t=0,n=e.length;n>t;t++)o+=e[t].length;for(r=new Uint8Array(o),i=0,t=0,n=e.length;n>t;t++)a=e[t],r.set(a,i),i+=a.length;return r}},a={arraySet:function(e,t,n,o,i){for(var a=0;o>a;a++)e[i+a]=t[n+a]},flattenChunks:function(e){return[].concat.apply([],e)}};n.setTyped=function(e){e?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,i)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,a))},n.setTyped(o)},{}],2:[function(e,t,n){"use strict";function o(e,t){if(65537>t&&(e.subarray&&r||!e.subarray&&a))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var n="",o=0;t>o;o++)n+=String.fromCharCode(e[o]);return n}var i=e("./common"),a=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch(s){a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(s){r=!1}for(var l=new i.Buf8(256),d=0;256>d;d++)l[d]=d>=252?6:d>=248?5:d>=240?4:d>=224?3:d>=192?2:1;l[254]=l[254]=1,n.string2buf=function(e){var t,n,o,a,r,s=e.length,l=0;for(a=0;s>a;a++)n=e.charCodeAt(a),55296===(64512&n)&&s>a+1&&(o=e.charCodeAt(a+1),56320===(64512&o)&&(n=65536+(n-55296<<10)+(o-56320),a++)),l+=128>n?1:2048>n?2:65536>n?3:4;for(t=new i.Buf8(l),r=0,a=0;l>r;a++)n=e.charCodeAt(a),55296===(64512&n)&&s>a+1&&(o=e.charCodeAt(a+1),56320===(64512&o)&&(n=65536+(n-55296<<10)+(o-56320),a++)),128>n?t[r++]=n:2048>n?(t[r++]=192|n>>>6,t[r++]=128|63&n):65536>n?(t[r++]=224|n>>>12,t[r++]=128|n>>>6&63,t[r++]=128|63&n):(t[r++]=240|n>>>18,t[r++]=128|n>>>12&63,t[r++]=128|n>>>6&63,t[r++]=128|63&n);return t},n.buf2binstring=function(e){return o(e,e.length)},n.binstring2buf=function(e){for(var t=new i.Buf8(e.length),n=0,o=t.length;o>n;n++)t[n]=e.charCodeAt(n);return t},n.buf2string=function(e,t){var n,i,a,r,s=t||e.length,d=new Array(2*s);for(i=0,n=0;s>n;)if(a=e[n++],128>a)d[i++]=a;else if(r=l[a],r>4)d[i++]=65533,n+=r-1;else{for(a&=2===r?31:3===r?15:7;r>1&&s>n;)a=a<<6|63&e[n++],r--;r>1?d[i++]=65533:65536>a?d[i++]=a:(a-=65536,d[i++]=55296|a>>10&1023,d[i++]=56320|1023&a)}return o(d,i)},n.utf8border=function(e,t){var n;for(t=t||e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&128===(192&e[n]);)n--;return 0>n?t:0===n?t:n+l[e[n]]>t?n:t}},{"./common":1}],3:[function(e,t,n){"use strict";function o(e,t,n,o){for(var i=65535&e|0,a=e>>>16&65535|0,r=0;0!==n;){r=n>2e3?2e3:n,n-=r;do i=i+t[o++]|0,a=a+i|0;while(--r);i%=65521,a%=65521}return i|a<<16|0}t.exports=o},{}],4:[function(e,t,n){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(e,t,n){"use strict";function o(){for(var e,t=[],n=0;256>n;n++){e=n;for(var o=0;8>o;o++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}function i(e,t,n,o){var i=a,r=o+n;e=-1^e;for(var s=o;r>s;s++)e=e>>>8^i[255&(e^t[s])];return-1^e}var a=o();t.exports=i},{}],6:[function(e,t,n){"use strict";function o(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}t.exports=o},{}],7:[function(e,t,n){"use strict";var o=30,i=12;t.exports=function(e,t){var n,a,r,s,l,d,u,c,f,h,m,p,b,w,g,v,k,y,_,x,S,M,C,E,R;n=e.state,a=e.next_in,E=e.input,r=a+(e.avail_in-5),s=e.next_out,R=e.output,l=s-(t-e.avail_out),d=s+(e.avail_out-257),u=n.dmax,c=n.wsize,f=n.whave,h=n.wnext,m=n.window,p=n.hold,b=n.bits,w=n.lencode,g=n.distcode,v=(1<b&&(p+=E[a++]<>>24,p>>>=_,b-=_,_=y>>>16&255,0===_)R[s++]=65535&y;else{if(!(16&_)){if(0===(64&_)){y=w[(65535&y)+(p&(1<<_)-1)];continue t}if(32&_){n.mode=i;break e}e.msg="invalid literal/length code",n.mode=o;break e}x=65535&y,_&=15,_&&(_>b&&(p+=E[a++]<>>=_,b-=_),15>b&&(p+=E[a++]<>>24,p>>>=_,b-=_,_=y>>>16&255,!(16&_)){if(0===(64&_)){y=g[(65535&y)+(p&(1<<_)-1)];continue n}e.msg="invalid distance code",n.mode=o;break e}if(S=65535&y,_&=15,_>b&&(p+=E[a++]<b&&(p+=E[a++]<u){e.msg="invalid distance too far back",n.mode=o;break e}if(p>>>=_,b-=_,_=s-l,S>_){if(_=S-_,_>f&&n.sane){e.msg="invalid distance too far back",n.mode=o;break e}if(M=0,C=m,0===h){if(M+=c-_,x>_){x-=_;do R[s++]=m[M++];while(--_);M=s-S,C=R}}else if(_>h){if(M+=c+h-_,_-=h,x>_){x-=_;do R[s++]=m[M++];while(--_);if(M=0,x>h){_=h,x-=_;do R[s++]=m[M++];while(--_);M=s-S,C=R}}}else if(M+=h-_,x>_){x-=_;do R[s++]=m[M++];while(--_);M=s-S,C=R}for(;x>2;)R[s++]=C[M++],R[s++]=C[M++],R[s++]=C[M++],x-=3;x&&(R[s++]=C[M++],x>1&&(R[s++]=C[M++]))}else{M=s-S;do R[s++]=R[M++],R[s++]=R[M++],R[s++]=R[M++],x-=3;while(x>2);x&&(R[s++]=R[M++],x>1&&(R[s++]=R[M++]))}break}}break}}while(r>a&&d>s);x=b>>3,a-=x,b-=x<<3,p&=(1<a?5+(r-a):5-(a-r),e.avail_out=d>s?257+(d-s):257-(s-d),n.hold=p,n.bits=b}},{}],8:[function(e,t,n){"use strict";function o(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function i(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new w.Buf16(320),this.work=new w.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=U,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new w.Buf32(me),t.distcode=t.distdyn=new w.Buf32(pe),t.sane=1,t.back=-1,R):L}function r(e){var t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,a(e)):L}function s(e,t){var n,o;return e&&e.state?(o=e.state,0>t?(n=0,t=-t):(n=(t>>4)+1,48>t&&(t&=15)),t&&(8>t||t>15)?L:(null!==o.window&&o.wbits!==t&&(o.window=null),o.wrap=n,o.wbits=t,r(e))):L}function l(e,t){var n,o;return e?(o=new i,e.state=o,o.window=null,n=s(e,t),n!==R&&(e.state=null),n):L}function d(e){return l(e,we)}function u(e){if(ge){var t;for(p=new w.Buf32(512),b=new w.Buf32(32),t=0;144>t;)e.lens[t++]=8;for(;256>t;)e.lens[t++]=9;for(;280>t;)e.lens[t++]=7;for(;288>t;)e.lens[t++]=8;for(y(x,e.lens,0,288,p,0,e.work,{bits:9}),t=0;32>t;)e.lens[t++]=5;y(S,e.lens,0,32,b,0,e.work,{bits:5}),ge=!1}e.lencode=p,e.lenbits=9,e.distcode=b,e.distbits=5}function c(e,t,n,o){var i,a=e.state;return null===a.window&&(a.wsize=1<=a.wsize?(w.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>o&&(i=o),w.arraySet(a.window,t,n-o,i,a.wnext),o-=i,o?(w.arraySet(a.window,t,n-o,o,0),a.wnext=o,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whaveh;){if(0===l)break e;l--,f+=i[r++]<>>8&255,n.check=v(n.check,Ee,2,0),f=0,h=0,n.mode=O;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&f)<<8)+(f>>8))%31){e.msg="incorrect header check",n.mode=ce;break}if((15&f)!==I){e.msg="unknown compression method",n.mode=ce;break}if(f>>>=4,h-=4,_e=(15&f)+8,0===n.wbits)n.wbits=_e;else if(_e>n.wbits){e.msg="invalid window size",n.mode=ce;break}n.dmax=1<<_e,e.adler=n.check=1,n.mode=512&f?H:J,f=0,h=0;break;case O:for(;16>h;){if(0===l)break e;l--,f+=i[r++]<>8&1),512&n.flags&&(Ee[0]=255&f,Ee[1]=f>>>8&255,n.check=v(n.check,Ee,2,0)),f=0,h=0,n.mode=Z;case Z:for(;32>h;){if(0===l)break e;l--,f+=i[r++]<>>8&255,Ee[2]=f>>>16&255,Ee[3]=f>>>24&255,n.check=v(n.check,Ee,4,0)),f=0,h=0,n.mode=T;case T:for(;16>h;){if(0===l)break e;l--,f+=i[r++]<>8),512&n.flags&&(Ee[0]=255&f,Ee[1]=f>>>8&255,n.check=v(n.check,Ee,2,0)),f=0,h=0,n.mode=P;case P:if(1024&n.flags){for(;16>h;){if(0===l)break e;l--,f+=i[r++]<>>8&255,n.check=v(n.check,Ee,2,0)),f=0,h=0}else n.head&&(n.head.extra=null);n.mode=N;case N:if(1024&n.flags&&(b=n.length,b>l&&(b=l),b&&(n.head&&(_e=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),w.arraySet(n.head.extra,i,r,b,_e)),512&n.flags&&(n.check=v(n.check,i,b,r)),l-=b,r+=b,n.length-=b),n.length))break e;n.length=0,n.mode=q;case q:if(2048&n.flags){if(0===l)break e;b=0;do _e=i[r+b++],n.head&&_e&&n.length<65536&&(n.head.name+=String.fromCharCode(_e));while(_e&&l>b);if(512&n.flags&&(n.check=v(n.check,i,b,r)),l-=b,r+=b,_e)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=G;case G:if(4096&n.flags){if(0===l)break e;b=0;do _e=i[r+b++],n.head&&_e&&n.length<65536&&(n.head.comment+=String.fromCharCode(_e));while(_e&&l>b);if(512&n.flags&&(n.check=v(n.check,i,b,r)),l-=b,r+=b,_e)break e}else n.head&&(n.head.comment=null);n.mode=j;case j:if(512&n.flags){for(;16>h;){if(0===l)break e;l--,f+=i[r++]<>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=J;break;case H:for(;32>h;){if(0===l)break e;l--,f+=i[r++]<>>=7&h,h-=7&h,n.mode=le;break}for(;3>h;){if(0===l)break e;l--,f+=i[r++]<>>=1,h-=1,3&f){case 0:n.mode=Y;break;case 1:if(u(n),n.mode=te,t===E){f>>>=2,h-=2;break e}break;case 2:n.mode=Q;break;case 3:e.msg="invalid block type",n.mode=ce}f>>>=2,h-=2;break;case Y:for(f>>>=7&h,h-=7&h;32>h;){if(0===l)break e;l--,f+=i[r++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=ce;break}if(n.length=65535&f,f=0,h=0,n.mode=X,t===E)break e;case X:n.mode=V;case V:if(b=n.length){if(b>l&&(b=l),b>d&&(b=d),0===b)break e;w.arraySet(a,i,r,b,s),l-=b,r+=b,d-=b,s+=b,n.length-=b;break}n.mode=J;break;case Q:for(;14>h;){if(0===l)break e;l--,f+=i[r++]<>>=5,h-=5,n.ndist=(31&f)+1,f>>>=5,h-=5,n.ncode=(15&f)+4,f>>>=4,h-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=ce;break}n.have=0,n.mode=$;case $:for(;n.haveh;){if(0===l)break e;l--,f+=i[r++]<>>=3,h-=3}for(;n.have<19;)n.lens[Re[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Se={bits:n.lenbits},xe=y(_,n.lens,0,19,n.lencode,0,n.work,Se),n.lenbits=Se.bits,xe){e.msg="invalid code lengths set",n.mode=ce;break}n.have=0,n.mode=ee;case ee:for(;n.have>>24,we=Ce>>>16&255,ge=65535&Ce,!(h>=be);){if(0===l)break e;l--,f+=i[r++]<ge)f>>>=be,h-=be,n.lens[n.have++]=ge;else{if(16===ge){for(Me=be+2;Me>h;){if(0===l)break e;l--,f+=i[r++]<>>=be,h-=be,0===n.have){e.msg="invalid bit length repeat",n.mode=ce;break}_e=n.lens[n.have-1],b=3+(3&f),f>>>=2,h-=2}else if(17===ge){for(Me=be+3;Me>h;){if(0===l)break e;l--,f+=i[r++]<>>=be,h-=be,_e=0,b=3+(7&f),f>>>=3,h-=3}else{for(Me=be+7;Me>h;){if(0===l)break e;l--,f+=i[r++]<>>=be,h-=be,_e=0,b=11+(127&f),f>>>=7,h-=7}if(n.have+b>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=ce;break}for(;b--;)n.lens[n.have++]=_e}}if(n.mode===ce)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=ce;break}if(n.lenbits=9,Se={bits:n.lenbits},xe=y(x,n.lens,0,n.nlen,n.lencode,0,n.work,Se),n.lenbits=Se.bits,xe){e.msg="invalid literal/lengths set",n.mode=ce;break}if(n.distbits=6,n.distcode=n.distdyn,Se={bits:n.distbits},xe=y(S,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Se),n.distbits=Se.bits,xe){e.msg="invalid distances set",n.mode=ce;break}if(n.mode=te,t===E)break e;case te:n.mode=ne;case ne:if(l>=6&&d>=258){e.next_out=s,e.avail_out=d,e.next_in=r,e.avail_in=l,n.hold=f,n.bits=h,k(e,p),s=e.next_out,a=e.output,d=e.avail_out,r=e.next_in,i=e.input,l=e.avail_in,f=n.hold,h=n.bits,n.mode===J&&(n.back=-1);break}for(n.back=0;Ce=n.lencode[f&(1<>>24,we=Ce>>>16&255,ge=65535&Ce,!(h>=be);){if(0===l)break e;l--,f+=i[r++]<>ve)],be=Ce>>>24,we=Ce>>>16&255,ge=65535&Ce,!(h>=ve+be);){if(0===l)break e;l--,f+=i[r++]<>>=ve,h-=ve,n.back+=ve}if(f>>>=be,h-=be,n.back+=be,n.length=ge,0===we){n.mode=se;break}if(32&we){n.back=-1,n.mode=J;break}if(64&we){e.msg="invalid literal/length code",n.mode=ce;break}n.extra=15&we,n.mode=oe;case oe:if(n.extra){for(Me=n.extra;Me>h;){if(0===l)break e;l--,f+=i[r++]<>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ie;case ie:for(;Ce=n.distcode[f&(1<>>24,we=Ce>>>16&255,ge=65535&Ce,!(h>=be);){if(0===l)break e;l--,f+=i[r++]<>ve)],be=Ce>>>24,we=Ce>>>16&255,ge=65535&Ce,!(h>=ve+be);){if(0===l)break e;l--,f+=i[r++]<>>=ve,h-=ve,n.back+=ve}if(f>>>=be,h-=be,n.back+=be,64&we){e.msg="invalid distance code",n.mode=ce;break}n.offset=ge,n.extra=15&we,n.mode=ae;case ae:if(n.extra){for(Me=n.extra;Me>h;){if(0===l)break e;l--,f+=i[r++]<>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=ce;break}n.mode=re;case re:if(0===d)break e;if(b=p-d,n.offset>b){if(b=n.offset-b,b>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=ce;break}b>n.wnext?(b-=n.wnext,me=n.wsize-b):me=n.wnext-b,b>n.length&&(b=n.length),pe=n.window}else pe=a,me=s-n.offset,b=n.length;b>d&&(b=d),d-=b,n.length-=b;do a[s++]=pe[me++];while(--b);0===n.length&&(n.mode=ne);break;case se:if(0===d)break e;a[s++]=n.length,d--,n.mode=ne;break;case le:if(n.wrap){for(;32>h;){if(0===l)break e;l--,f|=i[r++]<h;){if(0===l)break e;l--,f+=i[r++]<=D;D++)N[D]=0;for(F=0;m>F;F++)N[t[n+F]]++;for(z=R,A=i;A>=1&&0===N[A];A--);if(z>A&&(z=A),0===A)return p[b++]=20971520,p[b++]=20971520,g.bits=1,0;for(L=1;A>L&&0===N[L];L++);for(L>z&&(z=L),U=1,D=1;i>=D;D++)if(U<<=1,U-=N[D],0>U)return-1;if(U>0&&(e===s||1!==A))return-1;for(q[1]=0,D=1;i>D;D++)q[D+1]=q[D]+N[D];for(F=0;m>F;F++)0!==t[n+F]&&(w[q[t[n+F]]++]=F);if(e===s?(T=G=w,S=19):e===l?(T=u,P-=257,G=c,j-=257,S=256):(T=f,G=h,S=-1),Z=0,F=0,D=L,x=b,B=z,I=0,y=-1,O=1<a||e===d&&O>r)return 1;for(var H=0;;){H++,M=D-I,w[F]S?(C=G[j+w[F]],E=T[P+w[F]]):(C=96,E=0),v=1<>I)+k]=M<<24|C<<16|E|0;while(0!==k);for(v=1<>=1;if(0!==v?(Z&=v-1,Z+=v):Z=0,F++,0===--N[D]){if(D===A)break;D=t[n+w[F]]}if(D>z&&(Z&_)!==y){for(0===I&&(I=z),x+=L,B=D-I,U=1<B+I&&(U-=N[B+I],!(0>=U));)B++,U<<=1;if(O+=1<a||e===d&&O>r)return 1;y=Z&_,p[y]=z<<24|B<<16|x-b|0}}return 0!==Z&&(p[x+Z]=D-I<<24|64<<16|0),g.bits=z,0}},{"../utils/common":1}],10:[function(e,t,n){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(e,t,n){"use strict";function o(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=o},{}],"/lib/inflate.js":[function(e,t,n){"use strict";function o(e,t){var n=new h(t);if(n.push(e,!0),n.err)throw n.msg;return n.result}function i(e,t){return t=t||{},t.raw=!0,o(e,t)}var a=e("./zlib/inflate.js"),r=e("./utils/common"),s=e("./utils/strings"),l=e("./zlib/constants"),d=e("./zlib/messages"),u=e("./zlib/zstream"),c=e("./zlib/gzheader"),f=Object.prototype.toString,h=function(e){this.options=r.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0===(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var n=a.inflateInit2(this.strm,t.windowBits);if(n!==l.Z_OK)throw new Error(d[n]);this.header=new c,a.inflateGetHeader(this.strm,this.header)};h.prototype.push=function(e,t){var n,o,i,d,u,c=this.strm,h=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:t===!0?l.Z_FINISH:l.Z_NO_FLUSH,"string"==typeof e?c.input=s.binstring2buf(e):"[object ArrayBuffer]"===f.call(e)?c.input=new Uint8Array(e):c.input=e,c.next_in=0,c.avail_in=c.input.length;do{if(0===c.avail_out&&(c.output=new r.Buf8(h),c.next_out=0,c.avail_out=h),n=a.inflate(c,l.Z_NO_FLUSH),n!==l.Z_STREAM_END&&n!==l.Z_OK)return this.onEnd(n),this.ended=!0,!1;c.next_out&&(0===c.avail_out||n===l.Z_STREAM_END||0===c.avail_in&&(o===l.Z_FINISH||o===l.Z_SYNC_FLUSH))&&("string"===this.options.to?(i=s.utf8border(c.output,c.next_out),d=c.next_out-i,u=s.buf2string(c.output,i),c.next_out=d,c.avail_out=h-d,d&&r.arraySet(c.output,c.output,i,d,0),this.onData(u)):this.onData(r.shrinkBuf(c.output,c.next_out)))}while(c.avail_in>0&&n!==l.Z_STREAM_END);return n===l.Z_STREAM_END&&(o=l.Z_FINISH),o===l.Z_FINISH?(n=a.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===l.Z_OK):o===l.Z_SYNC_FLUSH?(this.onEnd(l.Z_OK),c.avail_out=0,!0):!0},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===l.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=h,n.inflate=o,n.inflateRaw=i,n.ungzip=o},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate.js":8, +"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")});var Module;"undefined"==typeof Module&&(Module=eval("(function() { try { return Module || {} } catch(e) { return {} } })()")),Module.expectedDataFileDownloads||(Module.expectedDataFileDownloads=0,Module.finishedDataFileDownloads=0),Module.expectedDataFileDownloads++,function(){var e=function(e){function t(e){console.error("package error:",e)}function n(){function e(e,t){if(!e)throw t+(new Error).stack}function t(e,t,n,o){this.start=e,this.end=t,this.crunched=n,this.audio=o}function n(n){Module.finishedDataFileDownloads++,e(n,"Loading data file failed.");var o=new Uint8Array(n);t.prototype.byteArray=o,t.prototype.requests["/data.unity3d"].onload(),t.prototype.requests["/methods_pointedto_by_uievents.xml"].onload(),t.prototype.requests["/preserved_derived_types.xml"].onload(),t.prototype.requests["/Il2CppData/Metadata/global-metadata.dat"].onload(),t.prototype.requests["/Resources/unity_default_resources"].onload(),t.prototype.requests["/Managed/mono/2.0/machine.config"].onload(),Module.removeRunDependency("datafile_WebDemo.data")}Module.FS_createPath("/","Il2CppData",!0,!0),Module.FS_createPath("/Il2CppData","Metadata",!0,!0),Module.FS_createPath("/","Resources",!0,!0),Module.FS_createPath("/","Managed",!0,!0),Module.FS_createPath("/Managed","mono",!0,!0),Module.FS_createPath("/Managed/mono","2.0",!0,!0),t.prototype={requests:{},open:function(e,t){this.name=t,this.requests[t]=this,Module.addRunDependency("fp "+this.name)},send:function(){},onload:function(){var e=this.byteArray.subarray(this.start,this.end);this.finish(e)},finish:function(e){var t=this;Module.FS_createPreloadedFile(this.name,null,e,!0,!0,function(){Module.removeRunDependency("fp "+t.name)},function(){t.audio?Module.removeRunDependency("fp "+t.name):Module.printErr("Preloading file "+t.name+" failed")},!1,!0),this.requests[this.name]=null}},new t(0,1037871,0,0).open("GET","/data.unity3d"),new t(1037871,1037890,0,0).open("GET","/methods_pointedto_by_uievents.xml"),new t(1037890,1038414,0,0).open("GET","/preserved_derived_types.xml"),new t(1038414,2468474,0,0).open("GET","/Il2CppData/Metadata/global-metadata.dat"),new t(2468474,3949902,0,0).open("GET","/Resources/unity_default_resources"),new t(3949902,3977527,0,0).open("GET","/Managed/mono/2.0/machine.config"),Module.addRunDependency("datafile_WebDemo.data"),Module.preloadResults||(Module.preloadResults={}),Module.preloadResults[i]={fromCache:!1},l?(n(l),l=null):d=n}var o;if("object"==typeof window)o=window.encodeURIComponent(window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/");else{if("undefined"==typeof location)throw"using preloaded data can only be done on a web page or in a web worker";o=encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/")}var i="WebDemo.data",a="WebDemo.data";"function"!=typeof Module.locateFilePackage||Module.locateFile||(Module.locateFile=Module.locateFilePackage,Module.printErr("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)"));var r="function"==typeof Module.locateFile?Module.locateFile(a):(Module.filePackagePrefixURL||"")+a,s=3977527,l=null,d=null;fetchRemotePackageWrapper(r,s,function(e){d?(d(e),d=null):l=e},t),Module.calledRun?n():(Module.preRun||(Module.preRun=[]),Module.preRun.push(n))};e()}(); \ No newline at end of file diff --git a/.github/demo/Release/WebDemo.datagz b/.github/demo/Release/WebDemo.datagz new file mode 100644 index 0000000..6a99039 Binary files /dev/null and b/.github/demo/Release/WebDemo.datagz differ diff --git a/.github/demo/Release/WebDemo.jsgz b/.github/demo/Release/WebDemo.jsgz new file mode 100644 index 0000000..8d402ca Binary files /dev/null and b/.github/demo/Release/WebDemo.jsgz differ diff --git a/.github/demo/Release/WebDemo.memgz b/.github/demo/Release/WebDemo.memgz new file mode 100644 index 0000000..a97e59b Binary files /dev/null and b/.github/demo/Release/WebDemo.memgz differ diff --git a/.github/demo/TemplateData/UnityProgress.js b/.github/demo/TemplateData/UnityProgress.js new file mode 100644 index 0000000..4f13ac1 --- /dev/null +++ b/.github/demo/TemplateData/UnityProgress.js @@ -0,0 +1,97 @@ +function UnityProgress (dom) { + this.progress = 0.0; + this.message = ""; + this.dom = dom; + + var parent = dom.parentNode; + + var background = document.createElement("div"); + background.style.background = "#4D4D4D"; + background.style.position = "absolute"; + parent.appendChild(background); + this.background = background; + + var logoImage = document.createElement("img"); + logoImage.src = "TemplateData/progresslogo.png"; + logoImage.style.position = "absolute"; + parent.appendChild(logoImage); + this.logoImage = logoImage; + + var progressFrame = document.createElement("img"); + progressFrame.src = "TemplateData/loadingbar.png"; + progressFrame.style.position = "absolute"; + parent.appendChild(progressFrame); + this.progressFrame = progressFrame; + + var progressBar = document.createElement("img"); + progressBar.src = "TemplateData/fullbar.png"; + progressBar.style.position = "absolute"; + parent.appendChild(progressBar); + this.progressBar = progressBar; + + var messageArea = document.createElement("p"); + messageArea.style.position = "absolute"; + parent.appendChild(messageArea); + this.messageArea = messageArea; + + + this.SetProgress = function (progress) { + if (this.progress < progress) + this.progress = progress; + this.messageArea.style.display = "none"; + this.progressFrame.style.display = "inline"; + this.progressBar.style.display = "inline"; + this.Update(); + } + + this.SetMessage = function (message) { + this.message = message; + this.background.style.display = "inline"; + this.logoImage.style.display = "inline"; + this.progressFrame.style.display = "none"; + this.progressBar.style.display = "none"; + this.Update(); + } + + this.Clear = function() { + this.background.style.display = "none"; + this.logoImage.style.display = "none"; + this.progressFrame.style.display = "none"; + this.progressBar.style.display = "none"; + } + + this.Update = function() { + this.background.style.top = this.dom.offsetTop + 'px'; + this.background.style.left = this.dom.offsetLeft + 'px'; + this.background.style.width = this.dom.offsetWidth + 'px'; + this.background.style.height = this.dom.offsetHeight + 'px'; + + var logoImg = new Image(); + logoImg.src = this.logoImage.src; + var progressFrameImg = new Image(); + progressFrameImg.src = this.progressFrame.src; + + this.logoImage.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 - logoImg.height * 0.5) + 'px'; + this.logoImage.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - logoImg.width * 0.5) + 'px'; + this.logoImage.style.width = logoImg.width+'px'; + this.logoImage.style.height = logoImg.height+'px'; + + this.progressFrame.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 + logoImg.height * 0.5 + 10) + 'px'; + this.progressFrame.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - progressFrameImg.width * 0.5) + 'px'; + this.progressFrame.width = progressFrameImg.width; + this.progressFrame.height = progressFrameImg.height; + + this.progressBar.style.top = this.progressFrame.style.top; + this.progressBar.style.left = this.progressFrame.style.left; + this.progressBar.width = progressFrameImg.width * Math.min(this.progress, 1); + this.progressBar.height = progressFrameImg.height; + + this.messageArea.style.top = this.progressFrame.style.top; + this.messageArea.style.left = 0; + this.messageArea.style.width = '100%'; + this.messageArea.style.textAlign = 'center'; + this.messageArea.innerHTML = this.message; + } + + this.Update (); +} \ No newline at end of file diff --git a/.github/demo/TemplateData/favicon.ico b/.github/demo/TemplateData/favicon.ico new file mode 100644 index 0000000..6387a2e Binary files /dev/null and b/.github/demo/TemplateData/favicon.ico differ diff --git a/.github/demo/TemplateData/fullbar.png b/.github/demo/TemplateData/fullbar.png new file mode 100644 index 0000000..92c0f3d Binary files /dev/null and b/.github/demo/TemplateData/fullbar.png differ diff --git a/.github/demo/TemplateData/fullscreen.png b/.github/demo/TemplateData/fullscreen.png new file mode 100644 index 0000000..d37f4c6 Binary files /dev/null and b/.github/demo/TemplateData/fullscreen.png differ diff --git a/.github/demo/TemplateData/loadingbar.png b/.github/demo/TemplateData/loadingbar.png new file mode 100644 index 0000000..22aaba4 Binary files /dev/null and b/.github/demo/TemplateData/loadingbar.png differ diff --git a/.github/demo/TemplateData/logo.png b/.github/demo/TemplateData/logo.png new file mode 100644 index 0000000..70ecdc3 Binary files /dev/null and b/.github/demo/TemplateData/logo.png differ diff --git a/.github/demo/TemplateData/progresslogo.png b/.github/demo/TemplateData/progresslogo.png new file mode 100644 index 0000000..c636bb6 Binary files /dev/null and b/.github/demo/TemplateData/progresslogo.png differ diff --git a/.github/demo/TemplateData/style.css b/.github/demo/TemplateData/style.css new file mode 100644 index 0000000..ffcc435 --- /dev/null +++ b/.github/demo/TemplateData/style.css @@ -0,0 +1,28 @@ + +/**************************************** + ==== RESETS +****************************************/ + +html,body,div,canvas { margin: 0; padding: 0; } +::-moz-selection { color: #333; text-shadow: none; } +::selection { color: #333; text-shadow: none; } +.clear:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; } +.clear { display: inline-table; clear: both; } +/* Hides from IE-mac \*/ * html .clear { height: 1%; } .clear { display: block; } /* End hide from IE-mac */ + +/**************************************** + ==== LAYOUT +****************************************/ + +html, body { width: 100%; height: 100%; font-family: Helvetica, Verdana, Arial, sans-serif; } +body { } +p.header, p.footer { display: none; } +div.logo { width: 204px; height: 38px; float: left; background: url(logo.png) 0 0 no-repeat; position: relative; z-index: 10; } +div.title { height: 38px; line-height: 38px; padding: 0 10px; margin: 0 1px 0 0; float: right; color: #333; text-align: right; font-size: 18px; position: relative; z-index: 10; } +.template-wrap { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); } +.template-wrap canvas { margin: 0 0 10px 0; position: relative; z-index: 9; box-shadow: 0 10px 30px rgba(0,0,0,0.2); -moz-box-shadow: 0 10px 30px rgba(0,0,0,0.2); } +.fullscreen { float: right; position: relative; z-index: 10; } + +body.template { } +.template .template-wrap { } +.template .template-wrap canvas { } diff --git a/.github/demo/index.html b/.github/demo/index.html new file mode 100644 index 0000000..ef28f93 --- /dev/null +++ b/.github/demo/index.html @@ -0,0 +1,34 @@ + + + + + + Unity WebGL Player | UnityFlash + + + + + +

Unity WebGL Player | UnityFlash

+
+ +
+ +
Fullscreen
+
UnityFlash
+
+ + + + + + diff --git a/.github/images/screenshot-1.png b/.github/images/screenshot-1.png new file mode 100644 index 0000000..32f7db4 Binary files /dev/null and b/.github/images/screenshot-1.png differ diff --git a/.github/images/screenshot-2.png b/.github/images/screenshot-2.png new file mode 100644 index 0000000..9fdb8dd Binary files /dev/null and b/.github/images/screenshot-2.png differ diff --git a/.github/images/screenshot-3.png b/.github/images/screenshot-3.png new file mode 100644 index 0000000..8fd47d9 Binary files /dev/null and b/.github/images/screenshot-3.png differ diff --git a/.github/images/title-icon.png b/.github/images/title-icon.png new file mode 100644 index 0000000..b833069 Binary files /dev/null and b/.github/images/title-icon.png differ diff --git a/Assets/FlashTools/Docs/API.md b/Assets/FlashTools/Docs/API.md new file mode 100644 index 0000000..b35575d --- /dev/null +++ b/Assets/FlashTools/Docs/API.md @@ -0,0 +1,267 @@ +## SwfClip + +```csharp +// Occurs when clip changes +event Action OnChangeClipEvent; + +// Occurs when sequence changes +event Action OnChangeSequenceEvent; + +// Occurs when current frame changes +event Action OnChangeCurrentFrameEvent; +``` + +```csharp +// Gets or sets the animation mesh renderer sorting layer +// [value] - The sorting layer +string sortingLayer { get; set; } + +// Gets or sets the animation mesh renderer sorting order +// [value] - The sorting order +int sortingOrder { get; set; } + +// Gets or sets the animation tint color +// [value] - The tint color +Color tint { get; set; } + +// Gets or sets the animation asset (reset sequence and current frame) +// [value] - The animation asset +SwfClipAsset clip { get; set; } + +// Gets or sets the animation sequence (reset current frame) +// [value] - The animation sequence +string sequence { get; set; } + +// Gets or sets the animation current frame +// [value] - The animation current frame +int currentFrame { get; set; } + +// Gets the current animation sequence frame count +// [value] - The frame count +int frameCount { get; } + +// Gets the animation frame rate +// [value] - The frame rate +float frameRate { get; } + +// Gets the current frame label count +// [value] - The frame label count +int currentLabelCount { get; } +``` + +```csharp +// Gets the current frame mesh bounding volume in local space (Since 1.3.8) +// [value] - The bounding volume in local space +Bounds currentLocalBounds { get; } + +// Gets the current frame mesh bounding volume in world space (Since 1.3.8) +// [value] - The bounding volume in world space +Bounds currentWorldBounds { get; } +``` + +```csharp +// Rewind current sequence to begin frame +void ToBeginFrame(); + +// Rewind current sequence to end frame +void ToEndFrame(); + +// Rewind current sequence to previous frame +// [returns] - [true], if animation was rewound, [false] otherwise +bool ToPrevFrame(); + +// Rewind current sequence to next frame +// [returns] - [true], if animation was rewound, [false] otherwise +bool ToNextFrame(); + +// Gets the current frame label by index +// [returns] - The current frame label +// [index] - Current frame label index +string GetCurrentFrameLabel(int index); +``` + +## SwfClipController + +```csharp +// Occurs when the controller stops played clip +event Action OnStopPlayingEvent; + +// Occurs when the controller plays stopped clip +event Action OnPlayStoppedEvent; + +// Occurs when the controller rewinds played clip +event Action OnRewindPlayingEvent; +``` + +```csharp +// Controller play modes +enum PlayModes { + // Forward play mode + Forward, + // Backward play mode + Backward +} + +// Controller loop modes +enum LoopModes { + // Once loop mode + Once, + // Repeat loop mode + Loop +} + +// Gets or sets a value indicating whether controller play after awake on scene +// [value] - [true] if auto play; otherwise, [false] +bool autoPlay { get; set; } + +// Gets or sets a value indicating whether controller uses unscaled delta time +// [value] - [true] if uses unscaled delta time; otherwise, [false] +bool useUnscaledDt { get; set; } + +// Gets or sets the controller rate scale +// [value] - The rate scale +float rateScale { get; set; } + +// Gets or sets the controller group name +// [value] - The group name +string groupName { get; set; } + +// Gets or sets the controller play mode +// [value] - The play mode +PlayModes playMode { get; set; } + +// Gets or sets the controller loop mode +// [value] - The loop mode +LoopModes loopMode { get; set; } + +// Gets the controller clip +// [value] - The clip +SwfClip clip { get; } + +// Gets a value indicating whether controller is playing +// [value] - [true] if is playing; otherwise, [false] +bool isPlaying { get; } + +// Gets a value indicating whether controller is stopped +// [value] - [true] if is stopped; otherwise, [false] +bool isStopped { get; } +``` + +```csharp +// Changes the animation frame with stops it +// [frame] - The new current frame +void GotoAndStop(int frame); + +// Changes the animation sequence and frame with stops it +// [sequence] - The new sequence +// [frame] - The new current frame +void GotoAndStop(string sequence, int frame); + +// Changes the animation frame with plays it +// [frame] - The new current frame +void GotoAndPlay(int frame); + +// Changes the animation sequence and frame with plays it +// [sequence] - The new sequence +// [frame] - The new current frame +void GotoAndPlay(string sequence, int frame); + +// Stop with specified rewind action +// [rewind] - If set to [true] rewind animation to begin frame +void Stop(bool rewind); + +// Changes the animation sequence and stop controller with rewind +// [sequence] - The new sequence +void Stop(string sequence); + +// Play with specified rewind action +// [rewind] - If set to [true] rewind animation to begin frame +void Play(bool rewind); + +// Changes the animation sequence and play controller with rewind +// [sequence] - The new sequence +void Play(string sequence); + +// Rewind animation to begin frame +void Rewind(); +``` + +## SwfManager + +```csharp +// Get cached manager instance from scene or create it (if allowed) +// [allow_create] - If set to [true] allow create +static SwfManager GetInstance(bool allow_create); +``` + +```csharp +// Get animation clip count on scene +// [value] - Clip count +int clipCount { get; } + +// Get animation clip controller count on scene +// [value] - Clip controller count +int controllerCount { get; } + +// Get or set a value indicating whether animation updates is paused +// [value] - [true] if is paused; otherwise, [false] +bool isPaused { get; set; } + +// Get or set a value indicating whether animation updates is playing +// [value] - [true] if is playing; otherwise, [false] +bool isPlaying { get; set; } + +// Get or set a value indicating whether animation updates uses unscaled delta time +// [value] - [true] if uses unscaled delta time; otherwise, [false] +bool useUnscaledDt { get; set; } + +// Get or set the global animation rate scale +// [value] - Global rate scale +float rateScale { get; set; } +``` + +```csharp +// Pause animation updates +void Pause(); + +// Resume animation updates +void Resume(); + +// Pause the group of animations by name +// [group_name] - Group name +void PauseGroup(string group_name); + +// Resume the group of animations by name +// [group_name] - Group name +void ResumeGroup(string group_name); + +// Determines whether group of animations is paused +// [returns] - [true] if group is paused; otherwise, [false] +// [group_name] - Group name +bool IsGroupPaused(string group_name); + +// Determines whether group of animations is playing +// [returns] - [true] if group is playing; otherwise, [false] +// [group_name] - Group name +bool IsGroupPlaying(string group_name); + +// Set the group of animations use unscaled delta time +// [group_name] - Group name +// [yesno] - [true] if group will use unscaled delta time; otherwise, [false] +void SetGroupUseUnscaledDt(string group_name, bool yesno); + +// Determines whether group of animations uses unscaled delta time +// [returns] - [true] if group uses unscaled delta time; otherwise, [false] +// [group_name] - Group name +bool IsGroupUseUnscaledDt(string group_name); + +// Set the group of animations rate scale +// [group_name] - Group name +// [rate_scale] - Rate scale +void SetGroupRateScale(string group_name, float rate_scale); + +// Get the group of animations rate scale +// [returns] - The group rate scale +// [group_name] - Group name +float GetGroupRateScale(string group_name); +``` diff --git a/Assets/FlashTools/Docs/CHANGELOG.md b/Assets/FlashTools/Docs/CHANGELOG.md index 96d6170..12c5468 100644 --- a/Assets/FlashTools/Docs/CHANGELOG.md +++ b/Assets/FlashTools/Docs/CHANGELOG.md @@ -1,42 +1,42 @@ -###### Version 1.3.18 +### Version 1.3.18 * Fix frameCount working before Start * Fix preview in Unity 2021 -###### Version 1.3.17 +### Version 1.3.17 * Fix 2019 warnings * Force swf asset binary serialization -###### Version 1.3.16 +### Version 1.3.16 * Minor promo fixes -###### Version 1.3.15 +### Version 1.3.15 * Add optional bitmap trimming * Fix preview leaks in the Editor mode * Add warning notes about outdated assets * Add log message about successfully converting -###### Version 1.3.14 +### Version 1.3.14 * Fix 2018.3.2f1 compilation -###### Version 1.3.13 +### Version 1.3.13 * Fix preview shutdown warning -###### Version 1.3.12 +### Version 1.3.12 * Upgrade to minimal LTS version * Fix anchor frame label detector * More readable conversion warnings -###### Version 1.3.11 +### Version 1.3.11 * Fix trial version in Unity 2017 * Fix warnings in Unity 2017 * Fix possible mesh leak after scene switch -###### Version 1.3.10 +### Version 1.3.10 * Fix (conversion error: 'Error: scaleSelection: Argument number 1 is invalid.') * Fix (Parsing swf error: Failed to read past end of stream) * Fix rasterization error with vector graphics in buttons -###### Version 1.3.9 +### Version 1.3.9 * Not save generated meshes in scene * Fix (At line 908 of file "FTMain.jsfl": ReferenceError: ft is not defined) * Fix warning on add missing components @@ -44,7 +44,7 @@ * Replace shader "if" instruction to "step" * Replace mask shader "if + discard" instruction to "clip" -###### Version 1.3.8 +### Version 1.3.8 * Fix shape groups in tweens problems * Fix drawing object shape problems * Fix locked elements problem @@ -58,74 +58,74 @@ * Remove excess "if" instruction from shaders * Remove excess animation reimports -###### Version 1.3.7 +### Version 1.3.7 * Fix multiple import * Fix single frame optimization -###### Version 1.3.6 +### Version 1.3.6 * Fix for scale very small vector items * Big vector item optimization * More yield instructions and extensions -###### Version 1.3.5 +### Version 1.3.5 * Fix sprite import problem -###### Version 1.3.4 +### Version 1.3.4 * Fix CS6 export problem * Fix unity postprocessor problems -###### Version 1.3.3 +### Version 1.3.3 * Fix undefined unusedItems in CS6 -###### Version 1.3.2 +### Version 1.3.2 * Fix bug custom scale export with small items optimization -###### Version 1.3.1 +### Version 1.3.1 * Fix some Unity 5.5 deprecated functions -###### Version 1.3.0 +### Version 1.3.0 * ETC separated alpha support * Export animations with custom scale (for retina) * New small vector scaled items optimization -###### Version 1.2.0 +### Version 1.2.0 * Add Yield instructions for wait in coroutines(SwfWaitPlayStopped, SwfWaitRewindPlaying, SwfWaitStopPlaying) * Add unscaled delta time support(for separate animations, groups of animations or for all) * Fix guide type flash layers * Some fixes for reconvert asset problem -###### Version 1.1.1 +### Version 1.1.1 * Add conversion error by shape tween in CS6 * Fix life after death (problem about destroying with big lag by frame event) -###### Version 1.1.0 +### Version 1.1.0 * Sequence separator is anchor frame label (not common frame label) * SwfClip access to frame labels (currentLabelCount, GetCurrentFrameLabel) * SwfClip events (OnChangeClipEvent, OnChangeSequenceEvent, OnChangeCurrentFrameEvent) -###### Version 1.0.0 +### Version 1.0.0 * Initial asset store version * Sources to dll * Palette bitmaps support -###### Version 0.5.0 +### Version 0.5.0 * Flash optimizer twicks * Blending modes (except Alpha and Erase) -###### Version 0.4.0 +### Version 0.4.0 * Clip groups * Fix move assets bug * Tint color for clips * Animation API improvements -###### Version 0.3.0 +### Version 0.3.0 * Preview for animation assets and clips * Animation API improvements * Memory optimizations -###### Version 0.2.0 +### Version 0.2.0 * Export optimizations * Export clips with export names -###### Version 0.1.0 +### Version 0.1.0 * Initial alpha version diff --git a/Assets/FlashTools/Docs/GUIDE.md b/Assets/FlashTools/Docs/GUIDE.md new file mode 100644 index 0000000..bf15155 --- /dev/null +++ b/Assets/FlashTools/Docs/GUIDE.md @@ -0,0 +1,29 @@ +Open your flash animation in Adobe Flash (CS6 or above). +![](./Images/user-guide-1.png) + +Click the right button on movie clip which you want to export besides main timeline and go to the Properties. +![](./Images/user-guide-3.png) + +Choose "Export for ActionScript" and set name for clip in "Class" field. +![](./Images/user-guide-4.png) + +You can add **anchor** frame labels to separate timeline to different named sequences. +![](./Images/user-guide-2.png) + +Run export script (_FlashTools/FlashExport/FlashExport.jsfl_) for your flash animation. The script optimizes an animation, rasterizes vector graphics and export .swf file which is compatible with the toolset. +![](./Images/user-guide-5.png) +![](./Images/user-guide-6.png) + +Move exported .swf file to your unity project (You may find this .swf file at _export folder next to .fla file). +![](./Images/user-guide-7.png) + +.swf file will be automatically converted to unity asset with proper settings. Open them to change texture packing settings (by default it uses settings from _"FlashTools/Resources/SwfSettings"_). +![](./Images/user-guide-8.png) + +Now you can select exported clip and add it to scene or create a prefab. +![](./Images/user-guide-9.png) + +In instance properties you can change any settings like a sorting layer, play mode, current frame and etc. +![](./Images/user-guide-10.png) + +Enjoy! diff --git a/Assets/FlashTools/Docs/Images/user-guide-1.png b/Assets/FlashTools/Docs/Images/user-guide-1.png new file mode 100644 index 0000000..ef16ebb Binary files /dev/null and b/Assets/FlashTools/Docs/Images/user-guide-1.png differ diff --git a/Assets/FlashTools/Docs/Images/user-guide-10.png b/Assets/FlashTools/Docs/Images/user-guide-10.png new file mode 100644 index 0000000..e9b8931 Binary files /dev/null and b/Assets/FlashTools/Docs/Images/user-guide-10.png differ diff --git a/Assets/FlashTools/Docs/Images/user-guide-2.png b/Assets/FlashTools/Docs/Images/user-guide-2.png new file mode 100644 index 0000000..4d61494 Binary files /dev/null and b/Assets/FlashTools/Docs/Images/user-guide-2.png differ diff --git a/Assets/FlashTools/Docs/Images/user-guide-3.png b/Assets/FlashTools/Docs/Images/user-guide-3.png new file mode 100644 index 0000000..a67f3ca Binary files /dev/null and b/Assets/FlashTools/Docs/Images/user-guide-3.png differ diff --git a/Assets/FlashTools/Docs/Images/user-guide-4.png b/Assets/FlashTools/Docs/Images/user-guide-4.png new file mode 100644 index 0000000..102330a Binary files /dev/null and b/Assets/FlashTools/Docs/Images/user-guide-4.png differ diff --git a/Assets/FlashTools/Docs/Images/user-guide-5.png b/Assets/FlashTools/Docs/Images/user-guide-5.png new file mode 100644 index 0000000..4267ffd Binary files /dev/null and b/Assets/FlashTools/Docs/Images/user-guide-5.png differ diff --git a/Assets/FlashTools/Docs/Images/user-guide-6.png b/Assets/FlashTools/Docs/Images/user-guide-6.png new file mode 100644 index 0000000..d060033 Binary files /dev/null and b/Assets/FlashTools/Docs/Images/user-guide-6.png differ diff --git a/Assets/FlashTools/Docs/Images/user-guide-7.png b/Assets/FlashTools/Docs/Images/user-guide-7.png new file mode 100644 index 0000000..660c8fb Binary files /dev/null and b/Assets/FlashTools/Docs/Images/user-guide-7.png differ diff --git a/Assets/FlashTools/Docs/Images/user-guide-8.png b/Assets/FlashTools/Docs/Images/user-guide-8.png new file mode 100644 index 0000000..114efaa Binary files /dev/null and b/Assets/FlashTools/Docs/Images/user-guide-8.png differ diff --git a/Assets/FlashTools/Docs/Images/user-guide-9.png b/Assets/FlashTools/Docs/Images/user-guide-9.png new file mode 100644 index 0000000..946e9f2 Binary files /dev/null and b/Assets/FlashTools/Docs/Images/user-guide-9.png differ diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..75c5613 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (C) 2016-2022, by Matvey Cherevko (blackmatov@gmail.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3a62cab --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +![](.github/images/title-icon.png) + +# Flash Animation Toolset + +> Convert your flash animation for Unity easy! + +[Trial Version](https://assetstore.unity.com/packages/tools/animation/flash-animation-toolset-trial-73896) | +[Full Version](https://assetstore.unity.com/packages/tools/animation/flash-animation-toolset-73323) | +[Forum](https://forum.unity.com/threads/1-3-15-flash-animation-toolset.440085) | +[Web Demo](.github/demo) | +[User Guide](Assets/FlashTools/Docs/GUIDE.md) | +[API Reference](Assets/FlashTools/Docs/API.md) | +[Changelog](Assets/FlashTools/Docs/CHANGELOG.md) + +## Features + +- Support all transformations like 'rotation', 'skew' and 'scale' (except 3D) +- Support all tweens(classic, motion and etc), keyframes and layers +- Support mask layers +- Support bitmap and vector graphics +- Support all clip color effects like 'brightness', 'tint', 'alpha' and etc +- Support most blending modes (all except Alpha and Erase) +- Simple runtime API for controlling your animations in Unity +- Automatic packing texture atlases of animations with different settings +- Great performance with zero allocations in update loop +- Frame labels to separate sequences in one timeline +- Export marked "for export" clips and main timeline +- Live preview of animations in the Unity editor + +Supports Unity 2017.4 (LTS) and newer, both Personal and Pro. Full C# source code included. + +Leave your rating for this Asset. It is very important for me and the development of the project :) Thank you! + +## Usage video + + + +## Screenshots + +![](.github/images/screenshot-1.png) +![](.github/images/screenshot-2.png) +![](.github/images/screenshot-3.png) + +## [License (MIT)](./LICENSE.md) + +Samples use "Creative Commons CC0 1.0 Universal License" animations from [Glitch game](http://www.glitchthegame.com/public-domain-game-art)