提速了下
This commit is contained in:
@@ -37,6 +37,7 @@ export class BuffComp extends Component {
|
||||
speek_time:number=0;
|
||||
HeroView:HeroViewComp=null!
|
||||
FIGHTCON:FightConComp=null!
|
||||
hp_bar:any=null
|
||||
protected onLoad(): void {
|
||||
oops.message.on(GameEvent.UpdateVMData,this.to_update_vmdata,this)
|
||||
}
|
||||
@@ -50,6 +51,7 @@ export class BuffComp extends Component {
|
||||
this.top_node = this.node.getChildByName("top");
|
||||
let hp_y=this.node.getComponent(UITransform).height+20
|
||||
this.top_node.setPosition(0,hp_y,0)
|
||||
this.hp_bar=this.top_node.getChildByName("hp").getComponent(ProgressBar)
|
||||
// this.top_node.getChildByName("hp").active=(this.node.getComponent(HeroViewComp).fac == 1 ? true : false)
|
||||
|
||||
this.vmdata_update()
|
||||
@@ -70,7 +72,7 @@ export class BuffComp extends Component {
|
||||
if(this.buff_cd <= 0 && this.node.getChildByName("buff").active){
|
||||
this.node.getChildByName("buff").active = false;
|
||||
}
|
||||
this.in_speek(deltaTime)
|
||||
// this.in_speek(deltaTime)
|
||||
// this.vmdata_update()
|
||||
}
|
||||
hp_show(){
|
||||
@@ -78,7 +80,7 @@ export class BuffComp extends Component {
|
||||
let hp=this.HeroView.hp;
|
||||
let hp_max=this.HeroView.hp_max;
|
||||
let hp_progress= hp/hp_max;
|
||||
this.top_node.getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
this.hp_bar.progress = hp_progress;
|
||||
if(this.HeroView.is_boss) return
|
||||
this.top_node.getChildByName("hp").active = (hp == hp_max) ? false : true;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,11 @@ export default class HeroAnmComp extends Component{
|
||||
this.anm?.play('move')
|
||||
}else{
|
||||
this.spine?.setToSetupPose();
|
||||
this.spine?.setAnimation(0, 'Idle', true);
|
||||
if(this.node.parent.getComponent(HeroViewComp).fac==FacSet.HERO){
|
||||
this.spine?.setAnimation(0, 'Idle', true);
|
||||
}else{
|
||||
this.spine?.setAnimation(0, 'move', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
import { _decorator, Label, resources, Sprite, SpriteAtlas } 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";
|
||||
import { HeroModelComp } from "./HeroModelComp";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { HeroInfo, HeroPos } from "../common/config/heroSet";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('HeroInfoCompComp')
|
||||
@ecs.register('HeroInfoComp', false)
|
||||
export class HeroInfoCompComp extends CCComp {
|
||||
@property
|
||||
c_id:number=0
|
||||
@property
|
||||
is_Change:boolean=false
|
||||
|
||||
has_hero:boolean=false
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||
this.init()
|
||||
}
|
||||
init(){
|
||||
this.has_hero=false
|
||||
}
|
||||
update(dt: number): void {
|
||||
if(!smc.mission.play) return
|
||||
this.update_info()
|
||||
}
|
||||
update_info(){
|
||||
let heros=ecs.query(ecs.allOf(HeroModelComp))
|
||||
this.has_hero=false
|
||||
this.node.getChildByName("info").getChildByName("ap").getChildByName("num").getComponent(Label).string=""
|
||||
this.node.getChildByName("info").getChildByName("hp").getChildByName("num").getComponent(Label).string=""
|
||||
this.node.getChildByName("name").getComponent(Label).string="无英雄"
|
||||
const sprite = this.node.getChildByName("mask").getChildByName("icon").getComponent(Sprite);
|
||||
// sprite.spriteFrame = //需要添加默认头像
|
||||
for(let hero of heros){
|
||||
let info=hero.get(HeroViewComp)
|
||||
if(info.node.position.x==HeroPos[this.c_id].pos.x){
|
||||
this.has_hero=true
|
||||
this.node.getChildByName("info").getChildByName("ap").getChildByName("num").getComponent(Label).string=info.ap.toString()
|
||||
this.node.getChildByName("info").getChildByName("hp").getChildByName("num").getComponent(Label).string=info.hp.toString()
|
||||
this.node.getChildByName("name").getComponent(Label).string=HeroInfo[info.hero_uuid].name
|
||||
var icon_path = "game/heros/herois"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("mask").getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[info.hero_uuid].path);
|
||||
});
|
||||
}
|
||||
}
|
||||
// if(this.is_Change){
|
||||
// this.node.getChildByName("change").active=this.has_hero
|
||||
// this.node.getChildByName("select").active=!this.has_hero
|
||||
// }
|
||||
}
|
||||
/** 全局消息逻辑处理 */
|
||||
// private onHandler(event: string, args: any) {
|
||||
// switch (event) {
|
||||
// case ModuleEvent.Cmd:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "e8cba331-88b0-4b08-9756-374a422d3c28",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user