mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2025-10-09 00:26:04 +00:00
Upgrades ui
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { _decorator, Component, Node } from "cc";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("UpgradeLevelPointUI")
|
||||
export class UpgradeLevelPointUI extends Component {
|
||||
@property(Node) private upgradedGraphics: Node;
|
||||
|
||||
public init(): void {
|
||||
this.upgradedGraphics.active = false;
|
||||
}
|
||||
|
||||
public upgrade(): void {
|
||||
this.upgradedGraphics.active = true;
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "10d0fb94-c1dd-44db-86fa-7d5a3b29814a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -1,4 +1,5 @@
|
||||
import { Component, instantiate, Label, Node, Prefab, _decorator } from "cc";
|
||||
import { UpgradeLevelPointUI } from "./UpgradeLevelPointUI";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("UpgradeUI")
|
||||
@@ -7,14 +8,22 @@ export class UpgradeUI extends Component {
|
||||
@property(Node) private levelPointsParent: Node;
|
||||
@property(Label) private title: Label;
|
||||
@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++) {
|
||||
const node: Node = instantiate(this.levelPointPrefab);
|
||||
node.setParent(this.levelPointsParent);
|
||||
|
||||
const levelPointUI = node.getComponent(UpgradeLevelPointUI);
|
||||
levelPointUI.init();
|
||||
if (i < 3) {
|
||||
levelPointUI.upgrade();
|
||||
}
|
||||
}
|
||||
|
||||
this.title.string = titleText;
|
||||
this.description.string = descriptionText;
|
||||
this.cost.string = "55";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user