修复样板傻逼bug,循环动画挂载存档
This commit is contained in:
parent
c5600f78d1
commit
7e3625e637
@ -2192,6 +2192,7 @@ maps.prototype.showBgFgMap = function (name, loc, floorId, callback) {
|
|||||||
|
|
||||||
////// 隐藏前景/背景地图 //////
|
////// 隐藏前景/背景地图 //////
|
||||||
maps.prototype.hideBgFgMap = function (name, loc, floorId, callback) {
|
maps.prototype.hideBgFgMap = function (name, loc, floorId, callback) {
|
||||||
|
this.removeGlobalAnimate(loc.x, loc.y, name)
|
||||||
this._triggerBgFgMap('hide', name, loc, floorId, callback);
|
this._triggerBgFgMap('hide', name, loc, floorId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2455,7 +2456,7 @@ maps.prototype.setBgFgBlock = function (name, number, x, y, floorId) {
|
|||||||
if (/^\d+$/.test(number)) number = parseInt(number);
|
if (/^\d+$/.test(number)) number = parseInt(number);
|
||||||
else number = core.getNumberById(number);
|
else number = core.getNumberById(number);
|
||||||
}
|
}
|
||||||
|
this.removeGlobalAnimate(x, y, name)
|
||||||
var values = core.getFlag('__' + name + 'v__', {});
|
var values = core.getFlag('__' + name + 'v__', {});
|
||||||
values[floorId] = (values[floorId] || []).filter(function (one) { return one[0] != x || one[1] != y });
|
values[floorId] = (values[floorId] || []).filter(function (one) { return one[0] != x || one[1] != y });
|
||||||
values[floorId].push([x, y, number]);
|
values[floorId].push([x, y, number]);
|
||||||
|
@ -2,90 +2,96 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
{
|
{
|
||||||
"events": {
|
"events": {
|
||||||
"resetGame": function (hero, hard, floorId, maps, values) {
|
"resetGame": function (hero, hard, floorId, maps, values) {
|
||||||
// 重置整个游戏;此函数将在游戏开始时,或者每次读档时最先被调用
|
// 重置整个游戏;此函数将在游戏开始时,或者每次读档时最先被调用
|
||||||
// hero:勇士信息;hard:难度;floorId:当前楼层ID;maps:地图信息;values:全局数值信息
|
// hero:勇士信息;hard:难度;floorId:当前楼层ID;maps:地图信息;values:全局数值信息
|
||||||
|
|
||||||
// 清除游戏数据
|
// 清除游戏数据
|
||||||
// 这一步会清空状态栏和全部画布内容,并删除所有动态创建的画布
|
// 这一步会清空状态栏和全部画布内容,并删除所有动态创建的画布
|
||||||
core.clearStatus();
|
core.clearStatus();
|
||||||
// 初始化status
|
core.status.animateObjs = []
|
||||||
core.status = core.clone(core.initStatus, function (name) {
|
core.plugin.playing.clear()
|
||||||
return name != "hero" && name != "maps";
|
// 初始化status
|
||||||
});
|
core.status = core.clone(core.initStatus, function (name) {
|
||||||
core.control._bindRoutePush();
|
return name != "hero" && name != "maps";
|
||||||
core.status.played = true;
|
});
|
||||||
// 初始化人物,图标,统计信息
|
core.control._bindRoutePush();
|
||||||
core.status.hero = core.clone(hero);
|
core.status.played = true;
|
||||||
window.hero = core.status.hero;
|
// 初始化人物,图标,统计信息
|
||||||
window.flags = core.status.hero.flags;
|
core.status.hero = core.clone(hero);
|
||||||
core.events.setHeroIcon(core.status.hero.image, true);
|
window.hero = core.status.hero;
|
||||||
core.control._initStatistics(core.animateFrame.totalTime);
|
window.flags = core.status.hero.flags;
|
||||||
core.status.hero.statistics.totalTime = core.animateFrame.totalTime =
|
core.events.setHeroIcon(core.status.hero.image, true);
|
||||||
Math.max(
|
core.control._initStatistics(core.animateFrame.totalTime);
|
||||||
core.status.hero.statistics.totalTime,
|
core.status.hero.statistics.totalTime = core.animateFrame.totalTime =
|
||||||
core.animateFrame.totalTime
|
Math.max(
|
||||||
);
|
core.status.hero.statistics.totalTime,
|
||||||
core.status.hero.statistics.start = null;
|
core.animateFrame.totalTime
|
||||||
// 初始难度
|
);
|
||||||
core.status.hard = hard || "";
|
core.status.hero.statistics.start = null;
|
||||||
// 初始化地图
|
// 初始难度
|
||||||
core.status.floorId = floorId;
|
core.status.hard = hard || "";
|
||||||
core.status.maps = maps;
|
// 初始化地图
|
||||||
core.maps._resetFloorImages();
|
core.status.floorId = floorId;
|
||||||
// 初始化怪物和道具
|
core.status.maps = maps;
|
||||||
core.material.enemys = core.enemys.getEnemys();
|
core.maps._resetFloorImages();
|
||||||
core.material.items = core.items.getItems();
|
// 初始化怪物和道具
|
||||||
// 初始化全局数值和全局开关
|
core.material.enemys = core.enemys.getEnemys();
|
||||||
core.values = core.clone(core.data.values);
|
core.material.items = core.items.getItems();
|
||||||
for (var key in values || {}) core.values[key] = values[key];
|
// 初始化全局数值和全局开关
|
||||||
core.flags = core.clone(core.data.flags);
|
core.values = core.clone(core.data.values);
|
||||||
var globalFlags = core.getFlag("globalFlags", {});
|
for (var key in values || {}) core.values[key] = values[key];
|
||||||
for (var key in globalFlags) core.flags[key] = globalFlags[key];
|
core.flags = core.clone(core.data.flags);
|
||||||
core._init_sys_flags();
|
var globalFlags = core.getFlag("globalFlags", {});
|
||||||
// 初始化界面,状态栏等
|
for (var key in globalFlags) core.flags[key] = globalFlags[key];
|
||||||
core.resize();
|
core._init_sys_flags();
|
||||||
// 状态栏是否显示
|
// 初始化界面,状态栏等
|
||||||
if (core.hasFlag("hideStatusBar"))
|
core.resize();
|
||||||
core.hideStatusBar(core.hasFlag("showToolbox"));
|
// 状态栏是否显示
|
||||||
else core.showStatusBar();
|
if (core.hasFlag("hideStatusBar"))
|
||||||
// 隐藏右下角的音乐按钮
|
core.hideStatusBar(core.hasFlag("showToolbox"));
|
||||||
core.dom.musicBtn.style.display = "none";
|
else core.showStatusBar();
|
||||||
},
|
// 隐藏右下角的音乐按钮
|
||||||
|
core.dom.musicBtn.style.display = "none";
|
||||||
|
},
|
||||||
"win": function (reason, norank, noexit) {
|
"win": function (reason, norank, noexit) {
|
||||||
// 游戏获胜事件
|
// 游戏获胜事件
|
||||||
// 请注意,成绩统计时是按照hp进行上传并排名
|
// 请注意,成绩统计时是按照hp进行上传并排名
|
||||||
// 可以先在这里对最终分数进行计算,比如将2倍攻击和5倍黄钥匙数量加到分数上
|
// 可以先在这里对最终分数进行计算,比如将2倍攻击和5倍黄钥匙数量加到分数上
|
||||||
// core.status.hero.hp += 2 * core.getRealStatus('atk') + 5 * core.itemCount('yellowKey');
|
// core.status.hero.hp += 2 * core.getRealStatus('atk') + 5 * core.itemCount('yellowKey');
|
||||||
|
|
||||||
// 如果不退出,则临时存储数据
|
// 如果不退出,则临时存储数据
|
||||||
if (noexit) {
|
if (noexit) {
|
||||||
core.status.extraEvent = core.clone(core.status.event);
|
core.status.extraEvent = core.clone(core.status.event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 游戏获胜事件
|
// 游戏获胜事件
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
var replaying = core.isReplaying();
|
var replaying = core.isReplaying();
|
||||||
if (replaying) core.stopReplay();
|
if (replaying) core.stopReplay();
|
||||||
core.waitHeroToStop(function () {
|
core.waitHeroToStop(function () {
|
||||||
if (!noexit) {
|
if (!noexit) {
|
||||||
core.clearMap("all"); // 清空全地图
|
core.status.animateObjs = []
|
||||||
core.deleteAllCanvas(); // 删除所有创建的画布
|
core.plugin.playing.clear()
|
||||||
core.dom.gif2.innerHTML = "";
|
core.clearMap("all"); // 清空全地图
|
||||||
}
|
core.deleteAllCanvas(); // 删除所有创建的画布
|
||||||
reason = core.replaceText(reason);
|
core.dom.gif2.innerHTML = "";
|
||||||
core.drawText(
|
}
|
||||||
["\t[" + (reason || "恭喜通关") + "]你的分数是${status:hp}。"],
|
reason = core.replaceText(reason);
|
||||||
function () {
|
core.drawText(
|
||||||
core.events.gameOver(reason || "", replaying, norank);
|
["\t[" + (reason || "恭喜通关") + "]你的分数是${status:hp}。"],
|
||||||
}
|
function () {
|
||||||
);
|
core.events.gameOver(reason || "", replaying, norank);
|
||||||
});
|
}
|
||||||
},
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
"lose": function (reason) {
|
"lose": function (reason) {
|
||||||
// 游戏失败事件
|
// 游戏失败事件
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
var replaying = core.isReplaying();
|
var replaying = core.isReplaying();
|
||||||
core.stopReplay();
|
core.stopReplay();
|
||||||
|
core.status.animateObjs = []
|
||||||
|
core.plugin.playing.clear()
|
||||||
core.waitHeroToStop(function () {
|
core.waitHeroToStop(function () {
|
||||||
core.drawText(
|
core.drawText(
|
||||||
["\t[" + (reason || "结局1") + "]你死了。\n如题。"],
|
["\t[" + (reason || "结局1") + "]你死了。\n如题。"],
|
||||||
@ -1598,7 +1604,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
version: core.firstData.version,
|
version: core.firstData.version,
|
||||||
guid: core.getGuid(),
|
guid: core.getGuid(),
|
||||||
time: new Date().getTime(),
|
time: new Date().getTime(),
|
||||||
cg: cg
|
cg: cg,
|
||||||
|
animateObjs: core.status.animateObjs.filter(v => v.loop),
|
||||||
|
playing: [...core.plugin.playing].filter(v => v.loop)
|
||||||
};
|
};
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
@ -1645,6 +1653,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
// TODO:增加自己的一些读档处理
|
// TODO:增加自己的一些读档处理
|
||||||
core.ui.statusBar.clearItemInfo();
|
core.ui.statusBar.clearItemInfo();
|
||||||
core.ui.statusBar.update();
|
core.ui.statusBar.update();
|
||||||
|
core.status.animateObjs = data.animateObjs
|
||||||
|
core.plugin.playing = new Set(data.playing)
|
||||||
if (core.getFlag("_cgText")) {
|
if (core.getFlag("_cgText")) {
|
||||||
core.setFlag("_cgText", false)
|
core.setFlag("_cgText", false)
|
||||||
for (let v in data.cg) {
|
for (let v in data.cg) {
|
||||||
|
Loading…
Reference in New Issue
Block a user