1 line
42 KiB
JavaScript
1 line
42 KiB
JavaScript
function ui(){this.init()}ui.prototype.init=function(){this.uidata=functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.ui};ui.prototype.clearMap=function(c,e,f,d,a){if(c=="all"){for(var b in core.canvas){core.canvas[b].clearRect(0,0,416,416)}core.dom.gif.innerHTML=""}else{core.canvas[c].clearRect(e||0,f||0,d||416,a||416)}};ui.prototype.fillText=function(b,d,e,f,c,a){if(core.isset(c)){core.setFillStyle(b,c)}if(core.isset(a)){core.setFont(b,a)}core.canvas[b].fillText(d,e,f)};ui.prototype.fillRect=function(b,e,f,d,a,c){if(core.isset(c)){core.setFillStyle(b,c)}core.canvas[b].fillRect(e,f,d,a)};ui.prototype.strokeRect=function(c,f,g,e,a,d,b){if(core.isset(d)){core.setStrokeStyle(c,d)}if(core.isset(b)){core.setLineWidth(c,b)}core.canvas[c].strokeRect(f,g,e,a)};ui.prototype.drawLine=function(b,d,f,e,g,c,a){if(core.isset(c)){core.setStrokeStyle(b,c)}if(core.isset(a)){core.setLineWidth(b,a)}core.canvas[b].beginPath();core.canvas[b].moveTo(d,f);core.canvas[b].lineTo(e,g);core.canvas[b].closePath();core.canvas[b].stroke()};ui.prototype.setFont=function(b,a){core.canvas[b].font=a};ui.prototype.setLineWidth=function(c,a){if(c=="all"){for(var b in core.canvas){core.canvas[b].lineWidth=a}}core.canvas[c].lineWidth=a};ui.prototype.saveCanvas=function(a){core.canvas[a].save()};ui.prototype.loadCanvas=function(a){core.canvas[a].restore()};ui.prototype.setStrokeStyle=function(b,c){if(b=="all"){for(var a in core.canvas){core.canvas[a].strokeStyle=c}}else{core.canvas[b].strokeStyle=c}};ui.prototype.setAlpha=function(c,a){if(c=="all"){for(var b in core.canvas){core.canvas[b].globalAlpha=a}}else{core.canvas[c].globalAlpha=a}};ui.prototype.setOpacity=function(b,c){if(b=="all"){for(var a in core.canvas){core.canvas[a].canvas.style.opacity=c}}else{core.canvas[b].canvas.style.opacity=c}};ui.prototype.setFillStyle=function(b,c){if(b=="all"){for(var a in core.canvas){core.canvas[a].fillStyle=c}}else{core.canvas[b].fillStyle=c}};ui.prototype.closePanel=function(){core.status.boxAnimateObjs=[];clearInterval(core.status.event.interval);core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);core.unLockControl();core.status.event.data=null;core.status.event.id=null;core.status.event.selection=null;core.status.event.ui=null;core.status.event.interval=null};ui.prototype.drawTip=function(e,c){var f,g,h,a,b=false,d=0;clearInterval(core.interval.tipAnimate);core.setFont("data","16px Arial");core.setOpacity("data",0);core.canvas.data.textAlign="left";if(!core.isset(c)){f=16;g=18;h=f+core.canvas.data.measureText(e).width+16;a=42}else{f=44;g=18;h=f+core.canvas.data.measureText(e).width+8;a=42}core.interval.tipAnimate=window.setInterval(function(){if(b){d-=0.1}else{d+=0.1}core.setOpacity("data",d);core.clearMap("data",5,5,400,a);core.fillRect("data",5,5,h,a,"#000");if(core.isset(c)){core.canvas.data.drawImage(core.material.images.items,0,c*32,32,32,10,8,32,32)}core.fillText("data",e,f+5,g+15,"#fff");if(d>0.6||d<0){if(b){core.clearMap("data",5,5,400,a);core.setOpacity("data",1);clearInterval(core.interval.tipAnimate);return}else{if(!core.isset(core.timeout.getItemTipTimeout)){core.timeout.getItemTipTimeout=window.setTimeout(function(){b=true;core.timeout.getItemTipTimeout=null},750)}d=0.6;core.setOpacity("data",d)}}},30)};ui.prototype.drawText=function(b,a){if(core.isset(b)){if((core.isset(core.status.event)&&core.status.event.id=="action")||(core.isset(core.status.replay)&&core.status.replay.replaying)){core.insertAction(b,null,null,a);return}if(typeof b=="string"){b=[{content:b}]}else{if(b instanceof Object&&core.isset(b.content)){b=[b]}else{if(!(b instanceof Array)){core.drawTip("出错了");console.log(b);return}}}core.status.event={id:"text",data:{list:b,callback:a}};core.lockControl();core.stopAutomaticRoute();setTimeout(function(){core.drawText()},30);return}if(core.status.event.data.list.length==0){var a=core.status.event.data.callback;core.ui.closePanel(false);if(core.isset(a)){a()}return}var c=core.status.event.data.list.shift();if(typeof c=="string"){core.ui.drawTextBox(c)}else{core.ui.drawTextBox(c.content,c.id)}};ui.prototype.drawTextBox=function(c){clearInterval(core.status.event.interval);var n=null,r=null,o=null,l=null,m=32,a=null;if(c.indexOf("\t[")==0||c.indexOf("\\t[")==0){var p=c.indexOf("]");if(p>=0){var x=c.substring(2,p);if(c.indexOf("\\t[")==0){x=c.substring(3,p)}c=c.substring(p+1);var w=x.split(",");if(w.length==1){n=w[0];if(n!="hero"){if(core.isset(core.material.enemys[n])){r=core.material.enemys[n].name;if(core.isset(core.material.icons.enemy48[n])){o=core.material.images.enemy48;l=core.material.icons.enemy48[n];m=48;a=4}else{o=core.material.images.enemys;l=core.material.icons.enemys[n];m=32;a=2}}else{r=n;n="npc";o=null;l=null}}}else{n="npc";r=w[0];if(core.isset(core.material.icons.npc48[w[1]])){o=core.material.images.npc48;l=core.material.icons.npc48[w[1]];m=48;a=4}else{o=core.material.images.npcs;l=core.material.icons.npcs[w[1]];m=32;a=2}}}}var y=core.status.textAttribute||core.initStatus.textAttribute;var s=y.position,t=null,u=null,C=m-32;if(c.indexOf("\b[")==0||c.indexOf("\\b[")==0){var p=c.indexOf("]");if(p>=0){var x=c.substring(2,p);if(c.indexOf("\\b[")==0){x=c.substring(3,p)}c=c.substring(p+1);var w=x.split(",");if(w[0]=="up"||w[0]=="center"||w[0]=="down"){s=w[0];if(core.status.event.id=="action"){t=core.status.event.data.x;u=core.status.event.data.y}if(w.length>=2){if(w[1]=="hero"){t=core.getHeroLoc("x");u=core.getHeroLoc("y");C=core.material.icons.hero.height-32}else{if(w.length>=3){t=parseInt(w[1]);u=parseInt(w[2])}}}}}}c=core.replaceText(c);var b=core.canvas.ui.createPattern(core.material.ground,"repeat");core.status.boxAnimateObjs=[];core.clearMap("ui",0,0,416,416);var q=10,v=416-2*q;var d=q+25;if(n=="hero"||core.isset(l)){d=q+63}var A=v-(d-q)-13;var h="16px Verdana";if(y.bold){h="bold "+h}var f=core.splitLines("ui",c,A,h);var i=20+21*(f.length+1)+(n=="hero"?core.material.icons.hero.height-10:core.isset(r)?m-10:0);var B=6,D=22;var z;if(s=="center"){z=parseInt((416-i)/2)}else{if(s=="up"){if(t==null||u==null){z=5}else{z=32*u-i-C-D}}else{if(s=="down"){if(t==null||u==null){z=416-i-5}else{z=32*u+32+D}}}}core.setAlpha("ui",y.background[3]);core.setFillStyle("ui",core.arrayToRGB(y.background));core.setStrokeStyle("ui","#FFFFFF");core.fillRect("ui",q,z,v,i);core.strokeRect("ui",q-1,z-1,v+1,i+1,"#FFFFFF",2);var B=9;if(s=="up"&&core.isset(t)&&core.isset(u)){core.canvas.ui.clearRect(32*t+B,z+i-1,32-2*B,2);core.canvas.ui.beginPath();core.canvas.ui.moveTo(32*t+B-1,z+i-1);core.canvas.ui.lineTo(32*t+16,z+i+D-2);core.canvas.ui.lineTo(32*t+32-B+1,z+i-1);core.canvas.ui.moveTo(32*t+B-1,z+i-1);core.canvas.ui.closePath();core.canvas.ui.fill();core.drawLine("ui",32*t+B,z+i,32*t+16,z+i+D-2);core.drawLine("ui",32*t+32-B,z+i,32*t+16,z+i+D-2)}if(s=="down"&&core.isset(t)&&core.isset(u)){core.canvas.ui.clearRect(32*t+B,z-2,32-2*B,3);core.canvas.ui.beginPath();core.canvas.ui.moveTo(32*t+B-1,z+1);core.canvas.ui.lineTo(32*t+16-1,z-D+2);core.canvas.ui.lineTo(32*t+32-B-1,z+1);core.canvas.ui.moveTo(32*t+B-1,z+1);core.canvas.ui.closePath();core.canvas.ui.fill();core.drawLine("ui",32*t+B,z,32*t+16,z-D+2);core.drawLine("ui",32*t+32-B,z,32*t+16,z-D+2)}core.canvas.ui.textAlign="left";var e=z+35;if(core.isset(n)){e=z+57;core.setAlpha("ui",y.title[3]);core.setFillStyle("ui",core.arrayToRGB(y.title));core.setStrokeStyle("ui",core.arrayToRGB(y.title));if(n=="hero"){var j=core.material.icons.hero.height;core.strokeRect("ui",q+15-1,z+40-1,34,j+2,null,2);core.fillText("ui",core.status.hero.name,d,z+30,null,"bold 22px Verdana");core.clearMap("ui",q+15,z+40,32,j);core.fillRect("ui",q+15,z+40,32,j,b);var k=core.material.icons.hero.down;core.canvas.ui.drawImage(core.material.images.hero,k.stop*32,k.loc*j,32,j,q+15,z+40,32,j)}else{core.fillText("ui",r,d,z+30,null,"bold 22px Verdana");if(core.isset(l)){core.strokeRect("ui",q+15-1,z+40-1,34,m+2,null,2);core.status.boxAnimateObjs=[];core.status.boxAnimateObjs.push({bgx:q+15,bgy:z+40,bgWidth:32,bgHeight:m,x:q+15,y:z+40,height:m,animate:a,image:o,pos:l*m});core.drawBoxAnimate()}}}var g=function(E){core.clearMap("ui",d,e-18,A,z+i-e+10);core.setAlpha("ui",y.background[3]);core.setFillStyle("ui",core.arrayToRGB(y.background));core.fillRect("ui",d,e-18,A,z+i-e+10);core.setAlpha("ui",y.text[3]);core.setFillStyle("ui",core.arrayToRGB(y.text));var F=core.splitLines("ui",E,A,h);for(var G=0;G<F.length;G++){core.fillText("ui",F[G],d,e+21*G,null,h)}};if(y.time<=0||core.status.event.id!="action"){g(c)}else{var p=0;core.status.event.interval=setInterval(function(){g(c.substring(0,++p));if(p==c.length){clearInterval(core.status.event.interval)}},y.time)}};ui.prototype.drawChoices=function(g,f){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.status.event.ui={text:g,choices:f};var w=f.length;var u=85,C=416-2*u;var l=32*(w+2),c=208+l/2;if(w%2==0){c+=16}var e=c-l+56;var r=null,x=null,s=null,p=null,q=32,a=null;var k=null;var h=u+15;if(core.isset(g)){if(g.indexOf("\t[")==0){var t=g.indexOf("]");if(t>=0){var z=g.substring(2,t);g=g.substring(t+1);var y=z.split(",");if(y.length==1){r=y[0];if(r!="hero"){if(core.isset(core.material.enemys[r])){x=core.material.enemys[r].name;if(core.isset(core.material.icons.enemy48[r])){s=core.material.images.enemy48;p=core.material.icons.enemy48[r];q=48;a=4}else{s=core.material.images.enemys;p=core.material.icons.enemys[r];q=32;a=2}}else{x=r;r="npc";s=null;p=null}}}else{r="npc";x=y[0];if(core.isset(core.material.icons.npc48[y[1]])){s=core.material.images.npc48;p=core.material.icons.npc48[y[1]];q=48;a=4}else{s=core.material.images.npcs;p=core.material.icons.npcs[y[1]];q=32;a=2}}}}g=core.replaceText(g);if(r=="hero"||core.isset(p)){h=u+60}k=core.splitLines("ui",g,C-(h-u)-10,"bold 15px Verdana");var d=0;if(x!=null){d+=25}d+=k.length*20;l+=d}var B=c-l;core.fillRect("ui",u,B,C,l,b);core.strokeRect("ui",u-1,B-1,C+1,l+1,"#FFFFFF",2);if(core.isset(k)){var j=B+35;if(core.isset(r)){core.canvas.ui.textAlign="center";j=B+55;var A=u+C/2;if(r=="hero"||core.isset(p)){A+=22}if(r=="hero"){var m=core.material.icons.hero.height;core.strokeRect("ui",u+15-1,B+30-1,34,m+2,"#DDDDDD",2);core.fillText("ui",core.status.hero.name,A,B+27,"#FFD700","bold 19px Verdana");core.clearMap("ui",u+15,B+30,32,m);core.fillRect("ui",u+15,B+30,32,m,b);var n=core.material.icons.hero.down;core.canvas.ui.drawImage(core.material.images.hero,n.stop*32,n.loc*m,32,m,u+15,B+30,32,m)}else{core.fillText("ui",x,A,B+27,"#FFD700","bold 19px Verdana");if(core.isset(p)){core.strokeRect("ui",u+15-1,B+30-1,34,q+2,"#DDDDDD",2);core.status.boxAnimateObjs=[];core.status.boxAnimateObjs.push({bgx:u+15,bgy:B+30,bgWidth:32,bgHeight:q,x:u+15,y:B+30,height:q,animate:a,image:s,pos:p*q});core.drawBoxAnimate()}}}core.canvas.ui.textAlign="left";for(var o=0;o<k.length;o++){core.fillText("ui",k[o],h,j,"#FFFFFF","bold 15px Verdana");j+=20}}core.canvas.ui.textAlign="center";for(var o=0;o<f.length;o++){core.fillText("ui",core.replaceText(f[o].text||f[o]),208,e+32*o,"#FFFFFF","bold 17px Verdana")}if(f.length>0){if(!core.isset(core.status.event.selection)){core.status.event.selection=0}while(core.status.event.selection<0){core.status.event.selection+=f.length}while(core.status.event.selection>=f.length){core.status.event.selection-=f.length}var v=core.canvas.ui.measureText(core.replaceText(f[core.status.event.selection].text||f[core.status.event.selection])).width;core.strokeRect("ui",208-v/2-5,e+32*core.status.event.selection-20,v+10,28,"#FFD700",2)}return};ui.prototype.drawConfirmBox=function(l,n,j){core.lockControl();core.status.event.id="confirmBox";core.status.event.data={yes:n,no:j};core.status.event.ui=l;if(!core.isset(core.status.event.selection)||core.status.event.selection>1){core.status.event.selection=1}if(core.status.event.selection<0){core.status.event.selection=0}var a=core.canvas.ui.createPattern(core.material.ground,"repeat");core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);core.setFillStyle("ui",a);core.setFont("ui","bold 19px Verdana");var c=l.split("\n");var g=c.length;var h=0;for(var d in c){h=Math.max(h,core.canvas.ui.measureText(c[d]).width)}var e=Math.min(208-40-parseInt(h/2),100);var m=140-(g-1)*30;var k=416-2*e,b=416-140-m;if(core.isPlaying()){core.fillRect("ui",e,m,k,b,a)}if(core.isPlaying()){core.strokeRect("ui",e-1,m-1,k+1,b+1,"#FFFFFF",2)}core.canvas.ui.textAlign="center";for(var d in c){core.fillText("ui",c[d],208,m+50+d*30,"#FFFFFF")}core.fillText("ui","确定",208-38,m+b-35,"#FFFFFF","bold 17px Verdana");core.fillText("ui","取消",208+38,m+b-35);var f=core.canvas.ui.measureText("确定").width;if(core.status.event.selection==0){core.strokeRect("ui",208-38-parseInt(f/2)-5,m+b-35-20,f+10,28,"#FFD700",2)}if(core.status.event.selection==1){core.strokeRect("ui",208+38-parseInt(f/2)-5,m+b-35-20,f+10,28,"#FFD700",2)}};ui.prototype.drawSwitchs=function(){core.status.event.id="switchs";var a=["背景音乐:"+(core.musicStatus.bgmStatus?"[ON]":"[OFF]"),"背景音效:"+(core.musicStatus.soundStatus?"[ON]":"[OFF]"),"战斗动画: "+(core.flags.battleAnimate?"[ON]":"[OFF]"),"怪物显伤: "+(core.flags.displayEnemyDamage?"[ON]":"[OFF]"),"临界显伤: "+(core.flags.displayCritical?"[ON]":"[OFF]"),"领域显伤: "+(core.flags.displayExtraDamage?"[ON]":"[OFF]"),"下载离线版本","返回主菜单"];this.drawChoices(null,a)};ui.prototype.drawSettings=function(){core.status.event.id="settings";this.drawChoices(null,["系统设置","快捷商店","浏览地图","同步存档","返回标题","数据统计","操作帮助","关于本塔","返回游戏"])};ui.prototype.drawQuickShop=function(){core.status.event.id="selectShop";var d=core.status.shops,c=Object.keys(d);var a=[];for(var b=0;b<c.length;b++){a.push(d[c[b]].textInList)}a.push("返回游戏");this.drawChoices(null,a)};ui.prototype.drawBattleAnimate=function(J,f){core.lockControl();if(!core.isset(core.status.event.id)){core.status.event={id:"battle"}}var l=core.getStatus("hp"),h=core.getStatus("atk"),k=core.getStatus("def"),m=core.getStatus("mdef");var H=core.material.enemys[J];var E=H.hp,B=H.atk,C=H.def,F=H.money,D=H.experience,G=H.special;var s=0;if(core.enemys.hasSpecial(G,11)){var S=l*H.value;S=Math.floor(S);if(H.add){E+=S}s+=S}l-=core.enemys.getExtraDamage(H);if(core.enemys.hasSpecial(G,10)){B=h;C=k}if(core.enemys.hasSpecial(G,2)){k=0}if(core.enemys.hasSpecial(G,3)&&C<h){C=h-1}var Q=0;if(core.enemys.hasSpecial(G,1)){Q=1}var R=2;if(core.enemys.hasSpecial(G,4)){R=3}if(core.enemys.hasSpecial(G,5)){R=4}if(core.enemys.hasSpecial(G,6)){R=1+(H.n||4)}if(core.enemys.hasSpecial(G,7)){s+=Math.floor(core.values.breakArmor*k)}if(core.enemys.hasSpecial(G,9)){s+=Math.floor(core.values.purify*m)}m-=s;if(m<0){l+=m;m=0}var N=core.enemys.getSpecialText(J);var b=core.canvas.ui.createPattern(core.material.ground,"repeat");core.clearMap("ui",0,0,416,416);var u=10,K=416-2*u;var y=3;if(core.flags.enableMDef||core.flags.enableMoney||core.flags.enableExperience){y=4}if(core.flags.enableMoney&&core.flags.enableExperience){y=5}var x=60;var g=x*y+50;var P=(416-g)/2,d=g;core.setAlpha("ui",0.85);core.fillRect("ui",u,P,K,d,"#000000");core.setAlpha("ui",1);core.strokeRect("ui",u-1,P-1,K+1,d+1,"#FFFFFF",2);core.clearMap("data",0,0,416,416);clearInterval(core.interval.tipAnimate);core.setAlpha("data",1);core.setOpacity("data",1);core.status.boxAnimateObjs=[];var A=35;var e=40;var I=32,a=2;var r=core.material.images.enemys,q=core.material.icons.enemys;if(core.isset(core.material.icons.enemy48[J])){r=core.material.images.enemy48;q=core.material.icons.enemy48;I=48;a=4}var n=core.material.icons.hero.height;core.strokeRect("ui",u+A-1,P+A-1,e+2,n+e-32+2,"#FFD700",2);core.strokeRect("ui",u+K-A-e-1,P+A-1,e+2,I+e-32+2);core.canvas.ui.textAlign="center";core.fillText("ui",core.status.hero.name,u+A+e/2,P+A+n+40,"#FFD700","bold 22px Verdana");core.fillText("ui","怪物",u+K-A-e/2,P+A+I+40);for(var p=0,t=0;p<N.length;p++){if(N[p]!=""){core.fillText("ui",N[p],u+K-A-e/2,P+A+I+44+20*(++t),"#FF6A6A","15px Verdana")}}core.clearMap("ui",u+A,P+A,e,n+e-32);core.fillRect("ui",u+A,P+A,e,n+e-32,b);var o=core.material.icons.hero.down;core.canvas.ui.drawImage(core.material.images.hero,o.stop*32,o.loc*n,32,n,u+A+(e-32)/2,P+A+(e-32)/2,32,n);core.status.boxAnimateObjs=[];core.status.boxAnimateObjs.push({bgx:u+K-A-40,bgy:P+A,bgWidth:e,bgHeight:I+e-32,x:u+K-A-40+(e-32)/2,y:P+A+(e-32)/2,height:I,image:r,pos:I*q[J],animate:a});core.drawBoxAnimate();var z=80;var w=u+A+e+10;var v=w+z;var L=u+K-A-e-10;var M=L-z;core.canvas.ui.textAlign="left";var O=P+A+10;core.fillText("ui","生命值",w,O,"#DDDDDD","16px Verdana");core.drawLine("ui",w,O+8,v,O+8,"#FFFFFF",2);core.canvas.data.textAlign="right";core.fillText("data",l,v,O+26,"#DDDDDD","bold 16px Verdana");O+=x;core.canvas.ui.textAlign="left";core.fillText("ui","攻击",w,O,"#DDDDDD","16px Verdana");core.drawLine("ui",w,O+8,v,O+8,"#FFFFFF",2);core.canvas.ui.textAlign="right";core.fillText("ui",h,v,O+26,"#DDDDDD","bold 16px Verdana");O+=x;core.canvas.ui.textAlign="left";core.fillText("ui","防御",w,O,"#DDDDDD","16px Verdana");core.drawLine("ui",w,O+8,v,O+8,"#FFFFFF",2);core.canvas.ui.textAlign="right";core.fillText("ui",k,v,O+26,"#DDDDDD","bold 16px Verdana");if(core.flags.enableMDef){O+=x;core.canvas.ui.textAlign="left";core.fillText("ui","护盾",w,O,"#DDDDDD","16px Verdana");core.drawLine("ui",w,O+8,v,O+8,"#FFFFFF",2);core.canvas.data.textAlign="right";core.fillText("data",m,v,O+26,"#DDDDDD","bold 16px Verdana")}core.canvas.ui.textAlign="right";var O=P+A+10;core.fillText("ui","生命值",L,O,"#DDDDDD","16px Verdana");core.drawLine("ui",M,O+8,L,O+8,"#FFFFFF",2);core.canvas.data.textAlign="left";core.fillText("data",E,M,O+26,"#DDDDDD","bold 16px Verdana");O+=x;core.canvas.ui.textAlign="right";core.fillText("ui","攻击",L,O,"#DDDDDD","16px Verdana");core.drawLine("ui",M,O+8,L,O+8,"#FFFFFF",2);core.canvas.ui.textAlign="left";core.fillText("ui",B,M,O+26,"#DDDDDD","bold 16px Verdana");O+=x;core.canvas.ui.textAlign="right";core.fillText("ui","防御",L,O,"#DDDDDD","16px Verdana");core.drawLine("ui",M,O+8,L,O+8,"#FFFFFF",2);core.canvas.ui.textAlign="left";core.fillText("ui",C,M,O+26,"#DDDDDD","bold 16px Verdana");if(core.flags.enableMoney){O+=x;core.canvas.ui.textAlign="right";core.fillText("ui","金币",L,O,"#DDDDDD","16px Verdana");core.drawLine("ui",M,O+8,L,O+8,"#FFFFFF",2);core.canvas.ui.textAlign="left";core.fillText("ui",F,M,O+26,"#DDDDDD","bold 16px Verdana")}if(core.flags.enableExperience){O+=x;core.canvas.ui.textAlign="right";core.fillText("ui","经验",L,O,"#DDDDDD","16px Verdana");core.drawLine("ui",M,O+8,L,O+8,"#FFFFFF",2);core.canvas.ui.textAlign="left";core.fillText("ui",D,M,O+26,"#DDDDDD","bold 16px Verdana")}core.canvas.ui.textAlign="left";core.fillText("ui","V",v+8,208-15,"#FFFFFF","italic bold 40px Verdana");core.canvas.ui.textAlign="right";core.fillText("ui","S",M-8,208+15,"#FFFFFF","italic bold 40px Verdana");var c=setInterval(function(){core.playSound("attack.mp3");if(Q==0){core.drawLine("data",u+K-A-e+6,P+A+I+e-32-6,u+K-A-6,P+A+6,"#FF0000",4);setTimeout(function(){core.clearMap("data",u+K-A-e,P+A,e,e+I-32)},250);if(h-C>0){E-=h-C}if(E<0){E=0}core.clearMap("data",M,P+A+10,z,40);core.canvas.data.textAlign="left";core.fillText("data",E,M,P+A+10+26,"#DDDDDD","bold 16px Verdana");if(core.enemys.hasSpecial(G,8)){m-=Math.floor(core.values.counterAttack*h);if(m<0){l+=m;m=0}core.clearMap("data",w,P+A+10,z,40);core.canvas.data.textAlign="right";core.fillText("data",l,v,P+A+10+26,"#DDDDDD","bold 16px Verdana");if(core.flags.enableMDef){core.clearMap("data",w,P+A+10+3*x,z,40);core.fillText("data",m,v,P+A+10+26+3*x)}}}else{core.drawLine("data",u+A+6,P+A+n+(e-32)-6,u+A+e-6,P+A+6,"#FF0000",4);setTimeout(function(){core.clearMap("data",u+A,P+A,e,n+e-32)},250);var i=B-k;if(i<0){i=0}m-=i;if(m<0){l+=m;m=0}core.clearMap("data",w,P+A+10,z,40);core.canvas.data.textAlign="right";core.fillText("data",l,v,P+A+10+26,"#DDDDDD","bold 16px Verdana");if(core.flags.enableMDef){core.clearMap("data",w,P+A+10+3*x,z,40);core.fillText("data",m,v,P+A+10+26+3*x)}}Q++;if(Q>=R){Q=0}if(l<=0||E<=0){clearInterval(c);core.status.boxAnimateObjs=[];core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);core.clearMap("data",0,0,416,416);if(core.status.event.id=="battle"){core.unLockControl();core.status.event.id=null}if(core.isset(f)){f()}return}},500)};ui.prototype.drawWaiting=function(e){core.lockControl();core.status.event.id="waiting";var a=core.canvas.ui.createPattern(core.material.ground,"repeat");core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);core.setFillStyle("ui",a);core.setFont("ui","bold 17px Verdana");var f=core.canvas.ui.measureText(e).width;var d=Math.max(f+50,220);var c=208-parseInt(d/2),g=208-32-16,b=416-2*g;core.fillRect("ui",c,g,d,b,a);core.strokeRect("ui",c-1,g-1,d+1,b+1,"#FFFFFF",2);core.canvas.ui.textAlign="center";core.fillText("ui",e,208,g+56,"#FFFFFF")};ui.prototype.drawSyncSave=function(){core.status.event.id="syncSave";this.drawChoices(null,["同步存档到服务器","从服务器加载存档","存档至本地文件","从本地文件读档","下载当前录像","清空本地存档","返回主菜单"])};ui.prototype.drawSyncSelect=function(){core.status.event.id="syncSelect";this.drawChoices(null,["同步本地所有存档","只同步最新单存档","返回上级菜单"])};ui.prototype.drawLocalSaveSelect=function(){core.status.event.id="localSaveSelect";this.drawChoices(null,["下载所有存档","只下载最新单存档","返回上级菜单"])};ui.prototype.drawStorageRemove=function(){core.status.event.id="storageRemove";this.drawChoices(null,["清空全部塔的存档","只清空当前塔的存档","返回上级菜单"])};ui.prototype.drawReplay=function(){core.lockControl();core.status.event.id="replay";this.drawChoices(null,["从头回放录像","从存档开始回放","返回游戏"])};ui.prototype.drawPagination=function(b,c){core.setFont("ui","bold 15px Verdana");core.setFillStyle("ui","#DDDDDD");var a=core.canvas.ui.measureText(b+" / "+b).width;core.canvas.ui.textAlign="left";core.fillText("ui",b+" / "+c,parseInt((416-a)/2),403);core.canvas.ui.textAlign="center";if(b>1){core.fillText("ui","上一页",208-80,403)}if(b<c){core.fillText("ui","下一页",208+80,403)}core.fillText("ui","返回游戏",370,403)};ui.prototype.drawCursor=function(){if(!core.isset(core.status.automaticRoute.cursorX)){core.status.automaticRoute.cursorX=core.getHeroLoc("x")}if(core.status.automaticRoute.cursorX<0){core.status.automaticRoute.cursorX=0}if(core.status.automaticRoute.cursorX>12){core.status.automaticRoute.cursorX=12}if(!core.isset(core.status.automaticRoute.cursorY)){core.status.automaticRoute.cursorY=core.getHeroLoc("y")}if(core.status.automaticRoute.cursorY<0){core.status.automaticRoute.cursorY=0}if(core.status.automaticRoute.cursorY>12){core.status.automaticRoute.cursorY=12}core.status.event.id="cursor";core.lockControl();core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);var a=4;core.strokeRect("ui",32*core.status.automaticRoute.cursorX+a/2,32*core.status.automaticRoute.cursorY+a/2,32-a,32-a,"#FFD700",a)};ui.prototype.drawBook=function(n){var j=core.enemys.getCurrentEnemys(core.floorIds[core.status.event.selection]);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);core.fillRect("ui",0,0,416,416);core.setAlpha("ui",0.6);core.setFillStyle("ui","#000000");core.fillRect("ui",0,0,416,416);core.setAlpha("ui",1);core.canvas.ui.textAlign="left";core.setFont("ui","bold 15px Verdana");if(j.length==0){core.fillText("ui","本层无怪物",83,222,"#999999","bold 50px Verdana");core.canvas.ui.textAlign="center";core.fillText("ui","返回游戏",370,403,"#DDDDDD","bold 15px Verdana");return}if(n<0){n=0}if(n>=j.length){n=j.length-1}var q=6;var p=parseInt(n/q)+1;var s=parseInt((j.length-1)/q)+1;core.status.event.data=n;var r=(p-1)*q,g=Math.min(p*q,j.length);j=j.slice(r,g);core.status.boxAnimateObjs=[];for(var m=0;m<j.length;m++){var h=j[m];core.strokeRect("ui",22,62*m+22,42,42,"#DDDDDD",2);var c="enemys";if(core.isset(core.material.icons.enemy48[h.id])){c="enemy48"}var l=c=="enemy48"?48:32;var a=c=="enemy48"?4:2;core.status.boxAnimateObjs.push({bgx:22,bgy:62*m+22,bgWidth:42,bgHeight:42,x:27,y:62*m+27,height:32,animate:a,image:core.material.images[c],pos:core.material.icons[c][h.id]*l});core.canvas.ui.textAlign="center";if(h.special==""){core.fillText("ui",h.name,115,62*m+47,"#DDDDDD","bold 17px Verdana")}else{core.fillText("ui",h.name,115,62*m+40,"#DDDDDD","bold 17px Verdana");core.fillText("ui",h.special,115,62*m+62,"#FF6A6A","bold 15px Verdana")}core.canvas.ui.textAlign="left";core.fillText("ui","生命",165,62*m+32,"#DDDDDD","13px Verdana");core.fillText("ui",core.formatBigNumber(h.hp),195,62*m+32,"#DDDDDD","bold 13px Verdana");core.fillText("ui","攻击",255,62*m+32,"#DDDDDD","13px Verdana");core.fillText("ui",core.formatBigNumber(h.atk),285,62*m+32,"#DDDDDD","bold 13px Verdana");core.fillText("ui","防御",335,62*m+32,"#DDDDDD","13px Verdana");core.fillText("ui",core.formatBigNumber(h.def),365,62*m+32,"#DDDDDD","bold 13px Verdana");var k=165,o=0;if(core.flags.enableMoney){core.fillText("ui","金币",165,62*m+50,"#DDDDDD","13px Verdana");core.fillText("ui",core.formatBigNumber(h.money),195,62*m+50,"#DDDDDD","bold 13px Verdana");k=255;o++}if(core.flags.enableAddPoint){core.canvas.ui.textAlign="left";core.fillText("ui","加点",k,62*m+50,"#DDDDDD","13px Verdana");core.fillText("ui",core.formatBigNumber(h.point),k+30,62*m+50,"#DDDDDD","bold 13px Verdana");k=255;o++}if(core.flags.enableExperience&&o<2){core.canvas.ui.textAlign="left";core.fillText("ui","经验",k,62*m+50,"#DDDDDD","13px Verdana");core.fillText("ui",core.formatBigNumber(h.experience),k+30,62*m+50,"#DDDDDD","bold 13px Verdana");o++}var f=281;if(o==1){f=326}if(o==2){f=361}core.canvas.ui.textAlign="center";var e=h.damage;var d="#FFFF00";if(e==null){e="无法战斗";d="#FF0000"}else{if(e>=core.status.hero.hp){d="#FF0000"}if(e<=0){d="#00FF00"}e=core.formatBigNumber(e)}core.fillText("ui",e,f,62*m+50,d,"bold 13px Verdana");core.canvas.ui.textAlign="left";core.fillText("ui","临界",165,62*m+68,"#DDDDDD","13px Verdana");core.fillText("ui",core.formatBigNumber(h.critical),195,62*m+68,"#DDDDDD","bold 13px Verdana");core.fillText("ui","减伤",255,62*m+68,"#DDDDDD","13px Verdana");core.fillText("ui",core.formatBigNumber(h.criticalDamage),285,62*m+68,"#DDDDDD","bold 13px Verdana");core.fillText("ui","1防",335,62*m+68,"#DDDDDD","13px Verdana");core.fillText("ui",core.formatBigNumber(h.defDamage),365,62*m+68,"#DDDDDD","bold 13px Verdana");if(n==r+m){core.strokeRect("ui",10,62*m+13,416-10*2,62,"#FFD700")}}core.drawBoxAnimate();this.drawPagination(p,s)};ui.prototype.drawBookDetail=function(n){var j=core.enemys.getCurrentEnemys(core.floorIds[core.status.event.selection]);if(j.length==0){return}if(n<0){n=0}if(n>=j.length){n=j.length-1}var g=j[n];var h=g.id;var l=core.enemys.getSpecialHint(core.material.enemys[h]);if(l.length==0){l.push("该怪物无特殊属性。")}l.push("");var f=core.enemys.nextCriticals(h,10).map(function(i){return i[0]+":"+i[1]});while(f[0]=="0:0"){f.shift()}l.push("临界表:"+JSON.stringify(f));var b=l.join("\n");core.status.event.id="book-detail";clearInterval(core.interval.tipAnimate);core.clearMap("data",0,0,416,416);core.setOpacity("data",1);var o=10,q=416-2*o;var c=o+25;var t=q-(c-o)-13;var e=core.splitLines("data",b,t,"16px Verdana");var k=416-10-Math.min(416-24*(e.length+1)-65,250);var s=(416-k)/2,a=k;core.setAlpha("data",0.9);core.fillRect("data",o,s,q,a,"#000000");core.setAlpha("data",1);core.strokeRect("data",o-1,s-1,q+1,a+1,"#FFFFFF",2);core.canvas.data.textAlign="left";core.fillText("data",g.name,c,s+30,"#FFD700","bold 22px Verdana");var d=s+57;for(var m=0;m<e.length;m++){var r=e[m];var n=r.indexOf(":");if(n>=0){var u=r.substring(0,n+1);core.fillText("data",u,c,d,"#FF6A6A","bold 16px Verdana");var p=core.canvas.data.measureText(u).width;core.fillText("data",r.substring(n+1),c+p,d,"#FFFFFF","16px Verdana")}else{core.fillText("data",e[m],c,d,"#FFFFFF","16px Verdana")}d+=24}core.fillText("data","<点击任意位置继续>",270,s+k-13,"#CCCCCC","13px Verdana")};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(b<core.status.hero.flyRange.length-1){core.fillText("ui","▲",356,247-64,"#FFFFFF","17px Verdana")}if(b>0){core.fillText("ui","▼",356,247+64,"#FFFFFF","17px Verdana")}core.strokeRect("ui",20,100,273,273,"#FFFFFF",2);this.drawThumbnail(a,"ui",core.status.maps[a].blocks,20,100,273)};ui.prototype.drawMaps=function(c){if(!core.isset(c)){c=core.floorIds.indexOf(core.status.floorId)}if(c<0){c=0}if(c>=core.floorIds.length){c=core.floorIds.length-1}core.lockControl();core.status.event.id="viewMaps";core.status.event.data=c;var a=core.floorIds[c];clearTimeout(core.interval.tipAnimate);core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);this.drawThumbnail(a,"ui",core.status.maps[a].blocks,0,0,416);core.clearMap("data",0,0,416,416);core.setOpacity("data",0.2);core.canvas.data.textAlign="left";core.setFont("data","16px Arial");var d=core.floors[a].title;var e=16,f=18,g=e+core.canvas.data.measureText(d).width+16,b=42;core.fillRect("data",5,5,g,b,"#000");core.setOpacity("data",0.5);core.fillText("data",d,e+5,f+15,"#fff")};ui.prototype.drawToolbox=function(f){var n=Object.keys(core.status.hero.items.tools).sort();var b=Object.keys(core.status.hero.items.constants).sort();if(!core.isset(f)){if(n.length>0){f=0}else{if(b.length>0){f=100}else{f=0}}}core.status.event.selection=f;var k;if(f<100){k=n[f]}else{k=b[f-100]}if(!core.hasItem(k)){k=null}core.status.event.data=k;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(k)){var g=core.material.items[k];core.fillText("ui",g.name,10,32,"#FFD700","bold 20px Verdana");var l=g.text||"该道具暂无描述。";var j=core.splitLines("ui",l,406,"17px Verdana");core.fillText("ui",j[0],10,62,"#FFFFFF","17px Verdana");if(j.length==1){core.fillText("ui","<继续点击该道具即可进行使用>",10,89,"#CCCCCC","14px Verdana")}else{var h=l.substring(j[0].length);core.fillText("ui",h,10,89,"#FFFFFF","17px Verdana")}}core.canvas.ui.textAlign="right";var e=core.material.images.items;for(var c=0;c<n.length;c++){var m=n[c];var d=core.material.icons.items[m];if(c<6){core.canvas.ui.drawImage(e,0,d*32,32,32,16*(4*c+1)+5,144+5,32,32);core.fillText("ui",core.itemCount(m),16*(4*c+1)+40,144+38,"#FFFFFF","bold 14px Verdana");if(k==m){core.strokeRect("ui",16*(4*c+1)+1,144+1,40,40,"#FFD700")}}else{core.canvas.ui.drawImage(e,0,d*32,32,32,16*(4*(c-6)+1)+5,144+64+5,32,32);core.fillText("ui",core.itemCount(m),16*(4*(c-6)+1)+40,144+64+38,"#FFFFFF","bold 14px Verdana");if(k==m){core.strokeRect("ui",16*(4*(c-6)+1)+1,144+64+1,40,40,"#FFD700")}}}for(var c=0;c<b.length;c++){var a=b[c];var d=core.material.icons.items[a];if(c<6){core.canvas.ui.drawImage(e,0,d*32,32,32,16*(4*c+1)+5,304+5,32,32);if(k==a){core.strokeRect("ui",16*(4*c+1)+1,304+1,40,40,"#FFD700")}}else{core.canvas.ui.drawImage(e,0,d*32,32,32,16*(4*(c-6)+1)+5,304+64+5,32,32);if(k==a){core.strokeRect("ui",16*(4*(c-6)+1)+1,304+64+1,40,40,"#FFD700")}}}core.canvas.ui.textAlign="center";core.fillText("ui","删除道具",370,32,"#DDDDDD","bold 15px Verdana");core.fillText("ui","返回游戏",370,403,"#DDDDDD","bold 15px Verdana")};ui.prototype.drawSLPanel=function(d){if(!core.isset(d)){d=1}if(d<0){d=0}var h=parseInt(d/10),g=d%10;var e=main.savePages||30;if(h>=e){h=e-1}if(g>5){g=5}d=10*h+g;core.status.event.data=d;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 l=416/6,j=118;var k="#FFD700";if(core.status.event.selection){k="#FF6A6A"}var f=core.status.event.id=="save"?"存档":core.status.event.id=="load"?"读档":core.status.event.id=="replayLoad"?"回放":"";for(var b=0;b<6;b++){var c=5*h+b;var a=core.getLocalStorage(b==0?"autoSave":"save"+c,null);if(b<3){core.fillText("ui",b==0?"自动存档":f+c,(2*b+1)*l,35,"#FFFFFF","bold 17px Verdana");core.strokeRect("ui",(2*b+1)*l-j/2,50,j,j,b==g?k:"#FFFFFF",b==g?6:2);if(core.isset(a)&&core.isset(a.floorId)){this.drawThumbnail(a.floorId,"ui",core.maps.load(a.maps,a.floorId).blocks,(2*b+1)*l-j/2,50,j,a.hero.loc,a.hero.flags.heroIcon||"hero.png");core.fillText("ui",core.formatDate(new Date(a.time)),(2*b+1)*l,65+j,"#FFFFFF","10px Verdana")}else{core.fillRect("ui",(2*b+1)*l-j/2,50,j,j,"#333333",2);core.fillText("ui","空",(2*b+1)*l,117,"#FFFFFF","bold 30px Verdana")}}else{core.fillText("ui",f+c,(2*b-5)*l,230,"#FFFFFF","bold 17px Verdana");core.strokeRect("ui",(2*b-5)*l-j/2,245,j,j,b==g?k:"#FFFFFF",b==g?6:2);if(core.isset(a)&&core.isset(a.floorId)){this.drawThumbnail(a.floorId,"ui",core.maps.load(a.maps,a.floorId).blocks,(2*b-5)*l-j/2,245,j,a.hero.loc,a.hero.flags.heroIcon||"hero.png");core.fillText("ui",core.formatDate(new Date(a.time)),(2*b-5)*l,260+j,"#FFFFFF","10px Verdana")}else{core.fillRect("ui",(2*b-5)*l-j/2,245,j,j,"#333333",2);core.fillText("ui","空",(2*b-5)*l,245+70,"#FFFFFF","bold 30px Verdana")}}}this.drawPagination(h+1,e);if(core.status.event.selection){core.setFillStyle("ui","#FF6A6A")}core.fillText("ui","删除模式",48,403)};ui.prototype.drawThumbnail=function(h,g,f,w,z,v,n,m){core.clearMap(g,w,z,v,v);var k=core.floors[h].defaultGround||"ground";var d=core.material.icons.terrains[k];var e=core.material.images.terrains;var t=v/13;for(var o=0;o<13;o++){for(var r=0;r<13;r++){core.canvas[g].drawImage(e,0,d*32,32,32,w+o*t,z+r*t,t,t)}}var q=[];if(core.isset(core.floors[h].images)){q=core.floors[h].images;if(typeof q=="string"){q=[[0,0,q]]}}q.forEach(function(A){var y=v/416;var b=parseInt(A[0]),i=parseInt(A[1]),x=A[2];if(core.isset(b)&&core.isset(i)&&!A[3]&&core.isset(core.material.images.images[x])){b*=32;i*=32;var j=core.material.images.images[x];core.canvas.ui.drawImage(j,w+b*y,z+i*y,Math.min(v-b*y,y*j.width),Math.min(v-i*y,y*j.height))}});var s=core.maps.getMapArray(f);for(var a in f){var c=f[a];if(core.isset(c.event)&&!(core.isset(c.enable)&&!c.enable)){if(c.event.cls=="autotile"){core.drawAutotile(core.canvas.ui,s,c,t,w,z)}else{if(c.event.id!="none"){var d=core.material.icons[c.event.cls][c.event.id];var e=core.material.images[c.event.cls];var l=c.event.height||32;core.canvas[g].drawImage(e,0,d*l,32,l,w+c.x*t,z+c.y*t+(t-t*l/32),t,t*l/32)}}}}if(core.isset(n)){if(!core.isset(core.material.images.images[m])){m="hero.png"}var p=core.material.icons.hero[n.direction];var l=core.material.images.images[m].height/4;var u=t*l/32;core.canvas[g].drawImage(core.material.images.images[m],p.stop*32,p.loc*l,32,l,w+t*n.x,z+t*n.y+t-u,t,u)}q.forEach(function(A){var y=v/416;var b=parseInt(A[0]),i=parseInt(A[1]),x=A[2];if(core.isset(b)&&core.isset(i)&&A[3]&&core.isset(core.material.images.images[x])){b*=32;i*=32;var j=core.material.images.images[x];core.canvas.ui.drawImage(j,w+b*y,z+i*y,Math.min(v-b*y,y*j.width),Math.min(v-i*y,y*j.height))}})};ui.prototype.drawKeyBoard=function(){core.lockControl();core.status.event.id="keyBoard";core.clearMap("ui",0,0,416,416);var c=16,g=48,f=416-2*c,b=416-2*g;var a=core.canvas.ui.createPattern(core.material.ground,"repeat");core.fillRect("ui",c,g,f,b,a);core.strokeRect("ui",c-1,g-1,f+1,b+1,"#FFFFFF",2);core.canvas.ui.textAlign="center";core.fillText("ui","虚拟键盘",208,g+35,"#FFD700","bold 22px Verdana");core.setFont("ui","17px Verdana");core.setFillStyle("ui","#FFFFFF");var e=128-9;var d=[["F1","F2","F3","F4","F5","F6","F7","F8","F9","10","11"],["1","2","3","4","5","6","7","8","9","0"],["Q","W","E","R","T","Y","U","I","O","P"],["A","S","D","F","G","H","J","K","L"],["Z","X","C","V","B","N","M"],["-","=","[","]","\\",";","'",",",".","/","`"],["ES","TA","CA","SH","CT","AL","SP","BS","EN","DE"]];d.forEach(function(j){for(var h=0;h<j.length;h++){core.fillText("ui",j[h],48+32*h,e)}e+=32});core.fillText("ui","返回游戏",416-80,e-3,"#FFFFFF","bold 15px Verdana")};ui.prototype.drawStatistics=function(){var total={monster:{count:0,money:0,experience:0,point:0,},count:{yellowDoor:0,blueDoor:0,redDoor:0,steelDoor:0,yellowKey:0,blueKey:0,redKey:0,steelKey:0,redJewel:0,blueJewel:0,greenJewel:0,yellowJewel:0,redPotion:0,bluePotion:0,greenPotion:0,yellowPotion:0,superPotion:0,pickaxe:0,bomb:0,centerFly:0,poisonWine:0,weakWine:0,curseWine:0,superWine:0,sword1:0,sword2:0,sword3:0,sword4:0,sword5:0,shield1:0,shield2:0,shield3:0,shield4:0,shield5:0,},add:{hp:0,atk:0,def:0,mdef:0}};var current=core.clone(total);core.floorIds.forEach(function(floorId){var floor=core.floors[floorId];var blocks=core.status.maps[floorId].blocks;if(floor.cannotViewMap&&floorId!=core.status.floorId){return}blocks.forEach(function(block){if(!core.isset(block.event)||(core.isset(block.enable)&&!block.enable)){return}var event=block.event;if(event.cls.indexOf("enemy")==0){var enemyId=event.id,enemy=core.material.enemys[enemyId];total.monster.money+=enemy.money||0;total.monster.experience+=enemy.experience||0;total.monster.point+=enemy.point||0;total.monster.count++;if(floorId==core.status.floorId){current.monster.money+=enemy.money||0;current.monster.experience+=enemy.experience||0;current.monster.point+=enemy.point||0;current.monster.count++}}else{var id=event.id;var temp=core.clone(core.status.hero);if(core.isset(total.count[id])){var hp=0,atk=0,def=0,mdef=0;if(core.isset(core.material.items[id])&&core.material.items[id].cls=="items"&&id!="superPotion"){var ratio=floor.item_ratio||1;if(core.isset(core.items.itemEffect[id])){eval(core.items.itemEffect[id])}hp=core.status.hero.hp-temp.hp;atk=core.status.hero.atk-temp.atk;def=core.status.hero.def-temp.def;mdef=core.status.hero.mdef-temp.mdef}else{if(id.indexOf("sword")==0&&core.isset(core.values[id])){var x=core.values[id];if(typeof x=="number"){x={atk:x}}atk+=x.atk||0;def+=x.def||0;mdef+=x.mdef||0}if(id.indexOf("shield")==0&&core.isset(core.values[id])){var x=core.values[id];if(typeof x=="number"){x={def:x}}atk+=x.atk||0;def+=x.def||0;mdef+=x.mdef||0}}core.status.hero=core.clone(temp);total.count[id]++;total.add.hp+=hp;total.add.atk+=atk;total.add.def+=def;total.add.mdef+=mdef;if(floorId==core.status.floorId){current.count[id]++;current.add.hp+=hp;current.add.atk+=atk;current.add.def+=def;current.add.mdef+=mdef}}}})});var getText=function(type,data){var text=type+"地图中:\n";text+="共有怪物"+data.monster.count+"个";if(core.flags.enableMoney){text+=",总金币数"+data.monster.money}if(core.flags.enableExperience){text+=",总经验数"+data.monster.experience}if(core.flags.enableAddPoint){text+=",总加点数"+data.monster.point}text+="。\n\n";Object.keys(data.count).forEach(function(key){var value=data.count[key];if(value>0){var name="";if(key=="yellowDoor"){name="黄门"}else{if(key=="blueDoor"){name="蓝门"}else{if(key=="redDoor"){name="红门"}else{if(key=="steelDoor"){name="铁门"}else{name=core.material.items[key].name}}}}if(core.isset(name)){text+=name+value+"个;"}}});text+="\n\n";text+="共加生命值"+core.formatBigNumber(data.add.hp)+"点,攻击"+core.formatBigNumber(data.add.atk)+"点,防御"+core.formatBigNumber(data.add.def)+"点,魔防"+core.formatBigNumber(data.add.mdef)+"点。";return text};var formatTime=function(time){return core.setTwoDigits(parseInt(time/3600000))+":"+core.setTwoDigits(parseInt(time/60000)%60)+":"+core.setTwoDigits(parseInt(time/1000)%60)};var statistics=core.status.hero.statistics;core.drawText([getText("全塔",total),getText("当前",current),"当前总步数:"+core.status.hero.steps+",当前游戏时长:"+formatTime(statistics.currTime)+",总游戏时长"+formatTime(statistics.totalTime)+"。\n瞬间移动次数:"+statistics.moveDirectly+",共计少走"+statistics.ignoreSteps+"步。\n\n总计通过血瓶恢复生命值为"+core.formatBigNumber(statistics.hp)+"点。\n\n总计受到的伤害为"+core.formatBigNumber(statistics.battleDamage+statistics.poisonDamage+statistics.extraDamage)+",其中战斗伤害"+core.formatBigNumber(statistics.battleDamage)+"点"+(core.flags.enableDebuff?(",中毒伤害"+core.formatBigNumber(statistics.poisonDamage)+"点"):"")+",领域/夹击/阻击/血网伤害"+core.formatBigNumber(statistics.extraDamage)+"点。","\t[说明]1. 地图数据统计的效果仅模拟当前立刻获得该道具的效果。\n2. 不会计算“不可被浏览地图”的隐藏层的数据。\n3. 不会计算任何通过事件得到的道具(显示事件、改变图块、或直接增加道具等)。\n4. 在自定义道具(例如其他宝石)后,需在ui.js的drawStatistics中注册,不然不会进行统计。\n5. 所有统计信息仅供参考,如有错误,概不负责。"])};ui.prototype.drawAbout=function(){return this.uidata.drawAbout()};ui.prototype.drawHelp=function(){core.drawText(["\t[键盘快捷键列表][CTRL] 跳过对话\n[Z] 转向\n[X] 打开/关闭怪物手册\n[G] 打开/关闭楼层传送器\n[A] 读取自动存档(回退)\n[S/D] 打开/关闭存/读档页面\n[K] 打开/关闭快捷商店选择列表\n[T] 打开/关闭工具栏\n[ESC] 打开/关闭系统菜单\n[H] 打开帮助页面\n[R] 回放\n[SPACE] 轻按(仅在轻按开关打开时有效)\n[PgUp/PgDn] 浏览地图\n[1] 快捷使用破墙镐\n[2] 快捷使用炸弹/圣锤\n[3] 快捷使用中心对称飞行器","\t[鼠标操作]点状态栏中图标: 进行对应的操作\n点任意块: 寻路并移动\n点任意块并拖动: 指定寻路路线\n单击勇士: 转向\n双击勇士: 轻按(仅在轻按开关打开时有效)\n长按任意位置:跳过剧情对话或打开虚拟键盘\n"])}; |