-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes final lint issues + prettier format
- Loading branch information
1 parent
3fa5568
commit d618f4d
Showing
11 changed files
with
129 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,62 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { BehaviorSubject, Observable } from 'rxjs'; | ||
import { BehaviorSubject } from 'rxjs'; | ||
|
||
export interface GameConfig { | ||
difficultyId: number, | ||
difficultyId: number; | ||
rounds: number; | ||
secondsPerRound: number; | ||
timeToStartClassify: number; | ||
} | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
providedIn: 'root', | ||
}) | ||
export class GameConfigService { | ||
private _configValues: GameConfig = { | ||
difficultyId: 1, | ||
rounds: 3, | ||
secondsPerRound: 30, | ||
timeToStartClassify: 23 | ||
}; | ||
|
||
constructor() {} | ||
timeToStartClassify: 23, | ||
}; | ||
|
||
private readonly _config = new BehaviorSubject<GameConfig>(this._configValues); // Easy mode as default | ||
config$ = this._config.asObservable(); | ||
|
||
|
||
|
||
setDifficultyLevel(level: string): void { | ||
switch (level) { | ||
case 'easy': | ||
this.setConfig = { | ||
difficultyId: 1, | ||
rounds: 3, | ||
secondsPerRound: 30, | ||
timeToStartClassify: 25 | ||
this.setConfig = { | ||
difficultyId: 1, | ||
rounds: 3, | ||
secondsPerRound: 30, | ||
timeToStartClassify: 25, | ||
}; | ||
break; | ||
case 'medium': | ||
this.setConfig = { | ||
difficultyId: 2, | ||
rounds: 3, | ||
secondsPerRound: 20, | ||
timeToStartClassify: 15 | ||
this.setConfig = { | ||
difficultyId: 2, | ||
rounds: 3, | ||
secondsPerRound: 20, | ||
timeToStartClassify: 15, | ||
}; | ||
break; | ||
case 'hard': | ||
this.setConfig = { | ||
difficultyId: 3, | ||
rounds: 3, | ||
secondsPerRound: 20, | ||
timeToStartClassify: 15 | ||
}; | ||
this.setConfig = { | ||
difficultyId: 3, | ||
rounds: 3, | ||
secondsPerRound: 20, | ||
timeToStartClassify: 15, | ||
}; | ||
break; | ||
} | ||
} | ||
|
||
set setConfig(newConfigValues: GameConfig) { | ||
this._configValues = { ...this._configValues, ...newConfigValues }; | ||
this._config.next(newConfigValues); | ||
this._config.next(newConfigValues); | ||
} | ||
|
||
get getConfig(): GameConfig { | ||
return this._configValues; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.