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