技能卡槽 需要测试确认

This commit is contained in:
2025-06-26 16:57:55 +08:00
parent b00cc9536f
commit 0a25259cf4
4 changed files with 56 additions and 61 deletions

View File

@@ -130,52 +130,50 @@ export class EquipSkillComp extends CCComp {
get_skill(e:GameEvent,data:any){
console.log("get_skill")
if(this.skill1.uuid==0){
this.skill1.uuid=data.uuid
this.skill1.skill_name=SkillSet[data.uuid].name
this.skill1.type=1
this.skill1.cd=SkillSet[data.uuid].cd
this.skill1.cd_time=SkillSet[data.uuid].cd
let icon = this.node.getChildByName("boxs").getChildByName("skill1").getChildByName("icon")
icon.active=true
var icon_path = "game/skills/skill_icon"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = icon.getChildByName("skill").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[data.uuid].path);
});
return
switch(data.slot){
case "skill1":
this.skill1.uuid=data.uuid
this.skill1.skill_name=SkillSet[data.uuid].name
this.skill1.type=1
this.skill1.cd=SkillSet[data.uuid].cd
this.skill1.cd_time=SkillSet[data.uuid].cd
let icon1 = this.node.getChildByName("boxs").getChildByName("skill1").getChildByName("icon")
icon1.active=true
var icon_path = "game/skills/skill_icon"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = icon1.getChildByName("skill").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[data.uuid].path);
});
break
case "skill2":
this.skill2.uuid=data.uuid
this.skill2.skill_name=SkillSet[data.uuid].name
this.skill2.type=1
this.skill2.cd=SkillSet[data.uuid].cd
this.skill2.cd_time=SkillSet[data.uuid].cd
let icon2 = this.node.getChildByName("boxs").getChildByName("skill2").getChildByName("icon")
icon2.active=true
var icon_path = "game/skills/skill_icon"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = icon2.getChildByName("skill").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[data.uuid].path);
});
break
case "skill3":
this.skill3.uuid=data.uuid
this.skill3.skill_name=SkillSet[data.uuid].name
this.skill3.type=1
this.skill3.cd=SkillSet[data.uuid].cd
this.skill3.cd_time=SkillSet[data.uuid].cd
let icon = this.node.getChildByName("boxs").getChildByName("skill3").getChildByName("icon")
icon.active=true
var icon_path = "game/skills/skill_icon"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = icon.getChildByName("skill").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[data.uuid].path);
});
break
}
if(this.skill2.uuid==0){
this.skill2.uuid=data.uuid
this.skill2.skill_name=SkillSet[data.uuid].name
this.skill2.type=1
this.skill2.cd=SkillSet[data.uuid].cd
this.skill2.cd_time=SkillSet[data.uuid].cd
let icon = this.node.getChildByName("boxs").getChildByName("skill2").getChildByName("icon")
icon.active=true
var icon_path = "game/skills/skill_icon"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = icon.getChildByName("skill").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[data.uuid].path);
});
return
}
if(this.skill3.uuid==0){
this.skill3.uuid=data.uuid
this.skill3.skill_name=SkillSet[data.uuid].name
this.skill3.type=1
this.skill3.cd=SkillSet[data.uuid].cd
this.skill3.cd_time=SkillSet[data.uuid].cd
let icon = this.node.getChildByName("boxs").getChildByName("skill3").getChildByName("icon")
icon.active=true
var icon_path = "game/skills/skill_icon"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = icon.getChildByName("skill").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[data.uuid].path);
});
return
}
console.log("技能栏满了")
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */