mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2025-10-09 08:36:14 +00:00
Upgrader, LevelUpSkill
This commit is contained in:
12
assets/Scripts/Game/UI/LevelUpWindow.meta
Normal file
12
assets/Scripts/Game/UI/LevelUpWindow.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "b10425c2-13b2-4c46-a497-13a269a204de",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
29
assets/Scripts/Game/UI/LevelUpWindow/LevelUpModalWindow.ts
Normal file
29
assets/Scripts/Game/UI/LevelUpWindow/LevelUpModalWindow.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { CCString, instantiate, Node, Prefab, Vec3, _decorator } from "cc";
|
||||
import { ModalWindow } from "../../../Services/ModalWindowSystem/ModalWindow";
|
||||
import { delay } from "../../../Services/Utils/AsyncUtils";
|
||||
import { LevelUpSkill } from "./LevelUpSkill";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("LevelUpModalWindow")
|
||||
export class LevelUpModalWindow extends ModalWindow<string, string> {
|
||||
@property(Prefab) private skillPrefab: Prefab;
|
||||
@property(Node) private skillParent: Node;
|
||||
|
||||
protected async setup(params: string): Promise<void> {
|
||||
const xPositions: number[] = [-180, 0, 180];
|
||||
await delay(300);
|
||||
for (let i = 0; i < 3; i++) {
|
||||
await delay(500);
|
||||
const skill: LevelUpSkill = instantiate(this.skillPrefab).getComponent(LevelUpSkill);
|
||||
skill.node.setParent(this.skillParent);
|
||||
skill.node.setPosition(new Vec3(xPositions[i]));
|
||||
skill.init(params);
|
||||
skill.ChooseSkillEvent.on(this.chooseSkill, this);
|
||||
}
|
||||
}
|
||||
|
||||
private chooseSkill(skill: LevelUpSkill): void {
|
||||
this.dismiss("FInishedSuccessfuly");
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "f7ac6f2a-2bea-42ec-b5d0-58976001856c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
22
assets/Scripts/Game/UI/LevelUpWindow/LevelUpSkill.ts
Normal file
22
assets/Scripts/Game/UI/LevelUpWindow/LevelUpSkill.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Component, Label, NodeEventType, _decorator } from "cc";
|
||||
import { ISignal } from "../../../Services/EventSystem/ISignal";
|
||||
import { Signal } from "../../../Services/EventSystem/Signal";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("LevelUpSkill")
|
||||
export class LevelUpSkill extends Component {
|
||||
@property(Label) private skillTitle: Label;
|
||||
private chooseSkillEvent: Signal<LevelUpSkill> = new Signal<LevelUpSkill>();
|
||||
public init(skillTitle: string): void {
|
||||
this.skillTitle.string = skillTitle;
|
||||
this.node.on(NodeEventType.MOUSE_DOWN, this.chooseSkill, this);
|
||||
}
|
||||
|
||||
public get ChooseSkillEvent(): ISignal<LevelUpSkill> {
|
||||
return this.chooseSkillEvent;
|
||||
}
|
||||
|
||||
private chooseSkill(): void {
|
||||
this.chooseSkillEvent.trigger(this);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "65e26889-bc4f-487d-8625-602fbced8eb1",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user