Merge branch 'max_dev' of Software_Engineering_I/greenvironment-frontend into master
commit
e4551eebb9
@ -1,23 +1,27 @@
|
||||
export class Levellist {
|
||||
levels: { level: number, name: string, points: number }[] = [
|
||||
{level: 0, name: 'Green Horn', points: 0},
|
||||
{level: 1, name: 'Good Willed', points: 100},
|
||||
{level: 2, name: 'Helper', points: 200},
|
||||
{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},
|
||||
];
|
||||
export class Level {
|
||||
id: number;
|
||||
name: string;
|
||||
levelNumber: number;
|
||||
points: number;
|
||||
|
||||
getLevelName(level: number): any {
|
||||
let name = 'not defined';
|
||||
constructor(id: number, name: string, levelNumber: number, points: number) {
|
||||
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) {
|
||||
if (level === rank.level) {
|
||||
if (level === rank.levelNumber) {
|
||||
name = rank.name;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue