mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2025-10-09 08:36:14 +00:00
Pauser, game modal launcher
This commit is contained in:
27
assets/Scripts/Game/ModalWIndows/GameModalLauncher.ts
Normal file
27
assets/Scripts/Game/ModalWIndows/GameModalLauncher.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { ModalWindowManager } from "../../Services/ModalWindowSystem/ModalWindowManager";
|
||||
import { Pauser } from "../Pauser";
|
||||
import { Player } from "../Player/Player";
|
||||
import { Upgrader } from "../Upgrades/Upgrader";
|
||||
import { UpgradeType } from "../Upgrades/UpgradeType";
|
||||
import { GameModalWindowTypes } from "./GameModalWindowTypes";
|
||||
|
||||
export class GameModalLauncher {
|
||||
public constructor(
|
||||
private modalWindowManager: ModalWindowManager,
|
||||
private player: Player,
|
||||
private gamePauser: Pauser,
|
||||
private upgrader: Upgrader
|
||||
) {
|
||||
this.player.Level.LevelUpEvent.on(this.showLevelUpModal, this);
|
||||
}
|
||||
|
||||
private async showLevelUpModal(): Promise<void> {
|
||||
this.gamePauser.pause();
|
||||
const skillToUpgrade: UpgradeType = await this.modalWindowManager.showModal<UpgradeType[], UpgradeType>(
|
||||
GameModalWindowTypes.LevelUpModal,
|
||||
Array.from(this.upgrader.getAvailableUpgrades())
|
||||
);
|
||||
this.gamePauser.resume();
|
||||
this.upgrader.upgradeSkill(skillToUpgrade);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "19da79a2-30b2-4d73-83fb-b3ef17bde4d7",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
3
assets/Scripts/Game/ModalWIndows/GameModalWindowTypes.ts
Normal file
3
assets/Scripts/Game/ModalWIndows/GameModalWindowTypes.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export enum GameModalWindowTypes {
|
||||
LevelUpModal = "LevelUpModalWindow"
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "72fb4349-7b73-41e1-ad7a-4d50abcfc1fa",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user