feat: swipe to score/undo, tap to set server / new match
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,13 +3,36 @@ import Toybox.WatchUi;
|
|||||||
|
|
||||||
class garmin_padelDelegate extends WatchUi.BehaviorDelegate {
|
class garmin_padelDelegate extends WatchUi.BehaviorDelegate {
|
||||||
|
|
||||||
function initialize() {
|
public function initialize() {
|
||||||
BehaviorDelegate.initialize();
|
BehaviorDelegate.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMenu() as Boolean {
|
public function onSwipe(swipeEvent as WatchUi.SwipeEvent) as Boolean {
|
||||||
WatchUi.pushView(new Rez.Menus.MainMenu(), new garmin_padelMenuDelegate(), WatchUi.SLIDE_UP);
|
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;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import Toybox.Lang;
|
|
||||||
import Toybox.System;
|
|
||||||
import Toybox.WatchUi;
|
|
||||||
|
|
||||||
class garmin_padelMenuDelegate extends WatchUi.MenuInputDelegate {
|
|
||||||
|
|
||||||
function initialize() {
|
|
||||||
MenuInputDelegate.initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onMenuItem(item as Symbol) as Void {
|
|
||||||
if (item == :item_1) {
|
|
||||||
System.println("item 1");
|
|
||||||
} else if (item == :item_2) {
|
|
||||||
System.println("item 2");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user