-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLevel.ts
35 lines (31 loc) · 1.04 KB
/
Level.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
interface ILevel {
toBackground(): void;
toForeground(mapcanvas: HTMLCanvasElement, controlDiv: HTMLDivElement, guiDiv: HTMLDivElement) : boolean;
getName(): string;
clear(): void;
}
abstract class ALevel<W extends IWorld<W>> implements ILevel {
mapcanvas: HTMLCanvasElement;
controlDiv: HTMLDivElement;
guiDiv: HTMLDivElement;
constructor() {
}
toBackground(): void {
this.getRobot().toBackground();
}
toForeground(mapcanvas: HTMLCanvasElement, controlDiv: HTMLDivElement, guiDiv: HTMLDivElement): boolean {
this.mapcanvas = mapcanvas;
this.controlDiv = controlDiv;
this.guiDiv = guiDiv;
this.getRobot().toForeground(guiDiv, controlDiv, this.mapcanvas);
return false;
}
abstract getName(): string;
abstract resetWorld(): W;
abstract getRobot(): IRobot<W>;
abstract getTestMaps(): W[];
clear(): void {
localStorage.removeItem("automap:" + this.getName());
localStorage.removeItem("mapcode:" + this.getName());
}
}