Slash-The-Hordes/assets/Scripts/Game/UI/LevelUpWindow/LevelUpSkill.ts

24 lines
868 B
TypeScript
Raw Normal View History

2022-11-23 08:01:01 +00:00
import { Component, Label, NodeEventType, _decorator } from "cc";
import { ISignal } from "../../../Services/EventSystem/ISignal";
import { Signal } from "../../../Services/EventSystem/Signal";
2022-11-25 11:00:09 +00:00
import { UpgradeType } from "../../Upgrades/UpgradeType";
2022-11-23 08:01:01 +00:00
const { ccclass, property } = _decorator;
@ccclass("LevelUpSkill")
export class LevelUpSkill extends Component {
@property(Label) private skillTitle: Label;
private chooseSkillEvent: Signal<LevelUpSkill> = new Signal<LevelUpSkill>();
2022-11-25 11:00:09 +00:00
public init(skillType: UpgradeType): void {
this.skillTitle.string = `Skill ${skillType}`;
2022-11-23 08:01:01 +00:00
this.node.on(NodeEventType.MOUSE_DOWN, this.chooseSkill, this);
}
public get ChooseSkillEvent(): ISignal<LevelUpSkill> {
return this.chooseSkillEvent;
}
private chooseSkill(): void {
this.chooseSkillEvent.trigger(this);
}
}