场上卡牌优化
This commit is contained in:
@@ -23,7 +23,7 @@ export enum BoxSet {
|
||||
//地图边界
|
||||
LETF_END = -420,
|
||||
RIGHT_END = 420,
|
||||
HERO_START = -260,
|
||||
HERO_START = -280,
|
||||
MONSTER_START = 400,
|
||||
END_POINT = 360,
|
||||
//游戏地平线
|
||||
|
||||
@@ -70,7 +70,7 @@ export class MapMonsterComp extends CCComp {
|
||||
}
|
||||
load_role(){
|
||||
let role = ecs.getEntity<Role>(Role);
|
||||
let pos = v3(BoxSet.HERO_START-50,BoxSet.GAME_LINE)
|
||||
let pos = v3(BoxSet.HERO_START,BoxSet.GAME_LINE)
|
||||
role.load(pos,108)
|
||||
smc.Role=role
|
||||
console.log("加载玩家",role)
|
||||
@@ -110,12 +110,12 @@ export class MapMonsterComp extends CCComp {
|
||||
let monster_layer = scene.entityLayer!.node!
|
||||
switch (x) {
|
||||
case 1:
|
||||
// monster_layer = scene.entityLayer1!.node!;
|
||||
pos.y=pos.y+95;
|
||||
monster_layer = scene.entityLayer1!.node!;
|
||||
pos.y=pos.y+100;
|
||||
break;
|
||||
case 2:
|
||||
// monster_layer= scene.entityLayer2!.node!;
|
||||
pos.y=pos.y-95;
|
||||
monster_layer= scene.entityLayer2!.node!;
|
||||
pos.y=pos.y-100;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ export class Hero extends ecs.Entity {
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
node.parent=layer
|
||||
let ratio=this.set_ratio(uuid);
|
||||
node.setScale(ratio*node.scale.x, ratio*node.scale.y, node.scale.z);
|
||||
// let ratio=this.set_ratio(uuid);
|
||||
// node.setScale(ratio*node.scale.x, ratio*node.scale.y, node.scale.z);
|
||||
|
||||
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*scale, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
|
||||
node.setPosition(pos)
|
||||
@@ -59,26 +59,26 @@ export class Hero extends ecs.Entity {
|
||||
this.hero_init(uuid,node)
|
||||
oops.message.dispatchEvent("hero_load",this)
|
||||
}
|
||||
set_ratio(uuid:number){
|
||||
let ratio=1;
|
||||
switch (smc.heros[uuid].level) {
|
||||
case 2:
|
||||
ratio=1.1
|
||||
break;
|
||||
case 3:
|
||||
ratio=1.2
|
||||
break;
|
||||
case 4:
|
||||
ratio=1.3
|
||||
break;
|
||||
case 5:
|
||||
ratio=1.4
|
||||
break;
|
||||
default:
|
||||
ratio=1
|
||||
}
|
||||
return ratio;
|
||||
}
|
||||
// set_ratio(uuid:number){
|
||||
// let ratio=1;
|
||||
// switch (smc.heros[uuid].level) {
|
||||
// case 2:
|
||||
// ratio=1.1
|
||||
// break;
|
||||
// case 3:
|
||||
// ratio=1.2
|
||||
// break;
|
||||
// case 4:
|
||||
// ratio=1.3
|
||||
// break;
|
||||
// case 5:
|
||||
// ratio=1.4
|
||||
// break;
|
||||
// default:
|
||||
// ratio=1
|
||||
// }
|
||||
// return ratio;
|
||||
// }
|
||||
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
|
||||
var mv = node.getComponent(MonsterViewComp)!;
|
||||
var buff =node.getComponent(MonsterBuffComp)!;
|
||||
|
||||
@@ -46,8 +46,8 @@ export class Monster extends ecs.Entity {
|
||||
var node = instantiate(prefab);
|
||||
node.parent=layer
|
||||
// var as = node.getComponent(MonsterSpine);
|
||||
let ratio=this.set_ratio(uuid);
|
||||
node.setScale(ratio*node.scale.x*scale, ratio*node.scale.y, node.scale.z);
|
||||
// let ratio=this.set_ratio(uuid);
|
||||
node.setScale(node.scale.x*scale, node.scale.y, node.scale.z);
|
||||
|
||||
// node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*scale, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
|
||||
node.setPosition(pos)
|
||||
@@ -60,26 +60,26 @@ export class Monster extends ecs.Entity {
|
||||
this.hero_init(uuid,node)
|
||||
oops.message.dispatchEvent("monster_load",this)
|
||||
}
|
||||
set_ratio(uuid:number){
|
||||
let ratio=1;
|
||||
switch (smc.heros[uuid].level) {
|
||||
case 2:
|
||||
ratio=1.1
|
||||
break;
|
||||
case 3:
|
||||
ratio=1.2
|
||||
break;
|
||||
case 4:
|
||||
ratio=1.3
|
||||
break;
|
||||
case 5:
|
||||
ratio=1.4
|
||||
break;
|
||||
default:
|
||||
ratio=1
|
||||
}
|
||||
return ratio;
|
||||
}
|
||||
// set_ratio(uuid:number){
|
||||
// let ratio=1;
|
||||
// switch (smc.heros[uuid].level) {
|
||||
// case 2:
|
||||
// ratio=1.1
|
||||
// break;
|
||||
// case 3:
|
||||
// ratio=1.2
|
||||
// break;
|
||||
// case 4:
|
||||
// ratio=1.3
|
||||
// break;
|
||||
// case 5:
|
||||
// ratio=1.4
|
||||
// break;
|
||||
// default:
|
||||
// ratio=1
|
||||
// }
|
||||
// return ratio;
|
||||
// }
|
||||
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
|
||||
var mv = node.getComponent(MonsterViewComp)!;
|
||||
var buff =node.getComponent(MonsterBuffComp)!;
|
||||
|
||||
@@ -91,7 +91,9 @@ export class MonsterViewComp extends CCComp {
|
||||
this.sprite = this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
this.node.getChildByName("top").setScale(this.scale,1);
|
||||
this.node.getChildByName("atk").setScale(this.scale,1);
|
||||
this.node.getChildByName("atk").getComponent(Label).string = this.atk.toString();
|
||||
this.node.getChildByName("hp_max").setScale(this.scale,1);
|
||||
this.node.getChildByName("hp_max").getComponent(Label).string=this.hp_max.toString();
|
||||
|
||||
|
||||
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
|
||||
|
||||
Reference in New Issue
Block a user