DemoViewComp.ts 1.0 KB

123456789101112131415161718192021222324252627282930
  1. /*
  2. * @Author: mojunshou 1637302775@qq.com
  3. * @Date: 2025-02-26 17:11:55
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-02-27 16:29:40
  6. * @FilePath: \Cocos_android\assets\script\game\account\view\DemoViewComp.ts
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. import { _decorator } from "cc";
  10. import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
  11. import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
  12. import { Label } from "cc";
  13. const { ccclass, property } = _decorator;
  14. /** 视图层对象 */
  15. @ccclass('DemoViewComp')
  16. @ecs.register('DemoView', false)
  17. export class DemoViewComp extends CCComp {
  18. start() {
  19. const text = this.node.getChildByName("textLb")?.getComponent(Label);
  20. if (text) {
  21. text.string = "这是开始游戏的场景";
  22. }
  23. }
  24. reset() {
  25. this.node.destroy();
  26. }
  27. }