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 1
)[0]; )[0];
if (!main.replayChecking) { if (!main.replayChecking) {
mota.ui.fixed.open('start'); mota.ui.fixed.closeByName('start');
} }
if (core.isPlaying() && !core.status.gameOver) { if (core.isPlaying() && !core.status.gameOver) {
core.control.autosave(0); core.control.autosave(0);

View File

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