677a1a0214bd517782a919e898d49c8d602eda93.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5", "__unresolved_6"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, game, Prefab, ProgressBar, ch, gui, ch_start_pack, ResUtil, ModuleDef, SceneDef, _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2, _class3, _crd, ccclass, property, _preloadBundles, _preloadRes, _loadingText, _totalNum, Start;
  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 _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
  7. function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
  8. function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
  9. function _reportPossibleCrUseOfch(extras) {
  10. _reporterNs.report("ch", "../ch/ch", _context.meta, extras);
  11. }
  12. function _reportPossibleCrUseOfgui(extras) {
  13. _reporterNs.report("gui", "../core/ui/ui", _context.meta, extras);
  14. }
  15. function _reportPossibleCrUseOfch_start_pack(extras) {
  16. _reporterNs.report("ch_start_pack", "../ch/start/ch_start_pack", _context.meta, extras);
  17. }
  18. function _reportPossibleCrUseOfResUtil(extras) {
  19. _reporterNs.report("ResUtil", "../core/util/ResUtil", _context.meta, extras);
  20. }
  21. function _reportPossibleCrUseOfModuleDef(extras) {
  22. _reporterNs.report("ModuleDef", "../Scripts/ModuleDef", _context.meta, extras);
  23. }
  24. function _reportPossibleCrUseOfSceneDef(extras) {
  25. _reporterNs.report("SceneDef", "../Scripts/SceneDef", _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. game = _cc.game;
  36. Prefab = _cc.Prefab;
  37. ProgressBar = _cc.ProgressBar;
  38. }, function (_unresolved_2) {
  39. ch = _unresolved_2.ch;
  40. }, function (_unresolved_3) {
  41. gui = _unresolved_3.gui;
  42. }, function (_unresolved_4) {
  43. ch_start_pack = _unresolved_4.ch_start_pack;
  44. }, function (_unresolved_5) {
  45. ResUtil = _unresolved_5.ResUtil;
  46. }, function (_unresolved_6) {
  47. ModuleDef = _unresolved_6.ModuleDef;
  48. }, function (_unresolved_7) {
  49. SceneDef = _unresolved_7.SceneDef;
  50. }],
  51. execute: function () {
  52. _crd = true;
  53. _cclegacy._RF.push({}, "66e163GxmdDp7kaguqDvTVl", "Start", undefined);
  54. __checkObsolete__(['_decorator', 'game', 'Label', 'Prefab', 'Node', 'Slider', 'ProgressBar']);
  55. // import TableLoadUtil from '../core/util/TableLoadUtil';
  56. // import { TableUtil } from '../module_extra/table_ts/TableUtil';
  57. ({
  58. ccclass,
  59. property
  60. } = _decorator); //预加载模块
  61. _preloadBundles = [(_crd && ModuleDef === void 0 ? (_reportPossibleCrUseOfModuleDef({
  62. error: Error()
  63. }), ModuleDef) : ModuleDef).BASIC, (_crd && ModuleDef === void 0 ? (_reportPossibleCrUseOfModuleDef({
  64. error: Error()
  65. }), ModuleDef) : ModuleDef).EXTRA, (_crd && ModuleDef === void 0 ? (_reportPossibleCrUseOfModuleDef({
  66. error: Error()
  67. }), ModuleDef) : ModuleDef).GAME]; //预加载资源
  68. _preloadRes = [// { bundle: ModuleDef.EXTRA, url: 'ui_loading/UI_Loading' },
  69. {
  70. bundle: (_crd && ModuleDef === void 0 ? (_reportPossibleCrUseOfModuleDef({
  71. error: Error()
  72. }), ModuleDef) : ModuleDef).BASIC,
  73. url: 'ui_alert/UI_Alert'
  74. }, {
  75. bundle: (_crd && ModuleDef === void 0 ? (_reportPossibleCrUseOfModuleDef({
  76. error: Error()
  77. }), ModuleDef) : ModuleDef).BASIC,
  78. url: 'ui_waiting/UI_Waiting'
  79. }, {
  80. bundle: (_crd && ModuleDef === void 0 ? (_reportPossibleCrUseOfModuleDef({
  81. error: Error()
  82. }), ModuleDef) : ModuleDef).BASIC,
  83. url: 'ui_notify/UI_Notify'
  84. } // { bundle: ModuleDef.Link, url: 'ui/main/UI_Main' },
  85. ]; //
  86. _loadingText = ['Loading.', 'Loading..', 'Loading...'];
  87. _totalNum = _preloadBundles.length + _preloadRes.length + 1;
  88. _export("Start", Start = (_dec = ccclass('Start'), _dec2 = property(ProgressBar), _dec3 = property({
  89. type: Prefab,
  90. displayName: 'ui初始预制体'
  91. }), _dec(_class = (_class2 = (_class3 = class Start extends (_crd && ch_start_pack === void 0 ? (_reportPossibleCrUseOfch_start_pack({
  92. error: Error()
  93. }), ch_start_pack) : ch_start_pack) {
  94. constructor() {
  95. super(...arguments);
  96. // @property(Label)
  97. // txtLoading: Label;
  98. // @property(Slider)
  99. // loadingSlider: Slider;
  100. _initializerDefineProperty(this, "loadingBar", _descriptor, this);
  101. this._percent = '1';
  102. this._numCurrentLoaded = 0;
  103. _initializerDefineProperty(this, "ui_prefab", _descriptor2, this);
  104. }
  105. onLoad() {
  106. Start.packId = this.pid;
  107. }
  108. start() {
  109. var _this = this;
  110. return _asyncToGenerator(function* () {
  111. console.log('Start');
  112. (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({
  113. error: Error()
  114. }), gui) : gui).init(_this.ui_prefab);
  115. game.frameRate = 61; // if (this.pid == 1) {
  116. // // seeg.onLoginRet(
  117. // // async (ret: { openid: string; white: boolean }) => {
  118. // // console.log(ret);
  119. // // await this.try_init(3);
  120. // // this.preloadBundle(0);
  121. // // }
  122. // // //(ret: { userId: number; openId: string; isTest: boolean; abTest: number }) => {
  123. // // //console.log(ret);
  124. // // //}
  125. // // )
  126. // // seeg.init({ gid: this.gid, loggerLevel: this.log, old: false });
  127. // } else {
  128. // await this.try_init(3);
  129. // this.preloadBundle(0);
  130. // }
  131. yield _this.try_init(3);
  132. _this.preloadBundle(0);
  133. })();
  134. }
  135. onResLoaded() {
  136. this._numCurrentLoaded++;
  137. console.log(this._numCurrentLoaded); // this._percent = ~~(this._numCurrentLoaded / _totalNum * 100) + '%';
  138. }
  139. preloadBundle(idx) {
  140. var _this2 = this;
  141. return _asyncToGenerator(function* () {
  142. yield (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
  143. error: Error()
  144. }), ResUtil) : ResUtil).loadBundle(_preloadBundles[idx]);
  145. (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
  146. error: Error()
  147. }), ch) : ch).log.info('module:<' + _preloadBundles[idx] + '>loaded.');
  148. idx++;
  149. _this2.onResLoaded();
  150. if (idx < _preloadBundles.length) {
  151. _this2.preloadBundle(idx);
  152. } else {
  153. _this2.preloadRes(0);
  154. }
  155. })();
  156. }
  157. preloadRes(idx) {
  158. var _this3 = this;
  159. return _asyncToGenerator(function* () {
  160. var res = _preloadRes[idx];
  161. yield (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
  162. error: Error()
  163. }), ResUtil) : ResUtil).loadAsset(res.url, res.bundle);
  164. idx++;
  165. _this3.onResLoaded();
  166. if (idx < _preloadRes.length) {
  167. _this3.preloadRes(idx);
  168. } else {
  169. _this3.onPreloadingComplete();
  170. }
  171. })();
  172. }
  173. onPreloadingComplete() {
  174. var _this4 = this;
  175. return _asyncToGenerator(function* () {
  176. yield (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
  177. error: Error()
  178. }), ResUtil) : ResUtil).loadScene((_crd && SceneDef === void 0 ? (_reportPossibleCrUseOfSceneDef({
  179. error: Error()
  180. }), SceneDef) : SceneDef).Hall, (_crd && ModuleDef === void 0 ? (_reportPossibleCrUseOfModuleDef({
  181. error: Error()
  182. }), ModuleDef) : ModuleDef).GAME, true);
  183. _this4.onResLoaded();
  184. })();
  185. }
  186. update(deltaTime) {
  187. if (this._percent) {
  188. // this.txtLoading.string = 'Loading...' + this._percent;
  189. var sc = this._numCurrentLoaded / _totalNum;
  190. if (sc >= 1) {
  191. this.loadingBar.progress = sc;
  192. } else {
  193. this.loadingBar.progress = this._numCurrentLoaded / _totalNum;
  194. }
  195. } // else {
  196. // let idx = Math.floor(game.totalTime / 1000) % 3;
  197. // this.txtLoading.string = _loadingText[idx];
  198. // }
  199. }
  200. }, _class3.packId = void 0, _class3), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "loadingBar", [_dec2], {
  201. configurable: true,
  202. enumerable: true,
  203. writable: true,
  204. initializer: null
  205. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "ui_prefab", [_dec3], {
  206. configurable: true,
  207. enumerable: true,
  208. writable: true,
  209. initializer: null
  210. })), _class2)) || _class));
  211. _cclegacy._RF.pop();
  212. _crd = false;
  213. }
  214. };
  215. });
  216. //# sourceMappingURL=677a1a0214bd517782a919e898d49c8d602eda93.js.map