39 lines
845 B
TypeScript
39 lines
845 B
TypeScript
import { KeyContext } from "./key-context";
|
|
import { KeyboardManager } from "../keyboard-manager";
|
|
|
|
export class CarouselKeyContext extends KeyContext {
|
|
readonly name: string = "CarouselContext";
|
|
|
|
protected onKeyUp() {
|
|
super.onKeyUp();
|
|
this.store.moveTagUp();
|
|
}
|
|
|
|
protected onKeyDown() {
|
|
super.onKeyDown();
|
|
this.store.moveTagDown();
|
|
}
|
|
|
|
protected onKeyRight() {
|
|
super.onKeyRight();
|
|
this.store.moveGameRight();
|
|
}
|
|
|
|
protected onKeyLeft() {
|
|
super.onKeyLeft();
|
|
if (this.store.selectedGameIndex === 0) {
|
|
KeyboardManager.switchContext("sidebar");
|
|
}
|
|
else {
|
|
this.store.moveGameLeft();
|
|
}
|
|
}
|
|
|
|
protected onEscape() {
|
|
super.onEscape();
|
|
}
|
|
|
|
protected onEnter() {
|
|
super.onEnter();
|
|
}
|
|
} |