e96d72285755bd891f7b6b6f085ef0387a70134e.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5", "__unresolved_6", "__unresolved_7"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, oops, ecs, CCVMParentComp, ModuleUtil, DemoViewComp, smc, UIID, _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. function _reportPossibleCrUseOfModuleUtil(extras) {
  16. _reporterNs.report("ModuleUtil", "../../../../../extensions/oops-plugin-framework/assets/module/common/ModuleUtil", _context.meta, extras);
  17. }
  18. function _reportPossibleCrUseOfDemoViewComp(extras) {
  19. _reporterNs.report("DemoViewComp", "../../account/view/DemoViewComp", _context.meta, extras);
  20. }
  21. function _reportPossibleCrUseOfsmc(extras) {
  22. _reporterNs.report("smc", "../../common/SingletonModuleComp", _context.meta, extras);
  23. }
  24. function _reportPossibleCrUseOfUIID(extras) {
  25. _reporterNs.report("UIID", "../../common/config/GameUIConfig", _context.meta, extras);
  26. }
  27. return {
  28. setters: [function (_unresolved_) {
  29. _reporterNs = _unresolved_;
  30. }, function (_cc) {
  31. _cclegacy = _cc.cclegacy;
  32. __checkObsolete__ = _cc.__checkObsolete__;
  33. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  34. _decorator = _cc._decorator;
  35. }, function (_unresolved_2) {
  36. oops = _unresolved_2.oops;
  37. }, function (_unresolved_3) {
  38. ecs = _unresolved_3.ecs;
  39. }, function (_unresolved_4) {
  40. CCVMParentComp = _unresolved_4.CCVMParentComp;
  41. }, function (_unresolved_5) {
  42. ModuleUtil = _unresolved_5.ModuleUtil;
  43. }, function (_unresolved_6) {
  44. DemoViewComp = _unresolved_6.DemoViewComp;
  45. }, function (_unresolved_7) {
  46. smc = _unresolved_7.smc;
  47. }, function (_unresolved_8) {
  48. UIID = _unresolved_8.UIID;
  49. }],
  50. execute: function () {
  51. _crd = true;
  52. _cclegacy._RF.push({}, "92429ykTnxFCrcGyW58JWjj", "LoadingViewComp", undefined);
  53. /*
  54. * @Author: dgflash
  55. * @Date: 2021-07-03 16:13:17
  56. * @LastEditors: bansomin
  57. * @LastEditTime: 2024-03-31 01:17:02
  58. */
  59. __checkObsolete__(['_decorator']);
  60. ({
  61. ccclass,
  62. property
  63. } = _decorator);
  64. /** 游戏资源加载 */
  65. _export("LoadingViewComp", LoadingViewComp = (_dec = ccclass('LoadingViewComp'), _dec2 = (_crd && ecs === void 0 ? (_reportPossibleCrUseOfecs({
  66. error: Error()
  67. }), ecs) : ecs).register('LoadingView', false), _dec(_class = _dec2(_class = class LoadingViewComp extends (_crd && CCVMParentComp === void 0 ? (_reportPossibleCrUseOfCCVMParentComp({
  68. error: Error()
  69. }), CCVMParentComp) : CCVMParentComp) {
  70. constructor() {
  71. super(...arguments);
  72. /** VM 组件绑定数据 */
  73. this.data = {
  74. /** 加载资源当前进度 */
  75. finished: 0,
  76. /** 加载资源最大进度 */
  77. total: 0,
  78. /** 加载资源进度比例值 */
  79. progress: "0",
  80. /** 加载流程中提示文本 */
  81. prompt: ""
  82. };
  83. this.progress = 0;
  84. }
  85. start() {
  86. this.enter();
  87. }
  88. enter() {
  89. this.loadRes();
  90. }
  91. /** 加载资源 */
  92. loadRes() {
  93. var _this = this;
  94. return _asyncToGenerator(function* () {
  95. _this.data.progress = 0;
  96. yield _this.loadCustom();
  97. _this.loadGameRes();
  98. })();
  99. }
  100. /** 加载游戏本地JSON数据(自定义内容) */
  101. loadCustom() {
  102. // 加载游戏本地JSON数据的多语言提示文本
  103. this.data.prompt = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  104. error: Error()
  105. }), oops) : oops).language.getLangByID("loading_load_json");
  106. }
  107. /** 加载初始游戏内容资源 */
  108. loadGameRes() {
  109. // 加载初始游戏内容资源的多语言提示文本
  110. this.data.prompt = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  111. error: Error()
  112. }), oops) : oops).language.getLangByID("loading_load_game");
  113. (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  114. error: Error()
  115. }), oops) : oops).res.loadDir("game", this.onProgressCallback.bind(this), this.onCompleteCallback.bind(this));
  116. }
  117. /** 加载进度事件 */
  118. onProgressCallback(finished, total, item) {
  119. this.data.finished = finished;
  120. this.data.total = total;
  121. var progress = finished / total;
  122. if (progress > this.progress) {
  123. this.progress = progress;
  124. this.data.progress = (progress * 100).toFixed(2);
  125. }
  126. }
  127. /** 加载完成事件 */
  128. onCompleteCallback() {
  129. var _this2 = this;
  130. return _asyncToGenerator(function* () {
  131. // 获取用户信息的多语言提示文本
  132. _this2.data.prompt = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  133. error: Error()
  134. }), oops) : oops).language.getLangByID("loading_load_player");
  135. yield (_crd && ModuleUtil === void 0 ? (_reportPossibleCrUseOfModuleUtil({
  136. error: Error()
  137. }), ModuleUtil) : ModuleUtil).addViewUiAsync((_crd && smc === void 0 ? (_reportPossibleCrUseOfsmc({
  138. error: Error()
  139. }), smc) : smc).account, _crd && DemoViewComp === void 0 ? (_reportPossibleCrUseOfDemoViewComp({
  140. error: Error()
  141. }), DemoViewComp) : DemoViewComp, (_crd && UIID === void 0 ? (_reportPossibleCrUseOfUIID({
  142. error: Error()
  143. }), UIID) : UIID).Demo);
  144. (_crd && ModuleUtil === void 0 ? (_reportPossibleCrUseOfModuleUtil({
  145. error: Error()
  146. }), ModuleUtil) : ModuleUtil).removeViewUi(_this2.ent, LoadingViewComp, (_crd && UIID === void 0 ? (_reportPossibleCrUseOfUIID({
  147. error: Error()
  148. }), UIID) : UIID).Loading);
  149. })();
  150. }
  151. reset() {}
  152. }) || _class) || _class));
  153. _cclegacy._RF.pop();
  154. _crd = false;
  155. }
  156. };
  157. });
  158. //# sourceMappingURL=e96d72285755bd891f7b6b6f085ef0387a70134e.js.map