mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2025-10-09 00:26:04 +00:00
Menu modal WIP, new settigns
This commit is contained in:
20
assets/Scripts/Menu/ModalWindows/Upgrades/UpgradeUI.ts
Normal file
20
assets/Scripts/Menu/ModalWindows/Upgrades/UpgradeUI.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Component, instantiate, Label, Node, Prefab, _decorator } from "cc";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("UpgradeUI")
|
||||
export class UpgradeUI extends Component {
|
||||
@property(Prefab) private levelPointPrefab: Prefab;
|
||||
@property(Node) private levelPointsParent: Node;
|
||||
@property(Label) private title: Label;
|
||||
@property(Label) private description: 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);
|
||||
}
|
||||
|
||||
this.title.string = titleText;
|
||||
this.description.string = descriptionText;
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "76edae8c-16ba-482d-91fd-2833991475ac",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
import { instantiate, Prefab, _decorator, Node } from "cc";
|
||||
import { ModalWindow } from "../../../Services/ModalWindowSystem/ModalWindow";
|
||||
import { UpgradeUI } from "./UpgradeUI";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("UpgradesModalWindow")
|
||||
export class UpgradesModalWindow extends ModalWindow<Empty, Empty> {
|
||||
@property(Prefab) upgradeButtonPrefab: Prefab;
|
||||
@property(Node) upgradeButtonParent: Node;
|
||||
|
||||
public setup(params: Empty): void {
|
||||
for (let index = 0; index < 6; index++) {
|
||||
const upgradeButton: Node = instantiate(this.upgradeButtonPrefab);
|
||||
upgradeButton.getComponent(UpgradeUI).init("Title", "Description", 5);
|
||||
upgradeButton.setParent(this.upgradeButtonParent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class Empty {}
|
@@ -0,0 +1 @@
|
||||
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"854a4b66-9084-4ecd-814f-0300f12f7ff3","files":[],"subMetas":{},"userData":{}}
|
Reference in New Issue
Block a user