Add levels are loaded from the backend now
parent
8845d591e9
commit
0bb2fcf8d7
@ -1,23 +1,27 @@
|
|||||||
export class Levellist {
|
export class Level {
|
||||||
levels: { level: number, name: string, points: number }[] = [
|
id: number;
|
||||||
{level: 0, name: 'Green Horn', points: 0},
|
name: string;
|
||||||
{level: 1, name: 'Good Willed', points: 100},
|
levelNumber: number;
|
||||||
{level: 2, name: 'Helper', points: 200},
|
points: number;
|
||||||
{level: 3, name: 'World Saver', points: 300},
|
|
||||||
{level: 4, name: 'Hero of the Green Country', points: 400},
|
|
||||||
{level: 5, name: 'Champion of the Earth', points: 500},
|
|
||||||
{level: 6, name: 'Intergallactic Superhero', points: 600},
|
|
||||||
];
|
|
||||||
|
|
||||||
getLevelName(level: number): any {
|
constructor(id: number, name: string, levelNumber: number, points: number) {
|
||||||
let name = 'not defined';
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.levelNumber = levelNumber;
|
||||||
|
this.points = points;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class LevelList {
|
||||||
|
levels: Level[] = [];
|
||||||
|
|
||||||
|
getLevelName(level: number): string {
|
||||||
|
let name = 'not defined';
|
||||||
for (const rank of this.levels) {
|
for (const rank of this.levels) {
|
||||||
if (level === rank.level) {
|
if (level === rank.levelNumber) {
|
||||||
name = rank.name;
|
name = rank.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue