Files
pixelheros/assets/script/game/map/MissionHeroComp.ts
panw 3a8f015a78 refactor: 移除调试日志并统一使用日志工具
- 删除多个文件中的 console.log/console.warn/console.error 调试输出
- 将日志输出统一替换为 mLogger 工具,支持调试模式控制
- 清理注释掉的调试代码和空方法体
2026-02-03 16:49:24 +08:00

88 lines
2.8 KiB
TypeScript

import { _decorator, resources, Sprite, SpriteAtlas, SpriteFrame, v3, Vec3 } 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 { Hero } from "../hero/Hero";
import { smc } from "../common/SingletonModuleComp";
import { Timer } from "db://oops-framework/core/common/timer/Timer";
import { GameEvent } from "../common/config/GameEvent";
import { HeroPos } from "../common/config/heroSet";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('MissionHeroCompComp')
@ecs.register('MissionHeroComp', false)
export class MissionHeroCompComp extends CCComp {
timer:Timer=new Timer(2)
Friend_is_dead:boolean=false
current_hero_uuid:number=0
current_hero_num:number=-1
heros:any=[]
onLoad(){
this.on(GameEvent.FightReady,this.fight_ready,this)
this.on(GameEvent.Zhaohuan,this.zhao_huan,this)
this.on(GameEvent.MissionEnd,this.clear_heros,this)
// this.on(GameEvent.CallFriend,this.call_friend,this)
oops.message.on(GameEvent.CallFriend,this.call_friend,this)
}
onDestroy(){
oops.message.off(GameEvent.CallFriend,this.call_friend,this)
}
start() {
// this.test_call()
}
clear_heros(){
}
fight_ready(){
// this.heros=[]
// for(let i=0;i<FightSet.HERO_MAX_NUM;i++){
// this.heros.push({
// uuid:0,
// count:0,
// quality:0,
// })
// }
// this.current_hero_num=-1
// this.current_hero_uuid=0
smc.vmdata.mission_data.hero_num=0
this.addHero(smc.fight_hero,true)
// for(let i=0;i<Object.keys(heros).length;i++){
// if(heros[i]!=0){
// this.addHero(heros[i],false)
// }
// }
}
protected update(dt: number): void {
if(smc.mission.status != 1) return
}
private zhao_huan(event: string, args: any){
this.addHero(args.uuid)
}
private call_friend(event: string, args: any){
this.addHero(args.uuid,false,true)
}
/** 添加英雄 */
private addHero(uuid:number=1001,is_master:boolean=false,is_friend:boolean=false) {
let hero_pos=0
let hero = ecs.getEntity<Hero>(Hero);
let scale = 1
let pos:Vec3 = HeroPos[hero_pos].pos;
let fight_pos=1
hero.load(pos,scale,uuid,fight_pos,is_master,is_friend);
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
// this.node.destroy();
}
}