修复录像,修复部分bug,彻底完工

This commit is contained in:
AncTe committed 2023-04-28 23:58:07 +08:00
1 parent ebd94fc373
commit e4a556329b
16 files changed
+95 -36

No files matched your search

+8 -7
View File
@@ -2,9 +2,10 @@ import { Animation, circle, hyper, sleep, TimingFn } from 'mutate-animate';
import { completeAchievement } from '../ui/achievement';
import { has } from '../utils';
import { ChaseCameraData, ChasePath, getChaseDataByIndex } from './data';
import { init1 } from './chase1';
export default function init() {
return { startChase };
return { startChase, chaseInit1: init1 };
}
export function shake2(power: number, timing: TimingFn): TimingFn {
@@ -31,7 +32,7 @@ export class Chase {
*/
showPath: boolean = false;
endFn?: () => void;
endFn?: (lose: boolean) => void;
/**
* 开始一个追逐战
@@ -213,14 +214,14 @@ export class Chase {
* 当追逐战结束后执行函数
* @param fn 执行的函数
*/
onEnd(fn: () => void) {
onEnd(fn: (lose: boolean) => void) {
this.endFn = fn;
}
/**
* 结束这个追逐战
*/
end() {
end(lose: boolean = false) {
this.ani.ticker.destroy();
delete flags.onChase;
delete flags.chase;
@@ -229,7 +230,7 @@ export class Chase {
delete flags.chaseIndex;
flags.__lockViewport__ = false;
core.deleteCanvas('chasePath');
if (this.endFn) this.endFn();
if (this.endFn) this.endFn(lose);
}
}
@@ -248,9 +249,9 @@ export async function startChase(index: number) {
const hard = flags.chaseHard;
// 成就
chase.onEnd(() => {
chase.onEnd(lose => {
if (hard === 1) {
if (index === 1) {
if (index === 1 && !lose) {
completeAchievement('challenge', 0);
}
}
+1 -1
View File
@@ -158,7 +158,7 @@ export async function wolfMove(chase: Chase) {
export function judgeFail1(chase: Chase) {
chase.ani.ticker.add(() => {
if (core.status.hero.loc.x > core.bigmap.offsetX / 32 + 17) {
chase.end();
chase.end(true);
ani.time(750).apply('rect', 0);
core.lose('逃跑失败');
}
+4 -4
View File
@@ -64,7 +64,7 @@ watch(useFixed, n => {
core.setLocalStorage('useFixed', n);
});
watch(autoSkill, n => {
watch(autoLocate, n => {
flags.autoLocate = n;
core.updateStatusBar();
core.status.route.push(`set:autoLocate:${n}`);
@@ -101,9 +101,9 @@ function resetFlag() {
flags.itemDetail ??= true;
flags.autoLocate ??= true;
itemDetail.value = flags.itemDetail ? true : false;
autoSkill.value = flags.autoSkill ? true : false;
autoLocate.value = flags.autoLocate ? true : false;
itemDetail.value = !!flags.itemDetail;
autoSkill.value = !!flags.autoSkill;
autoLocate.value = !!flags.autoLocate;
}
export async function triggerFullscreen() {
+27 -1
View File
@@ -5,6 +5,8 @@ import { isNil } from 'lodash';
import { Animation, sleep, TimingFn } from 'mutate-animate';
import { ComputedRef, ref } from 'vue';
import { EVENT_KEY_CODE_MAP } from './keyCodes';
import axios from 'axios';
import { decompressFromBase64 } from 'lz-string';
type CanParseCss = keyof {
[P in keyof CSSStyleDeclaration as CSSStyleDeclaration[P] extends string
@@ -15,7 +17,14 @@ type CanParseCss = keyof {
};
export default function init() {
return { has, getDamageColor, parseCss, tip, changeLocalStorage };
return {
has,
getDamageColor,
parseCss,
tip,
changeLocalStorage,
swapChapter
};
}
/**
@@ -228,3 +237,20 @@ export function changeLocalStorage<T>(
const to = fn(now);
core.setLocalStorage(name, to);
}
export async function swapChapter(chapter: number, hard: number) {
const h = hard === 2 ? 'hard' : 'easy';
const save = await axios.get(
`${import.meta.env.BASE_URL}swap/${chapter}.${h}.h5save`,
{
responseType: 'text',
responseEncoding: 'utf-8'
}
);
const data = JSON.parse(decompressFromBase64(save.data));
core.loadData(data.data, () => {
core.removeFlag('__fromLoad__');
core.drawTip('读档成功');
});
}