Update Final

This commit is contained in:
oc committed 2017-12-09 14:39:48 +08:00
1 parent 3ce60d37c2
commit eb77c48057
15 files changed
+249 -305

No files matched your search

Binary file not shown.
Binary file not shown.
+204 -198
View File
@@ -630,7 +630,7 @@ core.prototype.onclick = function (x, y, stepPostfix) {
// 快捷商店
if (core.status.event.id == 'selectShop') {
core.events.clickSelectShop(x,y);
core.events.clickQuickShop(x,y);
return;
}
@@ -679,124 +679,10 @@ core.prototype.onclick = function (x, y, stepPostfix) {
if (core.status.event.id == 'syncSave') {
if (x>=4 && x<=8) {
if (y==5) {
core.ui.drawConfirmBox("你确定要将本地存档同步到服务器吗?", function(){
// console.log("同步存档...");
core.ui.drawWaiting("正在同步,请稍后...");
var formData = new FormData();
formData.append('type', 'save');
formData.append('name', core.firstData.name);
var saves = [];
for (var i=1;i<=180;i++) {
var data = core.getLocalStorage("save"+i, null);
if (core.isset(data)) {
saves.push(data);
}
}
var save_text = JSON.stringify(saves);
formData.append('data', save_text);
// send
var xhr = new XMLHttpRequest();
xhr.open("POST", "../sync.php");
xhr.timeout = 1000;
xhr.onload = function(e) {
if (xhr.status==200) {
// console.log("同步成功。");
var response = JSON.parse(xhr.response);
if (response.code<0) {
core.drawText("出错啦!\n无法同步存档到服务器。");
}
else {
core.drawText("同步成功!\n\n您的存档编号: "+response.code+"\n您的存档密码: "+response.msg+"\n\n请牢记以上两个信息(如截图等),在从服务器\n同步存档时使用。")
}
}
else {
core.drawText("出错啦!\n无法同步存档到服务器。");
}
};
xhr.ontimeout = function(e) {
console.log(e);
core.drawText("出错啦!\n无法同步存档到服务器。");
}
xhr.onerror = function(e) {
console.log(e);
core.drawText("出错啦!\n无法同步存档到服务器。");
}
xhr.send(formData);
}, function() {
core.ui.drawSyncSave();
})
core.syncSave("save");
}
if (y==6) {
core.ui.drawConfirmBox("你确定要从服务器加载存档吗?\n该操作将覆盖所有本地存档且不可逆!", function(){
var id = prompt("请输入存档编号:");
if (id==null || id=="") {
core.ui.drawSyncSave(); return;
}
var password = prompt("请输入存档密码:");
if (password==null || password=="") {
core.ui.drawSyncSave(); return;
}
core.ui.drawWaiting("正在同步,请稍后...");
var formData = new FormData();
formData.append('type', 'load');
formData.append('name', core.firstData.name);
formData.append('id', id);
formData.append('password', password);
// send
var xhr = new XMLHttpRequest();
xhr.open("POST", "../sync.php");
xhr.timeout = 1000;
xhr.onload = function(e) {
if (xhr.status==200) {
// console.log("同步成功。");
var response = JSON.parse(xhr.response);
switch (response.code) {
case 0:
// 成功
var data=JSON.parse(response.msg);
// console.log(data);
for (var i=1;i<=180;i++) {
if (i<=data.length) {
core.setLocalStorage("save"+i, data[i-1]);
}
else {
core.removeLocalStorage("save"+i);
}
}
core.drawText("同步成功!\n你的本地所有存档均已被覆盖。");
break;
case -1:
core.drawText("出错啦!\n存档编号"+id+"不存在!");
break;
case -2:
core.drawText("出错啦!\n存档密码错误!");
break;
default:
core.drawText("出错啦!\n无法从服务器同步存档。");
break;
}
}
else {
core.drawText("出错啦!\n无法从服务器同步存档。");
}
};
xhr.ontimeout = function(e) {
console.log(e);
core.drawText("出错啦!\n无法从服务器同步存档。");
}
xhr.onerror = function(e) {
console.log(e);
core.drawText("出错啦!\n无法从服务器同步存档。");
}
xhr.send(formData);
}, function() {
core.ui.drawSyncSave();
})
core.syncSave("load");
}
}
if (x>=5 && x<=7 && y==7) {
@@ -1318,7 +1204,7 @@ core.prototype.openDoor = function (id, x, y, needKey, callback) {
var speed=30;
if (needKey) {
var key = id.replace("Door", "Key");
if (!core.rmItem(key)) {
if (!core.removeItem(key)) {
if (key != "specialKey")
core.drawTip("你没有" + core.material.items[key].name);
else core.drawTip("无法开启此门");
@@ -1395,9 +1281,36 @@ core.prototype.battle = function (id, x, y, force, callback) {
core.events.afterBattle(id,x,y,callback);
}
core.prototype.trigger = function (x, y) {
var mapBlocks = core.status.thisMap.blocks;
var noPass;
for (var b = 0; b < mapBlocks.length; b++) {
if (mapBlocks[b].x == x && mapBlocks[b].y == y && !(core.isset(mapBlocks[b].enable) && !mapBlocks[b].enable)) { // 启用事件
noPass = mapBlocks[b].event && mapBlocks[b].event.noPass;
if (noPass) {
core.clearAutomaticRouteNode(x, y);
}
if (core.isset(mapBlocks[b].event) && core.isset(mapBlocks[b].event.trigger)) {
var trigger = mapBlocks[b].event.trigger;
// 转换楼层能否穿透
if (trigger=='changeFloor' && (core.status.autoHeroMove || core.status.autoStep<core.status.autoStepRoutes.length)) {
var canCross = core.flags.portalWithoutTrigger;
if (core.isset(mapBlocks[b].event.data) && core.isset(mapBlocks[b].event.data.portalWithoutTrigger))
canCross=mapBlocks[b].event.data.portalWithoutTrigger;
if (canCross) continue;
}
core.material.events[trigger](mapBlocks[b], core, function (data) {
});
}
}
}
}
// 楼层切换
core.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback) {
time = time || 50;
time = time || 800;
time /= 20;
core.lockControl();
core.stopHero();
core.stopAutomaticRoute();
@@ -1519,15 +1432,6 @@ core.prototype.loadCanvas = function (map) {
core.canvas[map].restore();
}
core.prototype.setAlpha = function (map, alpha) {
if (map == 'all') {
for (var m in core.canvas) {
core.canvas[m].globalAlpha = alpha;
}
}
core.canvas[map].globalAlpha = alpha;
}
core.prototype.setStrokeStyle = function (map, style) {
if (map == 'all') {
for (var m in core.canvas) {
@@ -1580,7 +1484,7 @@ core.prototype.drawMap = function (mapName, callback) {
core.status.thisMap = mapData;
var blockIcon, blockImage;
core.clearMap('all');
core.rmGlobalAnimate(null, null, true);
core.removeGlobalAnimate(null, null, true);
for (var x = 0; x < 13; x++) {
for (var y = 0; y < 13; y++) {
blockIcon = core.material.icons.terrains.ground;
@@ -1608,6 +1512,10 @@ core.prototype.noPassExists = function (x, y, floorId) {
return core.isset(block.block.event.noPass) && block.block.event.noPass;
}
core.prototype.noPass = function (x, y) {
return x<0 || x>12 || y<0 || y>12 || core.noPassExists(x,y);
}
core.prototype.npcExists = function (x, y, floorId) {
var block = core.getBlock(x,y,floorId);
if (block==null) return false;
@@ -1650,32 +1558,7 @@ core.prototype.getBlock = function (x, y, floorId, needEnable) {
return null;
}
core.prototype.removeBlockById = function (index, floorId) {
var blocks = core.status.maps[floorId].blocks;
var x=blocks[index].x, y=blocks[index].y;
// 检查该点是否是checkBlock
if (core.floors[floorId].checkBlock.indexOf(x+","+y)>=0) {
blocks[index] = {'x': x, 'y': y, 'event': {'cls': 'terrains', 'id': 'ground', 'noPass': false, 'trigger': 'checkBlock'}};
return;
}
// 检查该点是否存在事件
var event = core.floors[floorId].events[x+","+y];
if (!core.isset(event))
event = core.floors[floorId].changeFloor[x+","+y];
// 不存在事件,直接删除
if (!core.isset(event)) {
blocks.splice(index,1);
return;
}
blocks[index].enable = false;
}
core.prototype.moveBlock = function(x,y,steps,time,disappear,callback) {
core.prototype.moveBlock = function(x,y,steps,time,immediateHide,callback) {
time = time || 500;
clearInterval(core.interval.tipAnimate);
@@ -1732,7 +1615,7 @@ core.prototype.moveBlock = function(x,y,steps,time,disappear,callback) {
var animate=window.setInterval(function() {
// 已经移动完毕,消失
if (moveSteps.length==0) {
if (disappear) opacityVal=0;
if (immediateHide) opacityVal=0;
else opacityVal -= 0.06;
core.setOpacity('data', opacityVal);
core.clearMap('data', nowX, nowY, 32, 32);
@@ -1834,7 +1717,7 @@ core.prototype.removeBlock = function (x, y, floorId) {
// 删除动画,清除地图
if (floorId==core.status.floorId) {
core.rmGlobalAnimate(x, y);
core.removeGlobalAnimate(x, y);
core.canvas.event.clearRect(x * 32, y * 32, 32, 32);
}
@@ -1843,42 +1726,38 @@ core.prototype.removeBlock = function (x, y, floorId) {
core.updateFg();
}
core.prototype.removeBlockById = function (index, floorId) {
var blocks = core.status.maps[floorId].blocks;
var x=blocks[index].x, y=blocks[index].y;
// 检查该点是否是checkBlock
if (core.floors[floorId].checkBlock.indexOf(x+","+y)>=0) {
blocks[index] = {'x': x, 'y': y, 'event': {'cls': 'terrains', 'id': 'ground', 'noPass': false, 'trigger': 'checkBlock'}};
return;
}
// 检查该点是否存在事件
var event = core.floors[floorId].events[x+","+y];
if (!core.isset(event))
event = core.floors[floorId].changeFloor[x+","+y];
// 不存在事件,直接删除
if (!core.isset(event)) {
blocks.splice(index,1);
return;
}
blocks[index].enable = false;
}
core.prototype.removeBlockByIds = function (floorId, ids) {
ids.sort(function (a,b) {return b-a}).forEach(function (id) {
core.removeBlockById(id, floorId);
});
}
core.prototype.noPass = function (x, y) {
return x<0 || x>12 || y<0 || y>12 || core.noPassExists(x,y);
}
core.prototype.trigger = function (x, y) {
var mapBlocks = core.status.thisMap.blocks;
var noPass;
for (var b = 0; b < mapBlocks.length; b++) {
if (mapBlocks[b].x == x && mapBlocks[b].y == y && !(core.isset(mapBlocks[b].enable) && !mapBlocks[b].enable)) { // 启用事件
noPass = mapBlocks[b].event && mapBlocks[b].event.noPass;
if (noPass) {
core.clearAutomaticRouteNode(x, y);
}
if (core.isset(mapBlocks[b].event) && core.isset(mapBlocks[b].event.trigger)) {
var trigger = mapBlocks[b].event.trigger;
// 转换楼层能否穿透
if (trigger=='changeFloor' && (core.status.autoHeroMove || core.status.autoStep<core.status.autoStepRoutes.length)) {
var canCross = core.flags.portalWithoutTrigger;
if (core.isset(mapBlocks[b].event.data) && core.isset(mapBlocks[b].event.data.portalWithoutTrigger))
canCross=mapBlocks[b].event.data.portalWithoutTrigger;
if (canCross) continue;
}
core.material.events[trigger](mapBlocks[b], core, function (data) {
});
}
}
}
}
core.prototype.addGlobalAnimate = function (animateMore, x, y, loc, image) {
if (animateMore == 2) {
core.status.twoAnimateObjs.push({
@@ -1900,7 +1779,7 @@ core.prototype.addGlobalAnimate = function (animateMore, x, y, loc, image) {
}
}
core.prototype.rmGlobalAnimate = function (x, y, all) {
core.prototype.removeGlobalAnimate = function (x, y, all) {
if (all == true) {
core.status.twoAnimateObjs = [];
core.status.fourAnimateObjs = [];
@@ -1982,6 +1861,7 @@ core.prototype.setHeroLoc = function (itemName, itemVal) {
}
core.prototype.getHeroLoc = function (itemName) {
if (!core.isset(itemName)) return core.status.hero.loc;
return core.status.hero.loc[itemName];
}
@@ -2070,7 +1950,7 @@ core.prototype.setItem = function (itemId, itemNum) {
core.status.hero.items[itemCls][itemId] = itemNum;
}
core.prototype.rmItem = function (itemId) {
core.prototype.removeItem = function (itemId) {
if (!core.hasItem(itemId)) return false;
var itemCls = core.material.items[itemId].cls;
core.status.hero.items[itemCls][itemId]--;
@@ -2315,15 +2195,12 @@ core.prototype.setTwoDigits = function (x) {
return parseInt(x)<10?"0"+x:x;
}
core.prototype.lose = function() {
core.stopAutomaticRoute();
if (!core.status.heroStop) {
setTimeout(function() {
core.lose();
}, 30);
return;
}
core.events.lose();
core.prototype.win = function(reason) {
core.events.win(reason);
}
core.prototype.lose = function(reason) {
core.events.lose(reason);
}
// 作弊
@@ -2455,6 +2332,131 @@ core.prototype.doSL = function (id, type) {
}
}
core.prototype.syncSave = function(type) {
if (type=='save') {
core.ui.drawConfirmBox("你确定要将本地存档同步到服务器吗?", function(){
// console.log("同步存档...");
core.ui.drawWaiting("正在同步,请稍后...");
var formData = new FormData();
formData.append('type', 'save');
formData.append('name', core.firstData.name);
var saves = [];
for (var i=1;i<=180;i++) {
var data = core.getLocalStorage("save"+i, null);
if (core.isset(data)) {
saves.push(data);
}
}
var save_text = JSON.stringify(saves);
formData.append('data', save_text);
// send
var xhr = new XMLHttpRequest();
xhr.open("POST", "../sync.php");
xhr.timeout = 1000;
xhr.onload = function(e) {
if (xhr.status==200) {
// console.log("同步成功。");
var response = JSON.parse(xhr.response);
if (response.code<0) {
core.drawText("出错啦!\n无法同步存档到服务器。");
}
else {
core.drawText("同步成功!\n\n您的存档编号: "+response.code+"\n您的存档密码: "+response.msg+"\n\n请牢记以上两个信息(如截图等),在从服务器\n同步存档时使用。")
}
}
else {
core.drawText("出错啦!\n无法同步存档到服务器。");
}
};
xhr.ontimeout = function(e) {
console.log(e);
core.drawText("出错啦!\n无法同步存档到服务器。");
}
xhr.onerror = function(e) {
console.log(e);
core.drawText("出错啦!\n无法同步存档到服务器。");
}
xhr.send(formData);
}, function() {
core.ui.drawSyncSave();
})
}
else if (type=='load') {
core.ui.drawConfirmBox("你确定要从服务器加载存档吗?\n该操作将覆盖所有本地存档且不可逆!", function(){
var id = prompt("请输入存档编号:");
if (id==null || id=="") {
core.ui.drawSyncSave(); return;
}
var password = prompt("请输入存档密码:");
if (password==null || password=="") {
core.ui.drawSyncSave(); return;
}
core.ui.drawWaiting("正在同步,请稍后...");
var formData = new FormData();
formData.append('type', 'load');
formData.append('name', core.firstData.name);
formData.append('id', id);
formData.append('password', password);
// send
var xhr = new XMLHttpRequest();
xhr.open("POST", "../sync.php");
xhr.timeout = 1000;
xhr.onload = function(e) {
if (xhr.status==200) {
// console.log("同步成功。");
var response = JSON.parse(xhr.response);
switch (response.code) {
case 0:
// 成功
var data=JSON.parse(response.msg);
// console.log(data);
for (var i=1;i<=180;i++) {
if (i<=data.length) {
core.setLocalStorage("save"+i, data[i-1]);
}
else {
core.removeLocalStorage("save"+i);
}
}
core.drawText("同步成功!\n你的本地所有存档均已被覆盖。");
break;
case -1:
core.drawText("出错啦!\n存档编号"+id+"不存在!");
break;
case -2:
core.drawText("出错啦!\n存档密码错误!");
break;
default:
core.drawText("出错啦!\n无法从服务器同步存档。");
break;
}
}
else {
core.drawText("出错啦!\n无法从服务器同步存档。");
}
};
xhr.ontimeout = function(e) {
console.log(e);
core.drawText("出错啦!\n无法从服务器同步存档。");
}
xhr.onerror = function(e) {
console.log(e);
core.drawText("出错啦!\n无法从服务器同步存档。");
}
xhr.send(formData);
}, function() {
core.ui.drawSyncSave();
})
}
}
core.prototype.saveData = function(dataId) {
var data = {
'floorId': core.status.floorId,
@@ -2521,6 +2523,10 @@ core.prototype.hasFlag = function(flag) {
return false;
}
core.prototype.insertAction = function (list) {
core.events.insertAction(list);
}
core.prototype.lockControl = function () {
core.status.lockControl = true;
}
+1 -1
View File
@@ -1 +1 @@
function core(){this.dom={};this.statusBar={};this.canvas={};this.images=[];this.sounds={};this.floorIds=[];this.floors={};this.firstData={};this.material={images:{},sounds:{},ground:null,items:{},enemys:{},icons:{},events:{}};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:{},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:{},event:{id:null,data:null},openingDoor:null,twoAnimateObjs:[],fourAnimateObjs:[],boxAnimateObjs:[],};this.status={};this.flags={}}core.prototype.init=function(c,i,a,f,h,d,e,b){core.dom=c;core.statusBar=i;core.canvas=a;core.images=f;core.sounds=h;core.floorIds=d;core.floors=e;for(var g in b){core[g]=b[g]}core.flags=core.data.flags;core.values=core.clone(core.data.values);core.firstData=core.data.getFirstData();core.initStatus.shops=core.firstData.shops;core.dom.versionLabel.innerHTML=core.firstData.version;core.dom.logoLabel.innerHTML=core.firstData.title;core.material.items=core.items.getItems();core.initStatus.maps=core.maps.initMaps(d);core.material.enemys=core.clone(core.enemys.getEnemys());core.material.icons=core.icons.getIcons();core.material.events=core.events.getEvents();core.musicStatus.soundStatus=core.getLocalStorage("soundStatus",true);var j=navigator.userAgent;if(j.indexOf("iPhone")>-1||j.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()})};core.prototype.showStartAnimate=function(a){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 c=window.setInterval(function(){b-=0.03;if(b<0){clearInterval(c);core.dom.startTop.style.display="none";core.dom.startButtonGroup.style.display="block";if(core.isset(a)){a()}}core.dom.startTop.style.opacity=b},20)};core.prototype.hideStartAnimate=function(a){var b=1;var c=window.setInterval(function(){b-=0.03;if(b<0){clearInterval(c);core.dom.startPanel.style.display="none";if(core.isset(a)){a()}}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(c){var f=0,a=0,b=0;a=core.images.length;for(var e in core.sounds){b+=core.sounds[e].length}for(var d=0;d<core.images.length;d++){core.loadImage(core.images[d],function(j,h){core.setStartLoadTipText("正在加载图片 "+j+"...");j=j.split("-");j=j[0];core.material.images[j]=h;f++;core.setStartLoadTipText(j+" 加载完毕...");core.setStartProgressVal(f*(100/a));if(f==a){for(var k in core.sounds){for(var g=0;g<core.sounds[k].length;g++){var m=core.sounds[k][g];m=m.split("-");var l=new Audio();l.preload="none";l.src="sounds/"+m[0]+"."+k;if(m[1]=="loop"){l.loop="loop"}if(!core.isset(core.material.sounds[k])){core.material.sounds[k]={}}core.material.sounds[k][m[0]]=l}}c()}})}};core.prototype.loadImage=function(d,a){try{core.setStartLoadTipText("加载图片 "+d+" 中...");var c=new Image();c.src="images/"+d+".png";if(c.complete){a(d,c);return}c.onload=function(){a(d,c)}}catch(b){alert(b)}};core.prototype.loadSound=function(){if(!core.isset(core.material.sounds.mp3)){return}if(core.musicStatus.isIOS){return}if(core.musicStatus.loaded){return}core.musicStatus.loaded=true;console.log("加载音乐");var c=[];for(var a in core.material.sounds){for(var b in core.material.sounds[a]){c.push(core.material.sounds[a][b])}}core.loadSoundItem(c)};core.prototype.loadSoundItem=function(b){if(b.length==0){if(core.musicStatus.bgmStatus>0){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 coLine truncated
function core(){this.dom={};this.statusBar={};this.canvas={};this.images=[];this.sounds={};this.floorIds=[];this.floors={};this.firstData={};this.material={images:{},sounds:{},ground:null,items:{},enemys:{},icons:{},events:{}};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:{},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:{},event:{id:null,data:null},openingDoor:null,twoAnimateObjs:[],fourAnimateObjs:[],boxAnimateObjs:[],};this.status={};this.flags={}}core.prototype.init=function(c,i,a,f,h,d,e,b){core.dom=c;core.statusBar=i;core.canvas=a;core.images=f;core.sounds=h;core.floorIds=d;core.floors=e;for(var g in b){core[g]=b[g]}core.flags=core.data.flags;core.values=core.clone(core.data.values);core.firstData=core.data.getFirstData();core.initStatus.shops=core.firstData.shops;core.dom.versionLabel.innerHTML=core.firstData.version;core.dom.logoLabel.innerHTML=core.firstData.title;core.material.items=core.items.getItems();core.initStatus.maps=core.maps.initMaps(d);core.material.enemys=core.clone(core.enemys.getEnemys());core.material.icons=core.icons.getIcons();core.material.events=core.events.getEvents();core.musicStatus.soundStatus=core.getLocalStorage("soundStatus",true);var j=navigator.userAgent;if(j.indexOf("iPhone")>-1||j.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()})};core.prototype.showStartAnimate=function(a){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 c=window.setInterval(function(){b-=0.03;if(b<0){clearInterval(c);core.dom.startTop.style.display="none";core.dom.startButtonGroup.style.display="block";if(core.isset(a)){a()}}core.dom.startTop.style.opacity=b},20)};core.prototype.hideStartAnimate=function(a){var b=1;var c=window.setInterval(function(){b-=0.03;if(b<0){clearInterval(c);core.dom.startPanel.style.display="none";if(core.isset(a)){a()}}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(c){var f=0,a=0,b=0;a=core.images.length;for(var e in core.sounds){b+=core.sounds[e].length}for(var d=0;d<core.images.length;d++){core.loadImage(core.images[d],function(j,h){core.setStartLoadTipText("正在加载图片 "+j+"...");j=j.split("-");j=j[0];core.material.images[j]=h;f++;core.setStartLoadTipText(j+" 加载完毕...");core.setStartProgressVal(f*(100/a));if(f==a){for(var k in core.sounds){for(var g=0;g<core.sounds[k].length;g++){var m=core.sounds[k][g];m=m.split("-");var l=new Audio();l.preload="none";l.src="sounds/"+m[0]+"."+k;if(m[1]=="loop"){l.loop="loop"}if(!core.isset(core.material.sounds[k])){core.material.sounds[k]={}}core.material.sounds[k][m[0]]=l}}c()}})}};core.prototype.loadImage=function(d,a){try{core.setStartLoadTipText("加载图片 "+d+" 中...");var c=new Image();c.src="images/"+d+".png";if(c.complete){a(d,c);return}c.onload=function(){a(d,c)}}catch(b){alert(b)}};core.prototype.loadSound=function(){if(!core.isset(core.material.sounds.mp3)){return}if(core.musicStatus.isIOS){return}if(core.musicStatus.loaded){return}core.musicStatus.loaded=true;console.log("加载音乐");var c=[];for(var a in core.material.sounds){for(var b in core.material.sounds[a]){c.push(core.material.sounds[a][b])}}core.loadSoundItem(c)};core.prototype.loadSoundItem=function(b){if(b.length==0){if(core.musicStatus.bgmStatus>0){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 coLine truncated
+3 -3
View File
@@ -85,10 +85,9 @@ data.prototype.init = function() {
/****** 角色相关 ******/
"HPMAX": 999999, // HP上限;-1则无上限
"lavaDamage": 100, // 经过血网受到的伤害
"poisonDamage": 10, // 经过毒网受到的伤害
"poisonDamage": 10, // 中毒后每步受到的伤害
"weakValue": 20, // 衰弱状态下攻防减少的数值
/****** 道具相关 ******/
"cannotUseQuickShop": ["MT0"], // 不能使用快捷商店的楼层列表
"redJewel": 3, // 红宝石加攻击的数值
"blueJewel": 3, // 蓝宝石加防御的数值
"greenJewel": 5, // 绿宝石加魔防的数值
@@ -108,7 +107,8 @@ data.prototype.init = function() {
"shield5": 160, // 神圣盾加防数值
"moneyPocket": 500, // 金钱袋加金币的数值
/****** 道具相关 ******/
/****** 系统相关 ******/
"cannotUseQuickShop": ["MT0"], // 不能使用快捷商店的楼层列表
'animateSpeed': 500,
}
// 系统FLAG,在游戏运行中中请不要修改它。
+1 -1
View File
@@ -51,7 +51,7 @@ enemys.prototype.init = function () {
'goldHornSlime': {'name': '金角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
'redKing': {'name': '红衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
'whiteKing': {'name': '白衣武士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 17, 'experience': 0, 'special': 16},
'blackMagician': {'name': '黑暗大法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 12, 'experience': 0, 'special': 11, 'value': 1/3}, // 吸血怪需要在后面添加value代表吸血比例
'blackMagician': {'name': '黑暗大法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 12, 'experience': 0, 'special': 11, 'value': 1/3}, // 吸血怪需要在后面添加value代表吸血比例
'silverSlime': {'name': '银头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 15, 'experience': 0, 'special': 14},
'swordEmperor': {'name': '剑圣', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
'whiteHornSlime': {'name': '尖角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
+18 -13
View File
@@ -29,11 +29,6 @@ events.prototype.init = function () {
core.changeFloor(data.event.data.floorId, data.event.data.stair,
heroLoc, data.event.data.time, callback);
},
'openShop': function (data, core, callback) {
core.ui.drawShop(data.event.shopid);
if (core.isset(callback))
callback();
},
'passNet': function (data, core, callback) {
core.events.passNet(data);
if (core.isset(callback))
@@ -72,10 +67,17 @@ events.prototype.startGame = function (hard) {
core.hideStartAnimate(function() {
core.drawText(core.clone(core.firstData.startText), function() {
core.startGame(hard);
// 可以在这里设置一些难度分歧
// 例如,简单难度下改变初始生命可以调用:
// if (hard=='Easy') core.setStatus("hp", 10000);
// 具体的各种API参见doc文档
if (hard=='Easy') { // 简单难度
core.setFlag('hard', 1); // 可以用flag:hard来获得当前难度
// 可以在此设置一些初始福利,比如设置初始生命值可以调用:
// core.setStatus("hp", 10000);
}
if (hard=='Normal') { // 普通难度
core.setFlag('hard', 2); // 可以用flag:hard来获得当前难度
}
if (hard=='Hard') { // 困难难度
core.setFlag('hard', 3); // 可以用flag:hard来获得当前难度
}
});
})
}
@@ -84,7 +86,7 @@ events.prototype.startGame = function (hard) {
events.prototype.win = function(reason) {
// 获胜
core.waitHeroToStop(function() {
core.rmGlobalAnimate(0,0,true);
core.removeGlobalAnimate(0,0,true);
core.clearMap('all'); // 清空全地图
core.drawText([
"\t[结局2]恭喜通关!你的分数是${status:hp}。"
@@ -97,7 +99,9 @@ events.prototype.win = function(reason) {
events.prototype.lose = function(reason) {
// 失败
core.waitHeroToStop(function() {
core.drawText('\t[结局1]你死了。', function () {
core.drawText([
"\t[结局1]你死了。\n如题。"
], function () {
core.restart();
});
})
@@ -230,7 +234,7 @@ events.prototype.doAction = function() {
else this.doAction();
break;
case "move": // 移动事件
core.moveBlock(x,y,data.steps,data.time,data.disappear,function() {
core.moveBlock(x,y,data.steps,data.time,data.immediateHide,function() {
core.events.doAction();
})
break;
@@ -246,6 +250,7 @@ events.prototype.doAction = function() {
core.clearMap('hero', 0, 0, 416, 416);
core.setHeroLoc('x', data.loc[0]);
core.setHeroLoc('y', data.loc[1]);
if (core.isset(data.direction)) core.setHeroLoc('direction', data.direction);
core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');
this.doAction();
break;
@@ -675,7 +680,7 @@ events.prototype.clickShop = function(x,y) {
}
// 快捷商店
events.prototype.clickSelectShop = function(x,y) {
events.prototype.clickQuickShop = function(x, y) {
if (x >= 5 && x <= 7) {
var shopList = core.status.shops, keys = Object.keys(shopList);
var topIndex = 6 - parseInt((keys.length + 1) / 2);
+1 -1
View File
@@ -1 +1 @@
function events(){}events.prototype.init=function(){this.events={battle:function(c,b,a){b.battle(c.event.id,c.x,c.y);if(b.isset(a)){a()}},getItem:function(c,b,a){b.getItem(c.event.id,1,c.x,c.y);if(b.isset(a)){a()}},openDoor:function(c,b,a){b.openDoor(c.event.id,c.x,c.y,true);if(b.isset(a)){a()}},changeFloor:function(c,b,a){var d=null;if(b.isset(c.event.data.loc)){d={x:c.event.data.loc[0],y:c.event.data.loc[1]};if(b.isset(c.event.data.direction)){d.direction=c.event.data.direction}}b.changeFloor(c.event.data.floorId,c.event.data.stair,d,c.event.data.time,a)},openShop:function(c,b,a){b.ui.drawShop(c.event.shopid);if(b.isset(a)){a()}},passNet:function(c,b,a){b.events.passNet(c);if(b.isset(a)){a()}},checkBlock:function(c,b,a){b.events.checkBlock(c.x,c.y);if(b.isset(a)){a()}},action:function(c,b,a){b.events.doEvents(c.event.data,c.x,c.y);if(b.isset(a)){a()}}}};events.prototype.getEvents=function(a){if(a==undefined){return this.events}return this.events[a]};main.instance.events=new events();events.prototype.startGame=function(a){if(core.status.isStarting){return}core.status.isStarting=true;core.hideStartAnimate(function(){core.drawText(core.clone(core.firstData.startText),function(){core.startGame(a)})})};events.prototype.win=function(a){core.waitHeroToStop(function(){core.rmGlobalAnimate(0,0,true);core.clearMap("all");core.drawText(["\t[结局2]恭喜通关!你的分数是${status:hp}。"],function(){core.restart()})})};events.prototype.lose=function(a){core.waitHeroToStop(function(){core.drawText("\t[结局1]你死了。",function(){core.restart()})})};events.prototype.checkBlock=function(g,h){var b=0;var c=[[0,-1],[-1,0],[0,1],[1,0]];var d=[null,null,null,null];for(var f in c){var a=core.getBlock(g+c[f][0],h+c[f][1]);if(a==null){continue}if(a.block.event.cls=="enemys"){d[f]=core.material.enemys[a.block.event.id]}}for(var f in d){if(d[f]!=null&&d[f].special==15){b+=d[f].value}}if(b>0){core.drawTip("受到领域伤害"+b+"点")}core.status.hero.hp-=b;if(core.status.hero.hp<=0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose("zone");return}var e=false;if(d[0]!=null&&d[2]!=null&&d[0].id==d[2].id&&d[0].special==16){e=true}if(d[1]!=null&&d[3]!=null&&d[1].id==d[3].id&&d[1].special==16){e=true}if(e&&core.status.hero.hp>1){core.status.hero.hp=parseInt(core.status.hero.hp/2);core.drawTip("受到夹击,生命变成一半")}core.updateStatusBar()};events.prototype.afterChangeFloor=function(a){if(!core.hasFlag("visited_"+a)){this.doEvents(core.floors[a].firstArrive);core.setFlag("visited_"+a,true)}};events.prototype.doEvents=function(b,c,d,a){core.waitHeroToStop(function(){if(!core.isset(b)){return}if(!(b instanceof Array)){b=[b]}core.lockControl();core.status.event={id:"action",data:{list:core.clone(b),x:c,y:d,callback:a}};core.events.doAction()})};events.prototype.doAction=function(){clearInterval(core.interval.boxAnimate);core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);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 b=core.status.event.data.list.shift();core.status.event.data.current=b;var m=core.status.event.data.x,n=core.status.event.data.y;if(typeof b=="string"){core.status.event.data.type="text";core.ui.drawTextBox(b);return}core.status.event.data.type=b.type;switch(b.type){case"text":core.ui.drawTextBox(b.data);break;case"show":if(core.isset(b.time)&&b.time>0&&(!core.isset(b.floorId)||b.floorId==core.status.floorId)){core.animateBlock(b.loc[0],b.loc[1],"show",b.time,function(){core.addBlock(b.loc[0],b.loc[1],b.floorId);core.events.doAction()})}else{core.addBlock(b.loc[0],b.loc[1],b.floorId);this.doAction()}break;case"hide":var j=m,k=n,i=core.status.floorId;if(core.isset(b.loc)){j=b.loc[0];k=b.loc[1]}if(core.isset(b.floorId)){i=b.floorId}core.removeBlock(j,k,i);if(core.isset(b.time)&&b.time>0&&i==core.status.floorId){core.animateBlock(j,k,"hide",b.time,function(){core.events.doAction()})}else{this.doAction()}break;case"move":core.moveBlock(m,n,b.steps,b.time,b.disappear,function(){core.events.doAction()});break;case"changeFloor":var f={x:b.loc[0],y:b.loc[1]};if(core.isset(b.direction)){f.direction=b.direction}core.changeFloor(b.floorId||core.status.floorId,null,f,b.time,function(){core.lockControl();core.events.doAction()});break;case"changePos":core.clearMap("hero",0,0,416,416);core.setHeroLoc("x",b.loc[0]);core.setHeroLoc("y",b.loc[1]);core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop");this.doAction();break;case"openDoor":var d=b.floorId||core.status.floorId;var a=core.getBlock(b.loc[0],b.loc[1],d);if(a!=null){if(d==core.status.floorId){core.openDoor(a.block.event.id,a.block.x,a.block.y,false,function(){core.events.doAction()})}else{core.removeBlock(a.block.x,a.block.y,d);this.doAction()}break}this.doAction();break;case"openShop":core.events.openShop(b.id);break;case"battle":core.battle(b.id,null,null,true,function(){core.events.doActionLine truncated
function events(){}events.prototype.init=function(){this.events={battle:function(c,b,a){b.battle(c.event.id,c.x,c.y);if(b.isset(a)){a()}},getItem:function(c,b,a){b.getItem(c.event.id,1,c.x,c.y);if(b.isset(a)){a()}},openDoor:function(c,b,a){b.openDoor(c.event.id,c.x,c.y,true);if(b.isset(a)){a()}},changeFloor:function(c,b,a){var d=null;if(b.isset(c.event.data.loc)){d={x:c.event.data.loc[0],y:c.event.data.loc[1]};if(b.isset(c.event.data.direction)){d.direction=c.event.data.direction}}b.changeFloor(c.event.data.floorId,c.event.data.stair,d,c.event.data.time,a)},openShop:function(c,b,a){b.ui.drawShop(c.event.shopid);if(b.isset(a)){a()}},passNet:function(c,b,a){b.events.passNet(c);if(b.isset(a)){a()}},checkBlock:function(c,b,a){b.events.checkBlock(c.x,c.y);if(b.isset(a)){a()}},action:function(c,b,a){b.events.doEvents(c.event.data,c.x,c.y);if(b.isset(a)){a()}}}};events.prototype.getEvents=function(a){if(a==undefined){return this.events}return this.events[a]};main.instance.events=new events();events.prototype.startGame=function(a){if(core.status.isStarting){return}core.status.isStarting=true;core.hideStartAnimate(function(){core.drawText(core.clone(core.firstData.startText),function(){core.startGame(a)})})};events.prototype.win=function(a){core.waitHeroToStop(function(){core.removeGlobalAnimate(0,0,true);core.clearMap("all");core.drawText(["\t[结局2]恭喜通关!你的分数是${status:hp}。"],function(){core.restart()})})};events.prototype.lose=function(a){core.waitHeroToStop(function(){core.drawText("\t[结局1]你死了。",function(){core.restart()})})};events.prototype.checkBlock=function(g, h){var b=0;var c=[[0,-1],[-1,0],[0,1],[1,0]];var d=[null,null,null,null];for(var f in c){var a=core.getBlock(g+c[f][0],h+c[f][1]);if(a==null){continue}if(a.block.event.cls=="enemys"){d[f]=core.material.enemys[a.block.event.id]}}for(var f in d){if(d[f]!=null&&d[f].special==15){b+=d[f].value}}if(b>0){core.drawTip("受到领域伤害"+b+"点")}core.status.hero.hp-=b;if(core.status.hero.hp<=0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose("zone");return}var e=false;if(d[0]!=null&&d[2]!=null&&d[0].id==d[2].id&&d[0].special==16){e=true}if(d[1]!=null&&d[3]!=null&&d[1].id==d[3].id&&d[1].special==16){e=true}if(e&&core.status.hero.hp>1){core.status.hero.hp=parseInt(core.status.hero.hp/2);core.drawTip("受到夹击,生命变成一半")}core.updateStatusBar()};events.prototype.afterChangeFloor=function(a){if(!core.hasFlag("visited_"+a)){this.doEvents(core.floors[a].firstArrive);core.setFlag("visited_"+a,true)}};events.prototype.doEvents=function(b,c,d,a){core.waitHeroToStop(function(){if(!core.isset(b)){return}if(!(b instanceof Array)){b=[b]}core.lockControl();core.status.event={id:"action",data:{list:core.clone(b),x:c,y:d,callback:a}};core.events.doAction()})};events.prototype.doAction=function(){clearInterval(core.interval.boxAnimate);core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);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 b=core.status.event.data.list.shift();core.status.event.data.current=b;var m=core.status.event.data.x,n=core.status.event.data.y;if(typeof b=="string"){core.status.event.data.type="text";core.ui.drawTextBox(b);return}core.status.event.data.type=b.type;switch(b.type){case"text":core.ui.drawTextBox(b.data);break;case"show":if(core.isset(b.time)&&b.time>0&&(!core.isset(b.floorId)||b.floorId==core.status.floorId)){core.animateBlock(b.loc[0],b.loc[1],"show",b.time,function(){core.addBlock(b.loc[0],b.loc[1],b.floorId);core.events.doAction()})}else{core.addBlock(b.loc[0],b.loc[1],b.floorId);this.doAction()}break;case"hide":var j=m,k=n,i=core.status.floorId;if(core.isset(b.loc)){j=b.loc[0];k=b.loc[1]}if(core.isset(b.floorId)){i=b.floorId}core.removeBlock(j,k,i);if(core.isset(b.time)&&b.time>0&&i==core.status.floorId){core.animateBlock(j,k,"hide",b.time,function(){core.events.doAction()})}else{this.doAction()}break;case"move":core.moveBlock(m,n,b.steps,b.time,b.disappear,function(){core.events.doAction()});break;case"changeFloor":var f={x:b.loc[0],y:b.loc[1]};if(core.isset(b.direction)){f.direction=b.direction}core.changeFloor(b.floorId||core.status.floorId,null,f,b.time,function(){core.lockControl();core.events.doAction()});break;case"changePos":core.clearMap("hero",0,0,416,416);core.setHeroLoc("x",b.loc[0]);core.setHeroLoc("y",b.loc[1]);core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop");this.doAction();break;case"openDoor":var d=b.floorId||core.status.floorId;var a=core.getBlock(b.loc[0],b.loc[1],d);if(a!=null){if(d==core.status.floorId){core.openDoor(a.block.event.id,a.block.x,a.block.y,false,function(){core.events.doAction()})}else{core.removeBlock(a.block.x,a.block.y,d);this.doAction()}break}this.doAction();break;case"openShop":core.events.openShop(b.id);break;case"battle":core.battle(b.id,null,null,true,function(){core.events.doALine truncated
+3 -3
View File
@@ -2,9 +2,9 @@
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
main.floors.MT0 = {
'floorId': 'MT0', // 楼层唯一标识符,需要和名字完全一致
'title': "0", // 楼层中文名
'name': 0, // 显示在状态栏中的名称
"floorId": "MT0", // 楼层唯一标识符,需要和名字完全一致
"title": "主塔 0 层", // 楼层中文名
"name": 0, // 显示在状态栏中的层数
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
+6 -6
View File
@@ -2,9 +2,9 @@
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
main.floors.sample0 = {
'floorId': 'sample0', // 楼层唯一标识符,需要和名字完全一致
'title': "样板 0 层", // 楼层中文名
'name': 0, // 显示在状态栏中的名称
"floorId": "sample0", // 楼层唯一标识符,需要和名字完全一致
"title": "样板 0 层", // 楼层中文名
"name": 0, // 显示在状态栏中的层数
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
[0, 0, 220, 0, 0, 6, 87, 3, 65, 64, 44, 43, 42],
@@ -79,10 +79,10 @@ main.floors.sample0 = {
"0,12": {"floorId": "sample0", "stair": "upFloor"}, // 注意,目标层有多个楼梯的话,写stair可能会导致到达位置不确定。这时候推荐写loc指明目标点位置。
"1,12": {"floorId": "sample0", "loc": [1,12]},
"2,12": {"floorId": "sample0", "loc": [2,12]},
"3,12": {"floorId": "sample0", "loc": [6,1]},
"4,12": {"floorId": "sample0", "loc": [0,9]},
"3,12": {"floorId": "sample0", "loc": [6,1], "direction": "up"}, // 切换楼层后勇士面对上方
"4,12": {"floorId": "sample0", "loc": [0,9], "direction": "left", "time": 1000}, // 切换楼层后勇士面对左边,切换动画1000ms
"5,12": {"floorId": "sample0", "loc": [6,10], "portalWithoutTrigger": false}, // 不能穿透
"6,12": {"floorId": "sample0", "loc": [10,10]},
"6,12": {"floorId": "sample0", "loc": [10,10], "direction": "left", "time": 1000, "portalWithoutTrigger": false},
},
"afterBattle": { // 战斗后可能触发的事件列表
"2,6": ["\t[ghostSkeleton]不可能,你怎么可能打败我!\n(一个打败怪物触发的事件)"]
+3 -3
View File
@@ -2,9 +2,9 @@
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
main.floors.sample1 = {
'floorId': 'sample1', // 楼层唯一标识符,需要和名字完全一致
'title': "样板 1 层", // 楼层中文名
'name': 1, // 显示在状态栏中的名称
"floorId": "sample1", // 楼层唯一标识符,需要和名字完全一致
"title": "样板 1 层", // 楼层中文名
"name": 1, // 显示在状态栏中的层数
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
[7, 131, 8, 2, 9, 130, 10, 2, 0, 0, 132, 0, 0],
+4 -4
View File
@@ -2,9 +2,9 @@
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
main.floors.sample2 = {
'floorId': 'sample2', // 楼层唯一标识符,需要和名字完全一致
'title': "主塔 40 层", // 楼层中文名
'name': 40, // 显示在状态栏中的名称
"floorId": "sample2", // 楼层唯一标识符,需要和名字完全一致
"title": "主塔 40 层", // 楼层中文名
"name": 40, // 显示在状态栏中的层数
"canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
[5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5],
@@ -296,7 +296,7 @@ main.floors.sample2 = {
{"type": "hide", "loc": [4,6]},
{"type": "hide", "loc": [8,6]},
{"type": "hide", "loc": [8,3]},
{"type": "changeFloor", "floorId": "sample2", "loc": [6,6], "direction": "up", "time": 100}, // 更换勇士地点,合计120毫秒
{"type": "changeFloor", "floorId": "sample2", "loc": [6,6], "direction": "up", "time": 1000}, // 更换勇士地点,合计1秒
{"type": "show", "loc": [6,5]}, // 显示黄宝石
{"type": "sleep", "time": 200}, // 等待200毫秒
{"type": "playSound", "name": "item.ogg"},
+5 -72
View File
@@ -351,76 +351,6 @@ ui.prototype.drawQuickShop = function (need) {
}
/**
* 绘制商店
* @param id
*/
ui.prototype.drawShop = function (id) {
var shop = core.status.shops[id];
// 正在移动中...
if (!core.status.heroStop) {
setTimeout(function () {
core.ui.drawShop(id);
}, 30);
return;
}
core.status.event.data = shop;
core.status.event.id = 'shop';
core.lockControl();
shop.visited = true;
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
var times = shop.times, need = eval(shop.need);
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', background);
var left = 97, top = 64, right = 416 - 2 * left, bottom = 416 - 2 * top;
core.fillRect('ui', left, top, right, bottom, background);
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
// 名称
core.canvas.ui.textAlign = "center";
core.fillText('ui', shop.title, left + 135, top + 34, '#FFFFFF', 'bold 19px Verdana');
// 动画
core.strokeRect('ui', left + 15 - 1, top + 30 - 1, 34, 34, '#DDDDDD', 2);
core.status.boxAnimateObjs = [];
core.status.boxAnimateObjs.push({
'bgx': left + 15, 'bgy': top + 30, 'bgsize': 32,
'image': core.material.images.npcs,
'x': left + 15, 'y': top + 30, 'icon': core.material.icons.npcs[shop.icon]
});
core.setBoxAnimate();
// 对话
core.canvas.ui.textAlign = "left";
if (need<0) need="若干";
var use = shop.use=='experience'?"经验":"金币";
core.fillText('ui', "勇敢的武士啊,给我" + need, left + 60, top + 65, '#FFFFFF', 'bold 14px Verdana');
core.fillText('ui', use + "你就可以:", left + 60, top + 83);
// 选项
core.canvas.ui.textAlign = "center";
for (var i = 0; i < shop.choices.length; i++) {
var choice = shop.choices[i];
var text = choice.text;
if (core.isset(choice.need))
text += "("+eval(choice.need)+use+")"
core.fillText('ui', text, 208, top + 120 + 32 * i, "#FFFFFF", "bold 17px Verdana");
}
core.fillText('ui', "退出商店", 208, top + 248);
}
/**
* 绘制“请等候...”
@@ -835,9 +765,11 @@ ui.prototype.drawAbout = function() {
// 名称
core.canvas.ui.textAlign = "left";
core.fillText('ui', "异空间", text_start, top+35, "#FFD700", "bold 22px Verdana");
core.fillText('ui', "HTML5复刻版", text_start+75, top+37, "#DDDDDD", "bold 15px Verdana");
core.fillText('ui', "HTML5 魔塔样板", text_start, top+35, "#FFD700", "bold 22px Verdana");
core.fillText('ui', "作者: 艾之葵", text_start, top + 80, "#FFFFFF", "bold 17px Verdana");
core.fillText('ui', 'HTML5魔塔交流群:539113091', text_start, top+112);
// TODO: 写自己的“关于”页面
/*
core.fillText('ui', "原作: ss433_2", text_start, top + 112, "#FFFFFF", "bold 17px Verdana");
core.fillText('ui', "制作工具: WebStorm", text_start, top + 144, "#FFFFFF", "bold 17px Verdana");
core.fillText('ui', "测试平台: Chrome/微信/iOS", text_start, top + 176, "#FFFFFF", "bold 17px Verdana");
@@ -846,4 +778,5 @@ ui.prototype.drawAbout = function() {
core.fillText('ui', 'iEcho', text_start+len, top+240);
core.fillText('ui', '打Dota的喵', text_start+len, top+272);
core.fillText('ui', 'HTML5魔塔交流群:539113091', text_start, top+304);
*/
}
Binary file not shown.
Binary file not shown.