diff --git a/libs/core.min.js b/libs/core.min.js deleted file mode 100644 index 1e60e949..00000000 --- a/libs/core.min.js +++ /dev/null @@ -1 +0,0 @@ -function core(){this.dom={};this.statusBar={};this.canvas={};this.images=[];this.sounds={};this.firstData={};this.material={images:{},sounds:{},ground:null,items:{},enemys:{},icons:{},events:{},npcs:{}};this.timeout={getItemTipTimeout:null};this.interval={twoAnimate:null,fourAnimate:null,boxAnimate:null,heroMoveTriggerInterval:null,heroMoveInterval:null,heroAutoMoveScan:null,tipAnimate:null,openDoorAnimate:null};this.musicStatus={isIOS:false,loaded:false,bgmStatus:false,soundStatus:true,playedSound:null,playedBgm:null};this.position={gameGroup:{},canvas:{},statusBar:{},toolBar:{},items:{},scale:1,screenMode:"bigScreen"};this.initStatus={played:false,hero:{id:"",name:"",hp:0,atk:0,def:0,mdef:0,money:0,experience:0,loc:{direction:"down",x:0,y:0},flyRange:[],items:[]},floorId:null,thisMap:null,maps:null,heroMoving:false,heroStop:true,lockControl:false,autoHeroMove:false,automaticRouting:false,automaticRouted:false,autoStep:0,movedStep:0,destStep:0,automaticRoutingTemp:{destX:0,destY:0,moveStep:[]},autoStepRoutes:[],holdingPath:0,stepPostfix:[],mouseOutCheck:1,moveStepBeforeStop:[],savePage:null,shops:{},npcs:{},event:{id:null,data:null},openingDoor:null,twoAnimateObjs:[],fourAnimateObjs:[],boxAnimateObjs:[]};this.status={};this.flags={}}core.prototype.init=function(h,c,d,b,a,f){core.dom=h;core.statusBar=c;core.canvas=d;core.images=b;core.sounds=a;for(var e in f){core[e]=f[e]}core.firstData=core.data.getFirstData();core.initStatus.shops=core.firstData.shops;core.initStatus.npcs=core.firstData.npcs;core.dom.versionLabel.innerHTML=core.firstData.version;core.material.items=core.items.getItems();core.initStatus.maps=core.maps.getMaps();core.material.enemys=core.clone(core.enemys.getEnemys());core.material.icons=core.icons.getIcons();core.material.events=core.events.getEvents();core.material.npcs=core.npcs.getNpcs();core.flags=core.data.flags;core.musicStatus.soundStatus=core.getLocalStorage("soundStatus",true);var g=navigator.userAgent;if(g.indexOf("iPhone")>-1||g.indexOf("iPad")>-1){console.log("你的设备为iphone,不自动播放音乐!");core.musicStatus.isIOS=true;core.musicStatus.soundStatus=false}core.material.ground=new Image();core.material.ground.src="images/ground.png";core.loader(function(){console.log(core.material);core.showStartAnimate(function(){})})};core.prototype.showStartAnimate=function(c){core.dom.startPanel.style.opacity=1;core.dom.startPanel.style.display="block";core.dom.startTop.style.opacity=1;core.dom.startTop.style.display="block";core.dom.startButtonGroup.style.display="none";core.dom.startButtons.style.display="block";core.dom.levelChooseButtons.style.display="none";core.status.played=false;core.clearStatus();core.clearMap("all");var b=1;var a=window.setInterval(function(){b-=0.03;if(b<0){clearInterval(a);core.dom.startTop.style.display="none";core.dom.startButtonGroup.style.display="block";if(core.isset(c)){c()}}core.dom.startTop.style.opacity=b},20)};core.prototype.hideStartAnimate=function(c){var b=1;var a=window.setInterval(function(){b-=0.03;if(b<0){clearInterval(a);core.dom.startPanel.style.display="none";c()}core.dom.startPanel.style.opacity=b},20)};core.prototype.setStartProgressVal=function(a){core.dom.startTopProgress.style.width=a+"%"};core.prototype.setStartLoadTipText=function(a){core.dom.startTopLoadTips.innerHTML=a};core.prototype.loader=function(g){var e=0,a=0,f=0,d=0;a=core.images.length;for(var c in core.sounds){d+=core.sounds[c].length}for(var b=0;b0){return}core.musicStatus.bgmStatus=1;if(core.musicStatus.soundStatus){core.playBgm("bgm","mp3")}return}var a=b.shift();a.oncanplay=function(){core.loadSoundItem(b)};a.load()};core.prototype.isPlaying=function(){if(core.isset(core.status.played)&&core.status.played){return true}return false};core.prototype.clearStatus=function(){for(var a in core.interval){clearInterval(core.interval[a])}core.status={};core.clearStatusBar();core.resize(main.dom.body.clientWidth,main.dom.body.clientHeight)};core.prototype.resetStatus=function(c,e,b,d){for(var a in core.interval){clearInterval(core.interval[a])}core.status=core.clone(core.initStatus);core.status.played=true;core.status.floorId=b;core.status.maps=core.clone(d);core.material.enemys=core.clone(core.enemys.getEnemys());core.status.hero=core.clone(c);core.status.hard=e;core.status.savePage=core.getLocalStorage("savePage",0);core.resize(main.dom.body.clientWidth,main.dom.body.clientHeight)};core.prototype.startGame=function(b,a){console.log("开始游戏");core.resetStatus(core.firstData.hero,b,core.firstData.floorId,core.initStatus.maps);core.changeFloor(core.status.floorId,null,core.firstData.hero.loc,function(){core.setHeroMoveTriggerInterval();if(core.isset(a)){a()}})};core.prototype.restart=function(){core.showStartAnimate()};core.prototype.keyDown=function(a){if(!core.status.played){return}if(core.status.automaticRouting||core.status.automaticRouted){core.stopAutomaticRoute()}if(core.status.lockControl){if(core.status.event.id=="book"){if(a.keyCode==37){core.ui.drawEnemyBook(core.status.event.data-1)}else{if(a.keyCode==39){core.ui.drawEnemyBook(core.status.event.data+1)}}return}if(core.status.event.id=="fly"){if(a.keyCode==38){core.ui.drawFly(core.status.event.data+1)}else{if(a.keyCode==40){core.ui.drawFly(core.status.event.data-1)}}return}if(core.status.event.id=="save"||core.status.event.id=="load"){if(a.keyCode==37){core.ui.drawSLPanel(core.status.event.data-1)}else{if(a.keyCode==39){core.ui.drawSLPanel(core.status.event.data+1)}}return}return}switch(a.keyCode){case 37:core.moveHero("left");break;case 38:core.moveHero("up");break;case 39:core.moveHero("right");break;case 40:core.moveHero("down");break}};core.prototype.keyUp=function(d){if(!core.status.played){return}if(core.status.lockControl){if(core.status.event.id=="book"&&(d.keyCode==27||d.keyCode==88)){core.ui.closePanel(true)}if(core.status.event.id=="fly"&&(d.keyCode==71||d.keyCode==27)){core.ui.closePanel()}if(core.status.event.id=="fly"&&d.keyCode==13){var a=core.status.hero.flyRange.indexOf(core.status.floorId);var c=core.status.event.dataa){c=d;a=f[d]}}g=[{x:0,y:1},{x:-1,y:0},{x:0,y:-1},{x:1,y:0},false][c];if(g){g.x+=e.x;g.y+=e.y;core.status.stepPostfix.push(g);core.fillPosWithPoint(g)}};core.prototype.onup=function(){core.status.holdingPath=0;if(core.status.stepPostfix.length>0){var b=[];var e={"0":{"1":"down","-1":"up"},"-1":{"0":"left"},"1":{"0":"right"}};for(var c=1;c12||c>12){return}if(!core.status.lockControl){core.setAutomaticRoute(b,c,a);return}if(core.status.event.id=="book"){core.events.clickBook(b,c);return}if(core.status.event.id=="fly"){core.events.clickFly(b,c);return}if(core.status.event.id=="settings"){core.events.clickSettings(b,c);return}if(core.status.event.id=="shop"){core.events.clickShop(b,c);return}if(core.status.event.id=="selectShop"){core.events.clickSelectShop(b,c);return}if(core.status.event.id=="toolbox"){core.events.clickToolbox(b,c);return}if(core.status.event.id=="save"||core.status.event.id=="load"){core.events.clickSL(b,c);return}if(core.status.event.id=="confirmBox"){if((b==4||b==5)&&c==7&&core.isset(core.status.event.data.yes)){core.status.event.data.yes()}if((b==7||b==8)&&c==7&&core.isset(core.status.event.data.no)){core.status.event.data.no()}return}if(core.status.event.id=="about"){if(core.isPlaying()){core.ui.closePanel(false)}else{core.showStartAnimate()}return}if(core.status.event.id=="text"){core.drawText();return}if(core.status.event.id=="npc"){core.events.clickNPC(b,c);return}if(core.status.event.id=="syncSave"){if(b>=4&&b<=8){if(c==5){core.showConfirmBox("你确定要将本地存档同步到服务器吗?",function(){core.waiting("正在同步,请稍后...");var h=new FormData();h.append("type","save");var d=[];for(var e=1;e<=180;e++){var g=core.getLocalStorage("save"+e,null);if(core.isset(g)){d.push(g)}}var f=JSON.stringify(d);h.append("data",f);var j=new XMLHttpRequest();j.open("POST","../sync.php");j.timeout=1000;j.onload=function(k){if(j.status==200){var i=JSON.parse(j.response);if(i.code<0){core.drawText("出错啦!\n无法同步存档到服务器。")}else{core.drawText("同步成功!\n\n您的存档编号: "+i.code+"\n您的存档密码: "+i.msg+"\n\n请牢记以上两个信息(如截图等),在从服务器\n同步存档时使用。")}}else{core.drawText("出错啦!\n无法同步存档到服务器。")}};j.ontimeout=function(i){console.log(i);core.drawText("出错啦!\n无法同步存档到服务器。")};j.onerror=function(i){console.log(i);core.drawText("出错啦!\n无法同步存档到服务器。")};j.send(h)},function(){core.syncSave()})}if(c==6){core.showConfirmBox("你确定要从服务器加载存档吗?\n该操作将覆盖所有本地存档且不可逆!",function(){var g=prompt("请输入存档编号:");if(g==null||g==""){core.syncSave();return}var d=prompt("请输入存档密码:");if(d==null||d==""){core.syncSave();return}core.waiting("正在同步,请稍后...");var e=new FormData();e.append("type","load");e.append("id",g);e.append("password",d);var f=new XMLHttpRequest();f.open("POST","../sync.php");f.timeout=1000;f.onload=function(l){if(f.status==200){var h=JSON.parse(f.response);switch(h.code){case 0:var k=JSON.parse(h.msg);for(var j=1;j<=180;j++){if(j<=k.length){core.setLocalStorage("save"+j,k[j-1])}else{core.removeLocalStorage("save"+j)}}core.drawText("同步成功!\n你的本地所有存档均已被覆盖。");break;case -1:core.drawText("出错啦!\n存档编号"+g+"不存在!");break;case -2:core.drawText("出错啦!\n存档密码错误!");break;default:core.drawText("出错啦!\n无法从服务器同步存档。");break}}else{core.drawText("出错啦!\n无法从服务器同步存档。")}};f.ontimeout=function(h){console.log(h);core.drawText("出错啦!\n无法从服务器同步存档。")};f.onerror=function(h){console.log(h);core.drawText("出错啦!\n无法从服务器同步存档。")};f.send(e)},function(){core.syncSave()})}}if(b>=5&&b<=7&&c==7){core.ui.openSettings(false)}}};core.prototype.onmousewheel=function(a){if(core.status.lockControl&&core.status.event.id=="fly"){if(a==-1){core.ui.drawFly(core.status.event.data-1)}if(a==1){core.ui.drawFly(core.status.event.data+1)}return}};core.prototype.clearAutomaticRouteNode=function(a,b){core.canvas.ui.clearRect(a*32+5,b*32+5,27,27)};core.prototype.stopAutomaticRoute=function(){if(!core.status.played){return}core.stopAutoHeroMove();core.status.automaticRouting=false;core.status.automaticRouted=false;core.status.autoStepRoutes=[];core.status.automaticRoutingTemp={destX:0,destY:0,moveStep:[]};if(core.status.moveStepBeforeStop.length==0){core.canvas.ui.clearRect(0,0,416,416)}};core.prototype.continueAutomaticRoute=function(){var a=core.status.moveStepBeforeStop;core.status.moveStepBeforeStop=[];if(a.length===0){return}if(a.length===1&&a[0].step===1){return}core.status.automaticRouting=true;core.setAutoHeroMove(a)};core.prototype.clearContinueAutomaticRoute=function(){core.canvas.ui.clearRect(0,0,416,416);core.status.moveStepBeforeStop=[]};core.prototype.setAutomaticRoute=function(d,c,b){if(!core.status.played||core.status.lockControl){return}else{if(core.status.automaticRouting){core.stopAutomaticRoute();return}}if(d==core.status.hero.loc.x&&c==core.status.hero.loc.y){core.turnHero();return}var f=0;var g=null;var e;core.status.automaticRoutingTemp={destX:0,destY:0,moveStep:[]};if(!(e=core.automaticRoute(d,c))){core.canvas.ui.clearRect(0,0,416,416);return false}e=e.concat(b);core.status.automaticRoutingTemp.destX=d;core.status.automaticRoutingTemp.destY=c;core.canvas.ui.save();core.canvas.ui.clearRect(0,0,416,416);core.canvas.ui.fillStyle="#bfbfbf";core.canvas.ui.strokeStyle="#bfbfbf";core.canvas.ui.lineWidth=8;for(var a=0;a12||p<0||p>12){continue}var e=13*q+p;if(core.isset(s[e])){continue}if(q==u&&p==t){s[e]=r;break}if(core.noPassExists(q,p)){continue}var a=1;if(core.idEndWith(q,p,"lavaNet")){a=100}if(!core.flags.potionWhileRouting&&core.idEndWith(q,p,"Potion")){a=20}s[e]=r;k.push(169*(g+a)+e)}if(core.isset(s[13*u+t])){break}}if(!core.isset(s[13*u+t])){return false}var d=u,c=t;while(d!=o||c!=m){var i=s[13*d+c];j.push({direction:i,x:d,y:c});d-=h[i].x;c-=h[i].y}j.reverse();return j};core.prototype.fillPosWithPoint=function(a){core.fillRect("ui",a.x*32+12,a.y*32+12,8,8,"#bfbfbf")};core.prototype.clearStepPostfix=function(){if(core.status.mouseOutCheck>0){core.status.mouseOutCheck--;window.setTimeout(core.clearStepPostfix,1000);return}core.status.holdingPath=0;if(core.status.stepPostfix.length>0){core.status.stepPostfix=[];core.canvas.ui.clearRect(0,0,416,416);core.canvas.ui.restore()}};core.prototype.stopAutoHeroMove=function(){core.status.autoHeroMove=false;core.status.automaticRouting=false;core.status.automaticRouted=false;core.status.autoStep=0;core.status.destStep=0;core.status.movedStep=0;core.status.autoStepRoutes=[];core.stopHero();clearInterval(core.interval.heroAutoMoveScan)};core.prototype.setAutoHeroMove=function(a,b){if(a.length==0){return}core.status.autoStepRoutes=a;core.status.autoStep=0;clearInterval(core.interval.heroAutoMoveScan);core.interval.heroAutoMoveScan=window.setInterval(function(){if(!core.status.autoHeroMove){if(core.status.autoStep==core.status.autoStepRoutes.length){core.stopAutoHeroMove();return}core.autoHeroMove(core.status.autoStepRoutes[core.status.autoStep].direction,core.status.autoStepRoutes[core.status.autoStep].step);core.status.autoStep++}},80)};core.prototype.autoHeroMove=function(b,a){core.status.autoHeroMove=true;core.status.destStep=a;core.moveHero(b)};core.prototype.setHeroMoveInterval=function(c,a,e,d){if(core.status.heroMoving){return}core.status.heroMoving=true;var b=0;core.interval.heroMoveInterval=window.setInterval(function(){switch(c){case"up":b-=4;if(b==-4||b==-8||b==-12||b==-16){core.drawHero(c,a,e,"leftFoot",0,b)}else{if(b==-20||b==-24||b==-28||b==-32){core.drawHero(c,a,e,"rightFoot",0,b)}}if(b==-32){core.setHeroLoc("y","--");core.moveOneStep();if(core.status.heroStop){core.drawHero(c,a,e-1,"stop")}if(core.isset(d)){d()}}break;case"left":b-=4;if(b==-4||b==-8||b==-12||b==-16){core.drawHero(c,a,e,"leftFoot",b)}else{if(b==-20||b==-24||b==-28||b==-32){core.drawHero(c,a,e,"rightFoot",b)}}if(b==-32){core.setHeroLoc("x","--");core.moveOneStep();if(core.status.heroStop){core.drawHero(c,a-1,e,"stop")}if(core.isset(d)){d()}}break;case"down":b+=4;if(b==4||b==8||b==12||b==16){core.drawHero(c,a,e,"leftFoot",0,b)}else{if(b==20||b==24||b==28||b==32){core.drawHero(c,a,e,"rightFoot",0,b)}}if(b==32){core.setHeroLoc("y","++");core.moveOneStep();if(core.status.heroStop){core.drawHero(c,a,e+1,"stop")}if(core.isset(d)){d()}}break;case"right":b+=4;if(b==4||b==8||b==12||b==16){core.drawHero(c,a,e,"leftFoot",b)}else{if(b==20||b==24||b==28||b==32){core.drawHero(c,a,e,"rightFoot",b)}}if(b==32){core.setHeroLoc("x","++");core.moveOneStep();if(core.status.heroStop){core.drawHero(c,a+1,e,"stop")}if(core.isset(d)){d()}}break}},10)};core.prototype.setHeroMoveTriggerInterval=function(){var c,a,d;var b={up:{x:0,y:-1},left:{x:-1,y:0},down:{x:0,y:1},right:{x:1,y:0}};core.interval.heroMoveTriggerInterval=window.setInterval(function(){if(!core.status.heroStop){c=core.getHeroLoc("direction");a=core.getHeroLoc("x");d=core.getHeroLoc("y");var e;e=core.noPass(a+b[c].x,d+b[c].y);if(e){core.trigger(a+b[c].x,d+b[c].y);core.drawHero(c,a,d,"stop");if(core.status.autoHeroMove){core.status.movedStep++;if(core.status.destStep==core.status.movedStep){core.status.autoHeroMove=false;core.status.destStep=0;core.status.movedStep=0;core.status.moveStepBeforeStop=[];core.stopAutomaticRoute()}}else{core.status.heroStop=true}return}core.setHeroMoveInterval(c,a,d,function(){if(core.status.autoHeroMove){core.status.movedStep++;if(core.status.destStep==core.status.movedStep){core.status.autoHeroMove=false;core.status.destStep=0;core.status.movedStep=0;core.stopHero();core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop")}}else{if(core.status.heroStop){core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop")}}core.trigger(core.getHeroLoc("x"),core.getHeroLoc("y"));clearInterval(core.interval.heroMoveInterval);core.status.heroMoving=false})}},50)};core.prototype.turnHero=function(a){if(core.isset(a)){core.status.hero.loc.direction=a}else{if(core.status.hero.loc.direction=="up"){core.status.hero.loc.direction="right"}else{if(core.status.hero.loc.direction=="right"){core.status.hero.loc.direction="down"}else{if(core.status.hero.loc.direction=="down"){core.status.hero.loc.direction="left"}else{if(core.status.hero.loc.direction=="left"){core.status.hero.loc.direction="up"}}}}}core.drawHero(core.status.hero.loc.direction,core.status.hero.loc.x,core.status.hero.loc.y,"stop",0,0);core.status.automaticRoutingTemp={destX:0,destY:0,moveStep:[]};core.canvas.ui.clearRect(0,0,416,416)};core.prototype.moveHero=function(a){core.setHeroLoc("direction",a);core.status.heroStop=false};core.prototype.moveOneStep=function(){core.status.hero.steps++};core.prototype.waitHeroToStop=function(a){core.stopAutomaticRoute();if(core.isset(a)){core.lockControl();setTimeout(function(){a()},30)}};core.prototype.stopHero=function(){core.status.heroStop=true};core.prototype.drawHero=function(d,b,g,c,a,f){a=a||0;f=f||0;core.clearAutomaticRouteNode(b,g);var e=core.material.icons.heros[core.status.hero.id][d];b=b*e.size;g=g*e.size;core.canvas.hero.clearRect(b-32,g-32,96,96);core.canvas.hero.drawImage(core.material.images.heros,e.loc[c]*e.size,e.loc.iconLoc*e.size,e.size,e.size,b+a,g+f,e.size,e.size)};core.prototype.openDoor=function(h,b,g,a,f){if(!core.terrainExists(b,g,h)){return}if(core.status.moveStepBeforeStop.length==0){core.status.moveStepBeforeStop=core.status.autoStepRoutes.slice(core.status.autoStep-1,core.status.autoStepRoutes.length);if(core.status.moveStepBeforeStop.length>=1){core.status.moveStepBeforeStop[0].step-=core.status.movedStep}}core.stopHero();core.stopAutomaticRoute();if(a){var d=h.replace("Door","Key");if(!core.useKey(d)){if(d!="specialKey"){core.drawTip("你没有"+core.material.items[d].name+"!","normal")}else{core.drawTip("无法开启此门。")}core.clearContinueAutomaticRoute();return}}core.playSound("door","ogg");var e=0;var c=core.material.icons.animates[h];core.interval.openDoorAnimate=window.setInterval(function(){e++;if(e==4){clearInterval(core.interval.openDoorAnimate);core.removeBlock("event",b,g);core.events.afterOpenDoor(h);if(core.isset(f)){f()}return}core.canvas.event.clearRect(32*b,32*g,32,32);core.canvas.event.drawImage(core.material.images.animates,32*e,32*c.loc,32,32,32*b,32*g,32,32)},30)};core.prototype.battle=function(g,a,f,e){if(typeof(core.status.moveStepBeforeStop)=="undefined"||core.status.moveStepBeforeStop.length==0){core.status.moveStepBeforeStop=core.status.autoStepRoutes.slice(core.status.autoStep-1,core.status.autoStepRoutes.length);if(core.status.moveStepBeforeStop.length>=1){core.status.moveStepBeforeStop[0].step-=core.status.movedStep}}core.stopHero();core.stopAutomaticRoute();var c=core.enemys.getDamage(g);if(c>=core.status.hero.hp){core.drawTip("你打不过此怪物!");core.clearContinueAutomaticRoute();return}core.playSound("attack","ogg");core.status.hero.hp-=c;var b=core.material.enemys[g].money;if(core.hasItem("coin")){core.status.hero.money+=core.material.enemys[g].money}core.status.hero.money+=b;core.status.hero.experience+=core.material.enemys[g].experience;core.updateStatusBar();core.removeBlock("event",a,f);core.canvas.event.clearRect(32*a,32*f,32,32);core.updateFg();var d="打败 "+core.material.enemys[g].name+",金币+"+b;if(core.flags.enableExperience){d+=",经验+"+core.material.enemys[g].experience}core.drawTip(d);core.events.afterBattle(g);if(core.isset(e)){e()}};core.prototype.changeFloor=function(d,c,a,f){core.lockControl();core.stopHero();core.stopAutomaticRoute();core.dom.floorNameLabel.innerHTML=core.status.maps[d].title;if(core.isset(c)){a=core.status.hero.loc;var e=core.status.maps[d].blocks;for(var b in e){if(core.isset(e[b].event)&&e[b].event.id===c){a.x=e[b].x;a.y=e[b].y}}if(core.status.maps[d].canFlyTo&&core.status.hero.flyRange.indexOf(d)<0){if(c=="upFloor"){core.status.hero.flyRange.unshift(d)}if(c=="downFloor"){core.status.hero.flyRange.push(d)}}}window.setTimeout(function(){core.playSound("floor","mp3");core.mapChangeAnimate("show",function(){core.statusBar.floor.innerHTML=core.status.maps[d].name;core.updateStatusBar();core.drawMap(d,function(){core.hide(core.dom.floorMsgGroup,10,function(){core.unLockControl();core.events.afterChangeFloor(d);if(core.isset(f)){f()}});core.setHeroLoc("direction",a.direction);core.setHeroLoc("x",a.x);core.setHeroLoc("y",a.y);core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop");core.updateFg()})})},50)};core.prototype.mapChangeAnimate=function(a,b){if(a=="show"){core.show(core.dom.floorMsgGroup,15,function(){b()})}else{core.hide(core.dom.floorMsgGroup,20,function(){b()})}};core.prototype.clearMap=function(e,c,f,d,b){if(e=="all"){for(var a in core.canvas){core.canvas[a].clearRect(0,0,416,416)}}else{core.canvas[e].clearRect(c,f,d,b)}};core.prototype.fillText=function(d,e,a,f,c,b){if(core.isset(c)){core.setFillStyle(d,c)}if(core.isset(b)){core.setFont(d,b)}core.canvas[d].fillText(e,a,f)};core.prototype.fillRect=function(e,b,f,d,a,c){if(core.isset(c)){core.setFillStyle(e,c)}core.canvas[e].fillRect(b,f,d,a)};core.prototype.strokeRect=function(f,c,g,e,b,d,a){if(core.isset(d)){core.setStrokeStyle(f,d)}if(core.isset(a)){core.setLineWidth(f,a)}core.canvas[f].strokeRect(c,g,e,b)};core.prototype.drawBlock=function(a,b,d,c,g,f,i,h,e){h=h||1;if(core.isset(e)&&e==true){core.canvas[a].clearRect(g*i,f*i,i,i)}core.canvas[a].drawImage(core.material.images[b],d*i,c*i,i,i,g*i,f*i,i*h,i*h)};core.prototype.setFont=function(b,a){core.canvas[b].font=a};core.prototype.setLineWidth=function(c,b){if(c=="all"){for(var a in core.canvas){core.canvas[a].lineWidth=b}}core.canvas[c].lineWidth=b};core.prototype.saveCanvas=function(a){core.canvas[a].save()};core.prototype.loadCanvas=function(a){core.canvas[a].restore()};core.prototype.setOpacity=function(c,b){if(c=="all"){for(var a in core.canvas){core.canvas[a].globalAlpha=b}}core.canvas[c].globalAlpha=b};core.prototype.setStrokeStyle=function(c,b){if(c=="all"){for(var a in core.canvas){core.canvas[a].strokeStyle=b}}else{core.canvas[c].strokeStyle=b}};core.prototype.setAlpha=function(c,b){if(c=="all"){for(var a in core.canvas){core.canvas[a].globalAlpha=b}}else{core.canvas[c].globalAlpha=b}};core.prototype.setOpacity=function(c,b){if(c=="all"){for(var a in core.canvas){core.canvas[a].canvas.style.opacity=b}}else{core.canvas[c].canvas.style.opacity=b}};core.prototype.setFillStyle=function(c,b){if(c=="all"){for(var a in core.canvas){core.canvas[a].fillStyle=b}}else{core.canvas[c].fillStyle=b}};core.prototype.drawMap=function(c,i){var j=core.status.maps[c];var g=j.blocks;core.status.floorId=c;core.status.thisMap=j;var h,f,a,d;core.clearMap("all");core.rmGlobalAnimate(null,null,true);core.enabledAllTrigger();for(h=0;h<13;h++){for(f=0;f<13;f++){a=core.material.icons.terrains.ground;d=core.material.images.terrains;core.canvas.bg.drawImage(d,0,a.loc*a.size,a.size,a.size,h*a.size,f*a.size,a.size,a.size)}}h=0;f=0;for(var e=0;e12||f>12||a<0||f<0){return true}if(core.stairExists(a,f)){return false}var d=core.status.thisMap.blocks;for(var b=0;b12||f>12||d<0||f<0){return true}var e=core.status.thisMap.blocks;var c;for(var a=0;a0){var a=core.canvas.ui.createPattern(core.material.ground,"repeat");core.drawBoxAnimate(a);core.interval.boxAnimate=setInterval(function(){core.drawBoxAnimate(a)},b)}};core.prototype.drawBoxAnimate=function(c){for(var b=0;b=999999999){f="???"}else{if(f>100000){f=(f/10000).toFixed(1)+"w"}}core.setFillStyle("fg","#000000");core.canvas.fg.fillText(f,32*a+2,32*(i+1)-2);core.canvas.fg.fillText(f,32*a,32*(i+1)-2);core.canvas.fg.fillText(f,32*a+2,32*(i+1));core.canvas.fg.fillText(f,32*a,32*(i+1));core.setFillStyle("fg",d);core.canvas.fg.fillText(f,32*a+1,32*(i+1)-1)}}};core.prototype.itemCount=function(b){if(!core.isset(b)||!core.isset(core.material.items[b])){return 0}var a=core.material.items[b].cls;return core.isset(core.status.hero.items[a][b])?core.status.hero.items[a][b]:0};core.prototype.hasItem=function(a){return core.itemCount(a)>0};core.prototype.setItem=function(c,b){var a=core.material.items[c].cls;if(a=="item"){return}if(!core.isset(core.status.hero.items[a])){core.status.hero.items[a]={}}core.status.hero.items[a][c]=b};core.prototype.useKey=function(b){if(!core.hasItem(b)){return false}var a=core.material.items[b].cls;core.status.hero.items[a][b]--;core.updateStatusBar();return true};core.prototype.useItem=function(a){core.items.useItem(a);return};core.prototype.canUseItem=function(a){return core.items.canUseItem(a)};core.prototype.addItem=function(d,c){var a=core.material.items[d];var b=a.cls;if(b=="item"){return}if(!core.isset(core.status.hero.items[b])){core.status.hero.items[b]={};core.status.hero.items[b][d]=0}else{if(!core.isset(core.status.hero.items[b][d])){core.status.hero.items[b][d]=0}}core.status.hero.items[b][d]+=c};core.prototype.getItemEffect=function(b,a){core.items.getItemEffect(b,a)};core.prototype.getItemEffectTip=function(a){return core.items.getItemEffectTip(a)};core.prototype.getItem=function(f,e,c,a,g){core.playSound("item","ogg");var b=core.material.items[f].cls;core.getItemEffect(f,e);core.removeBlock("event",c,a);var d="获得 "+core.material.items[f].name;if(e>1){d+="x"+e}if(b==="items"){d+=core.getItemEffectTip(f)}core.drawTip(d,"image",core.material.icons.items[f]);core.canvas.event.clearRect(c*32,a*32,32,32);core.updateStatusBar();if(core.isset(g)){g()}};core.prototype.drawTip=function(h,g,f){g=g||"normal";var d,c,b,i,e=false,a=0;clearInterval(core.interval.tipAnimate);core.setFont("data","16px Arial");core.saveCanvas("data");core.setOpacity("data",0);if(g=="normal"){d=16;c=18;b=d+core.canvas.data.measureText(h).width+16;i=42}else{if(g=="image"&&core.isset(f)){d=44;c=18;b=d+core.canvas.data.measureText(h).width+8;i=42}else{core.loadCanvas("data");return}}core.interval.tipAnimate=window.setInterval(function(){if(e){a-=0.1}else{a+=0.1}core.setOpacity("data",a);core.clearMap("data",5,5,400,i);core.fillRect("data",5,5,b,i,"#000");if(core.isset(f)){core.canvas.data.drawImage(core.material.images.items,0,f.loc*f.size,f.size,f.size,10,8,f.size,f.size)}core.fillText("data",h,d+5,c+15,"#fff");if(a>0.6||a<0){if(e){core.loadCanvas("data");core.clearMap("data",5,5,400,i);core.setOpacity("data",1);clearInterval(core.interval.tipAnimate);return}else{if(!core.timeout.getItemTipTimeout){core.timeout.getItemTipTimeout=window.setTimeout(function(){e=true;core.timeout.getItemTipTimeout=null},1000)}a=0.6;core.setOpacity("data",a)}}},30)};core.prototype.drawText=function(a,c){if(core.isset(a)){if(typeof a=="string"){a=[{content:a}]}else{if(a instanceof Object&&core.isset(a.content)){a=[a]}else{if(!(a instanceof Array)){core.drawTip("出错了");console.log(a);return}}}core.status.event={id:"text",data:{list:a,callback:c}};core.lockControl();core.stopAutomaticRoute();setTimeout(function(){core.drawText()},30);return}if(core.status.event.data.list.length==0){var c=core.status.event.data.callback;core.ui.closePanel(false);if(core.isset(c)){c()}return}var b=core.status.event.data.list.shift();if(typeof b=="string"){core.ui.drawTextBox(b)}else{core.ui.drawTextBox(b.content,b.id)}};core.prototype.visitNpc=function(b,a,f,e){if(!core.status.heroStop){setTimeout(function(){core.visitNpc(b,a,f,e)},30);return}if(!core.isset(core.status.npcs[b])){core.status.npcs[b]=0}var d=core.status.npcs[b];var c=core.npcs.getEffect(b,d);if(c.length==0){return}core.status.event.data={x:a,y:f,id:b,list:c,callback:e};core.status.event.id="npc";core.lockControl();core.npcAction()};core.prototype.npcAction=function(){if(core.status.event.data.list.length==0){if(core.isset(core.status.event.data.callback)){core.status.event.data.callback()}core.ui.closePanel(false);return}var g=core.status.event.data.list.shift();core.status.event.data.current=g;var c=core.status.event.data.id,l=core.status.event.data.x,j=core.status.event.data.y;if(g.action=="text"){core.ui.drawTextBox(g.content,core.isset(g.isHero)&&g.isHero?"hero":g.id);return}if(g.action=="choices"){var h=core.material.npcs[g.id];var b=core.canvas.ui.createPattern(core.material.ground,"repeat");clearInterval(core.interval.tipAnimate);core.clearMap("data",0,0,416,416);core.setOpacity("data",1);core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);core.setFillStyle("ui",b);var e=97,k=64,m=416-2*e,a=416-2*k;core.fillRect("ui",e,k,m,a,b);core.strokeRect("ui",e-1,k-1,m+1,a+1,"#FFFFFF",2);core.canvas.ui.textAlign="center";core.fillText("ui",h.name,e+135,k+34,"#FFFFFF","bold 19px Verdana");core.strokeRect("ui",e+15-1,k+30-1,34,34,"#DDDDDD",2);core.status.boxAnimateObjs=[];core.status.boxAnimateObjs.push({bgx:e+15,bgy:k+30,bgsize:32,image:core.material.images.npcs,x:e+15,y:k+30,icon:core.material.icons.npcs[h.icon]});core.setBoxAnimate(core.firstData.animateSpeed);core.canvas.ui.textAlign="left";var d=g.hint.split("\n");for(var f=0;fcore.status.hero.time.totaltime){core.status.hero.time.totaltime=d}if(core.isset(a)){core.status.hero.time.lasttime=a}else{core.status.hero.time.lasttime=new Date()}core.events.afterLoadData(b);core.changeFloor(b.floorId,null,b.hero.loc,function(){core.setHeroMoveTriggerInterval();if(core.isset(e)){e()}});core.upload(1500)};core.prototype.setStatus=function(a,b){if(core.isset(core.status.hero[a])){core.status.hero[a]=b}};core.prototype.getStatus=function(a){if(core.isset(core.status.hero[a])){return core.status.hero[a]}};core.prototype.lockControl=function(){core.status.lockControl=true};core.prototype.unLockControl=function(){core.status.lockControl=false};core.prototype.isset=function(a){if(a==undefined||a==null){return false}return true};core.prototype.playSound=function(b,a){if(!core.musicStatus.soundStatus||!core.musicStatus.loaded){return}core.musicStatus.playedSound=core.material.sounds[a][b];core.musicStatus.playedSound.play()};core.prototype.playBgm=function(a,b){if(core.musicStatus.isIOS||!core.musicStatus.loaded){return}if(core.isset(core.musicStatus.playedBgm)){core.musicStatus.playedBgm.pause()}core.musicStatus.playedBgm=core.material.sounds[b][a];if(core.musicStatus.soundStatus){core.musicStatus.playedBgm.play()}};core.prototype.changeSoundStatus=function(){if(core.musicStatus.soundStatus){main.core.disabledSound()}else{main.core.enabledSound()}};core.prototype.enabledSound=function(){core.musicStatus.soundStatus=true;core.playBgm("bgm","mp3");core.setLocalStorage("soundStatus",true)};core.prototype.disabledSound=function(){core.musicStatus.playedBgm.pause();core.musicStatus.soundStatus=false;core.setLocalStorage("soundStatus",false)};core.prototype.show=function(d,b,e){if(!core.isset(b)){d.style.display="block";return}d.style.display="block";d.style.opacity=0;var c=0;var a=window.setInterval(function(){c+=0.03;d.style.opacity=c;if(c>1){clearInterval(a);if(core.isset(e)){e()}}},b)};core.prototype.hide=function(d,b,e){if(!core.isset(b)){d.style.display="none";return}var c=1;var a=window.setInterval(function(){c-=0.03;d.style.opacity=c;if(c<0){d.style.display="none";clearInterval(a);if(core.isset(e)){e()}}},b)};core.prototype.clearStatusBar=function(){var a=["floor","hp","atk","def","money","experience","yellowKey","blueKey","redKey","hard"];a.forEach(function(b){core.statusBar[b].innerHTML=""});core.statusBar.image.book.style.opacity=0.3;core.statusBar.image.fly.style.opacity=0.3};core.prototype.updateStatusBar=function(){if(core.flags.HPMAX>0){core.setStatus("hp",Math.min(core.flags.HPMAX,core.getStatus("hp")))}var b=["hp","atk","def","money","experience"];b.forEach(function(c){core.statusBar[c].innerHTML=core.getStatus(c)});var a=["yellowKey","blueKey","redKey"];a.forEach(function(c){core.statusBar[c].innerHTML=core.setTwoDigits(core.status.hero.items.keys[c])});core.statusBar.hard.innerHTML="Lv"+core.status.hard;if(core.hasItem("book")){core.statusBar.image.book.style.opacity=1}else{core.statusBar.image.book.style.opacity=0.3}if(core.hasItem("fly")){core.statusBar.image.fly.style.opacity=1}else{core.statusBar.image.fly.style.opacity=0.3}core.updateFg()};core.prototype.resize=function(t,j){var v=416;var k=83;var x=49;var A=129;var m=v+6;var s=t;var n=false;if(t>j&&j<422){n=true;s=j}if(s=10&&a<=12&&b==12){core.ui.closePanel(true)}return};events.prototype.clickFly=function(a,e){if((a==10||a==11)&&e==9){core.ui.drawFly(core.status.event.data-1)}if((a==10||a==11)&&e==5){core.ui.drawFly(core.status.event.data+1)}if(a>=5&&a<=7&&e==12){core.ui.closePanel()}if(a>=0&&a<=9&&e>=3&&e<=11){var b=core.status.hero.flyRange.indexOf(core.status.floorId);var d=core.status.event.data=5&&x<=7){if(y>=5&&y<=8){if(y>=5+core.status.event.data.choices.length){return}var money=core.getStatus("money"),experience=core.getStatus("experience");var shop=core.status.event.data;var times=shop.times,need=eval(shop.need);var use=shop.use;var use_text=use=="money"?"金币":"经验";var choice=shop.choices[y-5];if(core.isset(choice.need)){need=eval(choice.need)}if(need>eval(use)){core.drawTip("你的"+use_text+"不足");return}eval(use+"-="+need);core.setStatus("money",money);core.setStatus("experience",experience);core.updateStatusBar();core.npcEffect(choice.effect);core.status.event.data.times++;core.ui.openShop(core.status.event.data.id);return}if(y==9){core.status.event.data=null;core.ui.closePanel();return}}};events.prototype.clickSelectShop=function(a,h){if(a>=5&&a<=7){var c=core.status.shops,e=Object.keys(c);var d=6-parseInt((e.length+1)/2);var b=6+parseInt((e.length+1)/2);if(h>=d&&h-d=10&&a<=12&&e==12){core.ui.closePanel(false);return}var d=null;var b=null;if(e>=4&&e<=7&&a!=12){b=Object.keys(core.status.hero.items.tools).sort()}if(e>=9&&e<=12&&a!=12){b=Object.keys(core.status.hero.items.constants).sort()}if(b==null){return}var c=0;if(e==4||e==5||e==9||e==10){c=parseInt(a/2)}else{c=6+parseInt(a/2)}if(c>=b.length){return}d=b[c];if(d==core.status.event.data){core.events.useItem(d)}else{core.ui.drawToolbox(d)}};events.prototype.clickSL=function(a,c){if((a==3||a==4)&&c==12){core.ui.drawSLPanel(core.status.event.data-1)}if((a==8||a==9)&&c==12){core.ui.drawSLPanel(core.status.event.data+1)}if(a>=10&&a<=12&&c==12){core.ui.closePanel(false);if(!core.isPlaying()){core.showStartAnimate()}return}var b=6*core.status.event.data+1;if(c>=1&&c<=4){if(a>=1&&a<=3){core.doSL(b,core.status.event.id)}if(a>=5&&a<=7){core.doSL(b+1,core.status.event.id)}if(a>=9&&a<=11){core.doSL(b+2,core.status.event.id)}}if(c>=7&&c<=10){if(a>=1&&a<=3){core.doSL(b+3,core.status.event.id)}if(a>=5&&a<=7){core.doSL(b+4,core.status.event.id)}if(a>=9&&a<=11){core.doSL(b+5,core.status.event.id)}}};events.prototype.clickSettings=function(a,b){if(a<5||a>7){return}if(b==3){if(core.musicStatus.isIOS){core.drawTip("iOS设备不支持播放音乐");return}core.changeSoundStatus();core.ui.openSettings(false)}if(b==4){core.ui.drawSelectShop()}if(b==5){this.decreaseHard()}if(b==6){core.ui.syncSave()}if(b==7){core.ui.showConfirmBox("你确定要重新开始吗?",function(){core.ui.closePanel();core.restart()},function(){core.ui.openSettings(false)})}if(b==8){core.ui.drawAbout()}if(b==9){core.ui.closePanel()}return};events.prototype.clickNPC=function(a,e){var d=core.status.event.data.current;if(core.isset(d)){if(d.action=="text"){core.npcAction();return}if(d.action=="choices"){if(a>=5&&a<=7){if(e>=5&&e<=8){if(e>=5+d.choices.length){return}var b=d.choices[e-5];if(core.isset(b.need)){var c=true;b.need.split(";").forEach(function(j){var h=j.split(",");var g=h[0],f=h[1],i=h[2];if(g=="status"){if(core.getStatus(f)=0}if(k=="pickaxe"){var b=[];for(var h in core.status.thisMap.blocks){var g=core.status.thisMap.blocks[h];if(core.isset(g.event)&&g.event.id=="yellowWall"){if(core.flags.picaxeFourDirections){if(Math.abs(g.x-core.status.hero.loc.x)+Math.abs(g.y-core.status.hero.loc.y)<=1){b.push(h)}}else{var o={up:{x:0,y:-1},left:{x:-1,y:0},down:{x:0,y:1},right:{x:1,y:0}};if(g.x==core.status.hero.loc.x+o[core.status.hero.loc.direction].x&&g.y==core.status.hero.loc.y+o[core.status.hero.loc.direction].y){b.push(h)}}}}if(b.length>0){core.status.event.data=b;return true}return false}if(k=="bomb"){var b=[];for(var h in core.status.thisMap.blocks){var g=core.status.thisMap.blocks[h];if(core.isset(g.event)&&g.event.cls=="enemys"&&Math.abs(g.x-core.status.hero.loc.x)+Math.abs(g.y-core.status.hero.loc.y)<=1){var f=core.material.enemys[g.event.id];if(core.isset(f.bomb)&&!f.bomb){continue}b.push(h)}}if(b.length>0){core.status.event.data=b;return true}return false}if(k=="earthquake"){var b=[];for(var h in core.status.thisMap.blocks){var g=core.status.thisMap.blocks[h];if(core.isset(g.event)&&(g.event.id=="yellowWall"||g.event.id=="blueWall"||g.event.id=="whiteWall")){b.push(h)}}if(b.length>0){core.status.event.data=b;return true}return false}if(k=="centerFly"){var l=12-core.getHeroLoc("x"),j=12-core.getHeroLoc("y");var a=core.status.thisMap.blocks;for(var n=0;n",270,n+q-13,"#CCCCCC","13px Verdana")};ui.prototype.showConfirmBox=function(k,e,l){core.status.event.id="confirmBox";core.status.event.data={yes:e,no:l};var b=core.canvas.ui.createPattern(core.material.ground,"repeat");core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);core.setFillStyle("ui",b);core.setFont("ui","bold 19px Verdana");var d=k.split("\n");var m=d.length;var j=0;for(var f in d){j=Math.max(j,core.canvas.ui.measureText(d[f]).width)}var c=Math.min(208-40-j/2,100);var g=140-(m-1)*30;var h=416-2*c,a=416-140-g;core.fillRect("ui",c,g,h,a,b);core.strokeRect("ui",c-1,g-1,h+1,a+1,"#FFFFFF",2);core.canvas.ui.textAlign="center";for(var f in d){core.fillText("ui",d[f],208,g+50+f*30,"#FFFFFF")}core.fillText("ui","确定",208-38,g+a-35,"#FFFFFF","bold 17px Verdana");core.fillText("ui","取消",208+38,g+a-35)};ui.prototype.drawSettings=function(d){if(!core.checkStatus("settings",d)){return}var c=core.canvas.ui.createPattern(core.material.ground,"repeat");core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);core.setFillStyle("ui",c);var f=97,e=64,b=416-2*f,a=416-2*e;core.fillRect("ui",f,e,b,a,c);core.strokeRect("ui",f-1,e-1,b+1,a+1,"#FFFFFF",2);core.canvas.ui.textAlign="center";core.fillText("ui","音乐: "+(core.musicStatus.soundStatus?"[ON]":"[OFF]"),208,e+56,"#FFFFFF","bold 17px Verdana");core.fillText("ui","快捷商店",208,e+88,"#FFFFFF","bold 17px Verdana");core.fillText("ui","降低难度",208,e+120,"#FFFFFF","bold 17px Verdana");core.fillText("ui","同步存档",208,e+152,"#FFFFFF","bold 17px Verdana");core.fillText("ui","重新开始",208,e+184,"#FFFFFF","bold 17px Verdana");core.fillText("ui","关于本塔",208,e+216,"#FFFFFF","bold 17px Verdana");core.fillText("ui","返回游戏",208,e+248,"#FFFFFF","bold 17px Verdana")};ui.prototype.drawSelectShop=function(g){if(core.isset(g)&&!core.checkStatus("selectShop",g)){return}core.status.event.id="selectShop";var b=core.canvas.ui.createPattern(core.material.ground,"repeat");core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);core.setFillStyle("ui",b);var k=core.status.shops,j=Object.keys(k);var e=j.length+1;if(e%2==0){e++}var c=97,f=208-32-16*e,h=416-2*c,a=416-2*f;core.fillRect("ui",c,f,h,a,b);core.strokeRect("ui",c-1,f-1,h+1,a+1,"#FFFFFF",2);core.canvas.ui.textAlign="center";for(var d=0;d1){core.fillText("ui","上一页",208-80,403)}if(cj){k=j}core.status.event.data=k;var b=(k-1)*g,f=Math.min(k*g,m.length);m=m.slice(b,f);core.status.boxAnimateObjs=[];for(var h=0;h=core.status.hero.hp){e="#FF0000"}if(l==0){e="#00FF00"}if(l>=999999999){l="无法战斗"}var c=core.canvas.ui.measureText(l).width;core.fillText("ui",l,n,62*h+50,e,"bold 13px Verdana");core.canvas.ui.textAlign="left";if(d.special!=""){core.setFont("data","bold 12px Verdana");var c=core.canvas.data.measureText(d.special).width;core.setAlpha("data","0.4");core.fillRect("data",64-4-c,62*h+46,c+4,17,"#000000");core.setAlpha("data","1");core.fillText("data",d.special,64-2-c,62*h+59,"#FF6A6A","bold 12px Verdana")}core.fillText("ui","临界",165,62*h+68,"#DDDDDD","13px Verdana");core.fillText("ui",d.critical,195,62*h+68,"#DDDDDD","bold 13px Verdana");core.fillText("ui","减伤",255,62*h+68,"#DDDDDD","13px Verdana");core.fillText("ui",d.criticalDamage,285,62*h+68,"#DDDDDD","bold 13px Verdana");core.fillText("ui","1防",335,62*h+68,"#DDDDDD","13px Verdana");core.fillText("ui",d.defDamage,365,62*h+68,"#DDDDDD","bold 13px Verdana")}core.setBoxAnimate(core.firstData.animateSpeed);this.drawPagination(k,j)};ui.prototype.drawFly=function(b){if(b<0){b=0}if(b>=core.status.hero.flyRange.length){b=core.status.hero.flyRange.length-1}core.status.event.data=b;var a=core.status.hero.flyRange[b];var c=core.status.maps[a].title;core.clearMap("ui",0,0,416,416);core.setAlpha("ui",0.85);core.fillRect("ui",0,0,416,416,"#000000");core.setAlpha("ui",1);core.canvas.ui.textAlign="center";core.fillText("ui","楼层跳跃",208,60,"#FFFFFF","bold 28px Verdana");core.fillText("ui","返回游戏",208,403,"#FFFFFF","bold 15px Verdana");core.fillText("ui",c,356,247,"#FFFFFF","bold 19px Verdana");if(b0){core.fillText("ui","▼",356,247+64,"#FFFFFF","17px Verdana")}core.strokeRect("ui",20,100,273,273,"#FFFFFF",2);this.drawThumbnail("ui",core.status.maps[a].blocks,20,100,273)};ui.prototype.drawToolbox=function(a){if(!core.hasItem(a)){a=null}core.status.event.data=a;core.clearMap("ui",0,0,416,416);core.setAlpha("ui",0.85);core.fillRect("ui",0,0,416,416,"#000000");core.setAlpha("ui",1);core.setFillStyle("ui","#DDDDDD");core.setStrokeStyle("ui","#DDDDDD");core.canvas.ui.lineWidth=2;core.canvas.ui.strokeWidth=2;core.canvas.ui.beginPath();core.canvas.ui.moveTo(0,130);core.canvas.ui.lineTo(416,130);core.canvas.ui.stroke();core.canvas.ui.beginPath();core.canvas.ui.moveTo(0,129);core.canvas.ui.lineTo(0,105);core.canvas.ui.lineTo(72,105);core.canvas.ui.lineTo(102,129);core.canvas.ui.fill();core.canvas.ui.beginPath();core.canvas.ui.moveTo(0,290);core.canvas.ui.lineTo(416,290);core.canvas.ui.stroke();core.canvas.ui.beginPath();core.canvas.ui.moveTo(0,289);core.canvas.ui.lineTo(0,265);core.canvas.ui.lineTo(72,265);core.canvas.ui.lineTo(102,289);core.canvas.ui.fill();core.canvas.ui.textAlign="left";core.fillText("ui","消耗道具",5,124,"#333333","bold 16px Verdana");core.fillText("ui","永久道具",5,284);if(core.isset(a)){var h=core.material.items[a];core.fillText("ui",h.name,10,32,"#FFD700","bold 20px Verdana");core.fillText("ui",h.text,10,62,"#FFFFFF","17px Verdana");core.fillText("ui","<继续点击该道具即可进行使用>",10,89,"#CCCCCC","14px Verdana")}core.canvas.ui.textAlign="right";var f=core.material.images.items;var c=Object.keys(core.status.hero.items.tools).sort();for(var b=0;b=30){f=29}core.status.event.data=f;core.status.savePage=f;core.clearMap("ui",0,0,416,416);core.setAlpha("ui",0.85);core.fillRect("ui",0,0,416,416,"#000000");core.setAlpha("ui",1);core.canvas.ui.textAlign="center";var b=416/6,d=117;var a=core.status.event.id=="save"?"存档":"读档";for(var c=0;c<6;c++){var g=6*f+c+1;var e=core.getLocalStorage("save"+g,null);if(c<3){core.fillText("ui",a+g,(2*c+1)*b,35,"#FFFFFF","bold 17px Verdana");core.strokeRect("ui",(2*c+1)*b-d/2,50,d,d,"#FFFFFF",2);if(core.isset(e)&&core.isset(e.floorId)){this.drawThumbnail("ui",core.maps.load(e.maps,e.floorId).blocks,(2*c+1)*b-d/2,50,d,e.hero.loc,e.hero.id);core.fillText("ui",core.formatDate(new Date(e.time)),(2*c+1)*b,65+d,"#FFFFFF","10px Verdana")}else{core.fillRect("ui",(2*c+1)*b-d/2,50,d,d,"#333333",2);core.fillText("ui","空",(2*c+1)*b,117,"#FFFFFF","bold 30px Verdana")}}else{core.fillText("ui",a+g,(2*c-5)*b,230,"#FFFFFF","bold 17px Verdana");core.strokeRect("ui",(2*c-5)*b-d/2,245,d,d,"#FFFFFF",2);if(core.isset(e)&&core.isset(e.floorId)){this.drawThumbnail("ui",core.maps.load(e.maps,e.floorId).blocks,(2*c-5)*b-d/2,245,d,e.hero.loc,e.hero.id);core.fillText("ui",core.formatDate(new Date(e.time)),(2*c-5)*b,260+d,"#FFFFFF","10px Verdana")}else{core.fillRect("ui",(2*c-5)*b-d/2,245,d,d,"#333333",2);core.fillText("ui","空",(2*c-5)*b,245+70,"#FFFFFF","bold 30px Verdana")}}}this.drawPagination(f+1,30)};ui.prototype.drawThumbnail=function(d,a,r,o,s,e,p){core.clearMap(d,r,o,s,s);var q=s/13;for(var k=0;k<13;k++){for(var h=0;h<13;h++){var g=core.material.icons.terrains.ground;var m=core.material.images.terrains;core.canvas[d].drawImage(m,0,g.loc*g.size,g.size,g.size,r+k*q,o+h*q,q,q)}}for(var n in a){var f=a[n];if(core.isset(f.event)){var k=f.x,h=f.y;var g=core.material.icons[f.event.cls][f.event.id];var m=core.material.images[f.event.cls];core.canvas[d].drawImage(m,0,g.loc*g.size,g.size,g.size,r+k*q,o+h*q,q,q)}}if(core.isset(e)){var c=core.isset(p)?p:core.status.hero.id;var l=core.material.icons.heros[c][e.direction];core.canvas[d].drawImage(core.material.images.heros,l.loc.stop*l.size,l.loc.iconLoc*l.size,l.size,l.size,r+q*e.x,o+q*e.y,q,q)}};ui.prototype.drawAbout=function(){if(!core.isPlaying()){core.status.event={id:null,data:null};core.dom.startPanel.style.display="none"}core.lockControl();core.status.event.id="about";core.clearMap("ui",0,0,416,416);var f=48,e=36,c=416-2*f,b=416-2*e;core.setAlpha("ui",0.85);core.fillRect("ui",f,e,c,b,"#000000");core.setAlpha("ui",1);core.strokeRect("ui",f-1,e-1,c+1,b+1,"#FFFFFF",2);var d=f+24;core.canvas.ui.textAlign="left";core.fillText("ui","异空间",d,e+35,"#FFD700","bold 22px Verdana");core.fillText("ui","HTML5复刻版",d+75,e+37,"#DDDDDD","bold 15px Verdana");core.fillText("ui","作者: 艾之葵",d,e+80,"#FFFFFF","bold 17px Verdana");core.fillText("ui","原作: ss433_2",d,e+112,"#FFFFFF","bold 17px Verdana");core.fillText("ui","制作工具: WebStorm",d,e+144,"#FFFFFF","bold 17px Verdana");core.fillText("ui","测试平台: Chrome/微信/iOS",d,e+176,"#FFFFFF","bold 17px Verdana");core.fillText("ui","特别鸣谢: ss433_2",d,e+208);var a=core.canvas.ui.measureText("特别鸣谢: ").width;core.fillText("ui","iEcho",d+a,e+240);core.fillText("ui","打Dota的喵",d+a,e+272);core.fillText("ui","HTML5魔塔交流群:539113091",d,e+304)}; \ No newline at end of file diff --git a/main.min.js b/main.min.js deleted file mode 100644 index dc70826e..00000000 --- a/main.min.js +++ /dev/null @@ -1 +0,0 @@ -function main(){this.dom={body:document.body,gameGroup:document.getElementById("gameGroup"),mainTips:document.getElementById("mainTips"),musicBtn:document.getElementById("musicBtn"),startPanel:document.getElementById("startPanel"),startTop:document.getElementById("startTop"),startTopProgressBar:document.getElementById("startTopProgressBar"),startTopProgress:document.getElementById("startTopProgress"),startTopLoadTips:document.getElementById("startTopLoadTips"),startBackground:document.getElementById("startBackground"),startButtonGroup:document.getElementById("startButtonGroup"),floorMsgGroup:document.getElementById("floorMsgGroup"),versionLabel:document.getElementById("versionLabel"),floorNameLabel:document.getElementById("floorNameLabel"),statusBar:document.getElementById("statusBar"),toolBar:document.getElementById("toolBar"),gameCanvas:document.getElementsByClassName("gameCanvas"),startButtons:document.getElementById("startButtons"),playGame:document.getElementById("playGame"),loadGame:document.getElementById("loadGame"),aboutGame:document.getElementById("aboutGame"),levelChooseButtons:document.getElementById("levelChooseButtons"),easyLevel:document.getElementById("easyLevel"),normalLevel:document.getElementById("normalLevel"),hardLevel:document.getElementById("hardLevel"),data:document.getElementById("data"),statusLabels:document.getElementsByClassName("statusLabel")};this.loadList=["items","icons","maps","enemys","events","npcs","data","ui","core"];this.images=["animates","enemys","heros","items","npcs","terrains"];this.sounds={mp3:["bgm-loop","floor"],ogg:["attack","door","item"]};this.statusBar={image:{floor:document.getElementById("img-floor"),hp:document.getElementById("img-hp"),atk:document.getElementById("img-atk"),def:document.getElementById("img-def"),money:document.getElementById("img-money"),experience:document.getElementById("img-experience"),book:document.getElementById("img-book"),fly:document.getElementById("img-fly"),toolbox:document.getElementById("img-toolbox"),shop:document.getElementById("img-shop"),save:document.getElementById("img-save"),load:document.getElementById("img-load"),settings:document.getElementById("img-settings")},floor:document.getElementById("floor"),hp:document.getElementById("hp"),atk:document.getElementById("atk"),def:document.getElementById("def"),money:document.getElementById("money"),experience:document.getElementById("experience"),yellowKey:document.getElementById("yellowKey"),blueKey:document.getElementById("blueKey"),redKey:document.getElementById("redKey"),hard:document.getElementById("hard")};this.instance={};this.canvas={}}main.prototype.init=function(){for(var a=0;a