heros 卡片 细节完善 思考下步内容
This commit is contained in:
@@ -1406,13 +1406,13 @@
|
||||
"_restitution": 0,
|
||||
"_offset": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": -1.3,
|
||||
"y": 39.7
|
||||
"x": 8.4,
|
||||
"y": 46.3
|
||||
},
|
||||
"_size": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 38.2,
|
||||
"height": 59.6
|
||||
"width": 57.6,
|
||||
"height": 71
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19282,7 +19282,7 @@
|
||||
],
|
||||
"value": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 141,
|
||||
"x": 283,
|
||||
"y": -100,
|
||||
"z": 0
|
||||
}
|
||||
|
||||
@@ -170,11 +170,10 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
}
|
||||
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
|
||||
let self_x = selfCollider.node.position.x;
|
||||
let other_x = otherCollider.node.position.x;
|
||||
if(selfCollider.group == otherCollider.group&&selfCollider.tag==otherCollider.tag){
|
||||
if(otherCollider.node.name=="role") return
|
||||
let self_x = selfCollider.node.position.x;
|
||||
let other_x = otherCollider.node.position.x;
|
||||
if(otherCollider.node.getComponent(HeroViewComp).type == this.type && self_x < other_x && Math.abs(other_x-self_x) < 30 ){
|
||||
if(otherCollider.node.getComponent(HeroViewComp).type == this.type && self_x < other_x && Math.abs(other_x-self_x) < 15 ){
|
||||
this.stop_cd = 0.1;
|
||||
}
|
||||
// if(selfCollider.node.position.y < otherCollider.node.position.y){
|
||||
@@ -265,7 +264,7 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
if(dir < this.dis){
|
||||
this.is_atking=true
|
||||
this.stop_cd = 0.1
|
||||
if(this.dis-dir > 45 ) this.stop_cd = 0.1
|
||||
}else{
|
||||
this.is_atking=false
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { _decorator,Button,EventHandler,EventTouch,Label,NodeEventType,resources,Sprite,SpriteAtlas,UITransform,v3 } from "cc";
|
||||
import { _decorator,Button,EventHandler,EventTouch,Label,NodeEventType,ProgressBar,resources,Sprite,SpriteAtlas,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 { smc } from "../common/SingletonModuleComp";
|
||||
@@ -13,16 +13,32 @@ const { ccclass, property } = _decorator;
|
||||
@ecs.register('HCardComp', false)
|
||||
export class HCardComp extends CCComp {
|
||||
hi: number = 0;
|
||||
|
||||
heros:any = []
|
||||
icon:any=[]
|
||||
hc_name:any=[]
|
||||
ap:any=[]
|
||||
hp:any=[]
|
||||
life:any=[]
|
||||
protected onLoad(): void {
|
||||
|
||||
|
||||
}
|
||||
start() {
|
||||
let heros:any= ecs.query(ecs.allOf(HeroModelComp));
|
||||
this.node.getChildByName("name").getComponent(Label)!.string = heros[this.hi].HeroView.hero_name
|
||||
this.heros= ecs.query(ecs.allOf(HeroModelComp));
|
||||
this.hc_name=this.node.getChildByName("name").getComponent(Label)!
|
||||
this.icon=this.node.getChildByName("icon").getComponent(Sprite)!
|
||||
this.hp=this.node.getChildByName("hp").getChildByName("num").getComponent(Label)!
|
||||
this.ap=this.node.getChildByName("ap").getChildByName("num").getComponent(Label)!
|
||||
this.life=this.node.getChildByName("life").getComponent(ProgressBar)!
|
||||
this.hc_name.string= this.heros[this.hi].HeroView.hero_name
|
||||
console.log("hcard start")
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
this.hp.string=this.heros[this.hi].HeroView.hp_max
|
||||
this.ap.string=this.heros[this.hi].HeroView.ap
|
||||
this.life.progress=this.heros[this.hi].HeroView.hp/this.heros[this.hi].HeroView.hp_max
|
||||
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
console.log("hcard reset");
|
||||
|
||||
@@ -119,7 +119,8 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
mission_end(){
|
||||
smc.vm_data.mission.play=false
|
||||
let heros:any= ecs.query(ecs.allOf(HeroViewComp));
|
||||
let heros:any= ecs.query(ecs.allOf(HeroModelComp));
|
||||
let monsters:any= ecs.query(ecs.allOf(MonModelComp));
|
||||
let hcards:any= ecs.query(ecs.allOf(HCardComp));
|
||||
let hcns=this.node.getChildByName("hcards")
|
||||
for(let i=0;i<hcns.children.length;i++){
|
||||
@@ -127,10 +128,14 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
for(let i=0;i<heros.length;i++){
|
||||
heros[i].HeroView.ent.destroy()
|
||||
|
||||
}
|
||||
for(let i=0;i<hcards.length;i++){
|
||||
hcards[i].HCardComp.ent.destroy()
|
||||
}
|
||||
for(let i=0;i<monsters.length;i++){
|
||||
monsters[i].HeroView.ent.destroy()
|
||||
}
|
||||
}
|
||||
on_mon_dead(){
|
||||
let coin =(GameSet.MON_COIN_ADD*smc.vm_data.mission.coin_reward_add*(1+Talents[1006].bonus*smc.vm_data.talent[1006].lv)).toFixed(0)
|
||||
@@ -217,7 +222,7 @@ export class MissionComp extends CCComp {
|
||||
for(let i=0;i<heros.length;i++){
|
||||
let hcard = ecs.getEntity<HCard>(HCard)
|
||||
console.log("hcard:",hcard)
|
||||
hcard.load(1001,0,node)
|
||||
hcard.load(1001,i,node)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user