optimize loadData

This commit is contained in:
oc 2019-04-22 23:38:41 +08:00
parent 189511e751
commit 507c2040c8
3 changed files with 6 additions and 4 deletions

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

@ -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);

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();