升级初步完成

This commit is contained in:
2024-12-06 16:34:17 +08:00
parent 4bac3c6d86
commit a968281bdc
9 changed files with 54 additions and 67 deletions

View File

@@ -1,13 +1,14 @@
import { _decorator,Button,EventHandler,EventTouch,instantiate,Label,NodeEventType,Prefab,resources,Sprite,SpriteAtlas,tween,UITransform,v3 } 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 { HeroList } from "../common/config/heroSet";
import { HeroInfo, HeroList } from "../common/config/heroSet";
import { HeroCard } from "../hero/HeroCard";
import { smc } from "../common/SingletonModuleComp";
import { UIID } from "../common/config/GameUIConfig";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { Items } from "../common/config/Items";
import { SkillSet } from "../common/config/SkillSet";
import { SlvSet } from "../common/config/RoleSet";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -39,8 +40,8 @@ export class HeroHomeComp extends CCComp {
}
hero_show(uuid:number) {
console.log("hero_home hero_show:",uuid)
let role = smc.vmdata.heros[uuid]
let hero =smc.heros[uuid]
let role = smc.heros[uuid]
let hero =HeroInfo[uuid]
this.h_uuid=uuid
let slv_node=this.node.getChildByName("name").getChildByName("slv");
let tal=this.node.getChildByName("slvup").getChildByName("tal");
@@ -105,10 +106,22 @@ export class HeroHomeComp extends CCComp {
}
lv_up(){
console.log("lvup h_uuid:",this.h_uuid)
console.log("升级",smc.vmdata.items[1001],smc.heros[this.h_uuid].lv*HeroInfo[this.h_uuid].lvexp)
if(smc.vmdata.items[1001] < smc.heros[this.h_uuid].lv*HeroInfo[this.h_uuid].lvexp){
console.log("材料不足")
return
}
smc.heros[this.h_uuid].lv++
smc.vmdata.items[1001] -= smc.heros[this.h_uuid].lv*HeroInfo[this.h_uuid].lvexp
}
slv_up(){
console.log("lvup slv_up:",this.h_uuid)
console.log("smc.vmdata.items[1004] SlvSet[smc.heros[this.h_uuid].slv]:",smc.vmdata.items[1004],SlvSet[smc.heros[this.h_uuid].slv])
if(smc.vmdata.items[1004] < SlvSet[smc.heros[this.h_uuid].slv]){
console.log("材料不足")
return
}
smc.heros[this.h_uuid].slv++
smc.vmdata.items[1004] -= SlvSet[smc.heros[this.h_uuid].slv]
}
item_show(e:any,val:any){
oops.gui.open(UIID.ItemInfo, Items[val]);