dd
This commit is contained in:
@@ -1,29 +1,45 @@
|
||||
import { _decorator } from "cc";
|
||||
import { EventTouch, Node,_decorator } 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 { UIID } from "../common/config/GameUIConfig";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('ItemInfoComp')
|
||||
@ecs.register('ItemInfo', false)
|
||||
export class ItemInfoComp extends CCComp {
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||
onAdded(args: any) {
|
||||
console.log("args");
|
||||
}
|
||||
|
||||
onLoad() {
|
||||
this.node.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
|
||||
}
|
||||
|
||||
private onTouchEnd(event: EventTouch) {
|
||||
switch (event.target.name) {
|
||||
case "btn_levelup":
|
||||
this.ent.remove(ItemInfoComp);
|
||||
break;
|
||||
case "btn_close":
|
||||
this.ent.remove(ItemInfoComp);
|
||||
break;
|
||||
}
|
||||
|
||||
event.propagationStopped = true;
|
||||
}
|
||||
|
||||
/** 全局消息逻辑处理 */
|
||||
// private onHandler(event: string, args: any) {
|
||||
// switch (event) {
|
||||
// case ModuleEvent.Cmd:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
oops.gui.remove(UIID.ItemInfo, false);
|
||||
|
||||
// 注:模拟二次删除清理缓存
|
||||
setTimeout(() => {
|
||||
oops.gui.remove(UIID.ItemInfo);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
console.log("释放角色信息界面");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user