清理smc
This commit is contained in:
@@ -27,74 +27,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
mskill:6001,
|
mskill:6001,
|
||||||
mmskill:6002,
|
mmskill:6002,
|
||||||
};
|
};
|
||||||
skills: any = {
|
|
||||||
6001:{uuid:6001,slv:0,num:4,x1:0},
|
|
||||||
6002:{uuid:6002,slv:0,num:3,x1:0},
|
|
||||||
6003:{uuid:6003,slv:0,num:0,x1:0},
|
|
||||||
6004:{uuid:6004,slv:0,num:0,x1:0},
|
|
||||||
6005:{uuid:6005,slv:0,num:0,x1:0},
|
|
||||||
6006:{uuid:6006,slv:0,num:0,x1:0},
|
|
||||||
6007:{uuid:6007,slv:0,num:0,x1:0},
|
|
||||||
6008:{uuid:6008,slv:0,num:0,x1:0},
|
|
||||||
6012:{uuid:6012,slv:0,num:0,x1:0},
|
|
||||||
};
|
|
||||||
/** 游戏主角 */
|
|
||||||
heros:any={
|
|
||||||
5001:{uuid:5001,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5002:{uuid:5002,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5003:{uuid:5003,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5004:{uuid:5004,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5005:{uuid:5005,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5006:{uuid:5006,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5007:{uuid:5007,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5008:{uuid:5008,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5009:{uuid:5009,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5010:{uuid:5010,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5011:{uuid:5011,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5012:{uuid:5012,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5013:{uuid:5013,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5014:{uuid:5014,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5015:{uuid:5015,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5016:{uuid:5016,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5017:{uuid:5017,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5018:{uuid:5018,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5019:{uuid:5019,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5020:{uuid:5020,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5021:{uuid:5021,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5022:{uuid:5022,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5023:{uuid:5023,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5024:{uuid:5024,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5025:{uuid:5025,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5026:{uuid:5026,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
5027:{uuid:5027,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
// 5028:{uuid:5028,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
// 5029:{uuid:5029,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
// 5030:{uuid:5030,lv:1,exp:0,slv:1,num:0,x1:0},
|
|
||||||
};
|
|
||||||
goods:any=[
|
|
||||||
{uuid:9001,num:100000,type:0,cost:0,inventory:5},
|
|
||||||
{uuid:1003,num:10,type:2,cost:10000,inventory:99},
|
|
||||||
];
|
|
||||||
items:any={
|
|
||||||
1001:{uuid:1001,num:0,x1:0},
|
|
||||||
1002:{uuid:1002,num:0,x1:0},
|
|
||||||
1003:{uuid:1003,num:0,x1:0},
|
|
||||||
1004:{uuid:1004,num:0,x1:0},
|
|
||||||
1005:{uuid:1005,num:0,x1:0},
|
|
||||||
1006:{uuid:1006,num:0,x1:0},
|
|
||||||
1007:{uuid:1007,num:0,x1:0},
|
|
||||||
1008:{uuid:1008,num:0,x1:0},
|
|
||||||
1009:{uuid:1009,num:0,x1:0},
|
|
||||||
1010:{uuid:1010,num:0,x1:0},
|
|
||||||
1011:{uuid:1011,num:0,x1:0},
|
|
||||||
1012:{uuid:1012,num:0,x1:0},
|
|
||||||
1013:{uuid:1013,num:0,x1:0},
|
|
||||||
1014:{uuid:1014,num:0,x1:0},
|
|
||||||
1015:{uuid:1015,num:0,x1:0},
|
|
||||||
1016:{uuid:1016,num:0,x1:0},
|
|
||||||
9001:{uuid:9001,num:0,x1:0},
|
|
||||||
9003:{uuid:9003,num:0,x1:0},
|
|
||||||
};
|
|
||||||
fight_heros=[]
|
fight_heros=[]
|
||||||
mheros:any = [];
|
mheros:any = [];
|
||||||
monsters:any = [];
|
monsters:any = [];
|
||||||
@@ -111,9 +43,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
name : "纸片精灵大乱斗",
|
name : "纸片精灵大乱斗",
|
||||||
game_over:false,
|
game_over:false,
|
||||||
game_pause:false,
|
game_pause:false,
|
||||||
buff_num:[2,2,2,2,2],
|
|
||||||
buff_num_max:10,
|
|
||||||
buff_num_less:0,
|
|
||||||
mission:{
|
mission:{
|
||||||
once:6, //每波刷新怪物数量
|
once:6, //每波刷新怪物数量
|
||||||
total:1, //总怪物数
|
total:1, //总怪物数
|
||||||
@@ -122,32 +51,12 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
mexp:0,
|
mexp:0,
|
||||||
mexp_max:100,
|
mexp_max:100,
|
||||||
drop:0,
|
drop:0,
|
||||||
buff_num:0,
|
|
||||||
hp:0,
|
hp:0,
|
||||||
ap:0,
|
ap:0,
|
||||||
def:0,
|
def:0,
|
||||||
crit:0,
|
crit:0,
|
||||||
dodge:0,
|
dodge:0,
|
||||||
dead:0,
|
dead:0,
|
||||||
|
|
||||||
mhp:0,
|
|
||||||
map:0,
|
|
||||||
mdef:0,
|
|
||||||
mcrit:0,
|
|
||||||
mdodge:0,
|
|
||||||
mdead:0,
|
|
||||||
|
|
||||||
hp_up:0,
|
|
||||||
ap_up:0,
|
|
||||||
def_up:0,
|
|
||||||
crit_up:0,
|
|
||||||
dodge_up:0,
|
|
||||||
mhp_up:0,
|
|
||||||
map_up:0,
|
|
||||||
mdef_up:0,
|
|
||||||
mcrit_up:0,
|
|
||||||
mdodge_up:0,
|
|
||||||
|
|
||||||
reward_num:0, //怪物死亡数
|
reward_num:0, //怪物死亡数
|
||||||
reward_gold:0,
|
reward_gold:0,
|
||||||
reward_exp:0,
|
reward_exp:0,
|
||||||
@@ -157,10 +66,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
skp:{num:2000,x1:0}, //技能升级点数
|
skp:{num:2000,x1:0}, //技能升级点数
|
||||||
energy:{num:10,x1:0},
|
energy:{num:10,x1:0},
|
||||||
box:{num:10,x1:0},
|
box:{num:10,x1:0},
|
||||||
free:{ cost:0,num:3,buy:3,},
|
|
||||||
goods1:{ cost:20000,num:3,buy:3,},
|
|
||||||
herochips:{ cost:30000,num:4,buy:3,},
|
|
||||||
skillchips:{ cost:500000,num:5,buy:3,},
|
|
||||||
|
|
||||||
};
|
};
|
||||||
vmAdd() {
|
vmAdd() {
|
||||||
|
|||||||
@@ -188,18 +188,6 @@ export class HeroViewComp extends CCComp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exp_add(exp:number=0){
|
|
||||||
if(this.box_group==BoxSet.HERO){
|
|
||||||
smc.vmdata.mission.exp +=exp
|
|
||||||
}
|
|
||||||
if(this.box_group==BoxSet.MONSTER){
|
|
||||||
smc.vmdata.mission.mexp +=exp
|
|
||||||
}
|
|
||||||
}
|
|
||||||
power_add(p:number){
|
|
||||||
this.pw+= p
|
|
||||||
}
|
|
||||||
add_shield(shield:number){
|
add_shield(shield:number){
|
||||||
this.shield =shield
|
this.shield =shield
|
||||||
if(this.shield>0) this.BUFFCOMP.show_shield(true)
|
if(this.shield>0) this.BUFFCOMP.show_shield(true)
|
||||||
@@ -289,8 +277,6 @@ export class HeroViewComp extends CCComp {
|
|||||||
|
|
||||||
dead(){
|
dead(){
|
||||||
this.BUFFCOMP.dead()
|
this.BUFFCOMP.dead()
|
||||||
this.exp_add(this.dexp)
|
|
||||||
this.power_add(this.dpw)
|
|
||||||
this.to_drop()
|
this.to_drop()
|
||||||
}
|
}
|
||||||
//掉落物品
|
//掉落物品
|
||||||
@@ -376,9 +362,6 @@ export class HeroViewComp extends CCComp {
|
|||||||
private showDamageImmediate(damage: number, isCrit: boolean) {
|
private showDamageImmediate(damage: number, isCrit: boolean) {
|
||||||
this.BUFFCOMP.in_atked();
|
this.BUFFCOMP.in_atked();
|
||||||
this.atked_count++;
|
this.atked_count++;
|
||||||
this.exp_add(this.uaexp);
|
|
||||||
this.power_add(this.uapw);
|
|
||||||
|
|
||||||
if (isCrit) {
|
if (isCrit) {
|
||||||
this.BUFFCOMP.tooltip(4, damage.toFixed(0), damage);
|
this.BUFFCOMP.tooltip(4, damage.toFixed(0), damage);
|
||||||
console.log("暴击伤害:" + damage);
|
console.log("暴击伤害:" + damage);
|
||||||
|
|||||||
@@ -24,63 +24,15 @@ export class GoodsComp extends CCComp {
|
|||||||
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||||
}
|
}
|
||||||
update_data(){
|
update_data(){
|
||||||
let goods:any=smc.goods[this.smc_index]
|
|
||||||
let gnode=this.node.getChildByName("item")
|
|
||||||
switch (goods.type) {
|
|
||||||
default:
|
|
||||||
let item=ecs.getEntity<Item>(Item)
|
|
||||||
item.load(goods.uuid,goods.num,gnode)
|
|
||||||
this.node.getChildByName("inventory").getComponent(Label).string="库存:"+goods.inventory.toString()
|
|
||||||
console.log("item",item)
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
let path = "game/gui/hchip";
|
|
||||||
let prefab: Prefab = oops.res.get(path, Prefab)!;
|
|
||||||
let node = instantiate(prefab);
|
|
||||||
node.parent=gnode
|
|
||||||
let hc= node.getComponent(HChipComp)
|
|
||||||
hc.update_data(goods.uuid,goods.num)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if(goods.cost > 0){
|
|
||||||
this.node.getChildByName("free").active=false
|
|
||||||
this.node.getChildByName("buy").getChildByName("cost").getComponent(Label).string=goods.cost.toString()
|
|
||||||
}else{
|
|
||||||
this.node.getChildByName("free").active=true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
buy(){
|
buy(){
|
||||||
console.log("购买商品"+this.smc_index)
|
console.log("购买商品"+this.smc_index)
|
||||||
let goods:any=smc.goods[this.smc_index]
|
|
||||||
if(smc.vmdata.gold.num <= goods.cost){
|
|
||||||
oops.gui.toast("金币不足");
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if(goods.inventory <= 0){
|
|
||||||
oops.gui.toast("库存不足");
|
|
||||||
return
|
|
||||||
}
|
|
||||||
switch (goods.type) {
|
|
||||||
case 0:
|
|
||||||
smc.vmdata.gold.num+=goods.num
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
smc.vmdata.exp.num+=goods.num
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
smc.items[goods.uuid].num+=goods.num
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
smc.heros[goods.uuid].num += goods.num
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
goods.inventory--
|
|
||||||
smc.vmdata.gold.num-=goods.cost
|
|
||||||
this.update_inventory()
|
this.update_inventory()
|
||||||
}
|
}
|
||||||
|
|
||||||
update_inventory(){
|
update_inventory(){
|
||||||
this.node.getChildByName("inventory").getComponent(Label).string="库存:"+smc.goods[this.smc_index].inventory
|
|
||||||
}
|
}
|
||||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||||
reset() {
|
reset() {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export class HeroHomeComp extends CCComp {
|
|||||||
// var icon_path = "game/heros/herois"
|
// var icon_path = "game/heros/herois"
|
||||||
|
|
||||||
|
|
||||||
this.slv = Math.floor((smc.heros[uuid].lv) / 5);
|
|
||||||
let content=this.node.getChildByName("show").getChildByName("content")
|
let content=this.node.getChildByName("show").getChildByName("content")
|
||||||
content.getChildByName("name").getChildByName("value").getComponent(Label).string=this.hero.name
|
content.getChildByName("name").getChildByName("value").getComponent(Label).string=this.hero.name
|
||||||
content.getChildByName("name").getChildByName("g1").active=HeroInfo[uuid].quality==1
|
content.getChildByName("name").getChildByName("g1").active=HeroInfo[uuid].quality==1
|
||||||
@@ -85,79 +85,19 @@ export class HeroHomeComp extends CCComp {
|
|||||||
}
|
}
|
||||||
update_data(){
|
update_data(){
|
||||||
let content=this.node.getChildByName("show").getChildByName("content")
|
let content=this.node.getChildByName("show").getChildByName("content")
|
||||||
this.slv = Math.floor((smc.heros[this.h_uuid].lv) / 5);
|
|
||||||
this.gold_need=(getUpGoldByRange(smc.heros[this.h_uuid].lv)*smc.heros[this.h_uuid].lv)
|
|
||||||
this.chip_need=getUpChipByLv(smc.heros[this.h_uuid].lv)-this.hero.lvexp
|
|
||||||
// let slv_node=content.getChildByName("name").getChildByName("slv");
|
// let slv_node=content.getChildByName("name").getChildByName("slv");
|
||||||
let lvup=content.getChildByName("lvup");
|
|
||||||
// let slvup=content.getChildByName("slvup");
|
// let slvup=content.getChildByName("slvup");
|
||||||
let attr = content.getChildByName("attr");
|
let attr = content.getChildByName("attr");
|
||||||
content.getChildByName("name").getChildByName("lv").getComponent(Label).string = smc.heros[this.h_uuid].lv.toString()+"级";
|
|
||||||
// slv_node.getChildByName("slv").getComponent(Label).string = smc.heros[uuid].slv.toString();
|
// slv_node.getChildByName("slv").getComponent(Label).string = smc.heros[uuid].slv.toString();
|
||||||
|
|
||||||
// content.getChildByName("name").getChildByName("quality").getChildByName("q1").active = this.hero.quality == 1;
|
// content.getChildByName("name").getChildByName("quality").getChildByName("q1").active = this.hero.quality == 1;
|
||||||
// content.getChildByName("name").getChildByName("quality").getChildByName("q2").active = this.hero.quality == 2;
|
// content.getChildByName("name").getChildByName("quality").getChildByName("q2").active = this.hero.quality == 2;
|
||||||
// content.getChildByName("name").getChildByName("quality").getChildByName("q3").active = this.hero.quality == 3;
|
// content.getChildByName("name").getChildByName("quality").getChildByName("q3").active = this.hero.quality == 3;
|
||||||
|
|
||||||
// content.getChildByName("name").getChildByName("quality").getChildByName("k1").active = this.hero.kind == 1;
|
// content.getChildByName("name").getChildByName("quality").getChildByName("k1").active = this.hero.kind == 1;
|
||||||
// content.getChildByName("name").getChildByName("quality").getChildByName("k2").active = this.hero.kind == 2;
|
// content.getChildByName("name").getChildByName("quality").getChildByName("k2").active = this.hero.kind == 2;
|
||||||
// content.getChildByName("name").getChildByName("quality").getChildByName("k3").active = this.hero.kind == 3;
|
// content.getChildByName("name").getChildByName("quality").getChildByName("k3").active = this.hero.kind == 3;
|
||||||
|
|
||||||
|
|
||||||
let lvnum=smc.heros[this.h_uuid].num
|
|
||||||
// lvup.getChildByName("gold").getChildByName("need").getComponent(Label).string = (UpGold.LvUp*smc.heros[uuid].lv).toString()
|
// lvup.getChildByName("gold").getChildByName("need").getComponent(Label).string = (UpGold.LvUp*smc.heros[uuid].lv).toString()
|
||||||
lvup.getChildByName("item").getChildByName("chip").getChildByName("need").getComponent(Label).string = this.chip_need.toString()
|
attr.getChildByName("ap").getChildByName("val").getComponent(Label).string = this.hero.ap.toFixed(0).toString()
|
||||||
lvup.getChildByName("item").getChildByName("btn").getChildByName("gold").getChildByName("need").getComponent(Label).string = this.gold_need.toString()
|
attr.getChildByName("hp").getChildByName("val").getComponent(Label).string = this.hero.hp.toFixed(0).toString()
|
||||||
lvup.getChildByName("item").getChildByName("chip").getChildByName("num").getComponent(Label).string = lvnum.toString()
|
|
||||||
if( lvnum >=this.chip_need) {
|
|
||||||
lvup.getChildByName("item").getChildByName("chip").getChildByName("num").getComponent(Label).color = color(0,255,0);
|
|
||||||
}else{
|
|
||||||
lvup.getChildByName("item").getChildByName("chip").getChildByName("num").getComponent(Label).color = color(255,0,0);
|
|
||||||
}
|
|
||||||
lvup.getChildByName("up").active=lvnum >= this.chip_need
|
|
||||||
lvup.getChildByName("item").getChildByName("chip").getChildByName("bar").getComponent(ProgressBar).progress = lvnum/this.chip_need
|
|
||||||
// lvup.getChildByName("info").getChildByName("ap").getComponent(Label).string = "+"+this.hero.ap_up
|
|
||||||
// lvup.getChildByName("info").getChildByName("def").getComponent(Label).string = "+"+this.hero.def_up
|
|
||||||
// lvup.getChildByName("info").getChildByName("hp").getComponent(Label).string = "+"+this.hero.hp_up
|
|
||||||
|
|
||||||
// lvup.getChildByName("info2").getChildByName("ap").getComponent(Label).string = "+"+this.hero.sap_up+"%"
|
|
||||||
// lvup.getChildByName("info2").getChildByName("def").getComponent(Label).string = "+"+this.hero.sdef_up+"%"
|
|
||||||
// lvup.getChildByName("info2").getChildByName("hp").getComponent(Label).string = "+"+this.hero.shp_up+"%"
|
|
||||||
|
|
||||||
// lvup.getChildByName("item").getChildByName("btn").getChildByName("bar").getComponent(ProgressBar).progress = smc.vmdata.exp.num/((LvUp[0]+this.hero.lvexp)*smc.heros[uuid].lv)
|
|
||||||
// slvup.getChildByName("gold").getChildByName("btn").getChildByName("need").getComponent(Label).string = (UpGold.SlvUp*(smc.heros[uuid].slv+1)).toString()
|
|
||||||
// let sthis.chip_need=HeroInfo[this.h_uuid].slvexp
|
|
||||||
// let slvnum=smc.heros[this.h_uuid].num
|
|
||||||
// slvup.getChildByName("up").active=slvnum>=sthis.chip_need
|
|
||||||
// if( slvnum>=sthis.chip_need) {
|
|
||||||
// slvup.getChildByName("cost").getChildByName("btn").getChildByName("num").getComponent(Label).color = color(0,255,0);
|
|
||||||
// }else{
|
|
||||||
// slvup.getChildByName("cost").getChildByName("btn").getChildByName("num").getComponent(Label).color = color(255,0,0);
|
|
||||||
// }
|
|
||||||
// slvup.getChildByName("cost").getChildByName("btn").getChildByName("need").getComponent(Label).string = sthis.chip_need.toString()
|
|
||||||
// slvup.getChildByName("cost").getChildByName("btn").getChildByName("num").getComponent(Label).string = slvnum.toString()
|
|
||||||
// slvup.getChildByName("cost").getChildByName("btn").getChildByName("bar").getComponent(ProgressBar).progress = slvnum/sthis.chip_need
|
|
||||||
// let hchipcomp= slvup.getChildByName("cost").getChildByName("btn").getChildByName("hchip").getComponent(HChipComp)
|
|
||||||
// hchipcomp.update_data(this.h_uuid,0)
|
|
||||||
|
|
||||||
// if( smc.heros[uuid].slv==5) {
|
|
||||||
// slvup.getChildByName("btned").active=true
|
|
||||||
// }else{
|
|
||||||
// slvup.getChildByName("btned").active=false
|
|
||||||
// };
|
|
||||||
// if( smc.heros[uuid].slv==0) {
|
|
||||||
// content.getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("need").getComponent(Label).string = ((SlvUp[smc.heros[uuid].slv]-HeroInfo[this.h_uuid].slvexp)*(1+smc.heros[uuid].slv)).toString()
|
|
||||||
// content.getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("num").getComponent(Label).string = smc.heros[this.h_uuid].num.toString()
|
|
||||||
// content.getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("bar").getComponent(ProgressBar).progress = smc.heros[this.h_uuid].num/((SlvUp[smc.heros[uuid].slv]-HeroInfo[this.h_uuid].slvexp)*(1+smc.heros[uuid].slv))
|
|
||||||
// let hchipcomp= content.getChildByName("call").getChildByName("Node").getChildByName("cost").getChildByName("hchip").getComponent(HChipComp)
|
|
||||||
// hchipcomp.update_data(this.h_uuid,0)
|
|
||||||
// content.getChildByName("call").active=true
|
|
||||||
// }else{
|
|
||||||
// content.getChildByName("call").active=false
|
|
||||||
// };
|
|
||||||
attr.getChildByName("ap").getChildByName("val").getComponent(Label).string = ((this.hero.ap+this.hero.ap_up* smc.heros[this.h_uuid].lv)*(1+this.hero.sap_up/100*this.slv)).toFixed(0).toString()
|
|
||||||
attr.getChildByName("hp").getChildByName("val").getComponent(Label).string = ((this.hero.hp+this.hero.hp_up* smc.heros[this.h_uuid].lv)*(1+this.hero.shp_up/100*this.slv)).toFixed(0).toString()
|
|
||||||
attr.getChildByName("def").getChildByName("val").getComponent(Label).string = ((this.hero.ap+this.hero.def_up* smc.heros[this.h_uuid].lv)*(1+this.hero.sdef_up/100*this.slv)).toFixed(0).toString()
|
|
||||||
attr.getChildByName("acd").getChildByName("val").getComponent(Label).string = this.hero.a_cd
|
attr.getChildByName("acd").getChildByName("val").getComponent(Label).string = this.hero.a_cd
|
||||||
attr.getChildByName("speed").getChildByName("val").getComponent(Label).string = this.hero.speed
|
attr.getChildByName("speed").getChildByName("val").getComponent(Label).string = this.hero.speed
|
||||||
attr.getChildByName("dis").getChildByName("val").getComponent(Label).string = this.hero.dis
|
attr.getChildByName("dis").getChildByName("val").getComponent(Label).string = this.hero.dis
|
||||||
@@ -198,33 +138,8 @@ export class HeroHomeComp extends CCComp {
|
|||||||
this.h_uuid=HeroList[hi+1]
|
this.h_uuid=HeroList[hi+1]
|
||||||
this.hero_show(this.h_uuid)
|
this.hero_show(this.h_uuid)
|
||||||
}
|
}
|
||||||
// lv_up(){
|
|
||||||
// if(smc.vmdata.exp.num < ((this.hero.lvexp)*smc.heros[uuid].lv)){
|
|
||||||
// oops.gui.toast("资源不足,升级失败");
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// smc.vmdata.exp.num -= ((this.hero.lvexp)*smc.heros[uuid].lv)
|
|
||||||
// smc.heros[uuid].lv++
|
|
||||||
// this.update_data()
|
|
||||||
// }
|
|
||||||
lv_up(){
|
|
||||||
// if(smc.heros[uuid].slv>=5){
|
|
||||||
// oops.gui.toast("已经满星,升阶失败");
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
if(smc.heros[this.h_uuid].num < this.chip_need){
|
|
||||||
oops.gui.toast("碎片不足,升级失败");
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if(smc.vmdata.gold.num < this.gold_need){
|
|
||||||
oops.gui.toast("金币不足,升级失败");
|
|
||||||
return
|
|
||||||
}
|
|
||||||
smc.heros[this.h_uuid].num -= this.chip_need
|
|
||||||
smc.vmdata.gold.num -= (this.gold_need)
|
|
||||||
smc.heros[this.h_uuid].lv++
|
|
||||||
this.update_data()
|
|
||||||
}
|
|
||||||
item_show(e:any,val:any){
|
item_show(e:any,val:any){
|
||||||
oops.gui.open(UIID.ItemInfo, {uuid:val,type:0});
|
oops.gui.open(UIID.ItemInfo, {uuid:val,type:0});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,31 +85,7 @@ export class LuckHomeCompComp extends CCComp {
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
switch(reward){
|
switch(reward){
|
||||||
case 3:
|
|
||||||
this.show_hero_chip(uuid,num)
|
|
||||||
smc.heros[uuid].num += num
|
|
||||||
oops.message.dispatchEvent("hero_card_update_info")
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
this.show_hero_chip(uuid,num)
|
|
||||||
smc.heros[uuid].num += num
|
|
||||||
oops.message.dispatchEvent("hero_card_update_info")
|
|
||||||
// this.show_skill_chip(uuid,num)
|
|
||||||
// smc.skills[uuid].num += num
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
this.show_item(uuid,num)
|
|
||||||
if(uuid ==9001){
|
|
||||||
smc.vmdata.gold.num+=num
|
|
||||||
}
|
|
||||||
if(uuid ==9003){
|
|
||||||
smc.vmdata.exp.num+=num
|
|
||||||
}
|
|
||||||
if(uuid < 9000){
|
|
||||||
smc.items[uuid].num+=num
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
show_hero_chip(uuid:number,num:number){
|
show_hero_chip(uuid:number,num:number){
|
||||||
@@ -155,18 +131,7 @@ export class LuckHomeCompComp extends CCComp {
|
|||||||
to_open(){
|
to_open(){
|
||||||
if(this.selected==""){return;}
|
if(this.selected==""){return;}
|
||||||
switch(this.selected){
|
switch(this.selected){
|
||||||
case "sb":
|
|
||||||
if(smc.items[1001].num <=0){oops.gui.toast("宝箱数量不足"); this.btnno.active = true;return;}
|
|
||||||
this.open_sb();
|
|
||||||
break;
|
|
||||||
case "mb":
|
|
||||||
if(smc.items[1002].num <=0){oops.gui.toast("宝箱数量不足");this.btnno.active = true;return;}
|
|
||||||
this.open_mb();
|
|
||||||
break;
|
|
||||||
case "lb":
|
|
||||||
if(smc.items[1003].num <=0){oops.gui.toast("宝箱数量不足");this.btnno.active = true;return;}
|
|
||||||
this.open_lb();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,18 +45,11 @@ export class MSCardComp extends CCComp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
update_data(){
|
update_data(){
|
||||||
if(smc.skills[this.s_uuid].slv>=1) {this.node.getChildByName("slv").getChildByName("s1").active=true} else {this.node.getChildByName("slv").getChildByName("s1").active=false};
|
|
||||||
if(smc.skills[this.s_uuid].slv>=2) {this.node.getChildByName("slv").getChildByName("s2").active=true} else {this.node.getChildByName("slv").getChildByName("s2").active=false};
|
|
||||||
if(smc.skills[this.s_uuid].slv>=3) {this.node.getChildByName("slv").getChildByName("s3").active=true} else {this.node.getChildByName("slv").getChildByName("s3").active=false};
|
|
||||||
if(smc.skills[this.s_uuid].slv>=4) {this.node.getChildByName("slv").getChildByName("s4").active=true} else {this.node.getChildByName("slv").getChildByName("s4").active=false};
|
|
||||||
if(smc.skills[this.s_uuid].slv>=5) {this.node.getChildByName("slv").getChildByName("s5").active=true} else {this.node.getChildByName("slv").getChildByName("s5").active=false};
|
|
||||||
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].slv)).toString()
|
|
||||||
let sc= this.node.getChildByName("update").getChildByName("schip").getComponent(SChipComp)
|
|
||||||
sc.update_data(this.s_uuid,0)
|
|
||||||
}
|
}
|
||||||
select(){
|
select(){
|
||||||
smc.mission.mskill=this.s_uuid
|
smc.mission.mskill=this.s_uuid
|
||||||
this.mhc.select_skill()
|
|
||||||
oops.message.dispatchEvent(GameEvent.MSSelected,{uuid:this.s_uuid})
|
oops.message.dispatchEvent(GameEvent.MSSelected,{uuid:this.s_uuid})
|
||||||
}
|
}
|
||||||
update_select(){
|
update_select(){
|
||||||
@@ -68,12 +61,7 @@ export class MSCardComp extends CCComp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
update_lv(){
|
update_lv(){
|
||||||
if(smc.skills[this.s_uuid].num <= (SkillSet[this.s_uuid].upcost*(1+smc.skills[this.s_uuid].slv))){
|
|
||||||
oops.gui.toast("技能碎片不足")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
smc.skills[this.s_uuid].num -= (SkillSet[this.s_uuid].upcost*(1+smc.skills[this.s_uuid].slv))
|
|
||||||
smc.skills[this.s_uuid].slv++
|
|
||||||
let mscards:any= ecs.query(ecs.allOf(MSCardComp));
|
let mscards:any= ecs.query(ecs.allOf(MSCardComp));
|
||||||
for(let i=0;i<mscards.length;i++){
|
for(let i=0;i<mscards.length;i++){
|
||||||
mscards[i].MSCardComp.update_data()
|
mscards[i].MSCardComp.update_data()
|
||||||
|
|||||||
@@ -26,11 +26,9 @@ export class MSkillComp extends CCComp {
|
|||||||
if(SkillSet[this.s_uuid]==undefined){this.skill_on=false; return}
|
if(SkillSet[this.s_uuid]==undefined){this.skill_on=false; return}
|
||||||
this.cd=SkillSet[this.s_uuid].cd;
|
this.cd=SkillSet[this.s_uuid].cd;
|
||||||
this.s_uuid=smc.mission.mskill
|
this.s_uuid=smc.mission.mskill
|
||||||
smc.vmdata.mission.exp_max=SkillSet[this.s_uuid].exp
|
|
||||||
|
|
||||||
if(this.group == BoxSet.MONSTER){
|
if(this.group == BoxSet.MONSTER){
|
||||||
this.s_uuid=smc.mission.mmskill
|
this.s_uuid=smc.mission.mmskill
|
||||||
smc.vmdata.mission.mexp_max=SkillSet[this.s_uuid].exp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var icon_path = "game/skills/skill_icon"
|
var icon_path = "game/skills/skill_icon"
|
||||||
@@ -43,7 +41,6 @@ export class MSkillComp extends CCComp {
|
|||||||
}
|
}
|
||||||
protected update(dt: number): void {
|
protected update(dt: number): void {
|
||||||
if(!this.skill_on) return
|
if(!this.skill_on) return
|
||||||
this.check_exp()
|
|
||||||
this.doing_cd(dt)
|
this.doing_cd(dt)
|
||||||
}
|
}
|
||||||
doing_cd(dt: number){
|
doing_cd(dt: number){
|
||||||
@@ -55,23 +52,6 @@ export class MSkillComp extends CCComp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
check_exp(){
|
|
||||||
switch(this.group){
|
|
||||||
case BoxSet.HERO:
|
|
||||||
if(smc.vmdata.mission.exp >= SkillSet[this.s_uuid].exp){
|
|
||||||
console.log("hero MSkillComp check_exp s_uuid:",this.s_uuid,this.group);
|
|
||||||
smc.vmdata.mission.exp-=SkillSet[this.s_uuid].exp
|
|
||||||
this.lvup()
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case BoxSet.MONSTER:
|
|
||||||
if(smc.vmdata.mission.mexp >= SkillSet[this.s_uuid].exp){
|
|
||||||
console.log("monster MSkillComp check_exp s_uuid:",this.s_uuid,this.group);
|
|
||||||
smc.vmdata.mission.mexp-=SkillSet[this.s_uuid].exp
|
|
||||||
this.lvup()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lvup(){
|
lvup(){
|
||||||
this.lv++
|
this.lv++
|
||||||
this.node.getChildByName("lv").getComponent(Label).string=this.lv.toString()
|
this.node.getChildByName("lv").getComponent(Label).string=this.lv.toString()
|
||||||
|
|||||||
@@ -108,9 +108,7 @@ export class MissionComp extends CCComp {
|
|||||||
this.fight_start=false
|
this.fight_start=false
|
||||||
smc.mission.is_victory=false
|
smc.mission.is_victory=false
|
||||||
smc.mission.is_defeat=false
|
smc.mission.is_defeat=false
|
||||||
smc.vmdata.mission.exp=0 //局内经验
|
|
||||||
smc.vmdata.mission.mexp=0 //敌方局内经验
|
|
||||||
smc.vmdata.mission.exp_max= smc.vmdata.mission.mexp_max=MBSet.exp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mskill_init(){
|
mskill_init(){
|
||||||
|
|||||||
@@ -23,12 +23,7 @@ export class ShopHomeComp extends CCComp {
|
|||||||
}
|
}
|
||||||
get_items(){
|
get_items(){
|
||||||
let goodsnode = this.node.getChildByName("goods").getChildByName("view").getChildByName("content")
|
let goodsnode = this.node.getChildByName("goods").getChildByName("view").getChildByName("content")
|
||||||
goodsnode.getComponent(UITransform).height=Math.floor(smc.goods.length/4*240)+50
|
|
||||||
console.log("smc.goods",smc.goods)
|
|
||||||
for (let x = 0; x < smc.goods.length; x++) {
|
|
||||||
let goods=ecs.getEntity<Goods>(Goods)
|
|
||||||
goods.load(x,goodsnode)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||||
reset() {
|
reset() {
|
||||||
|
|||||||
@@ -109,8 +109,6 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
|||||||
return (comp.cooldowns.get(config.uuid as number) ?? 0) <= 0;
|
return (comp.cooldowns.get(config.uuid as number) ?? 0) <= 0;
|
||||||
case CdType.HeroCD:
|
case CdType.HeroCD:
|
||||||
return view.at >= view.cd;
|
return view.at >= view.cd;
|
||||||
case CdType.HeroPower:
|
|
||||||
return view.pw >= view.pwm;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,17 +124,12 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
|||||||
switch(config.CdType) {
|
switch(config.CdType) {
|
||||||
case CdType.SkillCD:
|
case CdType.SkillCD:
|
||||||
view.as.max()
|
view.as.max()
|
||||||
|
|
||||||
comp.cooldowns.set(skillId, config.cd); // 重置冷却时间
|
comp.cooldowns.set(skillId, config.cd); // 重置冷却时间
|
||||||
break;
|
break;
|
||||||
case CdType.HeroCD:
|
case CdType.HeroCD:
|
||||||
view.as.atk()
|
view.as.atk()
|
||||||
view.at = view.at-view.cd; // 重置普攻计时器
|
view.at = view.at-view.cd; // 重置普攻计时器
|
||||||
break;
|
break;
|
||||||
case CdType.HeroPower:
|
|
||||||
view.as.max()
|
|
||||||
view.pw = view.pw-view.pwm; // 重置能量计时器
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 选择目标
|
// 选择目标
|
||||||
@@ -185,12 +178,12 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
|||||||
switch(config.TargetType) {
|
switch(config.TargetType) {
|
||||||
case TargetType.Frontline:
|
case TargetType.Frontline:
|
||||||
return this.filterFrontRow(candidates, isEnemyTeam);
|
return this.filterFrontRow(candidates, isEnemyTeam);
|
||||||
case TargetType.Backline:
|
// case TargetType.Backline:
|
||||||
return this.filterBackRow(candidates, isEnemyTeam);
|
// return this.filterBackRow(candidates, isEnemyTeam);
|
||||||
case TargetType.LowestHP:
|
// case TargetType.LowestHP:
|
||||||
return this.filterLowestHealth(candidates);
|
// return this.filterLowestHealth(candidates);
|
||||||
case TargetType.HighestHP:
|
// case TargetType.HighestHP:
|
||||||
return this.filterHighestHealth(candidates);
|
// return this.filterHighestHealth(candidates);
|
||||||
case TargetType.Melee:
|
case TargetType.Melee:
|
||||||
return candidates.filter(e => e.get(HeroViewComp).type === 0);
|
return candidates.filter(e => e.get(HeroViewComp).type === 0);
|
||||||
case TargetType.Ranged:
|
case TargetType.Ranged:
|
||||||
@@ -346,7 +339,6 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
|||||||
view.hp -= remainingDamage;
|
view.hp -= remainingDamage;
|
||||||
if(view.hp <= 0) {
|
if(view.hp <= 0) {
|
||||||
view.BUFFCOMP.dead()
|
view.BUFFCOMP.dead()
|
||||||
view.exp_add(view.dexp)
|
|
||||||
view.to_grave();
|
view.to_grave();
|
||||||
}
|
}
|
||||||
view.showDamage(result.value, result.isCrit);
|
view.showDamage(result.value, result.isCrit);
|
||||||
|
|||||||
Reference in New Issue
Block a user