- 修复怪物生成时近战/远程类型与槽位不匹配的问题,增加槽位类型限制 - 调整加载界面进度条尺寸和颜色,优化视觉表现 - 修改任务主页组件,注释掉未使用的标签切换功能 - 更新资源图集布局,修正精灵帧坐标和旋转状态 - 调整英雄界面预制件的部分UI元素尺寸
91 lines
2.7 KiB
TypeScript
91 lines
2.7 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
|
|
// this.switch_tab('home')
|
|
}
|
|
uodate_data(){
|
|
|
|
}
|
|
isWxClient(){
|
|
return typeof wx !== 'undefined' && typeof (wx as any).getSystemInfoSync === 'function';
|
|
}
|
|
// btn_func(e: any, data: string){
|
|
// if (['home', 'hero', 'rank'].includes(data)) {
|
|
// this.switch_tab(data);
|
|
// }
|
|
// }
|
|
|
|
// switch_tab(tab: string) {
|
|
// if (this.heros_page) this.heros_page.active = tab === 'hero';
|
|
// if (this.rank_page) this.rank_page.active = tab === 'rank';
|
|
|
|
// const setBtnActive = (btn: Node, isActive: boolean) => {
|
|
// const activeNode = btn?.getChildByName('active');
|
|
// if (activeNode) activeNode.active = isActive;
|
|
// }
|
|
|
|
// setBtnActive(this.home_btn, tab === 'home');
|
|
// setBtnActive(this.hero_btn, tab === 'hero');
|
|
// setBtnActive(this.rank_btn, tab === 'rank');
|
|
// }
|
|
|
|
|
|
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
|
reset() {
|
|
this.node.destroy();
|
|
}
|
|
} |