升级初步完成
This commit is contained in:
@@ -73,17 +73,17 @@ export class Boss extends ecs.Entity {
|
||||
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
|
||||
var bs = node.getComponent(BossViewComp)!;
|
||||
// console.log("hero_init",buff)
|
||||
bs.speed =bs.ospeed = smc.monsters[uuid].speed;
|
||||
bs.boos_name= smc.monsters[uuid].name;
|
||||
bs.hp= bs.hp_max = smc.monsters[uuid].hp;
|
||||
bs.level = smc.monsters[uuid].level;
|
||||
bs.atk = smc.monsters[uuid].atk;
|
||||
bs.atk_cd = smc.monsters[uuid].atk_cd;
|
||||
bs.atk_dis = smc.monsters[uuid].atk_dis;
|
||||
bs.power = smc.monsters[uuid].power;
|
||||
bs.power_max = smc.monsters[uuid].power_max;
|
||||
bs.skill = smc.monsters[uuid].skill_uuid;
|
||||
bs.type = smc.monsters[uuid].type;
|
||||
bs.speed =bs.ospeed = MonSet[uuid].speed;
|
||||
bs.boos_name= MonSet[uuid].name;
|
||||
bs.hp= bs.hp_max = MonSet[uuid].hp;
|
||||
bs.level = MonSet[uuid].level;
|
||||
bs.atk = MonSet[uuid].atk;
|
||||
bs.atk_cd = MonSet[uuid].atk_cd;
|
||||
bs.atk_dis = MonSet[uuid].atk_dis;
|
||||
bs.power = MonSet[uuid].power;
|
||||
bs.power_max = MonSet[uuid].power_max;
|
||||
bs.skill = MonSet[uuid].skill_uuid;
|
||||
bs.type = MonSet[uuid].type;
|
||||
bs.box_group = BoxSet.MONSTER;
|
||||
bs.scale = -1;
|
||||
bs.Tpos = v3(0,0,0);
|
||||
|
||||
@@ -29,7 +29,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
// {uuid:6213,type:2},{uuid:6214,type:2},{uuid:6215,type:2},
|
||||
// {uuid:6216,type:2},{uuid:6217,type:2},{uuid:6218,type:2}
|
||||
];
|
||||
items: any = []
|
||||
sitems:any = []
|
||||
player_skills: any = [
|
||||
];
|
||||
@@ -46,7 +45,11 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
];
|
||||
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 = [];
|
||||
monsters:any = [];
|
||||
skills:any = []
|
||||
@@ -96,10 +99,10 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
},
|
||||
fight_heros:[9001,],
|
||||
items:{
|
||||
1001:0,
|
||||
1001:1000,
|
||||
1002:0,
|
||||
1003:0,
|
||||
1004:0,
|
||||
1004:1000,
|
||||
1005:0,
|
||||
1006:0,
|
||||
1007:0,
|
||||
@@ -112,11 +115,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
1027: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:{
|
||||
1001:{uuid:1001,lv:0,},
|
||||
},
|
||||
|
||||
@@ -1,25 +1,2 @@
|
||||
/*
|
||||
* @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:{ }},
|
||||
}
|
||||
export const SlvSet =[0,20,40,80,160]
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ export class Hero extends ecs.Entity {
|
||||
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 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){
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
// console.log("hero_init",buff)
|
||||
let HInf= smc.heros[uuid] // 角色数据
|
||||
let HInf= HeroInfo[uuid] // 角色数据
|
||||
let talent= smc.vmdata.talent
|
||||
let hero =smc.vmdata.heros[uuid]
|
||||
let hero =smc.heros[uuid]
|
||||
let talents=Talents;
|
||||
hv.scale = scale;
|
||||
hv.box_group = box_group;
|
||||
@@ -112,7 +112,7 @@ export class Hero extends ecs.Entity {
|
||||
}
|
||||
set_ratio(uuid:number){
|
||||
let ratio=1;
|
||||
switch (smc.heros[uuid].level) {
|
||||
switch (HeroInfo[uuid].level) {
|
||||
case 2:
|
||||
ratio=1.05
|
||||
break;
|
||||
|
||||
@@ -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 { HeroCardComp } from "./HeroCardComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
|
||||
/** HeroCard 模块 */
|
||||
@ecs.register(`HeroCard`)
|
||||
@@ -18,17 +19,17 @@ export class HeroCard extends ecs.Entity {
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
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) => {
|
||||
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();
|
||||
if(smc.vmdata.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.vmdata.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.vmdata.heros[uuid].slv>=5) node.getChildByName("slv").getChildByName("s5").active=true;
|
||||
node.getChildByName("lv").getComponent(Label).string = smc.heros[uuid].lv.toString();
|
||||
if(smc.heros[uuid].slv>=1) node.getChildByName("slv").getChildByName("s1").active=true;
|
||||
if(smc.heros[uuid].slv>=2) node.getChildByName("slv").getChildByName("s2").active=true;
|
||||
if(smc.heros[uuid].slv>=3) node.getChildByName("slv").getChildByName("s3").active=true;
|
||||
if(smc.heros[uuid].slv>=4) node.getChildByName("slv").getChildByName("s4").active=true;
|
||||
if(smc.heros[uuid].slv>=5) node.getChildByName("slv").getChildByName("s5").active=true;
|
||||
let hcc = node.getComponent(HeroCardComp)!;
|
||||
hcc.hcc_uuid = uuid;
|
||||
this.add(hcc);
|
||||
|
||||
@@ -86,8 +86,6 @@ export class Initialize extends ecs.Entity {
|
||||
/** 加载完成进入游戏内容加载界面 */
|
||||
private onComplete(queue: AsyncQueue) {
|
||||
queue.complete = () => {
|
||||
smc.heros = HeroInfo;
|
||||
smc.monsters=MonSet;
|
||||
// console.log("加载完成!",smc.heros);
|
||||
smc.skills=SkillSet;
|
||||
smc.sitems=Sitems;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user