技能ui完成, todo 技能执行
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { _decorator } from "cc";
|
||||
import { _decorator, Label } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { MissionHomeComp } from "./MissionHomeComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -34,9 +35,12 @@ export class MSCardComp extends CCComp {
|
||||
}else{
|
||||
this.node.getChildByName("set").active=false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
update_data(){
|
||||
this.node.getChildByName("lv").getComponent(Label).string = smc.skills[this.s_uuid].lv.toString()+"级";
|
||||
this.node.getChildByName("update").getChildByName("cost").getComponent(Label).string =smc.skills[this.s_uuid].num.toString()+ " / "+(SkillSet[this.s_uuid].upcost*(1+smc.skills[this.s_uuid].lv)).toString()
|
||||
}
|
||||
select(){
|
||||
smc.mission.mskill=this.s_uuid
|
||||
this.mhc.select_skill()
|
||||
@@ -50,7 +54,19 @@ export class MSCardComp extends CCComp {
|
||||
this.node.getChildByName("set").getChildByName("btn").active=true
|
||||
}
|
||||
}
|
||||
|
||||
update_lv(){
|
||||
if(smc.skills[this.s_uuid].num <= (SkillSet[this.s_uuid].upcost*(1+smc.skills[this.s_uuid].lv))){
|
||||
oops.gui.toast("升级需要消耗"+SkillSet[this.s_uuid].upcost+"个能力石")
|
||||
return
|
||||
}
|
||||
smc.skills[this.s_uuid].num -= (SkillSet[this.s_uuid].upcost*(1+smc.skills[this.s_uuid].lv))
|
||||
smc.skills[this.s_uuid].lv++
|
||||
let mscards:any= ecs.query(ecs.allOf(MSCardComp));
|
||||
for(let i=0;i<mscards.length;i++){
|
||||
mscards[i].MSCardComp.update_data()
|
||||
}
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
|
||||
Reference in New Issue
Block a user