修改插件加载机制

This commit is contained in:
AncTe committed 2023-08-01 12:22:05 +08:00
1 parent 0604c56e98
commit d2746c4dc5
43 files changed
+527 -490

No files matched your search

+1 -1
View File
@@ -191,7 +191,7 @@ core.events.afterBattle = function (
canvas.width = 32;
canvas.height = 32;
core.drawIcon(canvas, enemy.id, 0, 0, 32, 32, frame);
const manager = core.applyFragWith(canvas);
const manager = ancTe.plugin.frag.applyFragWith(canvas);
const frag = manager.canvas;
frag.style.imageRendering = 'pixelated';
frag.style.width = `${frag.width * core.domStyle.scale}px`;
+1 -1
View File
@@ -10,7 +10,7 @@ control.prototype.checkBlock = function (forceMockery: boolean = false) {
const damage = info?.damage;
if (damage) {
if (!main.replayChecking) {
core.addPop(
ancTe.plugin.pop.addPop(
(x - core.bigmap.offsetX / 32) * 32 + 12,
(y - core.bigmap.offsetY / 32) * 32 + 20,
(-damage).toString()
+1 -1
View File
@@ -36,7 +36,7 @@ export function removeMaps(fromId, toId, force) {
deleted = true;
}
if (deleted && !main.replayChecking) {
core.splitArea();
ancTe.plugin.fly.splitArea();
}
}
+1 -1
View File
@@ -227,7 +227,7 @@ export function getSkillConsume(skill) {
export function openTree() {
if (main.replayChecking) return;
core.plugin.skillTreeOpened.value = true;
ancTe.plugin.ui.skillTreeOpened.value = true;
}
/**
+1 -1
View File
@@ -27,7 +27,7 @@ export function studySkill(enemy: any, number: number) {
if (special instanceof Function) special = special(enemy);
if (!canStudySkill(number)) {
if (!main.replayChecking) {
core.tip('error', `无法学习${special}`);
ancTe.plugin.utils.tip('error', `无法学习${special}`);
}
return;
}
+20 -8
View File
@@ -496,7 +496,11 @@ function intelligentArrow(fromSelf) {
damaged[loc + direction] = true;
core.drawHeroAnimate('hand');
core.status.hero.hp -= 1000;
core.addPop(x * 32 + 16, y * 32 + 16, -1000);
ancTe.plugin.pop.addPop(
x * 32 + 16,
y * 32 + 16,
-1000
);
core.updateStatusBar();
if (core.status.hero.hp < 0) {
clearInterval(skill1);
@@ -511,7 +515,11 @@ function intelligentArrow(fromSelf) {
damaged[loc + direction] = true;
core.drawHeroAnimate('hand');
core.status.hero.hp -= 1000;
core.addPop(x * 32 + 16, y * 32 + 16, -1000);
ancTe.plugin.pop.addPop(
x * 32 + 16,
y * 32 + 16,
-1000
);
core.updateStatusBar();
if (core.status.hero.hp < 0) {
clearInterval(skill1);
@@ -637,7 +645,7 @@ function icyMomentem() {
if (x == locs[index][0] && y == locs[index][1]) {
core.drawHeroAnimate('hand');
core.status.hero.hp -= 5000;
core.addPop(x * 32 + 16, y * 32 + 16, -5000);
ancTe.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -5000);
core.updateStatusBar();
if (core.status.hero.hp < 0) {
core.status.hero.hp = 0;
@@ -812,7 +820,7 @@ function getThunderDamage(x, y, power) {
hy = core.status.hero.loc.y;
if (Math.abs(hx - x) <= 1 && Math.abs(hy - y) <= 1) {
core.status.hero.hp -= 3000 * power;
core.addPop(x * 32 + 16, y * 32 + 16, -3000 * power);
ancTe.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -3000 * power);
core.updateStatusBar();
if (core.status.hero.hp < 0) {
core.status.hero.hp = 0;
@@ -976,7 +984,11 @@ function ballThunder() {
) {
damaged[i] = true;
core.status.hero.hp -= 3000;
core.addPop(x * 32 + 16, y * 32 + 16, -3000);
ancTe.plugin.pop.addPop(
x * 32 + 16,
y * 32 + 16,
-3000
);
core.updateStatusBar();
core.playSound('electron.mp3');
if (core.status.hero.hp < 0) {
@@ -1482,7 +1494,7 @@ function boomingAnimate() {
hy = core.status.hero.loc.y;
if (loc[0] == hx && loc[1] == hy) {
core.status.hero.hp -= 3000;
core.addPop(x * 32 + 16, y * 32 + 16, -3000);
ancTe.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -3000);
core.updateStatusBar();
if (core.status.hero.hp < 0) {
core.status.hero.hp = 0;
@@ -1521,7 +1533,7 @@ function lineDamage(x1, y1, x2, y2, damage) {
n2 = ((y2 - y1) / (x2 - x1)) * (loc2[0] - x1) + y1 - loc2[1];
if (n1 * n2 <= 0) {
core.status.hero.hp -= damage;
core.addPop(x * 32 + 16, y * 32 + 16, -damage);
ancTe.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -damage);
core.updateStatusBar();
core.playSound('electron.mp3');
if (core.status.hero.hp < 0) {
@@ -1541,7 +1553,7 @@ function lineDamage(x1, y1, x2, y2, damage) {
n2 = ((y2 - y1) / (x2 - x1)) * (loc2[0] - x1) + y1 - loc2[1];
if (n1 * n2 <= 0) {
core.status.hero.hp -= damage;
core.addPop(x * 32 + 16, y * 32 + 16, -damage);
ancTe.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -damage);
core.updateStatusBar();
core.playSound('electron.mp3');
if (core.status.hero.hp < 0) {
+15 -11
View File
@@ -12,30 +12,34 @@ export {};
function openItemShop(itemShopId) {
if (!core.isReplaying()) {
core.plugin.openedShopId = itemShopId;
core.plugin.shopOpened.value = true;
ancTe.plugin.ui.shopOpened.value = true;
}
}
function updateVueStatusBar() {
if (main.replayChecking) return;
core.plugin.statusBarStatus.value = !core.plugin.statusBarStatus.value;
core.checkMarkedEnemy();
ancTe.plugin.mark.checkMarkedEnemy();
}
ui.prototype.drawBook = function () {
if (!core.isReplaying()) return (core.plugin.bookOpened.value = true);
if (!core.isReplaying())
return (ancTe.plugin.ui.bookOpened.value = true);
};
ui.prototype._drawToolbox = function () {
if (!core.isReplaying()) return (core.plugin.toolOpened.value = true);
if (!core.isReplaying())
return (ancTe.plugin.ui.toolOpened.value = true);
};
ui.prototype._drawEquipbox = function () {
if (!core.isReplaying()) return (core.plugin.equipOpened.value = true);
if (!core.isReplaying())
return (ancTe.plugin.ui.equipOpened.value = true);
};
ui.prototype.drawFly = function () {
if (!core.isReplaying()) return (core.plugin.flyOpened.value = true);
if (!core.isReplaying())
return (ancTe.plugin.ui.flyOpened.value = true);
};
control.prototype.updateStatusBar_update = function () {
@@ -53,7 +57,7 @@ export {};
control.prototype.showStatusBar = function () {
if (main.mode == 'editor') return;
core.removeFlag('hideStatusBar');
core.plugin.showStatusBar.value = true;
ancTe.plugin.ui.showStatusBar.value = true;
core.dom.tools.hard.style.display = 'block';
core.dom.toolBar.style.display = 'block';
};
@@ -64,7 +68,7 @@ export {};
// 如果原本就是隐藏的,则先显示
if (!core.domStyle.showStatusBar) this.showStatusBar();
if (core.isReplaying()) showToolbox = true;
core.plugin.showStatusBar.value = false;
ancTe.plugin.ui.showStatusBar.value = false;
var toolItems = core.dom.tools;
core.setFlag('hideStatusBar', true);
@@ -83,13 +87,13 @@ export {};
function showChapter(chapter) {
if (core.isReplaying()) return;
core.plugin.chapterContent.value = chapter;
core.plugin.chapterShowed.value = true;
ancTe.plugin.chapter.chapterContent.value = chapter;
ancTe.plugin.chapter.chapterShowed.value = true;
}
function openSkill() {
if (core.isReplaying()) return;
core.plugin.skillOpened.value = true;
ancTe.plugin.ui.skillOpened.value = true;
}
core.plugin.gameUi = {
+2 -2
View File
@@ -33,7 +33,7 @@ export const antiAliasing = ref(true);
export const fullscreen = ref(false);
watch(transition, n => {
core.plugin.transition.value = n;
ancTe.plugin.ui.transition.value = n;
core.setLocalStorage('transition', n);
});
@@ -88,7 +88,7 @@ watch(antiAliasing, n => {
function reset() {
const t = core.getLocalStorage('transition', false);
transition.value = t;
core.plugin.transition.value = transition.value;
ancTe.plugin.ui.transition.value = transition.value;
autoScale.value = core.getLocalStorage('autoScale', true);
showStudied.value = core.getLocalStorage('showStudied', true);
showHalo.value = core.getLocalStorage('showHalo', true);
+3 -10
View File
@@ -13,6 +13,8 @@ import Shop from '../ui/shop.vue';
import Achievement from '../ui/achievement.vue';
import Bgm from '../ui/bgmList.vue';
// todo: 优化开启控制器
export const bookOpened = ref(false);
export const toolOpened = ref(false);
export const equipOpened = ref(false);
@@ -25,23 +27,15 @@ export const flyOpened = ref(false);
export const showStudiedSkill = ref(false);
export const fixedDetailOpened = ref(false);
export const shopOpened = ref(false);
export const startOpened = ref(false);
export const startOpened = ref(true);
export const achievementOpened = ref(false);
export const bgmOpened = ref(false);
export const transition = ref(true);
export const noClosePanel = ref(false);
export const loaded = ref(false);
export const startAnimationEnded = ref(false);
watch(loaded, n => {
if (n && startAnimationEnded.value) startOpened.value = true;
});
watch(startAnimationEnded, n => {
if (n && loaded.value) startOpened.value = true;
});
let app: HTMLDivElement;
/** ui声明列表 */
@@ -98,7 +92,6 @@ export default function init() {
shopOpened,
startOpened,
startAnimationEnded,
loaded,
achievementOpened,
bgmOpened
};