mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-16 20:24:31 +08:00
feat: 苍蓝之殿下方区域完毕
This commit is contained in:
1 parent
06bcb94eae
commit
684fba1475
23 files changed
+199
-123
No files matched your search
@@ -33,7 +33,11 @@ interface HotkeyData extends Required<RegisterHotkeyData> {
|
||||
/**
|
||||
* @param id 此处的id包含数字后缀
|
||||
*/
|
||||
type HotkeyFunc = (id: string, code: KeyCode, ev: KeyboardEvent) => void;
|
||||
type HotkeyFunc = (
|
||||
id: string,
|
||||
code: KeyCode,
|
||||
ev: KeyboardEvent
|
||||
) => void | '@void';
|
||||
|
||||
export interface HotkeyJSON {
|
||||
key: KeyCode;
|
||||
@@ -129,7 +133,7 @@ export class Hotkey extends EventEmitter<HotkeyEvent> {
|
||||
this.scope = symbol;
|
||||
this.conditionMap.set(symbol, () => true);
|
||||
for (const key of Object.values(this.data)) {
|
||||
key.func.set(symbol, () => {});
|
||||
key.func.set(symbol, () => '@void');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,6 +188,7 @@ export class Hotkey extends EventEmitter<HotkeyEvent> {
|
||||
const toEmit = this.keyMap.get(key);
|
||||
if (!toEmit) return false;
|
||||
const { ctrl, shift, alt } = unwarpBinary(assist);
|
||||
let emitted = false;
|
||||
toEmit.forEach(v => {
|
||||
if (type !== v.type) return;
|
||||
if (ctrl === v.ctrl && shift === v.shift && alt === v.alt) {
|
||||
@@ -191,11 +196,12 @@ export class Hotkey extends EventEmitter<HotkeyEvent> {
|
||||
if (!func) {
|
||||
throw new Error(`Emit unknown scope keys.`);
|
||||
}
|
||||
func(v.id, key, ev);
|
||||
const res = func(v.id, key, ev);
|
||||
if (res !== '@void') emitted = true;
|
||||
}
|
||||
});
|
||||
this.emit('emit', key, assist, type);
|
||||
return toEmit.length > 0;
|
||||
return emitted;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -584,6 +584,52 @@ document.addEventListener('keyup', e => {
|
||||
const code = keycode(e.keyCode);
|
||||
if (gameKey.emitKey(code, assist, 'up', e)) {
|
||||
e.preventDefault();
|
||||
} else {
|
||||
// polyfill样板
|
||||
if (
|
||||
main.dom.startPanel.style.display == 'block' &&
|
||||
(main.dom.startButtons.style.display == 'block' ||
|
||||
main.dom.levelChooseButtons.style.display == 'block')
|
||||
) {
|
||||
if (e.keyCode == 38 || e.keyCode == 33)
|
||||
// up/pgup
|
||||
main.selectButton((main.selectedButton || 0) - 1);
|
||||
else if (e.keyCode == 40 || e.keyCode == 34)
|
||||
// down/pgdn
|
||||
main.selectButton((main.selectedButton || 0) + 1);
|
||||
else if (e.keyCode == 67 || e.keyCode == 13 || e.keyCode == 32)
|
||||
// C/Enter/Space
|
||||
main.selectButton(main.selectedButton);
|
||||
else if (
|
||||
e.keyCode == 27 &&
|
||||
main.dom.levelChooseButtons.style.display == 'block'
|
||||
) {
|
||||
// ESC
|
||||
core.showStartAnimate(true);
|
||||
e.preventDefault();
|
||||
}
|
||||
e.stopPropagation();
|
||||
return;
|
||||
}
|
||||
if (main.dom.inputDiv.style.display == 'block') {
|
||||
if (e.keyCode == 13) {
|
||||
setTimeout(function () {
|
||||
main.dom.inputYes.click();
|
||||
}, 50);
|
||||
} else if (e.keyCode == 27) {
|
||||
setTimeout(function () {
|
||||
main.dom.inputNo.click();
|
||||
}, 50);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (
|
||||
core &&
|
||||
core.isPlaying &&
|
||||
core.status &&
|
||||
(core.isPlaying() || core.status.lockControl)
|
||||
)
|
||||
core.onkeyUp(e);
|
||||
}
|
||||
});
|
||||
document.addEventListener('keydown', e => {
|
||||
|
||||
@@ -151,7 +151,7 @@ export const skills: Record<Chapter, Skill[]> = {
|
||||
index: 12,
|
||||
title: '聪慧',
|
||||
desc: ['使主角变得更加聪明,每级使绿宝石增加的智慧点上升5%'],
|
||||
consume: 'level > 5 ? 1000 * level ** 2 : 250 * level + 1250',
|
||||
consume: 'level > 5 ? 100 * level ** 2 : 250 * level + 1250',
|
||||
front: [
|
||||
[8, 10],
|
||||
[9, 10]
|
||||
@@ -164,7 +164,7 @@ export const skills: Record<Chapter, Skill[]> = {
|
||||
index: 13,
|
||||
title: '治愈',
|
||||
desc: ['使主角能够更好地回复生命,每级使血瓶的加血量增加2%'],
|
||||
consume: 'level > 5 ? 1000 * level ** 2 : 250 * level + 1250',
|
||||
consume: 'level > 5 ? 100 * level ** 2 : 250 * level + 1250',
|
||||
front: [[10, 3]],
|
||||
loc: [4, 5],
|
||||
max: 20,
|
||||
|
||||
Vendored
+1
-1
@@ -621,7 +621,7 @@ interface Ui {
|
||||
/**
|
||||
* 地图中间绘制一段文字
|
||||
*/
|
||||
drawText(contents: string, callback?: () => void): void;
|
||||
drawText(contents?: string, callback?: () => void): void;
|
||||
|
||||
/**
|
||||
* 自绘选择光标
|
||||
|
||||
Reference in new issue
Block a user