mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-03 18:24:30 +08:00
refactor: 接口与进程通讯优化
This commit is contained in:
1 parent
b407e7b80a
commit
5119227a41
41 files changed
+506
-181
No files matched your search
@@ -11,7 +11,9 @@ const potionItems: AllIdsOf<'items'>[] = [
|
||||
'I491'
|
||||
];
|
||||
|
||||
mota.game.hook.on('afterGetItem', (itemId, x, y, isGentleClick) => {
|
||||
const hook = Mota.require('var', 'hook');
|
||||
|
||||
hook.on('afterGetItem', (itemId, x, y, isGentleClick) => {
|
||||
// 获得一个道具后触发的事件
|
||||
// itemId:获得的道具ID;x和y是该道具所在的坐标
|
||||
// isGentleClick:是否是轻按触发的
|
||||
@@ -45,7 +47,7 @@ mota.game.hook.on('afterGetItem', (itemId, x, y, isGentleClick) => {
|
||||
if (todo.length > 0) core.insertAction(todo, x, y);
|
||||
});
|
||||
|
||||
mota.game.hook.on('afterOpenDoor', (doorId, x, y) => {
|
||||
hook.on('afterOpenDoor', (doorId, x, y) => {
|
||||
// 开一个门后触发的事件
|
||||
|
||||
const todo: any[] = [];
|
||||
|
||||
@@ -227,7 +227,7 @@ export function getSkillConsume(skill) {
|
||||
|
||||
export function openTree() {
|
||||
if (main.replayChecking) return;
|
||||
mota.ui.main.open('skillTree');
|
||||
Mota.require('var', 'mainUi').open('skillTree');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+12
-10
@@ -2,6 +2,8 @@
|
||||
export {};
|
||||
|
||||
(function () {
|
||||
const { mainUi, fixedUi } = Mota.requireAll('var');
|
||||
|
||||
if (main.replayChecking)
|
||||
return (core.plugin.gameUi = {
|
||||
openItemShop: () => 0,
|
||||
@@ -10,7 +12,7 @@ export {};
|
||||
|
||||
function openItemShop(itemShopId) {
|
||||
if (!core.isReplaying()) {
|
||||
mota.ui.main.open('shop', {
|
||||
Mota.require('var', 'mainUi').open('shop', {
|
||||
shopId: itemShopId
|
||||
});
|
||||
}
|
||||
@@ -23,19 +25,19 @@ export {};
|
||||
}
|
||||
|
||||
ui.prototype.drawBook = function () {
|
||||
if (!core.isReplaying()) return mota.ui.main.open('book');
|
||||
if (!core.isReplaying()) return mainUi.open('book');
|
||||
};
|
||||
|
||||
ui.prototype._drawToolbox = function () {
|
||||
if (!core.isReplaying()) return mota.ui.main.open('toolbox');
|
||||
if (!core.isReplaying()) return mainUi.open('toolbox');
|
||||
};
|
||||
|
||||
ui.prototype._drawEquipbox = function () {
|
||||
if (!core.isReplaying()) return mota.ui.main.open('equipbox');
|
||||
if (!core.isReplaying()) return mainUi.open('equipbox');
|
||||
};
|
||||
|
||||
ui.prototype.drawFly = function () {
|
||||
if (!core.isReplaying()) return mota.ui.main.open('fly');
|
||||
if (!core.isReplaying()) return mainUi.open('fly');
|
||||
};
|
||||
|
||||
control.prototype.updateStatusBar_update = function () {
|
||||
@@ -48,15 +50,15 @@ export {};
|
||||
core.control.noAutoEvents = true;
|
||||
// 更新vue状态栏
|
||||
updateVueStatusBar();
|
||||
mota.game.hook.emit('statusBarUpdate');
|
||||
Mota.require('var', 'hook').emit('statusBarUpdate');
|
||||
};
|
||||
|
||||
// todo: 多个状态栏分离与控制
|
||||
control.prototype.showStatusBar = function () {
|
||||
if (main.mode == 'editor') return;
|
||||
core.removeFlag('hideStatusBar');
|
||||
if (!mota.ui.fixed.hasName('statusBar')) {
|
||||
mota.ui.fixed.open('statusBar');
|
||||
if (!fixedUi.hasName('statusBar')) {
|
||||
fixedUi.open('statusBar');
|
||||
}
|
||||
core.dom.tools.hard.style.display = 'block';
|
||||
core.dom.toolBar.style.display = 'block';
|
||||
@@ -68,7 +70,7 @@ export {};
|
||||
// 如果原本就是隐藏的,则先显示
|
||||
if (!core.domStyle.showStatusBar) this.showStatusBar();
|
||||
if (core.isReplaying()) showToolbox = true;
|
||||
mota.ui.fixed.closeByName('statusBar');
|
||||
fixedUi.closeByName('statusBar');
|
||||
|
||||
var toolItems = core.dom.tools;
|
||||
core.setFlag('hideStatusBar', true);
|
||||
@@ -87,7 +89,7 @@ export {};
|
||||
|
||||
function openSkill() {
|
||||
if (core.isReplaying()) return;
|
||||
mota.ui.main.open('skill');
|
||||
mainUi.open('skill');
|
||||
}
|
||||
|
||||
core.plugin.gameUi = {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
|
||||
* But these are "more general", as they should work across browsers & OS`s.
|
||||
*/
|
||||
export const enum KeyCode {
|
||||
export enum KeyCode {
|
||||
DependsOnKbLayout = -1,
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,7 +51,9 @@ export function completeAchievement(type: AchievementType, index: number) {
|
||||
if (type === 'explore' && !Object.values(achiDict).includes(index)) {
|
||||
checkCompletionAchievement();
|
||||
}
|
||||
mota.ui.fixed.open('completeAchi', { complete: `${type},${index}` });
|
||||
Mota.require('var', 'fixedUi').open('completeAchi', {
|
||||
complete: `${type},${index}`
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user