Merge remote-tracking branch 'refs/remotes/ckcz123/v2.x' into refactoring-editor

This commit is contained in:
YouWei Zhao 2019-04-22 16:59:45 -04:00
commit e2594ee831
16 changed files with 2399 additions and 125 deletions

2133
API列表.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -776,7 +776,8 @@ core.getCurrentEnemys(floorId)
core.hasEnemyLeft(enemyId, floorId)
检查某个楼层是否还有剩余的指定怪物。floorId为楼层ID可忽略表示当前楼层。
检查某个楼层是否还有剩余的(指定)怪物。
floorId为楼层ID可忽略表示当前楼层。也可以传数组如["MT0","MT1"]同时检测多个楼层。
enemyId如果不填或null则检查是否剩余任何怪物否则只检查是否剩余指定的某类怪物。
```

View File

@ -587,7 +587,7 @@ default : ["","","",500,false]
colour : this.mapColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
var pattern1 = /^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
@ -620,7 +620,7 @@ default : ["","","",500,false]
colour : this.mapColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
var pattern1 = /^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
@ -761,7 +761,7 @@ default : ["","",""]
colour : this.mapColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
var pattern1 = /^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
@ -792,7 +792,7 @@ default : ["","",""]
colour : this.mapColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
var pattern1 = /^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
@ -823,7 +823,7 @@ default : ["bg","","",""]
colour : this.mapColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
var pattern1 = /^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
@ -854,7 +854,7 @@ default : ["bg","","",""]
colour : this.mapColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
var pattern1 = /^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
@ -1157,7 +1157,7 @@ helpUrl : https://h5mota.com/games/template/docs/#/event?id=animate%EF%BC%9A%E6%
default : ["zone","hero",false]
colour : this.soundColor
if (EvalString_0) {
if(/^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-]*,flag:[0-9a-zA-Z_][0-9a-zA-Z_\-]*$/.test(EvalString_0)) {
if(/^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+),flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/.test(EvalString_0)) {
EvalString_0=', "loc": ["'+EvalString_0.split(',').join('","')+'"]';
} else if (/hero|([+-]?\d+),([+-]?\d+)/.test(EvalString_0)) {
if(EvalString_0.indexOf(',')!==-1)EvalString_0='['+EvalString_0+']';
@ -2857,13 +2857,14 @@ MotaActionFunctions.EvalString_pre = function(EvalString){
MotaActionFunctions.IdString_pre = function(IdString){
if (IdString.indexOf('__door__')!==-1) throw new Error('请修改开门变量__door__如door1door2door3等依次向后。请勿存在两个门使用相同的开门变量。');
if (IdString && !(/^[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/.test(IdString)))throw new Error('id: '+IdString+'中包含了0-9 a-z A-Z _ - :之外的字符');
if (IdString && !(/^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/.test(IdString)) && !(/^[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/.test(IdString)))
throw new Error('id: '+IdString+'中包含了0-9 a-z A-Z _ - :之外的字符');
return IdString;
}
MotaActionFunctions.PosString_pre = function(PosString){
if (!PosString || /^-?\d+$/.test(PosString)) return PosString;
if (!(/^flag:[0-9a-zA-Z_][0-9a-zA-Z_:]*$/.test(PosString)))throw new Error(PosString+'中包含了0-9 a-z A-Z _ :之外的字符,或者是没有以flag: 开头');
if (!(/^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/.test(PosString)))throw new Error(PosString+'中包含了0-9 a-z A-Z _ 和中文之外的字符,或者是没有以flag: 开头');
return '"'+PosString+'"';
}

View File

@ -65,7 +65,7 @@ editor.prototype.init = function (callback) {
editor_mode = editor_mode(editor);
editor_unsorted_2_wrapper(editor_mode);
editor.mode = editor_mode;
core.resetGame(core.firstData.hero, null, core.firstData.floorId, core.initStatus.maps);
core.resetGame(core.firstData.hero, null, core.firstData.floorId, core.clone(core.initStatus.maps));
core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function () {
afterCoreReset();
}, true);

View File

@ -32,7 +32,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_range": "editor.mode.checkUnique(thiseval)",
"_data": "在此存放所有可能使用的动画必须是animate格式在这里不写后缀名 \n动画必须放在animates目录下文件名不能使用中文不能带空格或特殊字符 \n \"jianji\", \"thunder\" \n 根据需求自行添加"
"_data": "在此存放所有可能使用的动画必须是animate格式在这里不写后缀名 \n动画必须放在animates目录下文件名不能使用中文不能带空格或特殊字符 \n \"jianji\", \"thunder\" 根据需求自行添加"
},
"bgms": {
"_leaf": true,
@ -46,6 +46,11 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_range": "editor.mode.checkUnique(thiseval)",
"_data": "在此存放所有的SE和文件名一致 \n音频名不能使用中文不能带空格或特殊字符可以直接改名拼音就好"
},
"nameMap": {
"_leaf": true,
"_type": "textarea",
"_data": "文件名映射目前仅对images, animates, bgms, sounds有效。\n例如定义 {\"精灵石.mp3\":\"jinglingshi.mp3\"} 就可以使用\ncore.playBgm(\"精灵石.mp3\") 或对应的事件来播放该bgm。"
},
"startBackground": {
"_leaf": true,
"_type": "textarea",

View File

@ -71,7 +71,7 @@ actions.prototype._init = function () {
* 返回如果func返回true则不会再继续执行其他的交互函数否则会继续执行其他的交互函数
*/
actions.prototype.registerAction = function (action, name, func, priority) {
if (!name || !func || !(func instanceof Function))
if (!name || !func)
return;
priority = priority || 0;
if (!this.actions[action]) {
@ -99,8 +99,14 @@ actions.prototype.doRegisteredAction = function (action) {
var actions = this.actions[action];
if (!actions) return false;
for (var i = 0; i < actions.length; ++i) {
if (core.doFunc.apply(core, [actions[i].func, this].concat(Array.prototype.slice.call(arguments, 1))))
return true;
try {
if (core.doFunc.apply(core, [actions[i].func, this].concat(Array.prototype.slice.call(arguments, 1))))
return true;
}
catch (e) {
main.log(e);
main.log("ERROR in actions["+actions[i].name+"].");
}
}
return false;
}
@ -239,6 +245,7 @@ actions.prototype._sys_keyDown_lockControl = function (keyCode) {
case 'save':
case 'load':
case 'replayLoad':
case 'replayRemain':
this._keyDownSL(keyCode);
break;
case 'shop':
@ -340,6 +347,7 @@ actions.prototype._sys_keyUp_lockControl = function (keyCode, altKey) {
case 'save':
case 'load':
case 'replayLoad':
case 'replayRemain':
this._keyUpSL(keyCode);
break;
case 'keyBoard':
@ -606,6 +614,7 @@ actions.prototype._sys_onclick_lockControl = function (x, y) {
case 'save':
case 'load':
case 'replayLoad':
case 'replayRemain':
this._clickSL(x, y);
break;
case 'confirmBox':
@ -750,7 +759,7 @@ actions.prototype._sys_longClick_lockControl = function (x, y) {
}
}
// 长按SL快速翻页
if (["save","load","replayLoad"].indexOf(core.status.event.id) >= 0) {
if (["save","load","replayLoad","replayRemain"].indexOf(core.status.event.id) >= 0) {
if ([this.HSIZE-2, this.HSIZE-3, this.HSIZE+2, this.HSIZE+3].indexOf(x) >= 0 && y == this.LAST) {
this._clickSL(x, y);
return true;
@ -991,10 +1000,17 @@ actions.prototype._clickBook = function (x, y) {
// 怪物信息
var data = core.status.event.data;
if (data != null && y < this.LAST) {
var page = parseInt(data / this.HSIZE);
var index = this.HSIZE * page + parseInt(y / 2);
core.ui.drawBook(index);
core.ui.drawBookDetail(index);
var pageinfo = core.ui._drawBook_pageinfo();
var per_page = pageinfo.per_page, page = parseInt(data / per_page);
var u = this.LAST / per_page;
for (var i = 0; i < per_page; ++i) {
if (y >= u*i && y < u*(i+1)) {
var index = per_page * page + i;
core.ui.drawBook(index);
core.ui.drawBookDetail(index);
break;
}
}
return;
}
return;
@ -1027,7 +1043,7 @@ actions.prototype._keyUpBook = function (keycode) {
if (keycode == 13 || keycode == 32 || keycode == 67) {
var data = core.status.event.data;
if (data != null) {
this._clickBook(this.HSIZE, 2 * (data % this.HSIZE));
core.ui.drawBookDetail(data);
}
return;
}
@ -1644,6 +1660,7 @@ actions.prototype._clickSL = function (x, y) {
if (core.events.recoverEvents(core.status.event.interval))
return;
core.ui.closePanel();
delete core.status.tempRoute;
if (!core.isPlaying())
core.showStartAnimate(true);
return;
@ -1847,18 +1864,20 @@ actions.prototype._clickSwitchs = function (x, y) {
case 1:
return this._clickSwitchs_sound();
case 2:
return this._clickSwitchs_displayEnemyDamage();
return this._clickSwitchs_moveSpeed();
case 3:
return this._clickSwitchs_displayCritical();
return this._clickSwitchs_displayEnemyDamage();
case 4:
return this._clickSwitchs_displayExtraDamage();
return this._clickSwitchs_displayCritical();
case 5:
return this._clickSwitchs_localForage();
return this._clickSwitchs_displayExtraDamage();
case 6:
return this._clickSwitchs_clickMove();
return this._clickSwitchs_localForage();
case 7:
return this._clickSwitchs_ExtendKeyboard();
return this._clickSwitchs_clickMove();
case 8:
return this._clickSwitchs_ExtendKeyboard();
case 9:
core.status.event.selection = 0;
core.ui.drawSettings();
break;
@ -1877,6 +1896,16 @@ actions.prototype._clickSwitchs_sound = function () {
core.ui.drawSwitchs();
}
actions.prototype._clickSwitchs_moveSpeed = function () {
core.myprompt("请输入行走速度每走一步的时间单位毫秒默认100", core.values.moveSpeed, function (value) {
value = parseInt(value) || core.values.moveSpeed;
value = core.clamp(value, 10, 500);
core.values.moveSpeed = value;
core.setLocalStorage("moveSpeed", value);
core.ui.drawSwitchs();
});
}
actions.prototype._clickSwitchs_displayEnemyDamage = function () {
core.flags.displayEnemyDamage = !core.flags.displayEnemyDamage;
core.updateDamage();
@ -2006,12 +2035,10 @@ actions.prototype._clickSyncSave = function (x, y) {
case 4:
return this._clickSyncSave_replay();
case 5:
return this._clickSyncSave_download();
case 6:
core.status.event.selection = 0;
core.ui.drawStorageRemove();
break;
case 7:
case 6:
core.status.event.selection = 4;
core.ui.drawSettings();
break;
@ -2040,19 +2067,6 @@ actions.prototype._clickSyncSave_replay = function () {
}
}
actions.prototype._clickSyncSave_download = function () {
if (core.hasFlag('debug')) {
core.drawText("\t[系统提示]调试模式下无法下载录像");
return;
}
core.download(core.firstData.name + "_" + core.formatDate2() + ".h5route", JSON.stringify({
'name': core.firstData.name,
'hard': core.status.hard,
'seed': core.getFlag('__seed__'),
'route': core.encodeRoute(core.status.route)
}));
}
////// 同步存档界面时,放开某个键的操作 //////
actions.prototype._keyUpSyncSave = function (keycode) {
if (keycode == 27 || keycode == 88) {
@ -2239,9 +2253,10 @@ actions.prototype._clickReplay = function (x, y) {
switch (selection) {
case 0: return this._clickReplay_fromBeginning();
case 1: return this._clickReplay_fromLoad();
case 2: return core.chooseReplayFile();
case 3: return this._clickReplay_download();
case 4: return core.ui.closePanel();
case 2: return this._clickReplay_replayRemain();
case 3: return core.chooseReplayFile();
case 4: return this._clickReplay_download();
case 5: return core.ui.closePanel();
}
}
}
@ -2260,6 +2275,21 @@ actions.prototype._clickReplay_fromLoad = function () {
core.ui.drawSLPanel(10 * page + offset);
}
actions.prototype._clickReplay_replayRemain = function () {
core.closePanel();
core.drawText([
"\t[接续播放录像]该功能允许你播放\r[yellow]两个存档之间的录像\r常常用于\r[yellow]区域优化\r。\n" +
"例如,有若干个区,已经全部通关;之后重打一区并进行了优化,则可以对剩余区域直接播放录像而无需全部重打。",
"\t[步骤1]请选择一个存档。\n\r[yellow]该存档的坐标必须和当前勇士坐标完全相同。\r\n将尝试从此处开始回放。",
], function () {
core.status.event.id = 'replayRemain';
core.lockControl();
var saveIndex = core.saves.saveIndex;
var page = parseInt((saveIndex - 1) / 5), offset = saveIndex - 5 * page;
core.ui.drawSLPanel(10 * page + offset);
});
}
actions.prototype._clickReplay_download = function () {
if (core.hasFlag('debug')) return core.drawText("\t[系统提示]调试模式下无法下载录像");
core.download(core.firstData.name + "_" + core.formatDate2() + ".h5route", JSON.stringify({

View File

@ -1059,7 +1059,7 @@ control.prototype.startReplay = function (list) {
core.status.replay.pausing=false;
core.status.replay.speed=1.0;
core.status.replay.toReplay = core.clone(list);
core.status.replay.totalList = core.clone(list);
core.status.replay.totalList = core.status.route.concat(list);
core.status.replay.steps = 0;
core.status.replay.save = [];
core.updateStatusBar();
@ -1100,7 +1100,7 @@ control.prototype.speedUpReplay = function () {
else if (core.status.replay.speed==3) core.status.replay.speed=6;
else if (core.status.replay.speed==2.5) core.status.replay.speed=3;
else if (core.status.replay.speed==2) core.status.replay.speed=2.5;
else {
else if (core.status.replay.speed<2) {
core.status.replay.speed = parseInt(10*core.status.replay.speed + 2)/10;
}
core.drawTip("x"+core.status.replay.speed+"倍");
@ -1512,8 +1512,9 @@ control.prototype.checkAutosave = function () {
control.prototype.doSL = function (id, type) {
switch (type) {
case 'save': this._doSL_save(id); break;
case 'load': this._doSL_load(id); break;
case 'replayLoad': this._doSL_replayLoad(id); break;
case 'load': this._doSL_load(id, this._doSL_load_afterGet); break;
case 'replayLoad': this._doSL_load(id, this._doSL_replayLoad_afterGet); break;
case 'replayRemain': this._doSL_load(id, this._doSL_replayRemain_afterGet); break;
}
}
@ -1542,14 +1543,14 @@ control.prototype._doSL_save = function (id) {
return;
}
control.prototype._doSL_load = function (id) {
control.prototype._doSL_load = function (id, callback) {
if (id == 'autoSave' && core.saves.autosave.data != null) {
this._doSL_load_afterGet(id, core.clone(core.saves.autosave.data));
callback(id, core.clone(core.saves.autosave.data))
}
else {
core.getLocalForage(id=='autoSave'?id:"save"+id, null, function(data) {
if (id == 'autoSave') core.saves.autosave.data = core.clone(data);
core.control._doSL_load_afterGet(id, data);
callback(id, data);
}, function(err) {
main.log(err);
alert("无效的存档");
@ -1579,22 +1580,6 @@ control.prototype._doSL_load_afterGet = function (id, data) {
core.setLocalStorage('saveIndex', core.saves.saveIndex);
}
});
}
control.prototype._doSL_replayLoad = function (id) {
if (id == 'autoSave' && core.saves.autosave.data != null) {
this._doSL_replayLoad_afterGet(core.clone(core.saves.autosave.data));
}
else{
core.getLocalForage(id=='autoSave'?id:"save"+id, null, function(data) {
if (id == 'autoSave') core.saves.autosave.data = core.clone(data);
core.control._doSL_replayLoad_afterGet(id, data);
}, function(err) {
main.log(err);
alert("无效的存档");
})
}
}
control.prototype._doSL_replayLoad_afterGet = function (id, data) {
@ -1613,6 +1598,34 @@ control.prototype._doSL_replayLoad_afterGet = function (id, data) {
}
control.prototype._doSL_replayRemain_afterGet = function (id, data) {
if (!data) return core.drawTip("无效的存档");
var route = core.decodeRoute(data.route);
if (core.status.tempRoute) {
var remainRoute = core.subarray(route, core.status.tempRoute);
if (remainRoute == null)
return alert("无法接续播放录像!\n该存档必须是前一个选择的存档的后续内容。");
delete core.status.tempRoute;
core.ui.closePanel();
core.startReplay(remainRoute);
core.drawTip("接续播放录像");
return;
}
else if (data.floorId != core.status.floorId || data.hero.loc.x != core.getHeroLoc('x') || data.hero.loc.y != core.getHeroLoc('y'))
return alert("楼层或坐标不一致!");
core.status.tempRoute = route;
core.ui.closePanel();
core.drawText("\t[步骤2]请选择第二个存档。\n\r[yellow]该存档必须是前一个存档的后续。\r\n将尝试播放到此存档。", function () {
core.status.event.id = 'replayRemain';
core.lockControl();
var saveIndex = core.saves.saveIndex;
var page = parseInt((saveIndex - 1) / 5), offset = saveIndex - 5 * page;
core.ui.drawSLPanel(10 * page + offset);
});
}
////// 同步存档到服务器 //////
control.prototype.syncSave = function (type) {
core.ui.drawWaiting("正在同步,请稍后...");
@ -1856,8 +1869,8 @@ control.prototype.getStatus = function (name) {
////// 从status中获得属性如果不存在则从勇士属性中获取 //////
control.prototype.getStatusOrDefault = function (status, name) {
if (status && name in status)
return status[name];
return this.getStatus(name);
return Math.floor(status[name]);
return Math.floor(this.getStatus(name));
}
////// 获得勇士实际属性(增幅后的) //////
@ -1867,7 +1880,7 @@ control.prototype.getRealStatus = function (name) {
////// 从status中获得实际属性增幅后的如果不存在则从勇士属性中获取 //////
control.prototype.getRealStatusOrDefault = function (status, name) {
return this.getStatusOrDefault(status, name) * this.getBuff(name);
return Math.floor(this.getStatusOrDefault(status, name) * this.getBuff(name));
}
////// 设置某个属性的增幅值 //////
@ -1966,6 +1979,10 @@ control.prototype.debug = function() {
// ------ 天气色调BGM ------ //
control.prototype.getMappedName = function (name) {
return (main.nameMap || {})[name] || name;
}
////// 更改天气效果 //////
control.prototype.setWeather = function (type, level) {
// 非雨雪
@ -2088,6 +2105,7 @@ control.prototype.screenFlash = function (color, time, times, callback) {
////// 播放背景音乐 //////
control.prototype.playBgm = function (bgm, startTime) {
bgm = core.getMappedName(bgm);
if (main.mode!='play' || !core.material.bgms[bgm]) return;
// 如果不允许播放
if (!core.musicStatus.bgmStatus) {
@ -2114,8 +2132,6 @@ control.prototype.playBgm = function (bgm, startTime) {
}
control.prototype._playBgm_play = function (bgm, startTime) {
// 缓存BGM
core.loader.loadBgm(bgm);
// 如果当前正在播放且和本BGM相同直接忽略
if (core.musicStatus.playingBgm == bgm && !core.material.bgms[core.musicStatus.playingBgm].paused) {
return;
@ -2124,6 +2140,8 @@ control.prototype._playBgm_play = function (bgm, startTime) {
if (core.musicStatus.playingBgm) {
core.material.bgms[core.musicStatus.playingBgm].pause();
}
// 缓存BGM
core.loader.loadBgm(bgm);
// 播放当前BGM
core.material.bgms[bgm].volume = core.musicStatus.volume;
core.material.bgms[bgm].currentTime = startTime || 0;
@ -2152,7 +2170,7 @@ control.prototype.pauseBgm = function () {
control.prototype.resumeBgm = function () {
if (main.mode!='play')return;
try {
core.playBgm(core.musicStatus.playingBgm || core.musicStatus.lastBgm);
core.playBgm(core.musicStatus.playingBgm || core.musicStatus.lastBgm || main.startBgm);
}
catch (e) {
console.log("无法恢复BGM");
@ -2182,6 +2200,7 @@ control.prototype.triggerBgm = function () {
////// 播放音频 //////
control.prototype.playSound = function (sound) {
sound = core.getMappedName(sound);
if (main.mode!='play' || !core.musicStatus.soundStatus || !core.material.sounds[sound]) return;
try {
if (core.musicStatus.audioContext != null) {

View File

@ -252,6 +252,8 @@ core.prototype._init_sys_flags = function () {
core.flags.displayEnemyDamage = core.getLocalStorage('enemyDamage', core.flags.displayEnemyDamage);
core.flags.displayCritical = core.getLocalStorage('critical', core.flags.displayCritical);
core.flags.displayExtraDamage = core.getLocalStorage('extraDamage', core.flags.displayExtraDamage);
// 行走速度
core.values.moveSpeed = core.getLocalStorage('moveSpeed', core.values.moveSpeed);
}
core.prototype._init_platform = function () {

View File

@ -360,6 +360,14 @@ enemys.prototype._getCurrentEnemys_sort = function (enemys) {
}
enemys.prototype.hasEnemyLeft = function (enemyId, floorId) {
if (floorId == null) floorId = core.status.floorId;
if (floorId instanceof Array) {
for (var i = 0; i < floorId.length; ++i) {
if (core.hasEnemyLeft(enemyId, floorId[i]))
return true;
}
return false;
}
return core.getCurrentEnemys(floorId).filter(function (enemy) {
return enemyId == null || enemy.id == enemyId;
}).length > 0;

View File

@ -41,7 +41,7 @@ events.prototype.startGame = function (hard, seed, route, callback) {
events.prototype._startGame_start = function (hard, seed, route, callback) {
console.log('开始游戏');
core.resetGame(core.firstData.hero, hard, null, core.initStatus.maps);
core.resetGame(core.firstData.hero, hard, null, core.clone(core.initStatus.maps));
var nowLoc = core.clone(core.getHeroLoc());
core.setHeroLoc('x', -1);
core.setHeroLoc('y', -1);
@ -715,7 +715,7 @@ events.prototype._sys_action = function (data, callback) {
var dir = core.reverseDirection();
var id = data.event.id, toId = (data.event.faceIds || {})[dir];
if (toId && id != toId) {
var number = core.icons.getNumberById(toId);
var number = core.getNumberById(toId);
if (number > 0)
core.setBlock(number, ex, ey);
}
@ -928,7 +928,7 @@ events.prototype._action_autoText = function (data, x, y, prefix) {
events.prototype._action_scrollText = function (data, x, y, prefix) {
if (this.__action_checkReplaying()) return;
this.__action_doAsyncFunc(data.async, core.ui.drawScrollText, data.text, data.lineHeight || 1.4, data.time || 5000);
this.__action_doAsyncFunc(data.async, core.drawScrollText, data.text, data.time || 5000, data.lineHeight || 1.4);
}
events.prototype._action_comment = function (data, x, y, prefix) {
@ -945,9 +945,10 @@ events.prototype._action_setText = function (data, x, y, prefix) {
core.status.textAttribute[t] = data[t];
}
if (t == 'background') {
var img = core.material.images.images[data[t]];
var name = core.getMappedName(data[t]);
var img = core.material.images.images[name];
if (img && img.width == 192 && img.height == 128) {
core.status.textAttribute[t] = data[t];
core.status.textAttribute[t] = name;
}
}
});
@ -1071,20 +1072,20 @@ events.prototype._action_changePos = function (data, x, y, prefix) {
events.prototype._action_showImage = function (data, x, y, prefix) {
if (core.isReplaying()) data.time = 0;
this.__action_doAsyncFunc(data.async || data.time == 0, this.showImage,
this.__action_doAsyncFunc(data.async || data.time == 0, core.showImage,
data.code, data.image, data.sloc, data.loc, data.opacity, data.time);
}
events.prototype._action_showTextImage = function (data, x, y, prefix) {
var loc = this.__action_getLoc(data.loc, 0, 0, prefix);
if (core.isReplaying()) data.time = 0;
this.__action_doAsyncFunc(data.async || data.time == 0, this.showImage,
this.__action_doAsyncFunc(data.async || data.time == 0, core.showImage,
data.code, core.ui.textImage(data.text), loc[0], loc[1], 100, 100, data.opacity, data.time);
}
events.prototype._action_hideImage = function (data, x, y, prefix) {
if (core.isReplaying()) data.time = 0;
this.__action_doAsyncFunc(data.async || data.time == 0, this.hideImage, data.code, data.time);
this.__action_doAsyncFunc(data.async || data.time == 0, core.hideImage, data.code, data.time);
}
events.prototype._action_showGif = function (data, x, y, prefix) {
@ -1095,7 +1096,7 @@ events.prototype._action_showGif = function (data, x, y, prefix) {
events.prototype._action_moveImage = function (data, x, y, prefix) {
if (this.__action_checkReplaying()) return;
this.__action_doAsyncFunc(data.async, this.moveImage, data.code, data.to, data.opacity, data.time);
this.__action_doAsyncFunc(data.async, core.moveImage, data.code, data.to, data.opacity, data.time);
}
events.prototype._action_setFg = function (data, x, y, prefix) {
@ -1254,7 +1255,7 @@ events.prototype._action_stopSound = function (data, x, y, prefix) {
events.prototype._action_setVolume = function (data, x, y, prefix) {
data.value = core.clamp(parseInt(data.value) / 100, 0, 1);
core.setFlag("__volume__", data.value);
this.__action_doAsyncFunc(data.async, this.setVolume, data.value, data.time || 0);
this.__action_doAsyncFunc(data.async, core.setVolume, data.value, data.time || 0);
}
events.prototype._action_setValue = function (data, x, y, prefix) {
@ -1491,7 +1492,7 @@ events.prototype._action_updateEnemys = function (data, x, y, prefix) {
}
events.prototype._action_vibrate = function (data, x, y, prefix) {
this.__action_doAsyncFunc(data.async, this.vibrate, data.time);
this.__action_doAsyncFunc(data.async, core.vibrate, data.time);
}
events.prototype._action_sleep = function (data, x, y, prefix) {
@ -1747,6 +1748,7 @@ events.prototype.hasAsync = function () {
////// 跟随 //////
events.prototype.follow = function (name) {
core.status.hero.followers = core.status.hero.followers || [];
name = core.getMappedName(name);
if (core.material.images.images[name]
&& core.material.images.images[name].width == 128) {
core.status.hero.followers.push({"name": name});
@ -1763,6 +1765,7 @@ events.prototype.unfollow = function (name) {
core.status.hero.followers = [];
}
else {
name = core.getMappedName(name);
for (var i = 0; i < core.status.hero.followers.length; i++) {
if (core.status.hero.followers[i].name == name) {
core.status.hero.followers.splice(i, 1);
@ -1887,7 +1890,10 @@ events.prototype.closeDoor = function (x, y, id, callback) {
////// 显示图片 //////
events.prototype.showImage = function (code, image, sloc, loc, opacityVal, time, callback) {
if (typeof image == 'string') image = core.material.images.images[image];
if (typeof image == 'string') {
image = core.getMappedName(image);
image = core.material.images.images[image];
}
if (!image) {
if (callback) callback();
return;
@ -1980,6 +1986,7 @@ events.prototype._moveImage_moving = function (name, moveInfo, callback) {
////// 绘制或取消一张gif图片 //////
events.prototype.showGif = function (name, x, y) {
name = core.getMappedName(name);
var image = core.material.images.images[name];
if (image) {
var gif = new Image();
@ -2230,6 +2237,7 @@ events.prototype.canUseQuickShop = function (shopId) {
////// 设置角色行走图 //////
events.prototype.setHeroIcon = function (name, noDraw) {
name = core.getMappedName(name);
var img = core.material.images.images[name];
if (!img || img.width != 128) return;
core.setFlag("heroIcon", name);

View File

@ -238,6 +238,7 @@ loader.prototype.loadOneSound = function (name) {
}
loader.prototype.loadBgm = function (name) {
name = core.getMappedName(name);
if (!core.material.bgms[name]) return;
// 如果没开启音乐,则不预加载
if (!core.musicStatus.bgmStatus) return;
@ -265,6 +266,7 @@ loader.prototype._preloadBgm = function (bgm) {
}
loader.prototype.freeBgm = function (name) {
name = core.getMappedName(name);
if (!core.material.bgms[name]) return;
// 从cachedBgms中删除
core.musicStatus.cachedBgms = core.musicStatus.cachedBgms.filter(function (t) {

View File

@ -784,13 +784,26 @@ maps.prototype._drawBgFgMap = function (floorId, ctx, name, onMap) {
core.status[name + "maps"] = {};
var arr = this._getBgFgMapArray(name, floorId, true);
var eventArr = null;
if (main.mode == 'editor' && name == 'fg' && onMap) {
eventArr = this.getMapArray(floorId);
}
for (var x = 0; x < width; x++) {
for (var y = 0; y < height; y++) {
var block = this.initBlock(x, y, arr[y][x], true);
block.name = name;
var blockInfo = this.getBlockInfo(block);
if (!blockInfo) continue;
// --- 前景虚化
var blur = false, alpha;
if (eventArr != null && eventArr[y][x] != 0) {
blur = true;
alpha = ctx.globalAlpha;
ctx.globalAlpha = 0.6;
}
this._drawMap_drawBlockInfo(ctx, block, blockInfo, arr, onMap);
if (blur) ctx.globalAlpha = alpha;
}
}
if (onMap)
@ -806,6 +819,7 @@ maps.prototype._drawFloorImages = function (floorId, ctx, name, images, currStat
images.forEach(function (t) {
if (typeof t == 'string') t = [0, 0, t];
var dx = parseInt(t[0]), dy = parseInt(t[1]), imageName = t[2], frame = core.clamp(parseInt(t[4]), 1, 8);
imageName = core.getMappedName(imageName);
var image = core.material.images.images[imageName];
if (redraw && frame == 1) return; // 不重绘
@ -1069,6 +1083,7 @@ maps.prototype._drawThumbnail_realDrawTempCanvas = function (floorId, blocks, op
// 缩略图:勇士
if (options.heroLoc) {
options.heroIcon = options.heroIcon || core.getFlag("heroIcon", "hero.png");
options.heroIcon = core.getMappedName(options.heroIcon);
var icon = core.material.icons.hero[options.heroLoc.direction];
var height = core.material.images.images[options.heroIcon].height / 4;
tempCanvas.drawImage(core.material.images.images[options.heroIcon], icon.stop * 32, icon.loc * height, 32, height,
@ -1844,6 +1859,7 @@ maps.prototype.drawBoxAnimate = function () {
////// 绘制动画 //////
maps.prototype.drawAnimate = function (name, x, y, callback) {
name = core.getMappedName(name);
// 正在播放录像:不显示动画
if (core.isReplaying()) {

View File

@ -226,6 +226,7 @@ ui.prototype.drawImage = function (name, image, x, y, w, h, x1, y1, w1, h1) {
var ctx = this.getContextByName(name);
if (!ctx) return;
if (typeof image == 'string') {
image = core.getMappedName(image);
image = core.material.images.images[image];
if (!image) return;
}
@ -374,8 +375,10 @@ ui.prototype._getTitleAndIcon = function (content) {
icon = 0;
height = core.material.icons.hero.height;
}
else if (/^[-\w.]+\.png$/.test(s4))
else if (s4.endsWith(".png")) {
s4 = core.getMappedName(s4);
image = core.material.images.images[s4];
}
else {
var blockInfo = core.getBlockInfo(s4);
if (blockInfo != null) {
@ -509,29 +512,42 @@ ui.prototype.drawBackground = function (left, top, right, bottom, posInfo) {
var xoffset = posInfo.xoffset || 0, yoffset = posInfo.yoffset || 0;
var background = core.status.textAttribute.background;
if (this._drawBackground_drawWindowSkin(background, left, top, right, bottom, posInfo.position, px, py))
return true;
if (typeof background == 'string') background = core.initStatus.textAttribute.background;
this._drawBackground_drawColor(background, left, top, right, bottom, posInfo.position, px, py, xoffset, yoffset);
return false;
}
ui.prototype._drawWindowSkin_getOpacity = function () {
return core.getFlag("__winskin_opacity__", 0.85);
}
ui.prototype._drawBackground_drawWindowSkin = function (background, left, top, right, bottom, position, px, py) {
if (typeof background == 'string' && core.material.images.images[background]) {
var image = core.material.images.images[background];
if (image.width==192 && image.height==128) {
core.setAlpha('ui', 0.85);
this.drawWindowSkin(image, 'ui', left, top, right - left, bottom - top, posInfo.position, px, py);
core.setAlpha('ui', this._drawWindowSkin_getOpacity());
this.drawWindowSkin(image, 'ui', left, top, right - left, bottom - top, position, px, py);
core.setAlpha('ui', 1);
return true;
}
background = core.initStatus.textAttribute.background;
}
return false;
}
ui.prototype._drawBackground_drawColor = function (background, left, top, right, bottom, position, px, py, xoffset, yoffset) {
var alpha = background[3];
core.setAlpha('ui', alpha);
core.setStrokeStyle('ui', core.status.globalAttribute.borderColor);
core.setFillStyle('ui', core.arrayToRGB(background));
core.setLineWidth('ui', 2);
// 绘制
var ctx = core.canvas.ui;
ctx.beginPath();
ctx.moveTo(left, top);
// 上边缘三角
if (posInfo.position == 'down' && px != null && py != null) {
if (position == 'down' && px != null && py != null) {
ctx.lineTo(px + xoffset, top);
ctx.lineTo(px + 16, top - yoffset);
ctx.lineTo(px + 32 - xoffset, top);
@ -539,7 +555,7 @@ ui.prototype.drawBackground = function (left, top, right, bottom, posInfo) {
ctx.lineTo(right, top);
ctx.lineTo(right, bottom);
// 下边缘三角
if (posInfo.position == 'up' && px != null && py != null) {
if (position == 'up' && px != null && py != null) {
ctx.lineTo(px + 32 - xoffset, bottom);
ctx.lineTo(px + 16, bottom + yoffset);
ctx.lineTo(px + xoffset, bottom);
@ -549,7 +565,6 @@ ui.prototype.drawBackground = function (left, top, right, bottom, posInfo) {
ctx.fill();
ctx.stroke();
core.setAlpha('ui', 1);
return false;
}
////// 计算有效文本框的宽度
@ -802,7 +817,7 @@ ui.prototype.drawTextBox = function(content, showAll) {
var pInfo = core.clone(posInfo);
pInfo.xoffset = hPos.xoffset; pInfo.yoffset = vPos.yoffset - 4;
var isWindowSkin = this.drawBackground(hPos.left, vPos.top, hPos.right, vPos.bottom, pInfo);
var alpha = isWindowSkin ? 0.85 : textAttribute.background[3];
var alpha = isWindowSkin ? this._drawWindowSkin_getOpacity() : textAttribute.background[3];
// Step 4: 绘制标题、头像、动画
var content_top = this._drawTextBox_drawTitleAndIcon(titleInfo, hPos, vPos, alpha);
@ -818,6 +833,7 @@ ui.prototype._drawTextBox_drawImages = function (content) {
return content.replace(/(\f|\\f)\[(.*?)]/g, function (text, sympol, str) {
var ss = str.split(",");
if (ss.length!=3 && ss.length!=5 && ss.length!=9) return "";
ss[0] = core.getMappedName(ss[0]);
var img = core.material.images.images[ss[0]];
if (!img) return "";
// 绘制
@ -1174,6 +1190,7 @@ ui.prototype.drawSwitchs = function() {
var choices = [
"背景音乐: "+(core.musicStatus.bgmStatus ? "[ON]" : "[OFF]"),
"背景音效: "+(core.musicStatus.soundStatus ? "[ON]" : "[OFF]"),
"行走速度: "+parseInt(core.values.moveSpeed),
"怪物显伤: "+(core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"),
"临界显伤: "+(core.flags.displayCritical ? "[ON]" : "[OFF]"),
"领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
@ -1210,7 +1227,7 @@ ui.prototype.drawQuickShop = function () {
ui.prototype.drawSyncSave = function () {
core.status.event.id = 'syncSave';
this.drawChoices(null, [
"同步存档到服务器", "从服务器加载存档", "存档至本地文件", "从本地文件读档", "回放当前录像", "下载当前录像", "清空本地存档", "返回主菜单"
"同步存档到服务器", "从服务器加载存档", "存档至本地文件", "从本地文件读档", "回放和下载录像", "清空本地存档", "返回主菜单"
]);
}
@ -1242,7 +1259,7 @@ ui.prototype.drawReplay = function () {
core.lockControl();
core.status.event.id = 'replay';
this.drawChoices(null, [
"从头回放录像", "从存档开始回放", "选择录像文件", "下载当前录像", "返回游戏"
"从头回放录像", "从存档开始回放", "接续播放剩余录像", "选择录像文件", "下载当前录像", "返回游戏"
]);
}
@ -1309,12 +1326,14 @@ ui.prototype.drawBook = function (index) {
index = core.clamp(index, 0, enemys.length - 1);
core.status.event.data = index;
var perpage = this.HSIZE, page = parseInt(index / perpage) + 1, totalPage = Math.ceil(enemys.length / perpage);
var pageinfo = this._drawBook_pageinfo();
var perpage = pageinfo.per_page, page = parseInt(index / perpage) + 1, totalPage = Math.ceil(enemys.length / perpage);
var start = (page - 1) * perpage;
enemys = enemys.slice(start, page * perpage);
for (var i = 0; i < enemys.length; i++)
this._drawBook_drawOne(floorId, i, enemys[i], index == start + i);
this._drawBook_drawOne(floorId, i, enemys[i], pageinfo, index == start + i);
core.drawBoxAnimate();
this.drawPagination(page, totalPage);
@ -1322,6 +1341,13 @@ ui.prototype.drawBook = function (index) {
core.fillText('ui', '返回游戏', this.PIXEL - 46, this.PIXEL - 13,'#DDDDDD', this._buildFont(15, true));
}
ui.prototype._drawBook_pageinfo = function () {
var per_page = this.HSIZE; // 每页个数
var padding_top = 12; // 距离顶端像素
var per_height = (this.PIXEL - 32 - padding_top) / per_page;
return { per_page: per_page, padding_top: padding_top, per_height: per_height };
}
ui.prototype._drawBook_drawBackground = function () {
core.setAlpha('ui', 1);
core.setFillStyle('ui', core.material.groundPattern);
@ -1332,24 +1358,24 @@ ui.prototype._drawBook_drawBackground = function () {
core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL);
}
ui.prototype._drawBook_drawOne = function (floorId, index, enemy, selected) {
// --- 区域规划:每个区域总高度为62宽度为 PIXEL
var top = 62 * index + 12; // 最上面margin是12px
ui.prototype._drawBook_drawOne = function (floorId, index, enemy, pageinfo, selected) {
// --- 区域规划:每个区域总高度默认为62宽度为 PIXEL
var top = pageinfo.per_height * index + pageinfo.padding_top; // 最上面margin默认是12px
// 横向规划:
// 22 + 42 = 64 是头像框
this._drawBook_drawBox(index, enemy, top);
this._drawBook_drawBox(index, enemy, top, pageinfo);
// 剩余 PIXEL - 64 的宽度,按照 10 : 9 : 8 : 8 的比例划分
var left = 64, total_width = this.PIXEL - left;
var name_width = total_width * 10 / 35;
this._drawBook_drawName(index, enemy, top, left, name_width);
this._drawBook_drawContent(index, enemy, top, left + name_width);
if (selected)
core.strokeRect('ui', 10, top + 1, this.PIXEL - 10 * 2, 62, '#FFD700');
core.strokeRect('ui', 10, top + 1, this.PIXEL - 10 * 2, pageinfo.per_height, '#FFD700');
}
ui.prototype._drawBook_drawBox = function (index, enemy, top) {
ui.prototype._drawBook_drawBox = function (index, enemy, top, pageinfo) {
// 横向22+42纵向10 + 42 + 10正好居中内部图像 32x32
var border_top = top + 10, border_left = 22;
var border_top = top + (pageinfo.per_height - 42) / 2, border_left = 22;
var img_top = border_top + 5, img_left = border_left + 5;
core.strokeRect('ui', 22, border_top, 42, 42, '#DDDDDD', 2);
var blockInfo = core.getBlockInfo(enemy.id);
@ -2011,19 +2037,19 @@ ui.prototype._drawEquipbox_getStatusChanged = function (info, equip, equipType)
ui.prototype._drawEquipbox_drawStatusChanged = function (info, y, equip, equipType) {
var compare = this._drawEquipbox_getStatusChanged(info, equip, equipType);
if (compare == null) return;
var drawOffset = 10;
var obj = { drawOffset: 10, y: y };
// --- 变化值...
core.setFont('ui', this._buildFont(14, true));
for (var name in compare) {
var img = core.statusBar.icons[name];
var text = core.getStatusName(name);
if (img && core.flags.iconInEquipbox) { // 绘制图标
core.drawImage('ui', img, 0, 0, 32, 32, drawOffset, y - 13, 16, 16);
drawOffset += 20;
core.drawImage('ui', img, 0, 0, 32, 32, obj.drawOffset, obj.y - 13, 16, 16);
obj.drawOffset += 20;
}
else { // 绘制文字
core.fillText('ui', text + " ", drawOffset, y, '#CCCCCC');
drawOffset += core.calWidth('ui', text + " ");
this._drawEquipbox_drawStatusChanged_draw(text + " ", '#CCCCCC', obj);
}
var nowValue = core.getStatus(name) * core.getBuff(name), newValue = (nowValue + compare[name]) * core.getBuff(name);
if (equip.equip.percentage) {
@ -2033,13 +2059,22 @@ ui.prototype._drawEquipbox_drawStatusChanged = function (info, y, equip, equipTy
}
nowValue = core.formatBigNumber(nowValue);
newValue = core.formatBigNumber(newValue);
core.fillText('ui', nowValue + "->", drawOffset, y, '#CCCCCC');
drawOffset += core.calWidth('ui', nowValue + "->");
core.fillText('ui', newValue, drawOffset, y, compare[name]>0?'#00FF00':'#FF0000');
drawOffset += core.calWidth('ui', newValue) + 8;
this._drawEquipbox_drawStatusChanged_draw(nowValue+"->", '#CCCCCC', obj);
this._drawEquipbox_drawStatusChanged_draw(newValue, compare[name]>0?'#00FF00':'#FF0000', obj);
obj.drawOffset += 8;
}
}
ui.prototype._drawEquipbox_drawStatusChanged_draw = function (text, color, obj) {
var len = core.calWidth('ui', text);
if (obj.drawOffset + len >= core.__PIXELS__) { // 换行
obj.y += 19;
obj.drawOffset = 10;
}
core.fillText('ui', text, obj.drawOffset, obj.y, color);
obj.drawOffset += len;
}
ui.prototype._drawEquipbox_drawEquiped = function (info, line) {
core.setTextAlign('ui', 'center');
var per_line = this.HSIZE - 3, width = Math.floor(this.PIXEL / (per_line + 0.25));
@ -2169,7 +2204,7 @@ ui.prototype._drawSLPanel_drawRecords = function (n) {
var page = core.status.event.data.page;
var offset = core.status.event.data.offset;
var u = Math.floor(this.PIXEL/6), size = Math.floor(this.PIXEL/3-20);
var name=core.status.event.id=='save'?"存档":core.status.event.id=='load'?"读档":core.status.event.id=='replayLoad'?"回放":"";
var name=core.status.event.id=='save'?"存档":core.status.event.id=='load'?"读档":"回放";
for (var i = 0; i < (n||6); i++){
var data = core.status.event.ui[i];

View File

@ -63,10 +63,10 @@ utils.prototype.replaceText = function (text, need, times) {
utils.prototype.calValue = function (value, prefix, need, times) {
if (!core.isset(value)) return null;
if (typeof value === 'string') {
value = value.replace(/status:([\w\d_]+)/g, "core.getStatus('$1')");
value = value.replace(/item:([\w\d_]+)/g, "core.itemCount('$1')");
value = value.replace(/flag:([\w\d_]+)/g, "core.getFlag('$1', 0)");
value = value.replace(/switch:([\w\d_]+)/g, "core.getFlag('" + (prefix || ":f@x@y") + "@$1', 0)");
value = value.replace(/status:([a-zA-Z0-9_]+)/g, "core.getStatus('$1')");
value = value.replace(/item:([a-zA-Z0-9_]+)/g, "core.itemCount('$1')");
value = value.replace(/flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)/g, "core.getFlag('$1', 0)");
value = value.replace(/switch:([a-zA-Z0-9_]+)/g, "core.getFlag('" + (prefix || ":f@x@y") + "@$1', 0)");
return eval(value);
}
if (value instanceof Function) {
@ -282,8 +282,10 @@ utils.prototype.clone = function (data, filter, recursion) {
////// 裁剪图片 //////
utils.prototype.splitImage = function (image, width, height) {
if (typeof image == "string")
if (typeof image == "string") {
image = core.getMappedName(image);
image = core.material.images.images[image];
}
if (!image) return [];
width = width || 32;
height = height || width;

View File

@ -35,6 +35,10 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"bomb.mp3",
"centerFly.mp3"
],
"nameMap": {
"背景图.jpg": "bg.jpg",
"背景音乐.mp3": "bgm.mp3"
},
"startBackground": "bg.jpg",
"startLogoStyle": "color: black",
"levelChoose": [

View File

@ -9,7 +9,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 这一步会清空状态栏和全部画布内容,并删除所有动态创建的画布
core.clearStatus();
// 初始化status
core.status = core.clone(core.initStatus);
core.status = core.clone(core.initStatus, function (name) {
return name != 'hero' && name != 'maps';
});
core.status.played = true;
// 初始化人物,图标,统计信息
core.status.hero = core.clone(hero);
@ -22,7 +24,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.status.hard = hard || "";
// 初始化地图
core.status.floorId = floorId;
core.status.maps = core.clone(maps);
core.status.maps = maps;
// 初始化怪物和道具
core.material.enemys = core.enemys.getEnemys();
core.material.items = core.items.getItems();
@ -968,6 +970,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.events.setVolume(core.getFlag("__volume__", 1), 0);
// 加载勇士图标
var icon = core.getFlag("heroIcon", "hero.png");
icon = core.getMappedName(icon);
if (core.material.images.images[icon]) {
core.material.images.hero.src = core.material.images.images[icon].src;
core.material.icons.hero.height = core.material.images.images[icon].height / 4;
@ -978,7 +981,12 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// TODO增加自己的一些读档处理
// 切换到对应的楼层
core.changeFloor(data.floorId, null, data.hero.loc, 0, callback, true);
core.changeFloor(data.floorId, null, data.hero.loc, 0, function () {
// TODO可以在这里设置读档后播放BGM
// if (core.getFlag("bgm", 0)==1) core.playBgm("bgm.mp3");
if (callback) callback();
}, true);
},
"updateStatusBar": function () {
// 更新状态栏