修复动画的bug

This commit is contained in:
unanmed 2022-12-31 21:44:33 +08:00
parent 7e9aa28bc0
commit 394cda8a3c
5 changed files with 39 additions and 19 deletions

View File

@ -4560,13 +4560,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
var damage = core.status.checkBlock.damage[loc]; var damage = core.status.checkBlock.damage[loc];
if (damage) { if (damage) {
if (!main.replayChecking) if (!main.replayChecking)
core.addPop( core.addPop(x * 32 + 12, y * 32 + 20, damage);
x * 32 + 12,
y * 32 + 20,
damage,
'#f00',
'#000'
);
core.status.hero.hp -= damage; core.status.hero.hp -= damage;
var text = var text =
Object.keys(core.status.checkBlock.type[loc] || {}).join( Object.keys(core.status.checkBlock.type[loc] || {}).join(
@ -5246,10 +5240,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
core.extractBlocks(data); core.extractBlocks(data);
if (data === core.status.floorId) { if (data === core.status.floorId) {
core.drawMap(data); core.drawMap(data);
core.setWeather( let weather = core.getFlag('__weather__', null);
core.animateFrame.weather.type, if (!weather && core.status.thisMap.weather)
core.animateFrame.weather.level weather = core.status.thisMap.weather;
); if (weather) core.setWeather(weather[0], weather[1]);
else core.setWeather();
} }
core.updateStatusBar(true, true); core.updateStatusBar(true, true);
} }
@ -5435,14 +5430,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
} }
ui.prototype.drawBook = function () { ui.prototype.drawBook = function () {
if (!main.replayChecking)
return (core.plugin.bookOpened.value = true); return (core.plugin.bookOpened.value = true);
}; };
ui.prototype._drawToolbox = function () { ui.prototype._drawToolbox = function () {
if (!core.isReplaying())
return (core.plugin.toolOpened.value = true); return (core.plugin.toolOpened.value = true);
}; };
ui.prototype._drawEquipbox = function () { ui.prototype._drawEquipbox = function () {
if (!core.isReplaying())
return (core.plugin.equipOpened.value = true); return (core.plugin.equipOpened.value = true);
}; };
@ -5489,13 +5487,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}; };
this.showChapter = function (chapter) { this.showChapter = function (chapter) {
if (main.replayChecking) return; if (core.isReplaying()) return;
core.plugin.chapterContent.value = chapter; core.plugin.chapterContent.value = chapter;
core.plugin.chapterShowed.value = true; core.plugin.chapterShowed.value = true;
}; };
this.openSkill = function () { this.openSkill = function () {
if (main.replayChecking) return; if (core.isReplaying()) return;
core.plugin.skillOpened.value = true; core.plugin.skillOpened.value = true;
}; };
}, },

View File

@ -18,6 +18,15 @@
}, },
"autoScale": { "autoScale": {
"text": "自动放缩", "text": "自动放缩",
"desc": ["开启后,每次进入游戏时会自动缩放游戏画面至合适值。"] "desc": [
"开启后,每次进入游戏时会自动缩放游戏画面至合适值。该项只对电脑端有效。",
"<br>",
"<br>",
"缩放原则如下:",
"<br>",
"1. 首先尝试缩放至最大缩放比例",
"<br>",
"2. 如果缩放后游戏画面高度高于页面高度的95%,那么缩小一个缩放比例,否则保持最大比例"
]
} }
} }

View File

@ -3,7 +3,7 @@ const animation: ((time: number) => void)[] = [];
let animateTime = 0; let animateTime = 0;
export default function init() { export default function init() {
core.registerAnimationFrame('animate', true, time => { core.registerAnimationFrame('animateController', true, time => {
if (time - animateTime <= core.values.animateSpeed) return; if (time - animateTime <= core.values.animateSpeed) return;
for (const fn of animation) { for (const fn of animation) {
fn(time); fn(time);

View File

@ -2,6 +2,8 @@
let pop: any[] = []; let pop: any[] = [];
let time = 0;
// 插件必须有默认导出并返回所有外部会用到的函数所有返回的函数会被转发到core上 // 插件必须有默认导出并返回所有外部会用到的函数所有返回的函数会被转发到core上
// 并且在这里面完成所有的初始化,函数外部也可以进行初始化,但完全不能涉及到样板相关内容 // 并且在这里面完成所有的初始化,函数外部也可以进行初始化,但完全不能涉及到样板相关内容
export default function init() { export default function init() {
@ -14,7 +16,8 @@ export default function init() {
/** /**
* *
*/ */
function popValue() { function popValue(t: number) {
if (t - time < 15) return;
let ctx = core.getContextByName('pop')!; let ctx = core.getContextByName('pop')!;
if (!ctx) ctx = core.createCanvas('pop', 0, 0, core._PX_, core._PY_, 90); if (!ctx) ctx = core.createCanvas('pop', 0, 0, core._PX_, core._PY_, 90);
core.clearMap(ctx); core.clearMap(ctx);
@ -41,6 +44,7 @@ function popValue() {
if (one.frame >= 90) count++; if (one.frame >= 90) count++;
}); });
if (count > 0) pop.splice(0, count); if (count > 0) pop.splice(0, count);
time = t;
} }
/** /**

9
src/plugin/ui/fly.ts Normal file
View File

@ -0,0 +1,9 @@
export default function init() {
return { splitArea };
}
function splitArea() {}
function getMapData(floorId: FloorIds) {}
function bfs(floorId: FloorIds) {}