refactor: 优化ui控制器

This commit is contained in:
unanmed 2023-10-30 22:06:12 +08:00
parent 669ad11c82
commit 9a97a470f1
2 changed files with 8 additions and 21 deletions

View File

@ -2317,7 +2317,7 @@ control.prototype._doSL_load = function (id, callback) {
1
)[0];
if (!main.replayChecking) {
mota.ui.fixed.open('start');
mota.ui.fixed.closeByName('start');
}
if (core.isPlaying() && !core.status.gameOver) {
core.control.autosave(0);

View File

@ -64,32 +64,19 @@ fixedUi.register(
);
hook.once('mounted', () => {
const ui = document.getElementById('ui-main')!;
const fixed = document.getElementById('ui-fixed')!;
mainUi.on('start', () => {
const ui = document.getElementById('ui-main');
if (ui) {
ui.style.display = 'flex';
}
ui.style.display = 'flex';
});
mainUi.on('end', () => {
const ui = document.getElementById('ui-main');
if (ui) {
ui.style.display = 'none';
}
ui.style.display = 'none';
});
fixedUi.on('start', () => {
console.log(1);
const ui = document.getElementById('ui-fixed');
if (ui) {
ui.style.display = 'block';
}
fixed.style.display = 'block';
});
fixedUi.on('end', () => {
console.log(1);
const ui = document.getElementById('ui-fixed');
if (ui) {
ui.style.display = 'none';
}
fixed.style.display = 'none';
});
mainUi.focusByNum(fixedUi.open('start'));
});