升级初步完成

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

View File

@@ -247,7 +247,7 @@ export class CardControllerComp extends CCComp {
let cost: number = 0;
let { uuid, type } = card[0];
url = "game/hero/hero_icon";
({ uuid: pathName, name, level ,cost} = smc.heros[uuid]);
({ uuid: pathName, name, level ,cost} = HeroInfo[uuid]);
this.cards[index].lv=level
this.cards[index].cost = cost
let node=this.node.getChildByName('cards').getChildByName('card'+index)

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]);

View File

@@ -15,7 +15,7 @@ import { Talents } from "../common/config/TalentSet";
import { HeroViewComp } from "../hero/HeroViewComp";
import { BossViewComp } from "../Boss/BossViewComp";
import { Hero } from "../hero/Hero";
import { HeroSet } from "../common/config/heroSet";
import { HeroInfo, HeroSet } from "../common/config/heroSet";
import { Boss } from "../Boss/Boss";
import { MonModelComp } from "../hero/MonModelComp";
import { BossList, MissionNum, MissionSet, MonsetList } from "../common/config/MissionSet";
@@ -253,14 +253,14 @@ export class MissionComp extends CCComp {
private addHero(uuid:number=1001,i:number=0) {
let hero = ecs.getEntity<Hero>(Hero);
let scale = 1
let pos:Vec3 = v3(HeroSet.StartPos[smc.heros[uuid].type]-i*15,BoxSet.GAME_LINE);
let pos:Vec3 = v3(HeroSet.StartPos[HeroInfo[uuid].type]-i*15,BoxSet.GAME_LINE);
// console.log("addHero:",pos)
hero.load(pos,scale,uuid);
}
private addMonster(uuid:number=1001,i:number=0) {
let monster = ecs.getEntity<Hero>(Hero);
let scale = -1
let pos:Vec3 = v3(-1*HeroSet.StartPos[smc.heros[uuid].type]+i*15,BoxSet.GAME_LINE);
let pos:Vec3 = v3(-1*HeroSet.StartPos[HeroInfo[uuid].type]+i*15,BoxSet.GAME_LINE);
console.log("addMonster:",pos)
monster.load(pos,scale,uuid,false);
}