修改主对象的名称

This commit is contained in:
AncTe committed 2023-09-06 11:59:44 +08:00
1 parent e6d96f6e2a
commit 7073ac92c6
35 files changed
+122 -134

No files matched your search

+1 -1
View File
@@ -68,7 +68,7 @@ onMounted(async () => {
resize();
await sleep(50);
if (ancTe.plugin.ui.transition.value) await sleep(600);
if (mota.plugin.ui.transition.value) await sleep(600);
document.addEventListener('keyup', key);
});
onUpdated(resize);
+2 -2
View File
@@ -35,7 +35,7 @@ interface AncTePlugin {
frag: ReturnType<typeof import('../plugin/fx/frag').default>;
}
export interface AncTe {
export interface Mota {
sound: SoundController;
/** 游戏资源 */
resource: ResourceStore<Exclude<ResourceType, 'zip'>>;
@@ -53,7 +53,7 @@ export interface AncTe {
}
function ready() {
window.ancTe = {
window.mota = {
bgm: new BgmController(),
resource: new ResourceStore(),
zipResource: new ResourceStore(),
+5 -5
View File
@@ -19,9 +19,9 @@ export function readyAllResource() {
info.resource.forEach(v => {
const type = getTypeByResource(v);
if (type === 'zip') {
ancTe.zipResource.set(v, new Resource(v, 'zip'));
mota.zipResource.set(v, new Resource(v, 'zip'));
} else {
ancTe.resource.set(v, new Resource(v, type));
mota.resource.set(v, new Resource(v, type));
}
});
}
@@ -35,13 +35,13 @@ export function readyAllResource() {
loadData.forEach(v => {
const type = getTypeByResource(v);
if (type !== 'zip') {
ancTe.resource.set(v, new Resource(v, type));
mota.resource.set(v, new Resource(v, type));
}
});
ancTe.resource.forEach(v => v.active());
mota.resource.forEach(v => v.active());
loading.once('coreInit', () => {
const animates = new Resource('__all_animates__', 'text');
ancTe.resource.set('__all_animates__', animates);
mota.resource.set('__all_animates__', animates);
animates.active();
});
}
+3 -3
View File
@@ -52,7 +52,7 @@ export class Resource<
protected onLoadStart(v?: ResourceData[T]) {
if (this.format === 'bgm') {
// bgm 单独处理,因为它可以边播放边加载
ancTe.bgm.add(this.uri, v!);
mota.bgm.add(this.uri, v!);
}
}
@@ -61,7 +61,7 @@ export class Resource<
if (this.type === 'fonts') {
document.fonts.add(new FontFace(this.name, v as ArrayBuffer));
} else if (this.type === 'sounds') {
ancTe.sound.add(this.uri, v as ArrayBuffer);
mota.sound.add(this.uri, v as ArrayBuffer);
} else if (this.type === 'images') {
const name = `${this.name}${this.ext}` as ImageIds;
loading.on(
@@ -109,7 +109,7 @@ export class Resource<
const id = `${base}.${name}`;
const type = getTypeByResource(id) as NonZipResource;
const format = getZipFormatByType(type);
ancTe.resource.set(
mota.resource.set(
id,
new Resource(id, type).setData(file.async(format))
);
+8 -8
View File
@@ -37,7 +37,7 @@ export class Hotkey extends EventEmitter<HotkeyEvent> {
constructor(id: string, storage: boolean = true) {
super();
if (storage) {
this.storage = new GameStorage(GameStorage.fromAuthor('AncTe', id));
this.storage = new GameStorage(GameStorage.fromAuthor('Mota', id));
}
}
@@ -274,12 +274,12 @@ hotkey
if (block.event.cls.startsWith('enemy')) {
const id = block.event.id as EnemyIds;
const name = core.material.enemys[id].name;
if (ancTe.plugin.mark.hasMarkedEnemy(id)) {
if (mota.plugin.mark.hasMarkedEnemy(id)) {
tip('success', `已取消标记${name}!`);
ancTe.plugin.mark.unmarkEnemy(id);
mota.plugin.mark.unmarkEnemy(id);
} else {
tip('success', `已标记${name}!`);
ancTe.plugin.mark.checkMarkedEnemy(false);
mota.plugin.mark.checkMarkedEnemy(false);
}
}
}
@@ -303,8 +303,8 @@ hotkey
const [mx, my] = getLocFromMouseLoc(x, y);
if (core.getBlockCls(mx, my)?.startsWith('enemy')) {
core.plugin.fixedDetailPanel = 'special';
ancTe.plugin.fixed.showFixed.value = false;
ancTe.plugin.ui.fixedDetailOpened.value = true;
mota.plugin.fixed.showFixed.value = false;
mota.plugin.ui.fixedDetailOpened.value = true;
}
}
})
@@ -315,8 +315,8 @@ hotkey
const [mx, my] = getLocFromMouseLoc(x, y);
if (core.getBlockCls(mx, my)?.startsWith('enemy')) {
core.plugin.fixedDetailPanel = 'critical';
ancTe.plugin.fixed.showFixed.value = false;
ancTe.plugin.ui.fixedDetailOpened.value = true;
mota.plugin.fixed.showFixed.value = false;
mota.plugin.ui.fixedDetailOpened.value = true;
}
}
})
+1 -1
View File
@@ -248,7 +248,7 @@ export class UiController extends Focus<IndexedGameUi> {
* 根据ui的唯一标识符进行聚焦
* @param num 要聚焦于的ui的唯一标识符
*/
focusByNum(num: number, add?: boolean) {
focusByNum(num: number) {
const ui = this.stack.find(v => v.num === num);
if (!ui) return;
this.focus(ui);
+1 -1
View File
@@ -403,7 +403,7 @@ interface SettingStorage {
}
const storage = new GameStorage<SettingStorage>(
GameStorage.fromAuthor('AncTe', 'setting')
GameStorage.fromAuthor('Mota', 'setting')
);
loading.once('coreInit', () => {
+3 -3
View File
@@ -19,10 +19,10 @@ import gameCanvas from '../plugin/fx/gameCanvas';
import noise from '../plugin/fx/noise';
import smooth from '../plugin/fx/smoothView';
import frag from '../plugin/fx/frag';
import { AncTe } from '.';
import { Mota } from '.';
export function resolvePlugin() {
const toForward: [keyof AncTe['plugin'], any][] = [
const toForward: [keyof Mota['plugin'], any][] = [
['pop', pop()],
['ui', ui()],
['use', use()],
@@ -47,7 +47,7 @@ export function resolvePlugin() {
];
for (const [key, obj] of toForward) {
ancTe.plugin[key] = obj;
mota.plugin[key] = obj;
}
// 完成度相关
+2 -2
View File
@@ -37,7 +37,7 @@
"text": [
"第一章完成度达到100%"
],
"progress": "${ancTe.plugin.completion.getChapterCompletion(1)} / 100",
"progress": "${mota.plugin.completion.getChapterCompletion(1)} / 100",
"percent": true,
"point": 50
},
@@ -55,7 +55,7 @@
"text": [
"第二章完成度达到100%"
],
"progress": "${ancTe.plugin.completion.getChapterCompletion(2)} / 100",
"progress": "${mota.plugin.completion.getChapterCompletion(2)} / 100",
"percent": true,
"point": 50
},
+1 -1
View File
@@ -175,7 +175,7 @@ core.events.afterBattle = function (
canvas.width = 32;
canvas.height = 32;
core.drawIcon(canvas, enemy.id, 0, 0, 32, 32, frame);
const manager = ancTe.plugin.frag.applyFragWith(canvas);
const manager = mota.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) {
ancTe.plugin.pop.addPop(
mota.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) {
ancTe.plugin.fly.splitArea();
mota.plugin.fly.splitArea();
}
}
+1 -1
View File
@@ -227,7 +227,7 @@ export function getSkillConsume(skill) {
export function openTree() {
if (main.replayChecking) return;
ancTe.plugin.ui.skillTreeOpened.value = true;
mota.plugin.ui.skillTreeOpened.value = true;
}
/**
+8 -16
View File
@@ -496,11 +496,7 @@ function intelligentArrow(fromSelf) {
damaged[loc + direction] = true;
core.drawHeroAnimate('hand');
core.status.hero.hp -= 1000;
ancTe.plugin.pop.addPop(
x * 32 + 16,
y * 32 + 16,
-1000
);
mota.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -1000);
core.updateStatusBar();
if (core.status.hero.hp < 0) {
clearInterval(skill1);
@@ -515,11 +511,7 @@ function intelligentArrow(fromSelf) {
damaged[loc + direction] = true;
core.drawHeroAnimate('hand');
core.status.hero.hp -= 1000;
ancTe.plugin.pop.addPop(
x * 32 + 16,
y * 32 + 16,
-1000
);
mota.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -1000);
core.updateStatusBar();
if (core.status.hero.hp < 0) {
clearInterval(skill1);
@@ -645,7 +637,7 @@ function icyMomentem() {
if (x == locs[index][0] && y == locs[index][1]) {
core.drawHeroAnimate('hand');
core.status.hero.hp -= 5000;
ancTe.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -5000);
mota.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -5000);
core.updateStatusBar();
if (core.status.hero.hp < 0) {
core.status.hero.hp = 0;
@@ -820,7 +812,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;
ancTe.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -3000 * power);
mota.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -3000 * power);
core.updateStatusBar();
if (core.status.hero.hp < 0) {
core.status.hero.hp = 0;
@@ -984,7 +976,7 @@ function ballThunder() {
) {
damaged[i] = true;
core.status.hero.hp -= 3000;
ancTe.plugin.pop.addPop(
mota.plugin.pop.addPop(
x * 32 + 16,
y * 32 + 16,
-3000
@@ -1494,7 +1486,7 @@ function boomingAnimate() {
hy = core.status.hero.loc.y;
if (loc[0] == hx && loc[1] == hy) {
core.status.hero.hp -= 3000;
ancTe.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -3000);
mota.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -3000);
core.updateStatusBar();
if (core.status.hero.hp < 0) {
core.status.hero.hp = 0;
@@ -1533,7 +1525,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;
ancTe.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -damage);
mota.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -damage);
core.updateStatusBar();
core.playSound('electron.mp3');
if (core.status.hero.hp < 0) {
@@ -1553,7 +1545,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;
ancTe.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -damage);
mota.plugin.pop.addPop(x * 32 + 16, y * 32 + 16, -damage);
core.updateStatusBar();
core.playSound('electron.mp3');
if (core.status.hero.hp < 0) {
+13 -14
View File
@@ -12,35 +12,34 @@ export {};
function openItemShop(itemShopId) {
if (!core.isReplaying()) {
core.plugin.openedShopId = itemShopId;
ancTe.plugin.ui.shopOpened.value = true;
mota.plugin.ui.shopOpened.value = true;
}
}
function updateVueStatusBar() {
if (main.replayChecking) return;
ancTe.plugin.status.statusBarStatus.value =
!ancTe.plugin.status.statusBarStatus.value;
ancTe.plugin.mark.checkMarkedEnemy();
mota.plugin.status.statusBarStatus.value =
!mota.plugin.status.statusBarStatus.value;
mota.plugin.mark.checkMarkedEnemy();
}
ui.prototype.drawBook = function () {
if (!core.isReplaying())
return (ancTe.plugin.ui.bookOpened.value = true);
return (mota.plugin.ui.bookOpened.value = true);
};
ui.prototype._drawToolbox = function () {
if (!core.isReplaying())
return (ancTe.plugin.ui.toolOpened.value = true);
return (mota.plugin.ui.toolOpened.value = true);
};
ui.prototype._drawEquipbox = function () {
if (!core.isReplaying())
return (ancTe.plugin.ui.equipOpened.value = true);
return (mota.plugin.ui.equipOpened.value = true);
};
ui.prototype.drawFly = function () {
if (!core.isReplaying())
return (ancTe.plugin.ui.flyOpened.value = true);
if (!core.isReplaying()) return (mota.plugin.ui.flyOpened.value = true);
};
control.prototype.updateStatusBar_update = function () {
@@ -58,7 +57,7 @@ export {};
control.prototype.showStatusBar = function () {
if (main.mode == 'editor') return;
core.removeFlag('hideStatusBar');
ancTe.plugin.ui.showStatusBar.value = true;
mota.plugin.ui.showStatusBar.value = true;
core.dom.tools.hard.style.display = 'block';
core.dom.toolBar.style.display = 'block';
};
@@ -69,7 +68,7 @@ export {};
// 如果原本就是隐藏的,则先显示
if (!core.domStyle.showStatusBar) this.showStatusBar();
if (core.isReplaying()) showToolbox = true;
ancTe.plugin.ui.showStatusBar.value = false;
mota.plugin.ui.showStatusBar.value = false;
var toolItems = core.dom.tools;
core.setFlag('hideStatusBar', true);
@@ -88,13 +87,13 @@ export {};
function showChapter(chapter) {
if (core.isReplaying()) return;
ancTe.plugin.chapter.chapterContent.value = chapter;
ancTe.plugin.chapter.chapterShowed.value = true;
mota.plugin.chapter.chapterContent.value = chapter;
mota.plugin.chapter.chapterShowed.value = true;
}
function openSkill() {
if (core.isReplaying()) return;
ancTe.plugin.ui.skillOpened.value = true;
mota.plugin.ui.skillOpened.value = true;
}
core.plugin.gameUi = {
+2 -2
View File
@@ -451,7 +451,7 @@ type Forward<T> = {
type ForwardKeys<T> = keyof Forward<T>;
declare const ancTe: import('../core/index').AncTe;
declare const mota: import('../core/index').Mota;
interface Window {
ancTe: import('../core/index').AncTe;
mota: import('../core/index').Mota;
}
+1 -1
View File
@@ -51,7 +51,7 @@ const content = computed(() => {
const name = computed(() => list[selected.value]!.name);
function exit() {
ancTe.plugin.ui.bgmOpened.value = false;
mota.plugin.ui.bgmOpened.value = false;
}
function select(id: BgmIds) {
+3 -3
View File
@@ -113,8 +113,8 @@ async function show() {
*/
async function exit() {
noClosePanel.value = true;
ancTe.plugin.ui.bookOpened.value = false;
if (ancTe.plugin.ui.transition.value) await sleep(650);
mota.plugin.ui.bookOpened.value = false;
if (mota.plugin.ui.transition.value) await sleep(650);
else await sleep(100);
if (core.events.recoverEvents(core.status.event.interval)) {
return;
@@ -191,7 +191,7 @@ function keydown(e: KeyboardEvent) {
}
onMounted(async () => {
if (ancTe.plugin.ui.transition.value) await sleep(600);
if (mota.plugin.ui.transition.value) await sleep(600);
else await sleep(50);
document.addEventListener('keyup', keyup);
document.addEventListener('keydown', keydown);
+1 -1
View File
@@ -28,7 +28,7 @@ type DescKey = keyof typeof desc;
const selected = ref(Object.keys(desc)[0] as DescKey);
function exit() {
ancTe.plugin.ui.descOpened.value = false;
mota.plugin.ui.descOpened.value = false;
}
const content = computed(() => {
+6 -6
View File
@@ -303,7 +303,7 @@ function changeSort() {
}
function exit() {
ancTe.plugin.ui.equipOpened.value = false;
mota.plugin.ui.equipOpened.value = false;
}
function clickList(i: number) {
@@ -421,12 +421,12 @@ function dragout(e: Event) {
}
async function toTool() {
const before = ancTe.plugin.ui.transition.value;
ancTe.plugin.ui.transition.value = false;
const before = mota.plugin.ui.transition.value;
mota.plugin.ui.transition.value = false;
exit();
await sleep(50);
ancTe.plugin.ui.toolOpened.value = true;
ancTe.plugin.ui.transition.value = before;
mota.plugin.ui.toolOpened.value = true;
mota.plugin.ui.transition.value = before;
}
function keyup(e: KeyboardEvent) {
@@ -447,7 +447,7 @@ watch(toShow, n => {
onMounted(async () => {
bind();
if (ancTe.plugin.ui.transition.value) await sleep(600);
if (mota.plugin.ui.transition.value) await sleep(600);
else await sleep(50);
document.addEventListener('keyup', keyup);
});
+1 -1
View File
@@ -72,7 +72,7 @@ async function calHeight() {
vw = window.innerWidth;
width.value = vh * 0.28;
await new Promise(res => requestAnimationFrame(res));
if (ancTe.plugin.ui.fixedDetailOpened.value) {
if (mota.plugin.ui.fixedDetailOpened.value) {
showFixed.value = false;
}
updateMain();
+1 -1
View File
@@ -30,7 +30,7 @@ if (enemy) {
}
function close() {
ancTe.plugin.ui.fixedDetailOpened.value = false;
mota.plugin.ui.fixedDetailOpened.value = false;
}
</script>
+2 -2
View File
@@ -147,7 +147,7 @@ let thumbCtx: CanvasRenderingContext2D;
let downloadMode = false;
function exit() {
ancTe.plugin.ui.flyOpened.value = false;
mota.plugin.ui.flyOpened.value = false;
}
const title = computed(() => {
@@ -610,7 +610,7 @@ onMounted(async () => {
});
await sleep(50);
if (ancTe.plugin.ui.transition.value) await sleep(600);
if (mota.plugin.ui.transition.value) await sleep(600);
document.addEventListener('keyup', keyup);
map.addEventListener('touchstart', touchdown);
+1 -1
View File
@@ -182,7 +182,7 @@ function key(e: KeyboardEvent) {
onMounted(async () => {
await sleep(50);
if (ancTe.plugin.ui.transition.value) await sleep(600);
if (mota.plugin.ui.transition.value) await sleep(600);
document.addEventListener('keyup', key);
});
+2 -2
View File
@@ -303,12 +303,12 @@ function keydown(e: KeyboardEvent) {
function exit() {
if (bought) core.status.route.push('closeShop');
ancTe.plugin.ui.shopOpened.value = false;
mota.plugin.ui.shopOpened.value = false;
}
onMounted(async () => {
await sleep(50);
if (ancTe.plugin.ui.transition.value) await sleep(600);
if (mota.plugin.ui.transition.value) await sleep(600);
document.addEventListener('keyup', keyup);
document.addEventListener('keydown', keydown);
core.status.route.push(`openShop:${id}`);
+1 -1
View File
@@ -60,7 +60,7 @@ const content = computed(() => {
});
function exit() {
ancTe.plugin.ui.skillOpened.value = false;
mota.plugin.ui.skillOpened.value = false;
}
</script>
+2 -2
View File
@@ -173,7 +173,7 @@ const level = computed(() => {
});
function exit() {
ancTe.plugin.ui.skillTreeOpened.value = false;
mota.plugin.ui.skillTreeOpened.value = false;
}
function resize() {
@@ -274,7 +274,7 @@ onMounted(async () => {
draw();
await sleep(50);
if (ancTe.plugin.ui.transition.value) await sleep(600);
if (mota.plugin.ui.transition.value) await sleep(600);
canvas.addEventListener('click', click);
document.addEventListener('keyup', key);
});
+9 -9
View File
@@ -165,19 +165,19 @@ async function select(id: ShowItemIds, nouse: boolean = false) {
}
function exit() {
ancTe.plugin.ui.toolOpened.value = false;
mota.plugin.ui.toolOpened.value = false;
}
async function use(id: ShowItemIds) {
if (id === 'none') return;
if (core.canUseItem(id)) {
// 应该暂时把动画去掉
const before = ancTe.plugin.ui.transition.value;
ancTe.plugin.ui.transition.value = false;
const before = mota.plugin.ui.transition.value;
mota.plugin.ui.transition.value = false;
exit();
await sleep(50);
core.useItem(id);
ancTe.plugin.ui.transition.value = before;
mota.plugin.ui.transition.value = before;
} else {
message.warn({
content: '当前无法使用该道具!',
@@ -187,12 +187,12 @@ async function use(id: ShowItemIds) {
}
async function toEquip() {
const before = ancTe.plugin.ui.transition.value;
ancTe.plugin.ui.transition.value = false;
const before = mota.plugin.ui.transition.value;
mota.plugin.ui.transition.value = false;
exit();
await sleep(50);
ancTe.plugin.ui.equipOpened.value = true;
ancTe.plugin.ui.transition.value = before;
mota.plugin.ui.equipOpened.value = true;
mota.plugin.ui.transition.value = before;
}
function keyup(e: KeyboardEvent) {
@@ -239,7 +239,7 @@ function keydown(e: KeyboardEvent) {
}
onMounted(async () => {
if (ancTe.plugin.ui.transition.value) await sleep(600);
if (mota.plugin.ui.transition.value) await sleep(600);
else await sleep(50);
document.addEventListener('keyup', keyup);
document.addEventListener('keydown', keydown);