-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
37 lines (30 loc) · 1.01 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const missionMenu = new MissionMenu();
//% weight=100 color=#007BA7 icon="\uf0c9"
namespace Menu {
//% block
export function addMission(id: number, displayName: string): void {
const mission: IMission = {
id: id,
displayName: displayName,
isRunning: false
};
missionMenu.addMission(mission);
}
//% block="when $missionId is selected to run"
export function defineMissionHandler(missionId: number, missionHandler: () => void): void {
missionMenu.defineMissionHandler(missionId, missionHandler);
}
//% block
export function clearAllMissions(): void {
missionMenu.clearAllMissions();
}
brick.buttonUp.onEvent(ButtonEvent.Released, () => {
missionMenu.selectPreviousMission();
});
brick.buttonDown.onEvent(ButtonEvent.Released, () => {
missionMenu.selectNextMission();
});
brick.buttonEnter.onEvent(ButtonEvent.Released, () => {
missionMenu.runSelectedMission();
});
}