Files
pixelheros/assets/script/game/map/MissionHomeComp.ts
panw ed0d08b804 feat(地图): 新增英雄列表组件并扩展主页组件属性
- 添加 HlistComp 组件用于展示英雄列表,包含英雄图标、属性显示及翻页按钮
- 在 MissionHomeComp 中增加页面节点和按钮的引用属性,为页面切换功能做准备
2026-04-01 16:15:19 +08:00

75 lines
2.0 KiB
TypeScript

import { _decorator, instantiate, Prefab, resources, Sprite, SpriteAtlas, UITransform ,Node} 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 { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { smc } from "../common/SingletonModuleComp";
import { GameEvent } from "../common/config/GameEvent";
import { Timer } from "db://oops-framework/core/common/timer/Timer";
import { mLogger } from "../common/Logger";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('MissionHomeComp')
@ecs.register('MissionHome', false)
export class MissionHomeComp extends CCComp {
debugMode: boolean = false;
@property(Node)
heros_page=null!
@property(Node)
rank_page=null!
@property(Node)
home_btn=null!
@property(Node)
hero_btn=null!
@property(Node)
rank_btn=null!
protected onLoad(): void {
this.on(GameEvent.MissionEnd,this.mission_end,this)
}
/** 视图层逻辑代码分离演示 */
start() {
this.home_active()
}
onEnable(){
}
update(dt:number){
}
start_mission() {
mLogger.log(this.debugMode, 'MissionHomeComp', "start_mission")
oops.message.dispatchEvent(GameEvent.MissionStart, {})
this.node.active=false;
}
mission_end(){
mLogger.log(this.debugMode, 'MissionHomeComp', "[MissionHomeComp]=>mission_end")
this.home_active()
}
home_active(){
this.uodate_data()
this.node.active=true
}
uodate_data(){
}
isWxClient(){
return typeof wx !== 'undefined' && typeof (wx as any).getSystemInfoSync === 'function';
}
btn_func(e:string,data:any){
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}