score: call setUI after menu

master
Mika Dede 2021-10-09 20:01:48 +02:00
parent fbe14a79d1
commit 01d33cbbfa
No known key found for this signature in database
GPG Key ID: 546586DC38D45BBD
1 changed files with 20 additions and 16 deletions

View File

@ -28,25 +28,27 @@ function getSecondsTime() {
return Math.floor(getTime() * 1000); return Math.floor(getTime() * 1000);
} }
function setupInputWatchers() { function setupInputWatchers(init) {
isBangle1 = !!global.BTN4; isBangle1 = !!global.BTN4;
setWatch(() => handleInput(2), isBangle1 != null ? BTN2 : BTN, { repeat: true });
Bangle.setUI('updown', v => v && handleInput(Math.floor((v+2)/2)+(isBangle1 ? 0 : 3))); Bangle.setUI('updown', v => v && handleInput(Math.floor((v+2)/2)+(isBangle1 ? 0 : 3)));
Bangle.on('touch', (b, e) => { if (init) {
if (isBangle1) { setWatch(() => handleInput(2), isBangle1 != null ? BTN2 : BTN, { repeat: true });
if (b === 1) { Bangle.on('touch', (b, e) => {
handleInput(3); if (isBangle1) {
if (b === 1) {
handleInput(3);
} else {
handleInput(4);
}
} else { } else {
handleInput(4); if (e.x < getXCoord(w => w/2)) {
handleInput(0);
} else {
handleInput(1);
}
} }
} else { });
if (e.x < getXCoord(w => w/2)) { }
handleInput(0);
} else {
handleInput(1);
}
}
});
} }
function setupMatch() { function setupMatch() {
@ -87,6 +89,8 @@ function showSettingsMenu() {
settingsMenuOpened = null; settingsMenuOpened = null;
draw(); draw();
setupInputWatchers();
}, function (msg) { }, function (msg) {
switch (msg) { switch (msg) {
case 'end_set': case 'end_set':
@ -445,6 +449,6 @@ function draw() {
g.flip(); g.flip();
} }
setupInputWatchers(); setupInputWatchers(true);
setupMatch(); setupMatch();
draw(); draw();