39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { EventTouch, Label, 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 {
|
|
onAdded(args: any) {
|
|
this.node.getChildByName("name").getComponent(Label).string=args.name
|
|
this.node.getChildByName("info").getComponent(Label).string=args.info
|
|
}
|
|
|
|
private onTouchEnd(event: EventTouch) {
|
|
switch (event.target.name) {
|
|
case "btn":
|
|
this.reset();
|
|
break;
|
|
}
|
|
|
|
event.propagationStopped = true;
|
|
}
|
|
|
|
reset() {
|
|
oops.gui.remove(UIID.ItemInfo, false);
|
|
|
|
// // 注:模拟二次删除清理缓存
|
|
// setTimeout(() => {
|
|
// oops.gui.remove(UIID.ItemInfo);
|
|
// }, 100);
|
|
}
|
|
|
|
protected onDestroy(): void {
|
|
console.log("释放角色信息界面");
|
|
}
|
|
} |