游戏 模式再次改变
This commit is contained in:
76
assets/script/game/map/HeroUiComp.ts
Normal file
76
assets/script/game/map/HeroUiComp.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import { _decorator, resources, Sprite, SpriteAtlas ,Node, ProgressBar, tween, v3, Label, Animation, CCString, CCInteger} 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 { GameEvent } from "../common/config/GameEvent";
|
||||
import { CdType, SkillSet } from "../common/config/SkillSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { MissionEvent } from "../common/config/MissionEvent";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('HeroUiComp')
|
||||
@ecs.register('HeroUi', false)
|
||||
export class HeroUiComp extends CCComp {
|
||||
@property(CCString)
|
||||
hero_slot:string="skill1"
|
||||
@property(CCInteger)
|
||||
hero_slot_index:number=1
|
||||
heroUi:any=null
|
||||
skill_cd_bar_progress:any=null
|
||||
max_show:boolean=false
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
onLoad() {
|
||||
this.on(GameEvent.FightReady,this.fight_ready,this)
|
||||
this.on(GameEvent.UseHeroCard,this.get_hero,this)
|
||||
// this.node.getChildByName("icon").getChildByName("cd").active=false
|
||||
}
|
||||
start(){
|
||||
this.fight_ready()
|
||||
}
|
||||
|
||||
fight_ready(){
|
||||
console.log("[HeroUiComp]: fight_ready",this.node)
|
||||
this.heroUi={
|
||||
uuid:0,
|
||||
name:"hero",
|
||||
type:0, //1 被动 0 主动
|
||||
level:0,
|
||||
quality:0,
|
||||
cd:0,
|
||||
cd_time:0,
|
||||
active:false,
|
||||
}
|
||||
|
||||
}
|
||||
update(dt: number): void {
|
||||
if(!smc.mission.play||smc.mission.pause) return
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
get_hero(e:GameEvent,data:any){
|
||||
console.log("[HeroUiComp]: get_hero",data)
|
||||
let hero=HeroInfo[data.uuid]
|
||||
let icon=this.node.getChildByName("icon")
|
||||
icon.active=true
|
||||
var icon_path = "game/heros/herois"
|
||||
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = icon.getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(hero.path);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user