System.register(["cc"], function (_export, _context) {
  "use strict";

  var _cclegacy, _decorator, Component, Sprite, assetManager, isValid, Texture2D, _dec, _class, _crd, ccclass, property, SpriteRoot;

  return {
    setters: [function (_cc) {
      _cclegacy = _cc.cclegacy;
      _decorator = _cc._decorator;
      Component = _cc.Component;
      Sprite = _cc.Sprite;
      assetManager = _cc.assetManager;
      isValid = _cc.isValid;
      Texture2D = _cc.Texture2D;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "bb767hwV+BN3I+/jnjUE0Gm", "SpriteRoot", undefined);

      ({
        ccclass,
        property
      } = _decorator);
      /**
       * Predefined variables
       * Name = SpriteRoot
       * DateTime = Wed Mar 30 2022 21:49:52 GMT+0800 (中国标准时间)
       * Author = he258369
       * FileBasename = SpriteRoot.ts
       * FileBasenameNoExtension = SpriteRoot
       * URL = db://assets/scripts/SpriteRoot.ts
       * ManualUrl = https://docs.cocos.com/creator/3.4/manual/zh/
       *
       */

      _export("SpriteRoot", SpriteRoot = (_dec = ccclass('SpriteRoot'), _dec(_class = class SpriteRoot extends Component {
        // [1]
        // dummy = '';
        // [2]
        // @property
        // serializableDummy = 0;
        start() {
          // [3]
          // 修改 Sprite_2
          this.createBuilding('Sprite_2');
        }

        createBuilding(nodeName) {
          var blockNode = this.node.getChildByName(nodeName);
          var url = "https://img.zcool.cn/community/01824b59db07e3a80121ae0caa7f33.jpg@1280w_1l_2o_100sh.jpg";
          var sprite = blockNode.getComponent(Sprite);

          if (blockNode) {
            assetManager.loadRemote(url, (err, imageAsset) => {
              if (err) {
                console.error('set sprite frame failed! err:', url, err);
                return;
              }

              if (sprite && isValid(sprite)) {
                var texture = new Texture2D();
                texture.image = imageAsset;
                sprite.spriteFrame.texture = texture;
              }
            });
          }
        } // update (deltaTime: number) {
        //     // [4]
        // }


      }) || _class));

      _cclegacy._RF.pop();

      _crd = false;
    }
  };
});
//# sourceMappingURL=SpriteRoot.js.map