mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2026-02-14 12:22:42 +00:00
Meta upgrades
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { Component, instantiate, Label, Node, Prefab, _decorator } from "cc";
|
||||
import { MetaUpgradeSettings } from "../../../Game/Data/GameSettings";
|
||||
import { TranslationData } from "../../../Game/Data/TranslationData";
|
||||
import { MetaUpgradeType } from "../../../Game/Upgrades/UpgradeType";
|
||||
import { formatString } from "../../../Services/Utils/StringUtils";
|
||||
import { UpgradeLevelPointUI } from "./UpgradeLevelPointUI";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -10,8 +14,8 @@ export class UpgradeUI extends Component {
|
||||
@property(Label) private description: Label;
|
||||
@property(Label) private cost: Label;
|
||||
|
||||
public init(titleText: string, descriptionText: string, levels: number): void {
|
||||
for (let i = 0; i < levels; i++) {
|
||||
public init(upgradeType: MetaUpgradeType, upgradeSettings: MetaUpgradeSettings, level: number, translationData: TranslationData): void {
|
||||
for (let i = 0; i < upgradeSettings.bonuses.length; i++) {
|
||||
const node: Node = instantiate(this.levelPointPrefab);
|
||||
node.setParent(this.levelPointsParent);
|
||||
|
||||
@@ -22,8 +26,8 @@ export class UpgradeUI extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
this.title.string = titleText;
|
||||
this.description.string = descriptionText;
|
||||
this.cost.string = "55";
|
||||
this.title.string = `${translationData[`${upgradeType}_TITLE`]}`;
|
||||
this.description.string = formatString(`${translationData[`${upgradeType}_DESC`]}`, [upgradeSettings.bonuses[level].toString()]);
|
||||
this.cost.string = upgradeSettings.costs[level].toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user