forked from FOSS/BangleApps
hardalarm 1 btn
parent
1726233805
commit
660653858a
|
@ -71,26 +71,30 @@ function showAlarm(alarm) {
|
||||||
var currentGuess = 10;
|
var currentGuess = 10;
|
||||||
var randomNum = getRandomFromRange(0, 7, 13, 20);
|
var randomNum = getRandomFromRange(0, 7, 13, 20);
|
||||||
showNumberPicker(currentGuess, randomNum)
|
showNumberPicker(currentGuess, randomNum)
|
||||||
setWatch(o => {
|
|
||||||
|
let onSwipe = (x, y) => {
|
||||||
|
if (y == 1) {
|
||||||
if(!okClicked && currentGuess < 20) {
|
if(!okClicked && currentGuess < 20) {
|
||||||
currentGuess = currentGuess + 1;
|
currentGuess = currentGuess + 1;
|
||||||
showNumberPicker(currentGuess, randomNum);
|
showNumberPicker(currentGuess, randomNum);
|
||||||
}
|
}
|
||||||
}, BTN1, {repeat: true, edge: 'rising'});
|
}
|
||||||
|
else if (y == -1) {
|
||||||
|
if(!okClicked && currentGuess > 0) {
|
||||||
|
currentGuess = currentGuess - 1;
|
||||||
|
showNumberPicker(currentGuess, randomNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Bangle.on("swipe", onSwipe);
|
||||||
|
|
||||||
|
|
||||||
setWatch(o => {
|
setWatch(o => {
|
||||||
if(currentGuess == randomNum) {
|
if(currentGuess == randomNum) {
|
||||||
okClicked = true;
|
okClicked = true;
|
||||||
showPrompt(msg, buzzCount, alarm);
|
showPrompt(msg, buzzCount, alarm);
|
||||||
}
|
}
|
||||||
}, BTN2, {repeat: true, edge: 'rising'});
|
}, BTN, {repeat: true, edge: 'rising'});
|
||||||
|
|
||||||
setWatch(o => {
|
|
||||||
if(!okClicked && currentGuess > 0) {
|
|
||||||
currentGuess = currentGuess - 1;
|
|
||||||
showNumberPicker(currentGuess, randomNum);
|
|
||||||
}
|
|
||||||
}, BTN3, {repeat: true, edge: 'rising'});
|
|
||||||
|
|
||||||
function buzz() {
|
function buzz() {
|
||||||
Bangle.buzz(500).then(()=>{
|
Bangle.buzz(500).then(()=>{
|
||||||
|
|
Loading…
Reference in New Issue