mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2026-02-14 12:22:42 +00:00
Chest modal
This commit is contained in:
21
assets/Scripts/Game/ModalWIndows/ChestModalWindow.ts
Normal file
21
assets/Scripts/Game/ModalWIndows/ChestModalWindow.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { randomRangeInt, _decorator } from "cc";
|
||||
import { ModalWindow } from "../../Services/ModalWindowSystem/ModalWindow";
|
||||
import { UIButton } from "../../Services/UI/Button/UIButton";
|
||||
import { LevelUpModalWindowParams } from "../UI/LevelUpWindow/LevelUpModalWindow";
|
||||
import { LevelUpSkill } from "../UI/LevelUpWindow/LevelUpSkill";
|
||||
import { UpgradeType } from "../Upgrades/UpgradeType";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("ChestModalWindow")
|
||||
export class ChestModalWindow extends ModalWindow<LevelUpModalWindowParams, UpgradeType> {
|
||||
@property(LevelUpSkill) private levelUpSkill: LevelUpSkill;
|
||||
@property(UIButton) private okButton: UIButton;
|
||||
|
||||
protected setup(params: LevelUpModalWindowParams): void {
|
||||
const randomIndex = randomRangeInt(0, params.availableUpgrades.length - 1);
|
||||
const skillToUpgrade = params.availableUpgrades[randomIndex];
|
||||
this.levelUpSkill.init(skillToUpgrade, params.translationData);
|
||||
|
||||
this.okButton.InteractedEvent.on(() => this.dismiss(skillToUpgrade), this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user