41297756668c0510f828032e1d12f96a4d1a9194.js 11 KB

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