107d1fe45334c44eb3ff42ed28e116dc4109601e.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5", "__unresolved_6", "__unresolved_7", "__unresolved_8"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, oops, ecs, CCVMParentComp, ModuleUtil, smc, UIID, GameEvent, EliminateViewComp, _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 _reportPossibleCrUseOfsmc(extras) {
  19. _reporterNs.report("smc", "../../common/SingletonModuleComp", _context.meta, extras);
  20. }
  21. function _reportPossibleCrUseOfUIID(extras) {
  22. _reporterNs.report("UIID", "../../common/config/GameUIConfig", _context.meta, extras);
  23. }
  24. function _reportPossibleCrUseOfGameEvent(extras) {
  25. _reporterNs.report("GameEvent", "../../common/config/GameEvent", _context.meta, extras);
  26. }
  27. function _reportPossibleCrUseOfEliminateViewComp(extras) {
  28. _reporterNs.report("EliminateViewComp", "../../eliminate/view/EliminateViewComp", _context.meta, extras);
  29. }
  30. return {
  31. setters: [function (_unresolved_) {
  32. _reporterNs = _unresolved_;
  33. }, function (_cc) {
  34. _cclegacy = _cc.cclegacy;
  35. __checkObsolete__ = _cc.__checkObsolete__;
  36. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  37. _decorator = _cc._decorator;
  38. }, function (_unresolved_2) {
  39. oops = _unresolved_2.oops;
  40. }, function (_unresolved_3) {
  41. ecs = _unresolved_3.ecs;
  42. }, function (_unresolved_4) {
  43. CCVMParentComp = _unresolved_4.CCVMParentComp;
  44. }, function (_unresolved_5) {
  45. ModuleUtil = _unresolved_5.ModuleUtil;
  46. }, function (_unresolved_6) {
  47. smc = _unresolved_6.smc;
  48. }, function (_unresolved_7) {
  49. UIID = _unresolved_7.UIID;
  50. }, function (_unresolved_8) {
  51. GameEvent = _unresolved_8.GameEvent;
  52. }, function (_unresolved_9) {
  53. EliminateViewComp = _unresolved_9.EliminateViewComp;
  54. }],
  55. execute: function () {
  56. _crd = true;
  57. _cclegacy._RF.push({}, "92429ykTnxFCrcGyW58JWjj", "LoadingViewComp", undefined);
  58. /*
  59. * @Author: dgflash
  60. * @Date: 2021-07-03 16:13:17
  61. * @LastEditors: mojunshou 1637302775@qq.com
  62. * @LastEditTime: 2025-03-13 14:43:57
  63. */
  64. __checkObsolete__(['_decorator']);
  65. ({
  66. ccclass,
  67. property
  68. } = _decorator);
  69. /** 游戏资源加载 */
  70. _export("LoadingViewComp", LoadingViewComp = (_dec = ccclass('LoadingViewComp'), _dec2 = (_crd && ecs === void 0 ? (_reportPossibleCrUseOfecs({
  71. error: Error()
  72. }), ecs) : ecs).register('LoadingView', false), _dec(_class = _dec2(_class = class LoadingViewComp extends (_crd && CCVMParentComp === void 0 ? (_reportPossibleCrUseOfCCVMParentComp({
  73. error: Error()
  74. }), CCVMParentComp) : CCVMParentComp) {
  75. constructor() {
  76. super(...arguments);
  77. /** VM 组件绑定数据 */
  78. this.data = {
  79. /** 加载资源当前进度 */
  80. finished: 0,
  81. /** 加载资源最大进度 */
  82. total: 0,
  83. /** 加载资源进度比例值 */
  84. progress: "0",
  85. /** 加载流程中提示文本 */
  86. prompt: ""
  87. };
  88. this.progress = 0;
  89. }
  90. start() {
  91. this.enter();
  92. }
  93. enter() {
  94. this.addEvent();
  95. this.loadRes();
  96. }
  97. addEvent() {
  98. this.on((_crd && GameEvent === void 0 ? (_reportPossibleCrUseOfGameEvent({
  99. error: Error()
  100. }), GameEvent) : GameEvent).LoginSuccess, this.onHandler, this);
  101. }
  102. onHandler(event, args) {
  103. switch (event) {
  104. case (_crd && GameEvent === void 0 ? (_reportPossibleCrUseOfGameEvent({
  105. error: Error()
  106. }), GameEvent) : GameEvent).LoginSuccess:
  107. // 加载流程结束,移除加载提示界面
  108. console.log("加载流程结束,移除加载提示界面");
  109. this.ent.remove(LoadingViewComp);
  110. break;
  111. }
  112. }
  113. /** 加载资源 */
  114. loadRes() {
  115. var _this = this;
  116. return _asyncToGenerator(function* () {
  117. _this.data.progress = 0;
  118. yield _this.loadCustom();
  119. _this.loadGameRes();
  120. })();
  121. }
  122. /** 加载游戏本地JSON数据(自定义内容) */
  123. loadCustom() {
  124. // 加载游戏本地JSON数据的多语言提示文本
  125. this.data.prompt = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  126. error: Error()
  127. }), oops) : oops).language.getLangByID("loading_load_json");
  128. }
  129. /** 加载初始游戏内容资源 */
  130. loadGameRes() {
  131. // 加载初始游戏内容资源的多语言提示文本
  132. this.data.prompt = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  133. error: Error()
  134. }), oops) : oops).language.getLangByID("loading_load_game");
  135. (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  136. error: Error()
  137. }), oops) : oops).res.loadDir("game", this.onProgressCallback.bind(this), this.onCompleteCallback.bind(this));
  138. }
  139. /** 加载进度事件 */
  140. onProgressCallback(finished, total, item) {
  141. this.data.finished = finished;
  142. this.data.total = total;
  143. var progress = finished / total;
  144. if (progress > this.progress) {
  145. this.progress = progress;
  146. this.data.progress = (progress * 100).toFixed(2);
  147. }
  148. }
  149. /** 加载完成事件 */
  150. onCompleteCallback() {
  151. var _this2 = this;
  152. return _asyncToGenerator(function* () {
  153. // 获取用户信息的多语言提示文本
  154. _this2.data.prompt = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  155. error: Error()
  156. }), oops) : oops).language.getLangByID("loading_load_player"); // await ModuleUtil.addViewUiAsync(smc.account, DemoViewComp, UIID.Demo);
  157. yield (_crd && ModuleUtil === void 0 ? (_reportPossibleCrUseOfModuleUtil({
  158. error: Error()
  159. }), ModuleUtil) : ModuleUtil).addViewUiAsync((_crd && smc === void 0 ? (_reportPossibleCrUseOfsmc({
  160. error: Error()
  161. }), smc) : smc).account, _crd && EliminateViewComp === void 0 ? (_reportPossibleCrUseOfEliminateViewComp({
  162. error: Error()
  163. }), EliminateViewComp) : EliminateViewComp, (_crd && UIID === void 0 ? (_reportPossibleCrUseOfUIID({
  164. error: Error()
  165. }), UIID) : UIID).Game);
  166. (_crd && ModuleUtil === void 0 ? (_reportPossibleCrUseOfModuleUtil({
  167. error: Error()
  168. }), ModuleUtil) : ModuleUtil).removeViewUi(_this2.ent, LoadingViewComp, (_crd && UIID === void 0 ? (_reportPossibleCrUseOfUIID({
  169. error: Error()
  170. }), UIID) : UIID).Loading); // 初始化帐号模块
  171. // smc.account.connect();
  172. //初始化剩下的东西
  173. //这做正式逻辑
  174. })();
  175. }
  176. reset() {}
  177. }) || _class) || _class));
  178. _cclegacy._RF.pop();
  179. _crd = false;
  180. }
  181. };
  182. });
  183. //# sourceMappingURL=107d1fe45334c44eb3ff42ed28e116dc4109601e.js.map