Files
slgclient/assets/scripts/map/ui/SkillItemLogic.ts
2025-11-18 18:38:53 +08:00

42 lines
984 B
TypeScript

import { _decorator, Component, Label, Node, SpriteFrame } from 'cc';
const {ccclass, property} = _decorator;
import SkillCommand from "../../skill/SkillCommand";
import { Skill } from "../../skill/SkillProxy";
import SkillIconLogic from "./SkillIconLogic";
@ccclass('SkillItemLogic')
export default class SkillItemLogic extends Component {
@property(Label)
nameLab: Label = null;
@property(Label)
limitLab: Label = null;
@property(Node)
icon:Node = null;
@property([SpriteFrame])
sps:SpriteFrame[] = [];
_skill: Skill = null;
protected onEnable():void{
}
protected updateItem(skill:Skill):void{
var conf = SkillCommand.getInstance().proxy.getSkillCfg(skill.cfgId);
this._skill = skill;
this.nameLab.string = conf.name;
this.icon.getComponent(SkillIconLogic).setData(skill, null);
this.limitLab.string = this._skill.generals.length + "/" + conf.limit;
}
}