41297756668c0510f828032e1d12f96a4d1a9194.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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;
  116. if (_this.pid == 1) {// 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. yield _this.try_init(3);
  129. _this.preloadBundle(0);
  130. }
  131. })();
  132. }
  133. onResLoaded() {
  134. this._numCurrentLoaded++;
  135. console.log(this._numCurrentLoaded); // this._percent = ~~(this._numCurrentLoaded / _totalNum * 100) + '%';
  136. }
  137. preloadBundle(idx) {
  138. var _this2 = this;
  139. return _asyncToGenerator(function* () {
  140. yield (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
  141. error: Error()
  142. }), ResUtil) : ResUtil).loadBundle(_preloadBundles[idx]);
  143. (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
  144. error: Error()
  145. }), ch) : ch).log.info('module:<' + _preloadBundles[idx] + '>loaded.');
  146. idx++;
  147. _this2.onResLoaded();
  148. if (idx < _preloadBundles.length) {
  149. _this2.preloadBundle(idx);
  150. } else {
  151. _this2.preloadRes(0);
  152. }
  153. })();
  154. }
  155. preloadRes(idx) {
  156. var _this3 = this;
  157. return _asyncToGenerator(function* () {
  158. var res = _preloadRes[idx];
  159. yield (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
  160. error: Error()
  161. }), ResUtil) : ResUtil).loadAsset(res.url, res.bundle);
  162. idx++;
  163. _this3.onResLoaded();
  164. if (idx < _preloadRes.length) {
  165. _this3.preloadRes(idx);
  166. } else {
  167. _this3.onPreloadingComplete();
  168. }
  169. })();
  170. }
  171. onPreloadingComplete() {
  172. var _this4 = this;
  173. return _asyncToGenerator(function* () {
  174. yield (_crd && ResUtil === void 0 ? (_reportPossibleCrUseOfResUtil({
  175. error: Error()
  176. }), ResUtil) : ResUtil).loadScene((_crd && SceneDef === void 0 ? (_reportPossibleCrUseOfSceneDef({
  177. error: Error()
  178. }), SceneDef) : SceneDef).Hall, (_crd && ModuleDef === void 0 ? (_reportPossibleCrUseOfModuleDef({
  179. error: Error()
  180. }), ModuleDef) : ModuleDef).GAME, true);
  181. _this4.onResLoaded();
  182. })();
  183. }
  184. update(deltaTime) {
  185. if (this._percent) {
  186. // this.txtLoading.string = 'Loading...' + this._percent;
  187. var sc = this._numCurrentLoaded / _totalNum;
  188. if (sc >= 1) {
  189. this.loadingBar.progress = sc;
  190. } else {
  191. this.loadingBar.progress = this._numCurrentLoaded / _totalNum;
  192. }
  193. } // else {
  194. // let idx = Math.floor(game.totalTime / 1000) % 3;
  195. // this.txtLoading.string = _loadingText[idx];
  196. // }
  197. }
  198. }, _class3.packId = void 0, _class3), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "loadingBar", [_dec2], {
  199. configurable: true,
  200. enumerable: true,
  201. writable: true,
  202. initializer: null
  203. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "ui_prefab", [_dec3], {
  204. configurable: true,
  205. enumerable: true,
  206. writable: true,
  207. initializer: null
  208. })), _class2)) || _class));
  209. _cclegacy._RF.pop();
  210. _crd = false;
  211. }
  212. };
  213. });
  214. //# sourceMappingURL=41297756668c0510f828032e1d12f96a4d1a9194.js.map