Файловый менеджер - Редактировать - /home/jogoso94/public_html/jogos/3d_block_puzzle/js/bp3d.min.js
�азад
/** * @license almond 0.3.3 Copyright jQuery Foundation and other contributors. * Released under MIT license, http://github.com/requirejs/almond/LICENSE */ !function(){var t,e,i;!function(n){function s(t,e){return E.call(t,e)}function o(t,e){var i,n,s,o,r,a,h,l,c,p,d,u,m=e&&e.split("/"),g=b.map,f=g&&g["*"]||{};if(t){for(t=t.split("/"),r=t.length-1,b.nodeIdCompat&&L.test(t[r])&&(t[r]=t[r].replace(L,"")),"."===t[0].charAt(0)&&m&&(u=m.slice(0,m.length-1),t=u.concat(t)),c=0;c<t.length;c++)if("."===(d=t[c]))t.splice(c,1),c-=1;else if(".."===d){if(0===c||1===c&&".."===t[2]||".."===t[c-1])continue;c>0&&(t.splice(c-1,2),c-=2)}t=t.join("/")}if((m||f)&&g){for(i=t.split("/"),c=i.length;c>0;c-=1){if(n=i.slice(0,c).join("/"),m)for(p=m.length;p>0;p-=1)if((s=g[m.slice(0,p).join("/")])&&(s=s[n])){o=s,a=c;break}if(o)break;!h&&f&&f[n]&&(h=f[n],l=c)}!o&&h&&(o=h,a=l),o&&(i.splice(0,a,o),t=i.join("/"))}return t}function r(t,e){return function(){var i=C.call(arguments,0);return"string"!=typeof i[0]&&1===i.length&&i.push(null),m.apply(n,i.concat([t,e]))}}function a(t){return function(e){return o(e,t)}}function h(t){return function(e){v[t]=e}}function l(t){if(s(y,t)){var e=y[t];delete y[t],w[t]=!0,u.apply(n,e)}if(!s(v,t)&&!s(w,t))throw new Error("No "+t);return v[t]}function c(t){var e,i=t?t.indexOf("!"):-1;return i>-1&&(e=t.substring(0,i),t=t.substring(i+1,t.length)),[e,t]}function p(t){return t?c(t):[]}function d(t){return function(){return b&&b.config&&b.config[t]||{}}}var u,m,g,f,v={},y={},b={},w={},E=Object.prototype.hasOwnProperty,C=[].slice,L=/\.js$/;g=function(t,e){var i,n=c(t),s=n[0],r=e[1];return t=n[1],s&&(s=o(s,r),i=l(s)),s?t=i&&i.normalize?i.normalize(t,a(r)):o(t,r):(t=o(t,r),n=c(t),s=n[0],t=n[1],s&&(i=l(s))),{f:s?s+"!"+t:t,n:t,pr:s,p:i}},f={require:function(t){return r(t)},exports:function(t){var e=v[t];return void 0!==e?e:v[t]={}},module:function(t){return{id:t,uri:"",exports:v[t],config:d(t)}}},u=function(t,e,i,o){var a,c,d,u,m,b,E,C=[],L=typeof i;if(o=o||t,b=p(o),"undefined"===L||"function"===L){for(e=!e.length&&i.length?["require","exports","module"]:e,m=0;m<e.length;m+=1)if(u=g(e[m],b),"require"===(c=u.f))C[m]=f.require(t);else if("exports"===c)C[m]=f.exports(t),E=!0;else if("module"===c)a=C[m]=f.module(t);else if(s(v,c)||s(y,c)||s(w,c))C[m]=l(c);else{if(!u.p)throw new Error(t+" missing "+c);u.p.load(u.n,r(o,!0),h(c),{}),C[m]=v[c]}d=i?i.apply(v[t],C):void 0,t&&(a&&a.exports!==n&&a.exports!==v[t]?v[t]=a.exports:d===n&&E||(v[t]=d))}else t&&(v[t]=i)},t=e=m=function(t,e,i,s,o){if("string"==typeof t)return f[t]?f[t](e):l(g(t,p(e)).f);if(!t.splice){if(b=t,b.deps&&m(b.deps,b.callback),!e)return;e.splice?(t=e,e=i,i=null):t=n}return e=e||function(){},"function"==typeof i&&(i=s,s=o),s?u(n,t,e,i):setTimeout(function(){u(n,t,e,i)},4),m},m.config=function(t){return m(t)},t._defined=v,i=function(t,e,i){if("string"!=typeof t)throw new Error("See almond README: incorrect module build, no module name");e.splice||(i=e,e=[]),s(v,t)||s(y,t)||(y[t]=[t,e,i])},i.amd={jQuery:!0}}(),i("libs/almond",function(){}),i("rs/three/BaseApp",[],function(){"use strict";function t(t,e,i){this.width=t||1e3,this.height=e||600,this.fov=i||60,this.init()}return t.prototype.init=function(){this.scene=new THREE.Scene,this.camera=new THREE.PerspectiveCamera(this.fov,this.width/this.height,100,3e4);var t=this.renderer=new THREE.WebGLRenderer({alpha:!0,antialias:!0});t.setSize(this.width,this.height),t.setPixelRatio(window.devicePixelRatio),this.camera.lookAt(new THREE.Vector3(0,0,0)),this.el=t.domElement,this.raycaster=new THREE.Raycaster},t.prototype._renderRequest=function(t){this.renderer.render(this.scene,this.camera),this.rId=requestAnimationFrame(this._renderRequest.bind(this))},t.prototype.startRendering=function(){this.stopRendering(),this.rId=requestAnimationFrame(this._renderRequest.bind(this))},t.prototype.stopRendering=function(){cancelAnimationFrame(this.rId)},t.prototype.resizeHandler=function(){this.thfov=Math.tan(this.camera.fov*Math.PI/360)},t.prototype.setCameraMatchProjection=function(t){t=t||1;var e=this.camera,i=.5*this.height/Math.tan(e.fov*Math.PI/360);e.position.x=e.position.y=0,e.position.z=i/t,e.lookAt(new THREE.Vector3(0,0,0))},t.prototype._getScaleFitRatio=function(t,e,i){i=i||.75;var n=t/e;return this.width/n>this.height?this.height*i/e:this.width*i/t},t.prototype.getScaleFitPositionZ=function(t,e,i){this.setCameraMatchProjection();var n=this._getScaleFitRatio(t,e,i),s=this.camera.position.z;return s-s/n},t}),i("rs/bp3d/Preferences",[],function(){"use strict";function t(t,e){this.dataString=e,this.config=t,this.init(e)}return t.prototype.init=function(t){if(null==t){this.data={name:"bp3d",unlocked:{}};var e=this.config.data.level;for(var i in e)this.data.unlocked[i]=[1];this.save()}else this.data=JSON.parse(t)},t.prototype.save=function(){null!=this.data&&localStorage.setItem("bp3d",JSON.stringify(this.data))},t.prototype.isUnlocked=function(t,e){if(0==e)return!0;var i=this.getUnlockCategory(t);return null!=i&&1===i[e]},t.prototype.saveUnlock=function(t,e){var i=this.data.unlocked;void 0==i[t]&&(i[t]=[]),i[t][e]=1,this.save()},t.prototype.saveDifficulty=function(t){this.data.difficulty=t,this.save()},t.prototype.saveDefaultCategory=function(t){this.data.defaultCategory=t,this.save()},t.prototype.getUnlockCategory=function(t){var e=this.data.unlocked;for(var i in e)if(i==t)return e[i];return null},t}),i("rs/bp3d/AssetManager",[],function(){"use strict";function t(t){this.bp3d=t,this.init()}var e="assets/sounds",i="assets/graphics";return t.prototype.init=function(){var t=this.loadingManager=new THREE.LoadingManager,e=this;t.onLoad=function(){e.loaded=!0,console.log("Assets loaded"),e.onLoad&&e.onLoad.call(e)},t.onProgress=function(t,i,n){e.onProgress&&e.onProgress.call(e,t,i,n)},this.soundOn=!0},t.prototype.load=function(){this.loadPatterns(),this.loadAudio(),this.loadTextures()},t.prototype.loadPatterns=function(){var t=(this.bp3d.defaultOptions,this.bp3d.config),e=t.general.paddingPatterns;this.padSet=[];for(var n=0;n<e.length;n++){var s=document.createElement("img");s.class="paddingPattern",s.src=i+"/"+e[n],s.style.display="none",document.body.appendChild(s),this.padSet.push(s)}},t.prototype.loadAudio=function(){function t(t,e){var s=new THREE.Audio(n);return new THREE.AudioLoader(i.loadingManager).load(t,function(t){s.setBuffer(t),e&&e.call(i)}),s}var i=this,n=new THREE.AudioListener;this.bp3d.config.general.useBackgroundMusic&&(this.bgSound=t(e+"/bg.mp3",function(){this.bgSound.setLoop(!0)})),this.piecemove=t(e+"/piecemove.mp3"),this.btnClick=t(e+"/btnClick.mp3"),this.shufflestart=t(e+"/shufflestart.mp3"),this.shuffleend=t(e+"/shuffleend.mp3"),this.firework=t(e+"/firework.mp3"),this.wintune=t(e+"/wintune.mp3"),this.losetune=t(e+"/losetune.mp3")},t.prototype.loadTextures=function(){var t=(this.bp3d.defaultOptions,this),e=this.bp3d.config.general.boardTextures;this.boardTextures=[];for(var n=0;n<e.length;n++)!function(e){new THREE.TextureLoader(t.loadingManager).load(i+"/"+e,function(e){t.boardTextures.push(e)})}(e[n]);new THREE.TextureLoader(t.loadingManager).load(i+"/lensflare.png",function(e){t.fwTexture=e})},t.prototype.toggleSound=function(){this.soundOn=!this.soundOn,this.soundOn?(this.bgSound.setVolume(.8),this.piecemove.setVolume(1),this.btnClick.setVolume(1),this.shufflestart.setVolume(1),this.shuffleend.setVolume(1),this.firework.setVolume(1),this.wintune.setVolume(1)):(this.bgSound.setVolume(0),this.piecemove.setVolume(0),this.btnClick.setVolume(0),this.shufflestart.setVolume(0),this.shuffleend.setVolume(0),this.firework.setVolume(0),this.wintune.setVolume(0))},t}),i("rs/bp3d/ui/HomeScreenHeader",[],function(){"use strict";function t(t){this.hs=t,this.init()}return t.prototype.init=function(){var t=this.el=document.createElement("div");t.className="rs-hscreen-header";var e=this.hs.config;this.title=document.createElement("h1"),this.title.className="app-title",this.title.innerHTML=e.strings.APP_TITLE,t.appendChild(this.title),this.info=document.createElement("span"),this.info.className="app-info",this.info.innerHTML=e.strings.APP_INFO,t.appendChild(this.info),this.progress=document.createElement("div"),this.progress.className="app-progress",this.progressInner=document.createElement("div"),this.progressInner.className="app-progress-inner",t.appendChild(this.progress),this.progress.appendChild(this.progressInner),this.setProgress(0),this.logo=document.createElement("img"),this.logo.className="app-logo",this.logo.src="assets/graphics/logo.png",this.logo.onmousedown=function(t){t.preventDefault()},t.appendChild(this.logo)},t.prototype.hideProgress=function(){var t=this.progress;anime({targets:t,opacity:0,easing:"easeOutQuint",complete:function(){t.style.display="none"}})},t.prototype.hideLogo=function(){var t=this.logo,e=this.hs.bp3d.isMobile;anime({targets:t,opacity:0,easing:"easeOutQuint",complete:function(){if(e)return void(t.style.display="none");anime.remove(t),anime({targets:t,width:32,marginTop:20,opacity:1})}})},t.prototype.setProgress=function(t){this.progressInner.style.width=t+"%"},t.prototype.moveTop=function(){this.hideProgress(),this.hideLogo(),anime({targets:this.el,top:0,translateY:0,easing:"easeOutQuint",duration:1200})},t.prototype.center=function(){var t=this.hs.bp3d.assetManager,e=this.el;anime({targets:this.el,top:"50%",translateY:"-50%",duration:1400,update:function(){t.showDelay&&(anime.remove(e),anime({targets:e,top:0,translateY:0,duration:0}))}})},t}),i("rs/bp3d/ui/HomeScreenMenu",[],function(){"use strict";function t(t){this.hs=t,this.init()}return t.prototype.init=function(){var t=this.el=document.createElement("div");t.className="rs-hscreenmenu",this.con=document.createElement("div"),this.con.className="menu-list",t.appendChild(this.con);var e=this.hs.config,i=this.hs;this.addItem(e.strings.NEW_GAME,function(){i.startNewGame()}),e.general.useHelpPanel&&this.addItem(e.strings.HELP,function(){i.showHelp()}),e.general.useCreditPanel&&this.addItem(e.strings.CREDIT,function(){i.showCredit()})},t.prototype.addItem=function(t,e){var i=document.createElement("div");i.className="menu-item",i.innerHTML=t,i.style.opacity=0,this.con.appendChild(i);var n=this.hs.bp3d.assetManager;i.addEventListener("click",function(t){e&&e.call(this),n.btnClick.play()})},t.prototype.show=function(){anime({targets:".rs-hscreenmenu .menu-item",opacity:1,easing:"easeOutQuad",delay:anime.stagger(150,{start:500})})},t}),i("rs/game/BasePanel",[],function(){"use strict";function t(t,e){this.width=t||300,this.height=e||300,this.init()}return t.prototype.init=function(){(this.ol=document.createElement("div")).className="rs-game-overlay";var t=this.el=document.createElement("div");t.className="rs-game-panel",t.style.width=this.width+"px",t.style.height=this.height+"px";var e=this.closeBtn=document.createElement("span");e.className="rs-closebtn",e.innerHTML="×",t.appendChild(e),e.addEventListener("click",this.hide.bind(this))},t.prototype.show=function(){document.body.appendChild(this.ol),document.body.appendChild(this.el),anime.remove(this.el),anime({targets:this.el,opacity:[0,1],duration:800,easing:"easeOutQuint"})},t.prototype.hide=function(){document.body.contains(this.ol)&&document.body.removeChild(this.ol),document.body.contains(this.el)&&document.body.removeChild(this.el)},t.prototype.resize=function(t,e){},t}),i("rs/game/OptionPanel",["rs/game/BasePanel"],function(t){"use strict";function e(e,i){this.data=e,this.callback=i,t.prototype.constructor.call(this)}return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.prototype.init=function(){function e(t){var e=t.currentTarget.index;n.callback&&n.callback.call(n,e),n.hide()}t.prototype.init.call(this);var i=this.el;i.classList.add("rs-game-optionpanel"),i.style.height="auto";for(var n=this,s=0;s<this.data.length;s++){var o=document.createElement("div");o.className="rs-optionitem",o.innerHTML=this.data[s],o.index=s,o.addEventListener("click",e),i.appendChild(o)}},e}),i("rs/bp3d/ui/SettingPanel",["rs/game/OptionPanel","rs/game/BasePanel"],function(t,e){"use strict";function i(t){this.bp3d=t,this.config=t.config,e.prototype.constructor.call(this)}i.prototype=Object.create(e.prototype),i.prototype.constructor=i;return i.prototype.init=function(){e.prototype.init.call(this);var i=this.el;i.classList.add("rs-bp3d-spanel"),i.style.width="90%",i.style.height="auto",this.settings={difficulty:"EASY",defaultCategory:0};var n=this.container=document.createElement("div");n.className="rs-settingcontainer",i.appendChild(n);var s=this.config.data.level,o=[];for(var r in s)o.push(r);this.cat=o;var a=this,h=this.bp3d.assetManager,l=this.depanel=new t(o,function(t){a.bp3d.pref.saveDefaultCategory(t),a.updateSettingItem(),h.btnClick.play()}),c=this.dpanel=new t(["EASY","NORMAL","HARD"],function(t){a.bp3d.pref.saveDifficulty(t),a.updateSettingItem(),h.btnClick.play()});this.sitem1=this.buildSettingItem("Difficulty",c),this.sitem2=this.buildSettingItem("Default Category",l)},i.prototype.buildSettingItem=function(t,e){var i=this.bp3d.assetManager,n=document.createElement("div");n.className="rs-settingitem";var s=document.createElement("h3");s.innerHTML=t,n.title=s,n.appendChild(s);var o=document.createElement("span");return o.innerHTML="Button",n.btn=o,n.appendChild(o),this.container.appendChild(n),o.addEventListener("click",function(t){e.show(),i.btnClick.play()}),n},i.prototype.show=function(){e.prototype.show.call(this),this.updateSettingItem()},i.prototype.updateSettingItem=function(){var t=this.bp3d.pref,e=["EASY","NORMAL","HARD"];this.sitem1.btn.innerHTML=e[t.data.difficulty],this.sitem2.btn.innerHTML=this.cat[t.data.defaultCategory].toUpperCase()},i}),i("rs/utils/BrowserUtil",[],function(){"use strict";var t={bp:{XS:0,SM:576,MD:768,LG:992,XL:1200,XXL:1500,X3L:1900,X4L:2e3,X5L:3e3},computeStyle:function(t,e,i){return void 0===i&&(i="px"),parseFloat(getComputedStyle(t)[e].replace(i,""))},css:function(t,e){for(var i in e)t.style[i]=e[i]},getPrefix:function(){return t.pf||(window.opera||navigator.userAgent.indexOf(" OPR/")>=0?(t.pf="Webkit",t.browserName="Opera"):"undefined"!=typeof InstallTrigger?(t.pf="Moz",t.browserName="Firefox"):window.safari?(t.pf="Webkit",t.browserName="Safari"):window.chrome?(t.pf="Webkit",t.browserName="Chrome"):document.documentMode?(t.pf="ms",t.browserName="MSIE"):/Edge/.test(navigator.userAgent)?(t.pf="ms",t.browserName="MSIE"):(t.pf="Webkit",t.browserName="Safari"),"Webkit"===t.pf?t.ps="":t.ps="px",""!==t.pf?t.csspf="-"+t.pf.toLowerCase()+"-":t.csspf="",console.log(t.pf)),t.pf},getMouseTouchEvents:function(){return this.isMobile()?{mdown:"touchstart",mmove:"touchmove",mup:"touchend"}:{mdown:"mousedown",mmove:"mousemove",mup:"mouseup"}},isMobile:function(){return void 0===t.imb&&(t.imb=null===document.createElement("span").ontouchstart),t.imb},goFullscreen:function(e){var i=t.isFullscreenSupported();return!!i&&(""===i?e.requestFullScreen():e[i+"RequestFullScreen"]())},exitFullscreen:function(e){var i=t.isFullscreenSupported();return!!i&&(!!t.isFullscreen()&&(""===i?document.cancelFullScreen():document[i+"CancelFullScreen"]()))},fullScreenCallback:function(e,i,n){var s=t.isFullscreenSupported();if(!s)return!1;var o=s+"fullscreenchange";document.addEventListener(o,i)},isFullscreen:function(){var e=t.isFullscreenSupported();if(!e)return!1;switch(e){case"":return document.fullScreen;case"webkit":return document.webkitIsFullScreen;default:return document[e+"FullScreen"]}},isFullscreenSupported:function(){var e=t.pf.toLowerCase();return void 0!==document.cancelFullScreen?"":void 0!==document[e+"CancelFullScreen"]&&e}};return t}),i("rs/game/Scroller",["rs/utils/BrowserUtil"],function(t){"use strict";function e(e){t.isMobile()?(i="touchstart",n="touchend",s="touchmove"):(i="mousedown",n="mouseup",s="mousemove"),this.el=e,this.el.style.overflow="hidden",this.init()}var i,n,s;return e.prototype.init=function(){function t(){p.scrollTop+=.075*(l-p.scrollTop),d.scrollId=requestAnimationFrame(t)}function e(e){c=e.touches?e.touches[0].clientY:e.clientY,a=c,h=l=p.scrollTop,p.addEventListener(s,o),p.addEventListener(n,r),window.addEventListener(s,o),window.addEventListener(n,r),cancelAnimationFrame(d.scrollId),d.scrollId=requestAnimationFrame(t),p.style.cursor="grab"}function o(t){c=t.changedTouches?t.changedTouches[0].clientY:t.clientY;var e=2.5*(c-a),i=p.scrollHeight-d.el.clientHeight,n=h-e;n>i&&(n=i),n<0&&(n=0),l=n,p.style.cursor="grabbing"}function r(t){p.removeEventListener(s,o),p.removeEventListener(n,r),window.removeEventListener(s,o),window.removeEventListener(n,r),cancelAnimationFrame(d.scrollId),p.style.cursor="grab"}var a,h,l,c,p=this.el,d=this;p.addEventListener(i,e),p.addEventListener("mouseover",function(t){p.style.cursor="grab"})},e}),i("rs/bp3d/ui/HelpPanel",["rs/game/Scroller","rs/game/BasePanel"],function(t,e){"use strict";function i(){e.prototype.constructor.call(this)}i.prototype=Object.create(e.prototype),i.prototype.constructor=i;return i.prototype.init=function(){e.prototype.init.call(this);var i=this.el;i.classList.add("rs-bp3d-helppanel"),i.style.width=i.style.height="90%";var n=this.container=document.createElement("div");n.className="rs-helpcontainer",i.appendChild(n),this.scroller=new t(this.container);var s=new XMLHttpRequest;s.addEventListener("load",function(t){var e=this.responseText;n.innerHTML=e}),s.open("GET","assets/text/helpcontent.html"),s.send()},i}),i("rs/bp3d/ui/CreditPanel",["rs/game/BasePanel"],function(t){"use strict";function e(e){this.bp3d=e,t.prototype.constructor.call(this)}return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.prototype.init=function(){t.prototype.init.call(this);var e=this.el;e.classList.add("rs-bp3d-cpanel"),e.style.width="90%",e.style.height="auto";var i=this.content=document.createElement("div"),n=this.bp3d.config.strings;i.innerHTML="<h3>"+n.APP_TITLE+"</h3>",i.innerHTML+="<p>"+n.CREDIT_TEXT+"</p>",e.appendChild(i)},e}),i("rs/bp3d/screen/HomeScreen",["rs/bp3d/ui/HomeScreenHeader","rs/bp3d/ui/HomeScreenMenu","rs/bp3d/ui/SettingPanel","rs/bp3d/ui/HelpPanel","rs/bp3d/ui/CreditPanel"],function(t,e,i,n,s){"use strict";function o(t){this.bp3d=t,this.loaded=!1,this.config=t.config,this.init()}return o.prototype.init=function(){var o=this.el=document.createElement("div");o.className="rs-hscreen",o.style.width=o.style.height="100%",o.style.display="none",this.header=new t(this),this.menu=new e(this),this.hpanel=new n,this.cpanel=new s(this.bp3d),this.spanel=new i(this.bp3d)},o.prototype.load=function(){this.el.style.display="block",this.el.appendChild(this.header.el),this.header.center();var t=this.bp3d.assetManager,e=this,i=this.header,n=this.menu;t.onLoad=function(){setTimeout(function(){t.showDelay=!0,i.moveTop(),e.el.appendChild(n.el),n.show(),t.bgSound&&t.bgSound.play()},1500)},t.onProgress=function(t,i,n){e.header.setProgress(i/n*100)},this.bp3d.assetManager.load()},o.prototype.transitionIn=function(){this.el.style.display="block",anime({targets:this.el,translateY:0,easing:"easeOutQuint",opacity:1,duration:1200})},o.prototype.transitionOut=function(){var t=this.el;anime({targets:this.el,translateY:-400,easing:"easeOutQuint",opacity:0,duration:1200,complete:function(){t.style.display="none"}})},o.prototype.show=function(){if(this.bp3d.root.appendChild(this.el),!this.bp3d.assetManager.loaded)return void this.load();this.transitionIn()},o.prototype.hide=function(){this.bp3d.root.removeChild(this.el),this.transitionOut()},o.prototype.startNewGame=function(){this.bp3d.setGameScreen()},o.prototype.showSetting=function(){this.spanel.show()},o.prototype.showHelp=function(){this.hpanel.show()},o.prototype.showCredit=function(){this.cpanel.show()},o.prototype.resize=function(t,e){},o}),i("rs/game/ImagePanel",["rs/game/BasePanel"],function(t){"use strict";function e(){t.prototype.constructor.call(this)}return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.prototype.init=function(){t.prototype.init.call(this),this.el.classList.add("rs-image-panel");var e=this.img=document.createElement("img");this.el.appendChild(this.img),this.el.style.width=this.el.style.height="auto",e.addEventListener("click",this.hide.bind(this)),e.onload=function(t){var i=e.naturalWidth/e.naturalHeight;e.naturalHeight>=window.innerHeight&&(e.height=.85*window.innerHeight,e.width=e.height*i),e.naturalWidth>=window.innerWidth&&(e.width=.85*window.innerWidth,e.height=e.width/i)}},e.prototype.show=function(e){this.img.src=e,t.prototype.show.call(this)},e}),i("rs/game/IconButton",["rs/utils/BrowserUtil"],function(t){"use strict";function e(t,e){this.init(t,e)}return e.prototype.init=function(e,i){var n=this.el=document.createElement("span");n.className=e,t.css(n,{display:"block",cursor:"pointer",borderRadius:"50%",textAlign:"center"});var s=this;i&&n.addEventListener("click",function(t){i.call(s)})},e}),i("rs/bp3d/ui/GameButton",["rs/game/IconButton"],function(t){"use strict";function e(t,e){this.init(t,e)}return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.prototype.init=function(e,i){t.prototype.init.call(this,e,i),this.el.classList.add("rs-bp3d-mainbutton")},e.prototype.addClass=function(t){this.el.classList.add(t)},e.prototype.removeClass=function(t){this.el.classList.remove(t)},e}),i("rs/bp3d/ui/TrophyPanel",["rs/game/BasePanel","rs/bp3d/ui/GameButton"],function(t,e){"use strict";function i(e){this.gs=e,this.am=e.bp3d.assetManager,t.prototype.constructor.call(this)}return i.prototype=Object.create(t.prototype),i.prototype.constructor=i,i.prototype.init=function(){t.prototype.init.call(this);var i=this.el;i.classList.add("rs-trophy-panel"),i.style.width=i.style.height="90%",this.title=document.createElement("h1"),this.title.className="trophy-level-title",this.title.innerHTML="Level Up";var n=this.meta=document.createElement("div");n.className="meta-container",i.appendChild(n);var s=this.timespan=document.createElement("span");s.innerHTML="Time: 323s",n.appendChild(s);var o=this.movespan=document.createElement("span");o.innerHTML="Moves: 232",n.appendChild(o);var r=document.createElement("div");r.className="trophy-container";var a=document.createElement("img");a.src="assets/graphics/trophy.png",r.appendChild(a),i.appendChild(r);var h=document.createElement("span");h.className="level-label",h.innerHTML=23,r.appendChild(h),this.lvl=h;var l=this.btnContainer=document.createElement("div");l.className="trophy-button-container",i.appendChild(l),this.replayBtn=new e("icon-undo",this.doReplay.bind(this)),this.replayBtn.addClass("rs-bp3d-mainbutton-extra"),l.appendChild(this.replayBtn.el),this.nextBtn=new e("icon-nextlevel",this.doNext.bind(this)),this.nextBtn.addClass("rs-bp3d-mainbutton-extra"),l.appendChild(this.nextBtn.el)},i.prototype.show=function(){t.prototype.show.call(this),document.body.appendChild(this.title),this.setValues(this.gs.getPlayingTime(),this.gs.getMoveCount(),this.gs.currentLevel+1)},i.prototype.hide=function(){t.prototype.hide.call(this),document.body.contains(this.title)&&document.body.removeChild(this.title)},i.prototype.doReplay=function(){this.am.btnClick.play(),this.gs.replayLevel()},i.prototype.doNext=function(){this.am.btnClick.play(),this.gs.nextLevel()},i.prototype.setValues=function(t,e,i){this.timespan.innerHTML="Times: "+t+"s",this.lvl.innerHTML=i,this.movespan.innerHTML="Moves: "+e},i}),i("rs/bp3d/ui/LevelPanel",["rs/game/Scroller","rs/game/BasePanel"],function(t,e){"use strict";function i(t){this.gs=t,this.am=t.bp3d.assetManager,e.prototype.constructor.call(this),this.currentCategory=-1}return i.prototype=Object.create(e.prototype),i.prototype.constructor=i,i.prototype.init=function(){e.prototype.init.call(this);var i=this.el;this.el.classList.add("rs-bp3d-levelpanel"),i.style.width=i.style.height="90%";var n=this.levelTitle=document.createElement("div");n.className="trophy-level-title",n.innerHTML="Levels";var s=this.lgc=document.createElement("div");s.className="rs-bp3d-levelgridcontainer",i.appendChild(s),this.lg=document.createElement("div"),this.lg.className="rs-bp3d-levelgrid",s.appendChild(this.lg),this.scroller=new t(this.lgc)},i.prototype.show=function(){e.prototype.show.call(this),document.body.appendChild(this.levelTitle),this.buildGrid()},i.prototype.hide=function(){e.prototype.hide.call(this),document.body.contains(this.levelTitle)&&document.body.removeChild(this.levelTitle)},i.prototype.buildGrid=function(){function t(t){var i=t.currentTarget.index;o.isUnlocked(e.name,i)&&s.loadLevel(i),s.bp3d.assetManager.btnClick.play()}var e=this.gs.levels[this.gs.currentCategory],i=e.content.length,n=this.lg,s=this.gs,o=this.gs.bp3d.pref;n.textContent="";for(var r=0;r<i;r++){var a=document.createElement("div");a.className="rs-bp3d-levelgriditem",a.index=r,o.isUnlocked(e.name,r)?(a.innerHTML="<span>"+(r+1)+"</span>",a.unlocked=!0):(a.innerHTML='<span class="icon-lock"></span>',a.unlocked=!1),n.appendChild(a),a.addEventListener("click",t)}cancelAnimationFrame(this.scrollId),this.lgc.scrollTop=0;var h=96*Math.floor(this.lg.clientWidth/96);this.lg.style.width=h+"px",this.currentCategory=this.gs.currentCategory},i}),i("rs/bp3d/ui/CategoryPanel",["rs/game/BasePanel"],function(t){"use strict";function e(e){this.gs=e,t.prototype.constructor.call(this)}return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.prototype.init=function(){function e(t){s.currentCategory!==t.currentTarget.index&&(s.loadCategory(t.currentTarget.index),s.bp3d.assetManager.btnClick.play())}t.prototype.init.call(this);var i=this.el;i.classList.add("rs-bp3d-categorypanel"),i.style.width=i.style.height="auto",this.title=document.createElement("h1"),this.title.className="trophy-level-title",this.title.innerHTML="Category";var n=this.gs.levels,s=this.gs;this.list=[];for(var o=0;o<n.length;o++){var r=n[o],a=document.createElement("div");a.className="rs-categoryitem",a.innerHTML=r.name,a.index=o,a.addEventListener("click",e),this.list.push(a),i.appendChild(a)}},e.prototype.show=function(){t.prototype.show.call(this),document.body.appendChild(this.title);for(var e=this.gs.currentCategory,i=0;i<this.list.length;i++)this.list[i].classList.remove("selected-item");this.list[e].classList.add("selected-item")},e.prototype.hide=function(){t.prototype.hide.call(this),document.body.contains(this.title)&&document.body.removeChild(this.title)},e}),i("rs/bp3d/ui/GameScreenButtonBar",["rs/bp3d/ui/GameButton"],function(t){"use strict";function e(t){this.gs=t,this.init()}return e.prototype.init=function(){var e=this.el=document.createElement("div");e.className="rs-bp3d-gamebuttonbar";this.gs.bp3d.assetManager;this.hintBtn=new t("icon-eye",this.showHint.bind(this)),this.hintBtn.addClass("rs-bp3d-mainbutton-extra"),e.appendChild(this.hintBtn.el),this.levelBtn=new t("icon-stack",this.showGameLevels.bind(this)),this.levelBtn.addClass("rs-bp3d-mainbutton-extra"),e.appendChild(this.levelBtn.el),this.modeBtn=new t("icon-mode",this.showCategory.bind(this)),this.modeBtn.addClass("rs-bp3d-mainbutton-extra"),e.appendChild(this.modeBtn.el),this.infoBtn=new t("icon-info",this.showHelp.bind(this)),e.appendChild(this.infoBtn.el),this.homeBtn=new t("icon-home",this.showHome.bind(this)),e.appendChild(this.homeBtn.el),this.soundBtn=new t("icon-sound-on",this.toggleSound.bind(this)),this.soundBtn.isOn=!0,e.appendChild(this.soundBtn.el)},e.prototype.show=function(){anime({targets:this.el,bottom:15,easing:"easeOutQuint",duration:800})},e.prototype.hide=function(){anime({targets:this.el,bottom:-50,easing:"easeOutQuint",duration:800})},e.prototype.showHint=function(){var t=this.gs.bp3d.assetManager;this.gs.imagePanel.show(this.gs.getCurrentImagePath()),t.btnClick.play()},e.prototype.showGameLevels=function(){if(!this.gs.game3d.container.isShuffling){this.gs.bp3d.assetManager.btnClick.play(),this.gs.levelPanel.show()}},e.prototype.showCategory=function(t){this.gs.bp3d.assetManager.btnClick.play(),this.gs.catPanel.show()},e.prototype.showHome=function(t){this.gs.bp3d.assetManager.btnClick.play(),this.gs.bp3d.setHomeScreen()},e.prototype.showHelp=function(t){this.gs.bp3d.assetManager.btnClick.play(),this.gs.hpanel.show()},e.prototype.toggleSound=function(){var t=this.gs.bp3d.assetManager,e=this.soundBtn;e.isOn=!this.soundBtn.isOn,e.isOn?(e.removeClass("icon-sound-off"),e.addClass("icon-sound-on"),t.btnClick.play()):(e.removeClass("icon-sound-on"),e.addClass("icon-sound-off")),t.toggleSound()},e.prototype.getClientSize=function(){return[this.el.clientWidth,this.el.clientHeight]},e}),i("rs/bp3d/ui/GameScreenWonBar",["rs/bp3d/ui/GameButton"],function(t){"use strict";function e(t){this.gs=t,this.init()}return e.prototype.init=function(){var e=this.el=document.createElement("div");e.className="rs-bp3d-gamewonbar",e.style.bottom="-85px",this.status=document.createElement("h1"),this.status.className="trophy-level-title",this.status.innerHTML="DRAW",this.nextBtn=new t("icon-nextlevel",this.doNext.bind(this)),this.nextBtn.addClass("rs-bp3d-mainbutton-extra"),e.appendChild(this.nextBtn.el)},e.prototype.doNext=function(){this.gs.bp3d.assetManager.btnClick.play(),this.gs.nextLevel()},e.prototype.show=function(t){anime({targets:this.el,bottom:12,easing:"easeOutQuint",duration:800}),this.setStatus(t),document.body.appendChild(this.status)},e.prototype.setStatus=function(t){this.status.innerHTML=t},e.prototype.hide=function(t){anime({targets:this.el,bottom:-85,easing:"easeOutQuint",duration:800}),document.body.contains(this.status)&&document.body.removeChild(this.status)},e}),i("rs/bp3d/ui/GameScreenLoseBar",["rs/bp3d/ui/GameButton"],function(t){"use strict";function e(t){this.gs=t,this.init()}return e.prototype.init=function(){var e=this.el=document.createElement("div");e.className="rs-bp3d-gamewonbar",e.style.bottom="-85px",this.replayBtn=new t("icon-undo",this.doReplay.bind(this)),this.replayBtn.addClass("rs-bp3d-mainbutton-extra"),e.appendChild(this.replayBtn.el),this.status=document.createElement("h1"),this.status.className="trophy-level-title",this.status.innerHTML="DRAW"},e.prototype.doReplay=function(){this.gs.bp3d.assetManager.btnClick.play(),this.gs.replayLevel()},e.prototype.show=function(t){anime({targets:this.el,bottom:12,easing:"easeOutQuint",duration:800}),this.setStatus(t),document.body.appendChild(this.status)},e.prototype.hide=function(){anime({targets:this.el,bottom:-85,easing:"easeOutQuint",duration:800}),document.body.contains(this.status)&&document.body.removeChild(this.status)},e.prototype.setStatus=function(t){this.status.innerHTML=t},e}),i("rs/bp3d/ui/HeaderTimeButton",[],function(){"use strict";function t(t){this.gh=t,this.init()}return t.prototype.init=function(){var t=this.el=document.createElement("div");t.className="rs-bp3d-timebtn",this.isPlaying=!1,this.currentTime=0;var e=this.gh,i=this;t.addEventListener("click",function(t){e.gs.bp3d.assetManager.btnClick.play(),i.toggleTime()});var n=this.ticon=document.createElement("span");t.appendChild(n),n.className="icon-timer";var s=this.tval=document.createElement("span");s.className="timebtn-value",t.appendChild(s),s.innerHTML="00:00:00";var o=this.tpause=document.createElement("span");o.className="icon-pausetime",t.appendChild(o)},t.prototype.resume=function(){clearInterval(this.timeId),this.timeId=setInterval(this.timeTick.bind(this),1e3),this.isPlaying=!0,this.tpause.className="icon-pausetime"},t.prototype.pause=function(){clearInterval(this.timeId),this.isPlaying=!1,this.tpause.className="icon-playtime"},t.prototype.reset=function(){this.currentTime=0,this.tval.innerHTML="00:00:00"},t.prototype.timeTick=function(){function t(t){return t<10?"0"+t:t}this.currentTime+=1;var e=this.currentTime,i=Math.floor(e/3600),n=Math.floor((e-3600*i)/60),s=(e-3600*i)%60;this.tval.innerHTML=t(i)+":"+t(n)+":"+t(s)},t.prototype.toggleTime=function(){this.gh.gs.game3d.isRunningState()&&(this.isPlaying=!this.isPlaying,this.isPlaying?this.resume():this.pause())},t}),i("rs/bp3d/ui/HeaderLevelButton",[],function(){"use strict";function t(t){this.gh=t,this.init()}return t.prototype.init=function(){var t=this.el=document.createElement("div");t.className="rs-bp3d-levelbtn";var e=this.gh;this.el.addEventListener("click",function(t){e.gs.game3d.shuffle()}),this.label=document.createElement("span"), this.label.className="levelbtn-label",t.appendChild(this.label),this.btn=document.createElement("span"),this.btn.className="levelbtn-shuffle icon-shuffle",t.appendChild(this.btn),this.setLevel(1)},t.prototype.setLevel=function(t){function e(){return Math.floor(150*Math.random())}this.label.innerHTML="Level "+t,this.el.style.backgroundColor="rgba("+e()+", "+e()+", "+e()+", 1)"},t}),i("rs/bp3d/ui/HeaderMoveButton",[],function(){"use strict";function t(t){this.gh=t,this.init()}return t.prototype.init=function(){var t=this.el=document.createElement("div");t.className="rs-bp3d-movebtn",this.count=0;var e=this.gh,i=this;t.addEventListener("click",function(t){e.gs.bp3d.assetManager.btnClick.play(),i.undo()});var n=this.micon=document.createElement("span");t.appendChild(n),n.className="icon-quill";var s=this.mval=document.createElement("span");s.className="movebtn-value",t.appendChild(s),s.innerHTML="0000";var o=this.ubtn=document.createElement("span");o.className="icon-undo",t.appendChild(o)},t.prototype.addCount=function(t){this.count+=t;for(var e=this.count,i=0,n="";e>=10;)i++,e/=10;i=4-i-1;for(var s=0;s<i;s++)n+="0";this.mval.innerHTML=n+this.count},t.prototype.reset=function(){this.count=0,this.mval.innerHTML="0000"},t.prototype.undo=function(){this.gh.gs.game3d.undo()},t}),i("rs/bp3d/ui/DurationBar",[],function(){"use strict";function t(t){this.gh=t,this.init()}return t.prototype.init=function(){var t=document.createElement("div");this.el=t,t.className="rs-bp3d-dbar",this.bar=document.createElement("div"),this.bar.className="progress-bar",t.appendChild(this.bar),this.label=document.createElement("div"),this.label.className="duration-label",this.label.innerHTML=100,t.appendChild(this.label)},t.prototype.setValue=function(t){anime({targets:this.bar,width:100*t+"%",easing:"linear",duration:1e3})},t.prototype.setDuration=function(t){this.duration=this.currentValue=this.label.innerHTML=t},t.prototype.start=function(){var t=this;clearInterval(this.counterId),this.counterId=setInterval(function(){t.currentValue-=1,t.currentValue<=0&&(t.gh.gs.game3d.setLoseState(),t.stop());var e=t.currentValue/t.duration;t.bar.style.width=100*e+"%",t.label.innerHTML=t.currentValue},1e3)},t.prototype.stop=function(){clearInterval(this.counterId)},t.prototype.reset=function(){this.bar.style.width="100%"},t}),i("rs/bp3d/ui/GameScreenHeader",["rs/bp3d/ui/HeaderTimeButton","rs/bp3d/ui/HeaderLevelButton","rs/bp3d/ui/HeaderMoveButton","rs/bp3d/ui/DurationBar"],function(t,e,i,n){"use strict";function s(t){this.gs=t,this.init()}return s.prototype.init=function(){var s=this.el=document.createElement("div");s.className="rs-bp3d-gameheader",this.timeBtn=new t(this),this.levelBtn=new e(this),this.moveBtn=new i(this),this.dbar=new n(this),s.appendChild(this.dbar.el)},s.prototype.getClientSize=function(){return[this.el.clientWidth,this.el.clientHeight]},s.prototype.show=function(){anime({targets:this.el,top:4,easing:"easeOutQuint",duration:800})},s.prototype.hide=function(){anime({targets:this.el,top:-60,easing:"easeOutQuint",duration:800})},s}),i("rs/utils/ObjectUtil",[],function(){"use strict";var t={merge:function(t,e,i){for(var n in t)"[object Object]"===Object.prototype.toString.call(t[n])?(void 0===e[n]&&(e[n]={}),this.merge(t[n],e[n])):e[n]=t[n];return e},clone:function(e,i){var n={};return t.merge(e,n,i),n}};return t}),i("rs/game3d/Firework3DState",[],function(){"use strict";return{EXPLODED:0,FALLING:1,EXPIRED:2}}),i("rs/game3d/Firework3D",["rs/utils/ObjectUtil","rs/game3d/Firework3DState"],function(t,e){"use strict";function i(i){this.config={launchHeight:300,sphereRadius:200,color:16763904,size:72,numParticles:24},i=i||{},t.merge(i,this.config),this.state=e.EXPLODED,this.init()}var n=[16777215,16776960,14352128,16711844,15990528];return i.prototype=Object.create(THREE.Points.prototype),i.prototype.constructor=i,i.prototype.init=function(){THREE.Points.prototype.constructor.call(this);var t=this.config;this.geometry=new THREE.Geometry;for(var e=this.geometry.vertices,i=0;i<t.numParticles;i++){var s=new THREE.Vector3;s.tX=2*Math.random()*t.sphereRadius-t.sphereRadius+50,s.tY=2*Math.random()*t.sphereRadius-t.sphereRadius+50,s.tZ=2*Math.random()*t.sphereRadius-t.sphereRadius+50,e.push(s)}this.geometry.verticesNeedUpdate=!0;var o=n[Math.floor(Math.random()*n.length)];this.material=new THREE.PointsMaterial({size:t.size,color:o,opacity:1,transparent:!0,blending:THREE.AdditiveBlending,depthTest:!1,map:t.map}),this.material.needsUpdate=!0},i.prototype.setRegion=function(t,e){this.regionWidth=t,this.regionHeight=e},i.prototype.update=function(t){var i=this.geometry.vertices;if(this.state==e.EXPLODED){for(var n=0;n<i.length;n++){var s=i[n];s.x+=.1*(s.tX-s.x),s.y+=.1*(s.tY-s.y),s.z+=.1*(s.tZ-s.z)}Math.abs(s.tX-s.x)<5&&(this.state=e.FALLING)}else{for(var o=-80*t,n=0;n<i.length;n++){var s=i[n];s.vy+=o,s.y+=s.vy}this.material.opacity+=.025*(0-this.material.opacity),this.material.opacity<=.05&&this.reset()}this.geometry.verticesNeedUpdate=!0},i.prototype.reset=function(){if(this.regionWidth){this.position.x=Math.random()*this.regionWidth-.5*this.regionWidth;var t=this.regionHeight-this.config.launchHeight;this.position.y=Math.random()*t-.5*t}this.state=e.EXPLODED,this.material.opacity=1,this.material.color.set(n[Math.floor(Math.random()*n.length)]),this.rotation.z=0;for(var i=this.geometry.vertices,s=this.config,o=0;o<i.length;o++){var r=i[o];r.x=r.y=r.z=r.vy=0,r.tX=2*Math.random()*s.sphereRadius-s.sphereRadius+50,r.tY=2*Math.random()*s.sphereRadius-s.sphereRadius+50,r.tZ=2*Math.random()*s.sphereRadius-s.sphereRadius+50}this.geometry.verticesNeedUpdate=!0,this.material.needsUpdate=!0,s.callback&&s.callback.call(this)},i}),i("rs/game3d/Firework3DSet",["rs/utils/ObjectUtil","rs/game3d/Firework3D","rs/game3d/Firework3DState"],function(t,e,i){"use strict";function n(e,i){this.g3d=e,this.config={numFireworks:3,interval:500},i=i||{},t.merge(i,this.config),this.init()}return n.prototype=Object.create(THREE.Group.prototype),n.prototype.constructor=n,n.prototype.init=function(){THREE.Group.prototype.constructor.call(this);for(var t=this.config,i=this.g3d.gs.bp3d.assetManager.fwTexture,n=0;n<t.numFireworks;n++){var s=new e({map:i,callback:t.callback});this.add(s)}},n.prototype.update=function(t){for(var e=0;e<this.children.length;e++){this.children[e].update(t)}},n.prototype.changeRegion=function(t,e){this.children.forEach(function(i){i.setRegion(t,e)})},n.prototype.reset=function(){this.children.forEach(function(t){t.reset()})},n}),i("rs/bp3d/GameLight",[],function(){"use strict";function t(t){this.g3d=t,this.dopt=t.dopt,this.speed=this.dopt.lightMovingSpeed,this.init()}t.prototype=Object.create(THREE.Group.prototype),t.prototype.constructor=t;return t.prototype.init=function(){THREE.Group.prototype.constructor.call(this),this.bound=[300,400,10],this.dirX=1;var t=this.lights=[];t[0]=new THREE.PointLight(16777215,.85,0),t[1]=new THREE.PointLight(16777215,.85,0),t[0].position.set(-200,600,-400),t[0].oZ=-400,t[1].position.set(150,200,300),t[1].oZ=680,this.add(t[0]),this.add(t[1]);var e=(this.g3d.scene,new THREE.PointLightHelper(t[0],5),new THREE.PointLightHelper(t[1],20),new THREE.AmbientLight(this.dopt.ambientLight,.8));this.add(e)},t.prototype.animate=function(){this.lights[1].position.x+=this.dirX*this.speed;var t=this.lights[1].position.x;(t>.5*this.bound[0]||t<.5*-this.bound[0])&&(this.dirX=-this.dirX)},t.prototype.transition=function(){},t.prototype.setBound=function(t,e){this.bound=t;var i=this.lights[1];i.position.set(.5*t[0],0,i.oZ)},t}),i("rs/utils/ImageUtil",["rs/utils/ObjectUtil"],function(t){"use strict";return{createReflection:function(t,e){if(void 0===t)throw"Invalid input image";void 0===e&&(e=[0,.5,.4,.25,1,0]);var i=t.width,n=t.height,s=document.createElement("canvas");s.width=i,s.height=n;for(var o=s.getContext("2d"),r=o.createLinearGradient(0,0,0,n),a=.5*e.length,h=0;h<a;h++)r.addColorStop(e[2*h],"rgba(0, 0, 0, "+e[2*h+1]+")");o.fillStyle=r,o.fillRect(0,0,i,n),o.globalCompositeOperation="source-in",o.translate(0,t.height),o.scale(1,-1),o.drawImage(t,0,0);var l=document.createElement("img");return l.src=s.toDataURL(),l}}}),i("rs/bp3d/GrayscalePlane",[],function(){"use strict";function t(t){this.pb=t,this.init()}return t.prototype=Object.create(THREE.Group.prototype),t.prototype.constructor=t,t.prototype.init=function(){THREE.Group.prototype.constructor.call(this);var t=this.pb.dopt;this.mesh=new THREE.Mesh,this.add(this.mesh),this.mesh.geometry=new THREE.PlaneBufferGeometry(100,100);var e=new THREE.MeshPhongMaterial({specular:t.pieceSpecular,color:t.pieceColor,emissive:t.pieceEmissive,side:THREE.FrontSide});this.mesh.material=e,this.mesh.isGrayscale=!0,this.hcell=new THREE.Mesh,this.hcell.geometry=new THREE.PlaneBufferGeometry(10,10),this.hcell.material=new THREE.MeshBasicMaterial({color:16763904,opacity:.5,transparent:!0}),this.add(this.hcell),this.hcell.visible=!1,this.hcell.position.z=4},t.prototype.setImage=function(t){this.mesh.scale.set(t.width/100,t.height/100,1);for(var e=t.getContext("2d"),i=e.getImageData(0,0,t.width,t.height),n=i.data,s=0;s<n.length;s+=4){var o=.34*n[s]+.5*n[s+1]+.16*n[s+2];n[s]=o,n[s+1]=o,n[s+2]=o}var r=document.createElement("canvas");r.width=i.width,r.height=i.height;var a=r.getContext("2d");a.putImageData(i,0,0);for(var h=this.pb.row,l=this.pb.column,c=this.pb.segmentWidth,p=this.pb.segmentHeight,s=0;s<h;s++)a.moveTo(0,s*p),a.lineTo(i.width,s*p);for(var s=0;s<l;s++)a.moveTo(s*c,0),a.lineTo(s*c,i.height);a.lineWidth="2",a.strokeStyle="#111",a.stroke(),this.hcell.scale.set(c/10,p/10,1);var d=new THREE.CanvasTexture(r);this.mesh.material.map=d,this.mesh.material.needsUpdate=!0},t.prototype.highlightCell=function(t,e){var i=this.pb.imageWidth,n=this.pb.imageHeight,s=this.pb.segmentWidth,o=this.pb.segmentHeight,r=e*s-.5*i,a=.5*n-t*o;this.hcell.position.x=r+.5*s,this.hcell.position.y=a-.5*o,this.hcell.visible=!0},t.prototype.unHighLightCell=function(){this.hcell.visible=!1},t}),i("rs/bp3d/PuzzlePiece",[],function(){"use strict";function t(t){this.pb=t,this.init()}return t.prototype=Object.create(THREE.Mesh.prototype),t.prototype.constructor=t,t.prototype.init=function(){THREE.Mesh.prototype.constructor.call(this);var t=this.pb.dopt;this.bevelScale=t.bevelScale,this.geometry=new THREE.BoxGeometry(100,100,20),this.widh=this.height=100,this.depth=20,this.ou=0,this.ov=0,this.tu=1,this.tv=1,this.bd=this.bdv=.5*(1-this.bevelScale),this.bd1=this.bdv1=1-this.bd;var e=new THREE.MeshPhongMaterial({specular:t.pieceSpecular,color:t.pieceColor,emissive:t.pieceEmissive,side:THREE.FrontSide});this.material=e},t.prototype.modifyGeometry=function(t,e,i){this.width=t,this.height=e,this.depth=i;var n=this.geometry,s=n.vertices,o=.5*t,r=.5*e,a=.5*i,h=this.bevelScale,l=o*h,c=r*h;s[0].x=l,s[0].y=c,s[0].z=a,s[1].x=o,s[1].y=r,s[1].z=-a,s[2].x=l,s[2].y=-c,s[2].z=a,s[3].x=o,s[3].y=-r,s[3].z=-a,s[4].x=-o,s[4].y=r,s[4].z=-a,s[5].x=-l,s[5].y=c,s[5].z=a,s[6].x=-o,s[6].y=-r,s[6].z=-a,s[7].x=-l,s[7].y=-c,s[7].z=a,n.verticesNeedUpdate=!0;var n=this.geometry,p=n.faceVertexUvs[0],d=this.ou,u=this.ov,m=this.tu,g=this.tv,f=this.bd,v=this.bd1,y=this.bdv,b=this.bdv1;p[0][0].x=d+v,p[0][0].y=u+b,p[0][1].x=d+v,p[0][1].y=u+y,p[0][2].x=m,p[0][2].y=g,p[1][0].x=d+v,p[1][0].y=u+y,p[1][1].x=m,p[1][1].y=d,p[1][2].x=m,p[1][2].y=g,p[2][0].x=d,p[2][0].y=g,p[2][1].x=d,p[2][1].y=u,p[2][2].x=d+f,p[2][2].y=u+b,p[3][0].x=d,p[3][0].y=u,p[3][1].x=d+f,p[3][1].y=u+y,p[3][2].x=d+f,p[3][2].y=u+b,p[4][0].x=d,p[4][0].y=g,p[4][1].x=d+f,p[4][1].y=u+b,p[4][2].x=m,p[4][2].y=g,p[5][0].x=d+f,p[5][0].y=u+b,p[5][1].x=d+v,p[5][1].y=u+b,p[5][2].x=m,p[5][2].y=g,p[6][0].x=d+f,p[6][0].y=u+y,p[6][1].x=d,p[6][1].y=u,p[6][2].x=d+v,p[6][2].y=u+y,p[7][0].x=d,p[7][0].y=u,p[7][1].x=m,p[7][1].y=u,p[7][2].x=d+v,p[7][2].y=u+y,p[8][0].x=d+f,p[8][0].y=u+b,p[8][1].x=d+f,p[8][1].y=u+y,p[8][2].x=d+v,p[8][2].y=u+b,p[9][0].x=d+f,p[9][0].y=u+y,p[9][1].x=d+v,p[9][1].y=u+y,p[9][2].x=d+v,p[9][2].y=u+b,p[10][0].x=m,p[10][0].y=g,p[10][1].x=m,p[10][1].y=u,p[10][2].x=d,p[10][2].y=g,p[11][0].x=m,p[11][0].y=u,p[11][1].x=d,p[11][1].y=u,p[11][2].x=d,p[11][2].y=g,n.uvsNeedUpdate=!0},t.prototype.updateBevel=function(t){this.bevelScale=t,this.bd=.5*(1-this.bevelScale)*this.nhs,this.bd1=this.nhs-this.bd,this.bdv=.5*(1-this.bevelScale)*this.vhs,this.bdv1=this.vhs-this.bdv,this.modifyGeometry(this.width,this.height,this.depth)},t.prototype.tweenBevel=function(t){var e=this,i={value:this.bevelScale};e.updateBevel(t),anime({targets:i,value:t,easing:"easeOutQuint",duration:800,update:function(){e.updateBevel(i.value)}})},t.prototype.updateTexturePosition=function(t,e,i,n){this.index=t;var s=n.image.width,o=n.image.height,r=this.pb.dopt.pieceDepth,a=Math.floor(t/i),h=t%i,l=e-a-1,c=h,p=1/i,d=1/e,u=c*p,m=l*d,g=u+p,f=m+d;this.ou=u,this.ov=m,this.tu=g,this.tv=f,this.nhs=p,this.vhs=d,this.bd=.5*(1-this.bevelScale)*p,this.bd1=p-this.bd,this.bdv=.5*(1-this.bevelScale)*d,this.bdv1=d-this.bdv,this.modifyGeometry(s/i,o/e,r),this.setTexture(n)},t.prototype.setTexture=function(t){this.material.map=t,this.material.needsUpdate=!0},t.prototype.rmove=function(t,e){this.position.x=this.lastX+t/this.pb.rt,this.position.y=this.lastY+e/this.pb.rt,this.position.z=20},t.prototype.saveLastPosition=function(){this.lastX=this.position.x,this.lastY=this.position.y},t}),i("rs/bp3d/PuzzlePiecePool",["rs/bp3d/PuzzlePiece"],function(t){"use strict";function e(t){this.pb=t,this.init()}return e.prototype.init=function(){this.pool=[];for(var e=this.pb,i=0;i<10;i++){var n=new t(e);this.pool.push(n)}},e.prototype.obtain=function(){if(this.pool.length>0){var e=this.pool.pop();return e}var e=new t(this.pb);return e},e.prototype.free=function(t){this.pool.push(t)},e}),i("rs/bp3d/PuzzleBoard",["rs/bp3d/GrayscalePlane","rs/bp3d/PuzzlePiece","rs/bp3d/PuzzlePiecePool"],function(t,e,i){"use strict";function n(t){this.g3d=t,this.dopt=t.dopt,this.init()}return n.prototype=Object.create(THREE.Group.prototype),n.prototype.constructor=n,n.prototype.init=function(){function e(){var t=new THREE.BoxBufferGeometry(10,10,10),e=new THREE.MeshPhongMaterial({specular:n.pieceSpecular,color:n.pieceColor,emissive:n.pieceEmissive,side:THREE.FrontSide}),i=new THREE.Mesh(t,e);return s.add(i),i}THREE.Group.prototype.constructor.call(this);var n=this.dopt,s=(this.g3d.bp3d.assetManager,this);this.pool=new i(this),this.pieces=[],this.topBoard=e(),this.leftBoard=e(),this.rightBoard=e(),this.bottomBoard=e(),this.backBoard=e(),this.gsPlane=new t(this),this.add(this.gsPlane),this.visible=!1},n.prototype.applyImage=function(t,e,i,n){var s=new THREE.TextureLoader,o=this,r=this.pool;this.row=e,this.column=i,s.load(t,function(t){var s,a,h=o.pieces,l=t.image.width,c=t.image.height,p=l/i,d=c/e;p>d?(s=p*i,a=p*e,d=p):(a=d*e,s=d*i,p=d),o.imageWidth=s,o.imageHeight=a,o.segmentWidth=p,o.segmentHeight=d;var u=o.prepareImage(t.image,s,a),m=new THREE.CanvasTexture(u);o.gsPlane.setImage(u);for(var g=e*i,f=0;f<g;f++){var v;h[f]?v=h[f]:(v=r.obtain(),h.push(v),o.add(v)),v.bevelScale=o.dopt.bevelScale,v.updateTexturePosition(f,e,i,m)}for(var f=g;f<h.length;f++){var v=h[f];o.remove(v),r.free(v)}h.splice(g),o.arrangePieces(),o.arrangeBoard(),o.visible=!0;var y=o.g3d.bp3d.assetManager,b=y.boardTextures[Math.floor(Math.random()*y.boardTextures.length)];o.updateBoardTexture(b),o.unHighLightCell(),n&&n.call(o.g3d)})},n.prototype.getPaddingPattern=function(){var t=this.g3d.bp3d.assetManager.padSet;return t[Math.floor(Math.random()*t.length)]},n.prototype.arrangePieces=function(){this.parray=[],this.moveStack=[];for(var t=0;t<this.pieces.length;t++){var e=this.pieces[t],i=Math.floor(t/this.column),n=t%this.column,s=this.calPosition(i,n);e.position.set(s[0],s[1],0),e.visible=!0,e.pindex=t,e.tindex=-1,this.parray.push(t)}this.downItem=null,this.icell=this.jcell=-1,this.tracking=[]},n.prototype.calPosition=function(t,e,i){function n(t){return Math.abs(t)<1e-4?0:t}var s=this.imageWidth,o=this.imageHeight;void 0==i&&(i=0);var r=s/this.column+i,a=s-r,h=o-r,l=.5*-a,c=.5*h,p=l+e*r,d=c-t*r;return p=n(p),d=n(d),[p,d]},n.prototype.updateBoardTexture=function(t){this.topBoard.material.map=t,this.topBoard.material.needsUpdate=!0,this.bottomBoard.material.map=t,this.bottomBoard.material.needsUpdate=!0,this.leftBoard.material.map=t,this.leftBoard.material.needsUpdate=!0,this.rightBoard.material.map=t,this.rightBoard.material.needsUpdate=!0,this.backBoard.material.map=t,this.backBoard.material.needsUpdate=!0},n.prototype.prepareImage=function(t,e,i){var n=(this.dopt,this.getPaddingPattern()),s=document.createElement("canvas");s.width=e,s.height=i;var o=s.getContext("2d"),r=t.width/t.height;e/r>i?(t.height=i,t.width=i*r):(t.width=e,t.height=e/r);var a=.5*(e-t.width),h=.5*(i-t.height),l=o.createPattern(n,"repeat");return o.fillStyle=l,o.fillRect(0,0,e,i),o.drawImage(t,a,h,t.width,t.height),s},n.prototype.arrangeBoard=function(){var t=this.dopt,e=t.boardThickness,i=t.boardDepth,n=this.imageWidth,s=this.imageHeight,o=n+2*e,r=e,a=t.pieceDepth+i;this.topBoard.scale.set(o/10,r/10,a/10),this.topBoard.position.set(0,.5*s+.5*e,.5*-i),this.bottomBoard.scale.set(o/10,r/10,a/10),this.bottomBoard.position.set(0,.5*-s-.5*e,.5*-i),o=e,r=s,this.leftBoard.scale.set(o/10,r/10,a/10),this.leftBoard.position.set(.5*-n-.5*e,0,.5*-i),this.rightBoard.scale.set(o/10,r/10,a/10),this.rightBoard.position.set(.5*n+.5*e,0,.5*-i),this.backBoard.scale.set(n/10,s/10,i/10),this.backBoard.position.set(0,0,.5*-a)},n.prototype.getScaleFitPosition=function(t,e){var i,n=this.dopt,s=this.getBound(),o=s[0],r=s[1],a=s[2],h=n.fitFactor||.98,l=o/r;i=t/l>e?e*h/r:t*h/o,this.rt=i;var c=this.g3d.camera.position.z;return c-c/i-.5*a},n.prototype.getBound=function(){var t=this.dopt,e=this.imageWidth,i=this.imageHeight;return[e+2*t.boardThickness+2*this.segmentWidth,i+2*t.boardThickness+2*this.segmentHeight,t.pieceDepth+t.boardDepth]},n.prototype.shuffleBlock=function(){for(var t=(this.row,this.column,[]),e=(this.dopt.boardThickness,-1);e<this.column+1;e++)t.push({i:-1,j:e});for(var e=-1;e<this.column+1;e++)t.push({i:this.row,j:e});for(var i=0;i<this.row;i++)t.push({i:i,j:-1});for(var i=0;i<this.row;i++)t.push({i:i,j:this.column});!function(t){for(var e=t.length-1;e>0;e--){var i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}}(t);for(var n=0;n<this.pieces.length;n++){var s=this.pieces[n],i=t[n].i,e=t[n].j,o=this.calPosition(i,e),r=o[0],a=o[1];s.tX=r,s.tY=a,s.tindex=-1,anime({targets:s.position,keyframes:[{z:600*Math.random()+25},{z:0,x:r,y:a}],easing:"easeOutQuint",duration:1200,delay:250})}},n.prototype.isWon=function(){for(var t=0;t<this.pieces.length;t++){var e=this.pieces[t];if(e.pindex!==e.tindex)return!1}return!0},n.prototype.tweenBevel=function(t){for(var e=0;e<this.pieces.length;e++){this.pieces[e].tweenBevel(t)}},n.prototype.completeBoard=function(){this.tweenBevel(1),anime({targets:this.rotation,y:[0,Math.PI/6,-Math.PI/6,0],easing:"easeOutQuad",delay:200,duration:1e3})},n.prototype.detectCell=function(t,e){var i=t/this.imageWidth+.5,n=.5-e/this.imageHeight,s=Math.floor(i*this.column),o=Math.floor(n*this.row);this.gsPlane.highlightCell(o,s),this.icell=o,this.jcell=s},n.prototype.unHighLightCell=function(){this.icell=-1,this.jcell=-1,this.gsPlane.unHighLightCell()},n.prototype.attachItem=function(t){var e=this.icell*this.column+this.jcell;if(this.tracking.includes(e))return this.unHighLightCell(),void this.releaseItem(t);if(-1!==t.tindex){var i=this.tracking.indexOf(t.tindex);i>=0&&this.tracking.splice(i,1)}var n=this.calPosition(this.icell,this.jcell);anime.remove(t.position),anime({targets:t.position,x:n[0],y:n[1],z:0,duration:800}),t.tindex=e,this.tracking.push(e)},n.prototype.releaseItem=function(t){if(-1!==t.tindex){var e=this.tracking.indexOf(t.tindex);e>=0&&this.tracking.splice(e,1)}anime.remove(t.position),anime({targets:t.position,x:t.tX,y:t.tY,z:0,duration:800})},n}),i("rs/bp3d/Game3dContainer",["rs/utils/ImageUtil","rs/bp3d/PuzzleBoard","rs/bp3d/GameLight"],function(t,e,i){"use strict";function n(t){this.g3d=t,this.init()}n.prototype=Object.create(THREE.Group.prototype),n.prototype.constructor=n;return n.prototype.init=function(){THREE.Group.prototype.constructor.call(this),this.puzzleBoard=new e(this.g3d),this.add(this.puzzleBoard);var t=this.glight=new i(this.g3d);this.add(t)},n.prototype.fitPuzzleBoard=function(){var t=this.g3d.gs,e=(this.g3d.dopt,t.header.getClientSize()),i=t.bbar.getClientSize(),n=this.g3d.el.clientHeight,s=this.g3d.el.clientWidth,o=s,r=n-e[1]-i[1]-10;this.g3d.setCameraMatchProjection();var a=this.puzzleBoard.getScaleFitPosition(o,r);this.position.z=a,this.glight.setBound(this.puzzleBoard.getBound())},n.prototype.show=function(){this.visible=!1,this.fitPuzzleBoard();this.position.z;this.rotation.x=-Math.PI/3;var t=this;this.scale.set(.01,.01,.01),anime.remove(this.scale),anime({targets:this.scale,x:1,y:1,z:1,easing:"easeOutQuad",duration:1200}),anime.remove(this.rotation),anime({targets:this.rotation,x:0,easing:"easeOutCubic",duration:1500,complete:function(){setTimeout(function(){t.g3d.shuffle(),t.g3d.gs.startCounter()},300)}}),setTimeout(function(){t.visible=!0},140)},n.prototype.shuffle=function(){var t=this.position.z,e=this.position.z-400,i=this.g3d.bp3d.assetManager;this.isShuffling=!0;var n=this;setTimeout(function(){i.shufflestart.play()},250),setTimeout(function(){i.shuffleend.play()},1e3),anime({targets:this.position,keyframes:[{z:e,duration:1200},{z:t,delay:100,duration:1e3}],easing:"easeOutQuint",duration:1200,complete:function(){n.isShuffling=!1}}),anime({targets:this.rotation,keyframes:[{x:-Math.PI/3,duration:1200},{x:0,delay:100,duration:1200}],easing:"easeOutQuint"}),this.puzzleBoard.shuffleBlock()},n.prototype.setLoseState=function(){anime.remove(this.rotation),anime({targets:this.rotation,x:-Math.PI/3,easing:"easeOutQuint",duration:800});var t=this.position.z-400;anime.remove(this.position),anime({targets:this.position,z:t,easing:"easeOutQuint",duration:800})},n}),i("rs/bp3d/Game3d",["rs/three/BaseApp","rs/utils/ObjectUtil","rs/utils/BrowserUtil","rs/game3d/Firework3DSet","rs/bp3d/GameLight","rs/bp3d/Game3dContainer"],function(t,e,i,n,s,o){"use strict";function r(e){this.gs=e,this.config=e.config,this.bp3d=e.bp3d,this.dopt=this.bp3d.defaultOptions,this.am=this.bp3d.assetManager;t.prototype.constructor.call(this,500,300),this.setCameraMatchProjection(),this.defaultCursor="auto",this.buildScene()}r.prototype=Object.create(t.prototype),r.prototype.constructor=r;var a={RUNNING:0,WON:1,LOSE:2};return r.prototype.enableOrbitControl=function(){this.controls=new OrbitControls(this.camera,this.el),this.controls.enableDamping=!0},r.prototype.buildScene=function(){this.container=new o(this),this.clock=new THREE.Clock;var t=this.scene;t.add(this.container);var e=this.am;this.f3ds=new n(this,{numParticles:3,callback:function(){e.firework.play()}}),t.add(this.f3ds),this.setRunningState(),this._setUpRaycaster(),this.resizeHandler()},r.prototype._setUpRaycaster=function(){function t(t){var e,i;t.touches?(e=t.touches[0].clientX,i=t.touches[0].clientY):t.changedTouches?(e=t.changedTouches[0].clientX,i=t.changedTouches[0].clientY):(e=t.offsetX,i=t.offsetY);var a={x:e/c.width*2-1,y:-i/c.height*2+1};r.setFromCamera(a,o);for(var u=r.intersectObjects(h.children,!0),m=0;m<u.length;m++){var g=u[m].object;if(t.type==d.mdown&&void 0!==g.index&&-1!==g.index&&c.isRunningState()&&(p.downItem=g,p.unHighLightCell(),g.saveLastPosition(),n=e,s=i),t.type==d.mmove&&(void 0!==g.index?l.style.cursor="grab":l.style.cursor=c.defaultCursor,p.downItem)){var f=e-n,v=-i+s;if(p.downItem.rmove(f,v),u[m+1]){var y=u[m+1];y.object.isGrayscale&&p.detectCell(y.point.x,y.point.y)}else p.unHighLightCell()}break}0==u.length&&t.type==d.mmove&&(l.style.cursor=c.defaultCursor)}function e(t){null!=p.downItem&&(-1==p.icell?p.releaseItem(p.downItem):p.attachItem(p.downItem),p.downItem=null,c.state==a.RUNNING&&p.isWon()&&(p.completeBoard(),c.setWonState()))}var n,s,o=this.camera,r=this.raycaster,h=this.container,l=this.el,c=this,p=(this.am,this.container.puzzleBoard),d=i.getMouseTouchEvents();l.addEventListener(d.mdown,t),l.addEventListener(d.mmove,t),l.addEventListener(d.mup,e)},r.prototype.loadLevel=function(t,e){this.setRunningState();var i=this.gs.levels[this.gs.currentCategory];t==i.content.length&&(t=0);var n=i.content[t],s=n.board.split("x"),o=Number.parseInt(s[0]),r=Number.parseInt(s[1]),a=this;this.container.visible=!1,this.gs.header.dbar.setDuration(n.duration),this.container.puzzleBoard.applyImage(n.path,o,r,function(){a.container.show(),e.call(a)})},r.prototype._renderRequest=function(){t.prototype._renderRequest.call(this);var e=this.clock.getDelta();this.controls&&this.controls.update(),this.container.glight.animate(),this.state==a.WON&&this.f3ds.update(e)},r.prototype.setRunningState=function(){this.state=a.RUNNING,this.f3ds.visible=!1,this.gs.header.show()},r.prototype.isRunningState=function(){return this.state==a.RUNNING},r.prototype.setWonState=function(){this.state===a.RUNNING&&(this.state=a.WON,this.gs.stopCounter(),this.f3ds.visible=!0,this.f3ds.reset(),this.gs.header.timeBtn.pause(),this.gs.header.hide(),this.gs.showWonBar(),this.am.wintune.play(),this.gs.unlockNextLevel())},r.prototype.setLoseState=function(){this.state===a.RUNNING&&(this.state=a.LOSE,this.container.setLoseState(),this.gs.header.timeBtn.pause(),this.gs.header.hide(),this.gs.showLoseBar(),this.am.losetune.play())},r.prototype.resize=function(t,e){this.width=t,this.height=e,this.camera.aspect=t/e,this.camera.updateProjectionMatrix(),this.renderer.setSize(t,e),this.resizeHandler(),this.container.fitPuzzleBoard(),this.f3ds.changeRegion(t,e)},r.prototype.resizeHandler=function(e){t.prototype.resizeHandler.call(this),this.setCameraMatchProjection()},r.prototype.show=function(){this.el.style.display="block"},r.prototype.hide=function(){this.el.style.display="none"},r.prototype.shuffle=function(){this.isRunningState()&&(this.container.isShuffling||(this.container.shuffle(),this.gs.reset()))},r.prototype.destroy=function(){},r}),i("rs/bp3d/screen/GameScreen",["rs/game/ImagePanel","rs/bp3d/ui/TrophyPanel","rs/bp3d/ui/LevelPanel","rs/bp3d/ui/CategoryPanel","rs/bp3d/ui/HelpPanel","rs/bp3d/ui/GameScreenButtonBar","rs/bp3d/ui/GameScreenWonBar","rs/bp3d/ui/GameScreenLoseBar","rs/bp3d/ui/GameScreenHeader","rs/bp3d/Game3d"],function(t,e,i,n,s,o,r,a,h,l){"use strict";function c(t,e){this.bp3d=t,this.config=t.config,this.init()}return c.prototype.init=function(){var t=this.el=document.createElement("div");t.className="rs-gscreen",t.style.width=t.style.height="100%",t.style.display="none";var e=this.config.data.level;this.levels=[];for(var i in e)this.levels.push({name:i,content:e[i]});this.initPanel(),this.header=new h(this),t.appendChild(this.header.el),this.bbar=new o(this),t.appendChild(this.bbar.el),this.wbar=new r(this),t.appendChild(this.wbar.el),this.lbar=new a(this),t.appendChild(this.lbar.el),this.game3d=new l(this),t.appendChild(this.game3d.el),this.currentLevel=0},c.prototype.initPanel=function(){this.imagePanel=new t,this.trophyPanel=new e(this),this.levelPanel=new i(this),this.catPanel=new n(this),this.bp3d.homeScreen?this.hpanel=this.bp3d.homeScreen.hpanel:this.hpanel=new s},c.prototype.loadLevel=function(t){function e(){i.bp3d.hidePreloader(),i.reset(),i.header.levelBtn.setLevel(t+1),i.header.timeBtn.resume()}var i=this;this.trophyPanel.hide(),this.levelPanel.hide(),this.catPanel.hide(),this.wbar.hide(),this.lbar.hide(),this.stopCounter(),this.showButtonBar(),this.bp3d.showPreloader(),this.game3d.loadLevel(t,e),this.currentLevel=t},c.prototype.loadCategory=function(t){this.currentCategory=t,this.loadLevel(0)},c.prototype.replayLevel=function(){this.loadLevel(this.currentLevel)},c.prototype.nextLevel=function(){var t=this.currentLevel+1;t==this.levels[this.currentCategory].content.length&&(t=0),this.loadLevel(t)},c.prototype.unlockNextLevel=function(){var t=this.currentLevel+1,e=this.levels[this.currentCategory];t<e.content.length&&this.bp3d.pref.saveUnlock(e.name,t)},c.prototype.getCurrentImagePath=function(){var t=this.levels[this.currentCategory],e=t.content[this.currentLevel].path;return void 0==e&&(e=this.game3d.container.puzzleBoard.dataUrl),e},c.prototype.reset=function(){this.header.timeBtn.reset(),this.header.moveBtn.reset(),this.header.dbar.reset()},c.prototype.show=function(t){this.currentCategory=0,this.bp3d.root.appendChild(this.el),this.transitionIn();var e=this.bp3d.getAppDimension();this.game3d.resize(e[0],e[1]),this.game3d.startRendering(),void 0==t&&(t=0),this.loadLevel(t)},c.prototype.hide=function(){this.bp3d.root.removeChild(this.el),this.game3d.stopRendering()},c.prototype.showWonBar=function(){this.bbar.hide();var t=this.wbar;setTimeout(function(){t.show("Level Passed")},400)},c.prototype.showLoseBar=function(){this.bbar.hide();var t=this.lbar;setTimeout(function(){t.show("Time out")},400)},c.prototype.showButtonBar=function(){this.wbar.hide();var t=this.bbar;setTimeout(function(){t.show()},400)},c.prototype.transitionIn=function(){this.el.style.display="block"},c.prototype.transitionOut=function(){},c.prototype.getMoveCount=function(){return this.header.moveBtn.count},c.prototype.getPlayingTime=function(){return this.header.timeBtn.currentTime},c.prototype.resize=function(t,e){this.game3d.resize(t,e)},c.prototype.startCounter=function(){this.header.dbar.start()},c.prototype.stopCounter=function(){this.header.dbar.stop()},c.prototype.dispose=function(){},c}),i("rs/bp3d/screen/LevelScreen",[],function(){"use strict";function t(t,e){this.bp3d=t,this.config=t.config,this.init()}return t.prototype.init=function(){var t=this.el=document.createElement("div");t.className="rs-lscreen",t.style.width=t.style.height="100%",t.style.display="none",this.bp3d.root.appendChild(t)},t.prototype.show=function(){},t.prototype.hide=function(){},t.prototype.resize=function(){},t}),i("rs/utils/MouseUtil",["rs/utils/BrowserUtil"],function(t){"use strict";function e(t){t.preventDefault(),t.currentTarget.mouseWheelCallback.call(t.currentTarget.mousewheelContext,Math.max(-1,Math.min(1,t.wheelDelta||-t.detail)))}return{touchClick:function(e,i){t.isMobile()?e.addEventListener("touchstart",i):e.addEventListener("click",i)},removeTouchClick:function(e,i){t.isMobile()?e.removeEventListener("touchstart",i):e.removeEventListener("click",i)},startMouseWheel:function(t,i,n){t.mouseWheelCallback=i,t.mousewheelContext=n,t.addEventListener("DOMMouseScroll",e,!1),t.addEventListener("mousewheel",e,!1)},stopMouseWheel:function(t){t.removeEventListener("DOMMouseScroll",e),t.removeEventListener("mousewheel",e)},swipeStart:function(e,i,n,s,o){function r(t){u=t.clientX,m=t.clientY,g=(new Date).getTime(),e.addEventListener("mousemove",h),window.addEventListener("mouseup",l)}function a(t){e.removeEventListener("mousemove",h),window.removeEventListener("mouseup",l),e.removeEventListener("mouseout",a)}function h(e){var i=e.clientX-u,r=e.clientY-m;t.swipeState="move",Math.abs(i)>Math.abs(r)?s(i*n):o(r*n)}function l(t){e.removeEventListener("mousemove",h),window.removeEventListener("mouseup",l)}function c(t){u=t.touches[0].clientX,m=t.touches[0].clientY,g=(new Date).getTime(),e.addEventListener("touchmove",p),window.addEventListener("touchend",d)}function p(e){e.preventDefault();var i=e.changedTouches[0].clientX-u,r=e.changedTouches[0].clientY-m;t.swipeState="move",Math.abs(i)>Math.abs(r)?s(i*n):o(r*n)}function d(t){e.removeEventListener("touchmove",p),window.removeEventListener("touchend",d)}var u,m,g;e.style[t.getPrefix()+"UserSelect"]="none",e.removeTracking=function(){e.removeEventListener("mousedown",r),window.removeEventListener("mouseup",l),e.removeEventListener("mousemove",h),e.removeEventListener("mouseout",a),e.removeEventListener("touchstart",c),e.removeEventListener("touchend",d),e.removeEventListener("touchmove",p),e.removeTracking=null},t.isMobile()?e.addEventListener("touchstart",c):e.addEventListener("mousedown",r)},swipeStop:function(e){e.style[t.getPrefix()+"UserSelect"]="all",e.removeTracking&&e.removeTracking()}}}), i("rs/bp3d/FullscreenButton",["rs/utils/BrowserUtil","rs/utils/MouseUtil"],function(t,e){"use strict";function i(t,e){this.targetEl=t,this.build("icon-screen-full",e)}return i.prototype.build=function(i,n){var s=this,o=this.targetEl,r=this.el=document.createElement("span");r.className=i+" rs-bp3d-fsbtn",e.touchClick(r,function(e){t.isFullscreen()?t.exitFullscreen(o):t.goFullscreen(o)}),t.fullScreenCallback(o,function(){t.isFullscreen()?s.setFull():s.setNormal(),n.call(o)})},i.prototype.setFull=function(){this.el.classList.remove("icon-screen-full"),this.el.classList.add("icon-screen-normal")},i.prototype.setNormal=function(){this.el.classList.remove("icon-screen-normal"),this.el.classList.add("icon-screen-full")},i}),i("rs/ui/RingPreloader",["rs/utils/ObjectUtil"],function(t){"use strict";function e(e){this.dopt={size:40,borderWidth:6,borderColor:"#AAA"},t.merge(e,this.dopt),this.build()}return e.prototype.build=function(){var t=this.dopt,e=this.el=document.createElement("div");e.className="rs-ringpreloader",e.innerHTML="<div class='lds-ring'><div></div><div></div><div></div><div></div></div>",e.style.marginLeft=e.style.marginTop=.5*-t.size+"px";for(var i=e.firstChild.children,n=0;n<i.length;n++){var s=i[n].style;s.width=s.height=t.size+"px",s.borderWidth=t.borderWidth+"px",s.borderTopColor=t.borderColor}},e.prototype.show=function(){this.el.style.display="block"},e.prototype.hide=function(){this.el.style.display="none"},e}),i("rs/bp3d/BlockPuzzle",["rs/three/BaseApp","rs/bp3d/Preferences","rs/bp3d/AssetManager","rs/bp3d/screen/HomeScreen","rs/bp3d/screen/GameScreen","rs/bp3d/screen/LevelScreen","rs/bp3d/FullscreenButton","rs/ui/RingPreloader","rs/utils/ObjectUtil","rs/utils/MouseUtil","rs/utils/BrowserUtil"],function(t,e,i,n,s,o,r,a,h,l,c){"use strict";function p(t,e){this.loadConfig(),this.isMobile=c.isMobile(),this.isMobile?(d="touchstart",u="touchend",m="touchmove"):(d="mousedown",u="mouseup",m="mousemove"),this.mevents={mdown:d,mup:u,mmove:m},this.defaultOptions={bevelScale:.96,pieceDepth:22,pieceSpecular:657930,pieceEmissive:65793,pieceColor:16777215,boardThickness:1,boardDepth:16,boardMaxWidth:780,boardMaxHeight:780,fitFactor:.95,ambientLight:5592405,lightMovingSpeed:3},e=e||{},h.merge(e,this.defaultOptions),this.root=t,c.css(this.root,{position:"relative",display:"block",overflow:"hidden"});var i=this;window.addEventListener("resize",function(t){i.resize()}),document.body.addEventListener("click",function(t){})}var d,u,m;c.getPrefix();return p.prototype.loadConfig=function(){var t=this,e=new XMLHttpRequest;e.addEventListener("load",function(e){var i=JSON.parse(this.response);t.config=i,t.initComponents()}),e.open("GET","config.json"),e.send()},p.prototype.initComponents=function(){var t=this;this.defaultOptions,this.config;this.initPreferences(),this.initPreloader(),this.activeScreen=null,this.assetManager=new i(this),this.setHomeScreen(),setTimeout(function(){t.resize()},200)},p.prototype.initPreferences=function(){this.pref=new e(this.config,localStorage.getItem("bp3d"))},p.prototype.initPreloader=function(){var t=new a({borderColor:"#ccc"}),e=t.el;this.preloader=e,e.style.top="50%"},p.prototype.showPreloader=function(){this.root.appendChild(this.preloader)},p.prototype.hidePreloader=function(){this.root.contains(this.preloader)&&this.root.removeChild(this.preloader)},p.prototype.initFullcreen=function(){this.fsbtn=new r(this.root,function(t){console.log("fullsceen change")}),this.root.appendChild(this.fsbtn.el)},p.prototype.addEventListener=function(t,e){this.root.addEventListener(t,e)},p.prototype.setScreen=function(t){this.activeScreen&&this.activeScreen.hide(),t.show(),this.activeScreen=t},p.prototype.setGameScreen=function(){this.gameScreen||(this.gameScreen=new s(this)),this.setScreen(this.gameScreen)},p.prototype.setHomeScreen=function(){this.homeScreen||(this.homeScreen=new n(this)),this.setScreen(this.homeScreen)},p.prototype.dispose=function(){},p.prototype.resize=function(){var t=this.getAppDimension(),e=t[0],i=t[1];this.activeScreen&&this.activeScreen.resize(e,i)},p.prototype.getAppDimension=function(){var t=c.computeStyle,e=t(this.root,"borderTopWidth");return[t(this.root,"width")-2*e,t(this.root,"height")-2*e]},p}),window.BlockPuzzle=e("rs/bp3d/BlockPuzzle")}();
| ver. 1.4 |
Github
|
.
| PHP 8.2.29 | Генераци� �траницы: 0 |
proxy
|
phpinfo
|
�а�тройка