107d1fe45334c44eb3ff42ed28e116dc4109601e.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, oops, ecs, CCVMParentComp, _dec, _dec2, _class, _crd, ccclass, property, LoadingViewComp;
  4. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  5. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  6. function _reportPossibleCrUseOfoops(extras) {
  7. _reporterNs.report("oops", "../../../../../extensions/oops-plugin-framework/assets/core/Oops", _context.meta, extras);
  8. }
  9. function _reportPossibleCrUseOfecs(extras) {
  10. _reporterNs.report("ecs", "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS", _context.meta, extras);
  11. }
  12. function _reportPossibleCrUseOfCCVMParentComp(extras) {
  13. _reporterNs.report("CCVMParentComp", "../../../../../extensions/oops-plugin-framework/assets/module/common/CCVMParentComp", _context.meta, extras);
  14. }
  15. return {
  16. setters: [function (_unresolved_) {
  17. _reporterNs = _unresolved_;
  18. }, function (_cc) {
  19. _cclegacy = _cc.cclegacy;
  20. __checkObsolete__ = _cc.__checkObsolete__;
  21. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  22. _decorator = _cc._decorator;
  23. }, function (_unresolved_2) {
  24. oops = _unresolved_2.oops;
  25. }, function (_unresolved_3) {
  26. ecs = _unresolved_3.ecs;
  27. }, function (_unresolved_4) {
  28. CCVMParentComp = _unresolved_4.CCVMParentComp;
  29. }],
  30. execute: function () {
  31. _crd = true;
  32. _cclegacy._RF.push({}, "92429ykTnxFCrcGyW58JWjj", "LoadingViewComp", undefined);
  33. /*
  34. * @Author: dgflash
  35. * @Date: 2021-07-03 16:13:17
  36. * @LastEditors: mojunshou 1637302775@qq.com
  37. * @LastEditTime: 2025-03-06 14:56:34
  38. */
  39. __checkObsolete__(['_decorator']);
  40. ({
  41. ccclass,
  42. property
  43. } = _decorator);
  44. /** 游戏资源加载 */
  45. _export("LoadingViewComp", LoadingViewComp = (_dec = ccclass('LoadingViewComp'), _dec2 = (_crd && ecs === void 0 ? (_reportPossibleCrUseOfecs({
  46. error: Error()
  47. }), ecs) : ecs).register('LoadingView', false), _dec(_class = _dec2(_class = class LoadingViewComp extends (_crd && CCVMParentComp === void 0 ? (_reportPossibleCrUseOfCCVMParentComp({
  48. error: Error()
  49. }), CCVMParentComp) : CCVMParentComp) {
  50. constructor() {
  51. super(...arguments);
  52. /** VM 组件绑定数据 */
  53. this.data = {
  54. /** 加载资源当前进度 */
  55. finished: 0,
  56. /** 加载资源最大进度 */
  57. total: 0,
  58. /** 加载资源进度比例值 */
  59. progress: "0",
  60. /** 加载流程中提示文本 */
  61. prompt: ""
  62. };
  63. this.progress = 0;
  64. }
  65. start() {
  66. this.enter();
  67. }
  68. enter() {
  69. this.loadRes();
  70. }
  71. /** 加载资源 */
  72. loadRes() {
  73. var _this = this;
  74. return _asyncToGenerator(function* () {
  75. _this.data.progress = 0;
  76. yield _this.loadCustom();
  77. _this.loadGameRes();
  78. })();
  79. }
  80. /** 加载游戏本地JSON数据(自定义内容) */
  81. loadCustom() {
  82. // 加载游戏本地JSON数据的多语言提示文本
  83. this.data.prompt = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  84. error: Error()
  85. }), oops) : oops).language.getLangByID("loading_load_json");
  86. }
  87. /** 加载初始游戏内容资源 */
  88. loadGameRes() {
  89. // 加载初始游戏内容资源的多语言提示文本
  90. this.data.prompt = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  91. error: Error()
  92. }), oops) : oops).language.getLangByID("loading_load_game");
  93. (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  94. error: Error()
  95. }), oops) : oops).res.loadDir("game", this.onProgressCallback.bind(this), this.onCompleteCallback.bind(this));
  96. }
  97. /** 加载进度事件 */
  98. onProgressCallback(finished, total, item) {
  99. this.data.finished = finished;
  100. this.data.total = total;
  101. var progress = finished / total;
  102. if (progress > this.progress) {
  103. this.progress = progress;
  104. this.data.progress = (progress * 100).toFixed(2);
  105. }
  106. }
  107. /** 加载完成事件 */
  108. onCompleteCallback() {
  109. var _this2 = this;
  110. return _asyncToGenerator(function* () {
  111. // 获取用户信息的多语言提示文本
  112. _this2.data.prompt = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  113. error: Error()
  114. }), oops) : oops).language.getLangByID("loading_load_player"); // await ModuleUtil.addViewUiAsync(smc.account, DemoViewComp, UIID.Demo);
  115. // await ModuleUtil.addViewUiAsync(smc.account, StartViewComp, UIID.Start);
  116. // ModuleUtil.removeViewUi(this.ent, LoadingViewComp, UIID.Loading);
  117. // 初始化帐号模块
  118. // smc.account.connect();
  119. //初始化剩下的东西
  120. })();
  121. }
  122. reset() {}
  123. }) || _class) || _class));
  124. _cclegacy._RF.pop();
  125. _crd = false;
  126. }
  127. };
  128. });
  129. //# sourceMappingURL=107d1fe45334c44eb3ff42ed28e116dc4109601e.js.map