39 lines
1.0 KiB
MonkeyC
39 lines
1.0 KiB
MonkeyC
import Toybox.Lang;
|
|
import Toybox.WatchUi;
|
|
|
|
class garmin_padelDelegate extends WatchUi.BehaviorDelegate {
|
|
|
|
public function initialize() {
|
|
BehaviorDelegate.initialize();
|
|
}
|
|
|
|
public function onSwipe(swipeEvent as WatchUi.SwipeEvent) as Boolean {
|
|
var m = getApp().getMatch();
|
|
var dir = swipeEvent.getDirection();
|
|
if (dir == WatchUi.SWIPE_UP) {
|
|
m.pointTo(US);
|
|
} else if (dir == WatchUi.SWIPE_DOWN) {
|
|
m.pointTo(THEM);
|
|
} else if (dir == WatchUi.SWIPE_LEFT) {
|
|
m.undo();
|
|
} else {
|
|
return false;
|
|
}
|
|
WatchUi.requestUpdate();
|
|
return true;
|
|
}
|
|
|
|
public function onTap(clickEvent as WatchUi.ClickEvent) as Boolean {
|
|
var m = getApp().getMatch();
|
|
if (m.isMatchOver()) {
|
|
getApp().resetMatch();
|
|
} else if (m.canSetServer()) {
|
|
m.toggleStartingServer();
|
|
} else {
|
|
return false;
|
|
}
|
|
WatchUi.requestUpdate();
|
|
return true;
|
|
}
|
|
}
|