升级初步完成

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

@@ -73,17 +73,17 @@ export class Boss extends ecs.Entity {
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){ hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
var bs = node.getComponent(BossViewComp)!; var bs = node.getComponent(BossViewComp)!;
// console.log("hero_init",buff) // console.log("hero_init",buff)
bs.speed =bs.ospeed = smc.monsters[uuid].speed; bs.speed =bs.ospeed = MonSet[uuid].speed;
bs.boos_name= smc.monsters[uuid].name; bs.boos_name= MonSet[uuid].name;
bs.hp= bs.hp_max = smc.monsters[uuid].hp; bs.hp= bs.hp_max = MonSet[uuid].hp;
bs.level = smc.monsters[uuid].level; bs.level = MonSet[uuid].level;
bs.atk = smc.monsters[uuid].atk; bs.atk = MonSet[uuid].atk;
bs.atk_cd = smc.monsters[uuid].atk_cd; bs.atk_cd = MonSet[uuid].atk_cd;
bs.atk_dis = smc.monsters[uuid].atk_dis; bs.atk_dis = MonSet[uuid].atk_dis;
bs.power = smc.monsters[uuid].power; bs.power = MonSet[uuid].power;
bs.power_max = smc.monsters[uuid].power_max; bs.power_max = MonSet[uuid].power_max;
bs.skill = smc.monsters[uuid].skill_uuid; bs.skill = MonSet[uuid].skill_uuid;
bs.type = smc.monsters[uuid].type; bs.type = MonSet[uuid].type;
bs.box_group = BoxSet.MONSTER; bs.box_group = BoxSet.MONSTER;
bs.scale = -1; bs.scale = -1;
bs.Tpos = v3(0,0,0); bs.Tpos = v3(0,0,0);

View File

@@ -29,7 +29,6 @@ export class SingletonModuleComp extends ecs.Comp {
// {uuid:6213,type:2},{uuid:6214,type:2},{uuid:6215,type:2}, // {uuid:6213,type:2},{uuid:6214,type:2},{uuid:6215,type:2},
// {uuid:6216,type:2},{uuid:6217,type:2},{uuid:6218,type:2} // {uuid:6216,type:2},{uuid:6217,type:2},{uuid:6218,type:2}
]; ];
items: any = []
sitems:any = [] sitems:any = []
player_skills: any = [ player_skills: any = [
]; ];
@@ -46,7 +45,11 @@ export class SingletonModuleComp extends ecs.Comp {
]; ];
monster_buffs: any = []; monster_buffs: any = [];
/** 游戏主角 */ /** 游戏主角 */
heros:any = []; heros:any={
9001:{uuid:9001,lv:1,exp:0,slv:1,stone:0},
9002:{uuid:9002,lv:2,exp:0,slv:2,stone:0},
9003:{uuid:9003,lv:3,exp:0,slv:3,stone:0},
};
mheros:any = []; mheros:any = [];
monsters:any = []; monsters:any = [];
skills:any = [] skills:any = []
@@ -96,10 +99,10 @@ export class SingletonModuleComp extends ecs.Comp {
}, },
fight_heros:[9001,], fight_heros:[9001,],
items:{ items:{
1001:0, 1001:1000,
1002:0, 1002:0,
1003:0, 1003:0,
1004:0, 1004:1000,
1005:0, 1005:0,
1006:0, 1006:0,
1007:0, 1007:0,
@@ -112,11 +115,6 @@ export class SingletonModuleComp extends ecs.Comp {
1027:0, 1027:0,
1028:0, 1028:0,
}, },
heros:{
9001:{uuid:9001,lv:1,exp:0,slv:1,stone:0},
9002:{uuid:9002,lv:2,exp:0,slv:2,stone:0},
9003:{uuid:9003,lv:3,exp:0,slv:3,stone:0},
},
talent:{ talent:{
1001:{uuid:1001,lv:0,}, 1001:{uuid:1001,lv:0,},
}, },

View File

@@ -1,25 +1,2 @@
/* export const SlvSet =[0,20,40,80,160]
* @Author: dgflash
* @Date: 2021-11-23 15:28:39
* @LastEditors: dgflash
* @LastEditTime: 2022-01-26 16:42:00
*/
export const RoleType = {
1: "前排",
2: "后排",
}
export const RoleSet ={
101:{uuid:"101", name:'魔法师', path:"101",atk:6,atk_cd:2, hp:30, power:50, speed:150,skill:{ }},
102:{uuid:"102", name:'魔法师', path:"102",atk:6,atk_cd:2, hp:30, power:50, speed:150,skill:{ }},
103:{uuid:"103", name:'魔法师', path:"103",atk:6,atk_cd:2, hp:30, power:50, speed:150,skill:{ }},
104:{uuid:"104", name:'魔法师', path:"104",atk:6,atk_cd:2, hp:30, power:50, speed:150,skill:{ }},
105:{uuid:"105", name:'魔法师', path:"105",atk:6,atk_cd:2, hp:30, power:50, speed:150,skill:{ }},
106:{uuid:"106", name:'魔法师', path:"106",atk:6,atk_cd:2, hp:30, power:50, speed:150,skill:{ }},
107:{uuid:"107", name:'魔法师', path:"107",atk:6,atk_cd:2, hp:30, power:50, speed:150,skill:{ }},
108:{uuid:"108", name:'魔法师', path:"108",atk:6,atk_cd:2, hp:30, power:50, speed:150,skill:{ }},
109:{uuid:"109", name:'魔法师', path:"109",atk:6,atk_cd:2, hp:30, power:50, speed:150,skill:{ }},
110:{uuid:"110", name:'魔法师', path:"110",atk:6,atk_cd:2, hp:30, power:50, speed:150,skill:{ }},
}

View File

@@ -54,7 +54,7 @@ export class Hero extends ecs.Entity {
this.addComponents<ecs.Comp>( MonModelComp); this.addComponents<ecs.Comp>( MonModelComp);
} }
var path = "game/heros/"+smc.heros[uuid].path; var path = "game/heros/"+HeroInfo[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!; var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab); var node = instantiate(prefab);
@@ -69,9 +69,9 @@ export class Hero extends ecs.Entity {
hero_init(uuid:number=1001,node:Node,scale:number=1,box_group=BoxSet.HERO){ hero_init(uuid:number=1001,node:Node,scale:number=1,box_group=BoxSet.HERO){
var hv = node.getComponent(HeroViewComp)!; var hv = node.getComponent(HeroViewComp)!;
// console.log("hero_init",buff) // console.log("hero_init",buff)
let HInf= smc.heros[uuid] // 角色数据 let HInf= HeroInfo[uuid] // 角色数据
let talent= smc.vmdata.talent let talent= smc.vmdata.talent
let hero =smc.vmdata.heros[uuid] let hero =smc.heros[uuid]
let talents=Talents; let talents=Talents;
hv.scale = scale; hv.scale = scale;
hv.box_group = box_group; hv.box_group = box_group;
@@ -112,7 +112,7 @@ export class Hero extends ecs.Entity {
} }
set_ratio(uuid:number){ set_ratio(uuid:number){
let ratio=1; let ratio=1;
switch (smc.heros[uuid].level) { switch (HeroInfo[uuid].level) {
case 2: case 2:
ratio=1.05 ratio=1.05
break; break;

View File

@@ -3,6 +3,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { HeroCardComp } from "./HeroCardComp"; import { HeroCardComp } from "./HeroCardComp";
import { smc } from "../common/SingletonModuleComp"; import { smc } from "../common/SingletonModuleComp";
import { HeroInfo } from "../common/config/heroSet";
/** HeroCard 模块 */ /** HeroCard 模块 */
@ecs.register(`HeroCard`) @ecs.register(`HeroCard`)
@@ -18,17 +19,17 @@ export class HeroCard extends ecs.Entity {
var prefab: Prefab = oops.res.get(path, Prefab)!; var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab); var node = instantiate(prefab);
node.parent = parent; node.parent = parent;
node.getChildByName("name").getComponent(Label).string = smc.heros[uuid].name node.getChildByName("name").getComponent(Label).string = HeroInfo[uuid].name
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => { resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("Mask").getChildByName("hero").getComponent(Sprite); const sprite = node.getChildByName("Mask").getChildByName("hero").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(smc.heros[uuid].path); sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
}); });
node.getChildByName("lv").getComponent(Label).string = smc.vmdata.heros[uuid].lv.toString(); node.getChildByName("lv").getComponent(Label).string = smc.heros[uuid].lv.toString();
if(smc.vmdata.heros[uuid].slv>=1) node.getChildByName("slv").getChildByName("s1").active=true; if(smc.heros[uuid].slv>=1) node.getChildByName("slv").getChildByName("s1").active=true;
if(smc.vmdata.heros[uuid].slv>=2) node.getChildByName("slv").getChildByName("s2").active=true; if(smc.heros[uuid].slv>=2) node.getChildByName("slv").getChildByName("s2").active=true;
if(smc.vmdata.heros[uuid].slv>=3) node.getChildByName("slv").getChildByName("s3").active=true; if(smc.heros[uuid].slv>=3) node.getChildByName("slv").getChildByName("s3").active=true;
if(smc.vmdata.heros[uuid].slv>=4) node.getChildByName("slv").getChildByName("s4").active=true; if(smc.heros[uuid].slv>=4) node.getChildByName("slv").getChildByName("s4").active=true;
if(smc.vmdata.heros[uuid].slv>=5) node.getChildByName("slv").getChildByName("s5").active=true; if(smc.heros[uuid].slv>=5) node.getChildByName("slv").getChildByName("s5").active=true;
let hcc = node.getComponent(HeroCardComp)!; let hcc = node.getComponent(HeroCardComp)!;
hcc.hcc_uuid = uuid; hcc.hcc_uuid = uuid;
this.add(hcc); this.add(hcc);

View File

@@ -86,8 +86,6 @@ export class Initialize extends ecs.Entity {
/** 加载完成进入游戏内容加载界面 */ /** 加载完成进入游戏内容加载界面 */
private onComplete(queue: AsyncQueue) { private onComplete(queue: AsyncQueue) {
queue.complete = () => { queue.complete = () => {
smc.heros = HeroInfo;
smc.monsters=MonSet;
// console.log("加载完成!",smc.heros); // console.log("加载完成!",smc.heros);
smc.skills=SkillSet; smc.skills=SkillSet;
smc.sitems=Sitems; smc.sitems=Sitems;

View File

@@ -247,7 +247,7 @@ export class CardControllerComp extends CCComp {
let cost: number = 0; let cost: number = 0;
let { uuid, type } = card[0]; let { uuid, type } = card[0];
url = "game/hero/hero_icon"; 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].lv=level
this.cards[index].cost = cost this.cards[index].cost = cost
let node=this.node.getChildByName('cards').getChildByName('card'+index) 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 { _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 { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; 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 { HeroCard } from "../hero/HeroCard";
import { smc } from "../common/SingletonModuleComp"; import { smc } from "../common/SingletonModuleComp";
import { UIID } from "../common/config/GameUIConfig"; import { UIID } from "../common/config/GameUIConfig";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { Items } from "../common/config/Items"; import { Items } from "../common/config/Items";
import { SkillSet } from "../common/config/SkillSet"; import { SkillSet } from "../common/config/SkillSet";
import { SlvSet } from "../common/config/RoleSet";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
/** 视图层对象 */ /** 视图层对象 */
@@ -39,8 +40,8 @@ export class HeroHomeComp extends CCComp {
} }
hero_show(uuid:number) { hero_show(uuid:number) {
console.log("hero_home hero_show:",uuid) console.log("hero_home hero_show:",uuid)
let role = smc.vmdata.heros[uuid] let role = smc.heros[uuid]
let hero =smc.heros[uuid] let hero =HeroInfo[uuid]
this.h_uuid=uuid this.h_uuid=uuid
let slv_node=this.node.getChildByName("name").getChildByName("slv"); let slv_node=this.node.getChildByName("name").getChildByName("slv");
let tal=this.node.getChildByName("slvup").getChildByName("tal"); let tal=this.node.getChildByName("slvup").getChildByName("tal");
@@ -105,10 +106,22 @@ export class HeroHomeComp extends CCComp {
} }
lv_up(){ 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(){ 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){ item_show(e:any,val:any){
oops.gui.open(UIID.ItemInfo, Items[val]); 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 { HeroViewComp } from "../hero/HeroViewComp";
import { BossViewComp } from "../Boss/BossViewComp"; import { BossViewComp } from "../Boss/BossViewComp";
import { Hero } from "../hero/Hero"; import { Hero } from "../hero/Hero";
import { HeroSet } from "../common/config/heroSet"; import { HeroInfo, HeroSet } from "../common/config/heroSet";
import { Boss } from "../Boss/Boss"; import { Boss } from "../Boss/Boss";
import { MonModelComp } from "../hero/MonModelComp"; import { MonModelComp } from "../hero/MonModelComp";
import { BossList, MissionNum, MissionSet, MonsetList } from "../common/config/MissionSet"; 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) { private addHero(uuid:number=1001,i:number=0) {
let hero = ecs.getEntity<Hero>(Hero); let hero = ecs.getEntity<Hero>(Hero);
let scale = 1 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) // console.log("addHero:",pos)
hero.load(pos,scale,uuid); hero.load(pos,scale,uuid);
} }
private addMonster(uuid:number=1001,i:number=0) { private addMonster(uuid:number=1001,i:number=0) {
let monster = ecs.getEntity<Hero>(Hero); let monster = ecs.getEntity<Hero>(Hero);
let scale = -1 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) console.log("addMonster:",pos)
monster.load(pos,scale,uuid,false); monster.load(pos,scale,uuid,false);
} }