index.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. System.register("chunks:///_virtual/Layout_UI_Notify.ts", ['./rollupPluginModLoBabelHelpers.js', 'cc'], function (exports) {
  2. var _applyDecoratedDescriptor, _inheritsLoose, _initializerDefineProperty, _assertThisInitialized, cclegacy, _decorator, Prefab, Component;
  3. return {
  4. setters: [function (module) {
  5. _applyDecoratedDescriptor = module.applyDecoratedDescriptor;
  6. _inheritsLoose = module.inheritsLoose;
  7. _initializerDefineProperty = module.initializerDefineProperty;
  8. _assertThisInitialized = module.assertThisInitialized;
  9. }, function (module) {
  10. cclegacy = module.cclegacy;
  11. _decorator = module._decorator;
  12. Prefab = module.Prefab;
  13. Component = module.Component;
  14. }],
  15. execute: function () {
  16. var _dec, _dec2, _class, _class2, _descriptor;
  17. cclegacy._RF.push({}, "5d1b6Q2UX5OU7Ky2+eYjUZG", "Layout_UI_Notify", undefined);
  18. var ccclass = _decorator.ccclass,
  19. property = _decorator.property;
  20. var Layout_UI_Notify = exports('Layout_UI_Notify', (_dec = ccclass('Layout_UI_Notify'), _dec2 = property(Prefab), _dec(_class = (_class2 = /*#__PURE__*/function (_Component) {
  21. _inheritsLoose(Layout_UI_Notify, _Component);
  22. function Layout_UI_Notify() {
  23. var _this;
  24. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  25. args[_key] = arguments[_key];
  26. }
  27. _this = _Component.call.apply(_Component, [this].concat(args)) || this;
  28. _initializerDefineProperty(_this, "info_prefab", _descriptor, _assertThisInitialized(_this));
  29. return _this;
  30. }
  31. return Layout_UI_Notify;
  32. }(Component), _descriptor = _applyDecoratedDescriptor(_class2.prototype, "info_prefab", [_dec2], {
  33. configurable: true,
  34. enumerable: true,
  35. writable: true,
  36. initializer: null
  37. }), _class2)) || _class));
  38. cclegacy._RF.pop();
  39. }
  40. };
  41. });
  42. System.register("chunks:///_virtual/Layout_UIAlert.ts", ['./rollupPluginModLoBabelHelpers.js', 'cc'], function (exports) {
  43. var _applyDecoratedDescriptor, _inheritsLoose, _initializerDefineProperty, _assertThisInitialized, cclegacy, _decorator, Label, Button, Component;
  44. return {
  45. setters: [function (module) {
  46. _applyDecoratedDescriptor = module.applyDecoratedDescriptor;
  47. _inheritsLoose = module.inheritsLoose;
  48. _initializerDefineProperty = module.initializerDefineProperty;
  49. _assertThisInitialized = module.assertThisInitialized;
  50. }, function (module) {
  51. cclegacy = module.cclegacy;
  52. _decorator = module._decorator;
  53. Label = module.Label;
  54. Button = module.Button;
  55. Component = module.Component;
  56. }],
  57. execute: function () {
  58. var _dec, _dec2, _dec3, _dec4, _class, _class2, _descriptor, _descriptor2, _descriptor3;
  59. cclegacy._RF.push({}, "6ecd6IlzI9HPLIIqQ4aHRcQ", "Layout_UIAlert", undefined);
  60. var ccclass = _decorator.ccclass,
  61. property = _decorator.property;
  62. var Layout_UIAlert = exports('Layout_UIAlert', (_dec = ccclass('Layout_UIAlert'), _dec2 = property(Label), _dec3 = property(Button), _dec4 = property(Button), _dec(_class = (_class2 = /*#__PURE__*/function (_Component) {
  63. _inheritsLoose(Layout_UIAlert, _Component);
  64. function Layout_UIAlert() {
  65. var _this;
  66. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  67. args[_key] = arguments[_key];
  68. }
  69. _this = _Component.call.apply(_Component, [this].concat(args)) || this;
  70. _initializerDefineProperty(_this, "title", _descriptor, _assertThisInitialized(_this));
  71. _initializerDefineProperty(_this, "btnOK", _descriptor2, _assertThisInitialized(_this));
  72. _initializerDefineProperty(_this, "btnCancel", _descriptor3, _assertThisInitialized(_this));
  73. return _this;
  74. }
  75. return Layout_UIAlert;
  76. }(Component), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "title", [_dec2], {
  77. configurable: true,
  78. enumerable: true,
  79. writable: true,
  80. initializer: null
  81. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "btnOK", [_dec3], {
  82. configurable: true,
  83. enumerable: true,
  84. writable: true,
  85. initializer: null
  86. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "btnCancel", [_dec4], {
  87. configurable: true,
  88. enumerable: true,
  89. writable: true,
  90. initializer: null
  91. })), _class2)) || _class));
  92. cclegacy._RF.pop();
  93. }
  94. };
  95. });
  96. System.register("chunks:///_virtual/Layout_UIWaiting.ts", ['./rollupPluginModLoBabelHelpers.js', 'cc'], function (exports) {
  97. var _applyDecoratedDescriptor, _inheritsLoose, _initializerDefineProperty, _assertThisInitialized, cclegacy, _decorator, Node, Label, Component;
  98. return {
  99. setters: [function (module) {
  100. _applyDecoratedDescriptor = module.applyDecoratedDescriptor;
  101. _inheritsLoose = module.inheritsLoose;
  102. _initializerDefineProperty = module.initializerDefineProperty;
  103. _assertThisInitialized = module.assertThisInitialized;
  104. }, function (module) {
  105. cclegacy = module.cclegacy;
  106. _decorator = module._decorator;
  107. Node = module.Node;
  108. Label = module.Label;
  109. Component = module.Component;
  110. }],
  111. execute: function () {
  112. var _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2;
  113. cclegacy._RF.push({}, "cf096mKKypBc5BOy11i+5NG", "Layout_UIWaiting", undefined);
  114. var ccclass = _decorator.ccclass,
  115. property = _decorator.property;
  116. var Layout_UIWaiting = exports('Layout_UIWaiting', (_dec = ccclass('tgxLayout_UIWaiting'), _dec2 = property(Node), _dec3 = property(Label), _dec(_class = (_class2 = /*#__PURE__*/function (_Component) {
  117. _inheritsLoose(Layout_UIWaiting, _Component);
  118. function Layout_UIWaiting() {
  119. var _this;
  120. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  121. args[_key] = arguments[_key];
  122. }
  123. _this = _Component.call.apply(_Component, [this].concat(args)) || this;
  124. _initializerDefineProperty(_this, "loadingIcon", _descriptor, _assertThisInitialized(_this));
  125. _initializerDefineProperty(_this, "loadingTxt", _descriptor2, _assertThisInitialized(_this));
  126. return _this;
  127. }
  128. return Layout_UIWaiting;
  129. }(Component), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "loadingIcon", [_dec2], {
  130. configurable: true,
  131. enumerable: true,
  132. writable: true,
  133. initializer: null
  134. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "loadingTxt", [_dec3], {
  135. configurable: true,
  136. enumerable: true,
  137. writable: true,
  138. initializer: null
  139. })), _class2)) || _class));
  140. cclegacy._RF.pop();
  141. }
  142. };
  143. });
  144. System.register("chunks:///_virtual/module_basic", ['./Layout_UIAlert.ts', './UIAlert.ts', './Layout_UI_Notify.ts', './UINotify.ts', './Layout_UIWaiting.ts', './UIWaiting.ts'], function () {
  145. return {
  146. setters: [null, null, null, null, null, null],
  147. execute: function () {}
  148. };
  149. });
  150. System.register("chunks:///_virtual/UIAlert.ts", ['./rollupPluginModLoBabelHelpers.js', 'cc', './ui.ts', './Wait.ts', './ModuleDef2.ts', './Layout_UIAlert.ts', './ui_base.ts'], function (exports) {
  151. var _inheritsLoose, _asyncToGenerator, _regeneratorRuntime, cclegacy, GameUILayers, gui, get_new_wait, ModuleDef, Layout_UIAlert, ui_base;
  152. return {
  153. setters: [function (module) {
  154. _inheritsLoose = module.inheritsLoose;
  155. _asyncToGenerator = module.asyncToGenerator;
  156. _regeneratorRuntime = module.regeneratorRuntime;
  157. }, function (module) {
  158. cclegacy = module.cclegacy;
  159. }, function (module) {
  160. GameUILayers = module.GameUILayers;
  161. gui = module.gui;
  162. }, function (module) {
  163. get_new_wait = module.default;
  164. }, function (module) {
  165. ModuleDef = module.ModuleDef;
  166. }, function (module) {
  167. Layout_UIAlert = module.Layout_UIAlert;
  168. }, function (module) {
  169. ui_base = module.default;
  170. }],
  171. execute: function () {
  172. cclegacy._RF.push({}, "7e91f8G1GtMQ4+Lvts9iEeD", "UIAlert", undefined);
  173. var UIAlert = exports('UIAlert', /*#__PURE__*/function (_ui_base) {
  174. _inheritsLoose(UIAlert, _ui_base);
  175. function UIAlert() {
  176. var _this;
  177. _this = _ui_base.call(this, ModuleDef.BASIC, 'ui_alert/UI_Alert', GameUILayers.ALERT, Layout_UIAlert) || this;
  178. _this.wait = get_new_wait();
  179. return _this;
  180. }
  181. /**
  182. * 显示一个选择提示
  183. * @param options title?:string 标题,content?:string内容,ok?:string 确认字,cancel?:string 取消字,show?:boolean是否显示取消
  184. * @returns 是否选择确定
  185. */
  186. UIAlert.show = /*#__PURE__*/
  187. function () {
  188. var _show = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
  189. var ui;
  190. return _regeneratorRuntime().wrap(function _callee$(_context) {
  191. while (1) switch (_context.prev = _context.next) {
  192. case 0:
  193. _context.next = 2;
  194. return gui.show(UIAlert);
  195. case 2:
  196. ui = _context.sent;
  197. _context.next = 5;
  198. return ui.await_choose(options);
  199. case 5:
  200. return _context.abrupt("return", _context.sent);
  201. case 6:
  202. case "end":
  203. return _context.stop();
  204. }
  205. }, _callee);
  206. }));
  207. function show(_x) {
  208. return _show.apply(this, arguments);
  209. }
  210. return show;
  211. }();
  212. var _proto = UIAlert.prototype;
  213. _proto.onCreated = function onCreated() {
  214. var _this2 = this;
  215. var layout = this.getLayout();
  216. this.onButtonEvent(layout.btnOK, function () {
  217. _this2.wait.resolve(true);
  218. _this2.close();
  219. });
  220. this.onButtonEvent(layout.btnCancel, function () {
  221. _this2.wait.resolve(false);
  222. _this2.close();
  223. });
  224. };
  225. _proto.onDispose = function onDispose() {
  226. this.wait.resolve(false);
  227. this.wait.dispose();
  228. this.wait = null;
  229. };
  230. _proto.await_choose = /*#__PURE__*/function () {
  231. var _await_choose = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
  232. var layout;
  233. return _regeneratorRuntime().wrap(function _callee2$(_context2) {
  234. while (1) switch (_context2.prev = _context2.next) {
  235. case 0:
  236. layout = this.getLayout();
  237. layout.title.string = options.title || '提示';
  238. layout.btnCancel.node.active = options.show;
  239. return _context2.abrupt("return", this.wait.wait());
  240. case 4:
  241. case "end":
  242. return _context2.stop();
  243. }
  244. }, _callee2, this);
  245. }));
  246. function await_choose(_x2) {
  247. return _await_choose.apply(this, arguments);
  248. }
  249. return await_choose;
  250. }();
  251. return UIAlert;
  252. }(ui_base));
  253. cclegacy._RF.pop();
  254. }
  255. };
  256. });
  257. System.register("chunks:///_virtual/UINotify.ts", ['./rollupPluginModLoBabelHelpers.js', 'cc', './Layout_UI_Notify.ts', './ui.ts', './ModuleDef.ts', './ui_base.ts'], function (exports) {
  258. var _inheritsLoose, _asyncToGenerator, _regeneratorRuntime, cclegacy, instantiate, Label, math, Layout_UI_Notify, GameUILayers, gui, ModuleDef, ui_base;
  259. return {
  260. setters: [function (module) {
  261. _inheritsLoose = module.inheritsLoose;
  262. _asyncToGenerator = module.asyncToGenerator;
  263. _regeneratorRuntime = module.regeneratorRuntime;
  264. }, function (module) {
  265. cclegacy = module.cclegacy;
  266. instantiate = module.instantiate;
  267. Label = module.Label;
  268. math = module.math;
  269. }, function (module) {
  270. Layout_UI_Notify = module.Layout_UI_Notify;
  271. }, function (module) {
  272. GameUILayers = module.GameUILayers;
  273. gui = module.gui;
  274. }, function (module) {
  275. ModuleDef = module.ModuleDef;
  276. }, function (module) {
  277. ui_base = module.default;
  278. }],
  279. execute: function () {
  280. cclegacy._RF.push({}, "2e622idLyVJBYf//0497gj2", "UINotify", undefined);
  281. var NotifyInfo = /*#__PURE__*/function () {
  282. function NotifyInfo(node, parent, txt) {
  283. //正常大小
  284. this.time = void 0;
  285. this.node = void 0;
  286. this.state = void 0;
  287. this._state_time = 0;
  288. this.time = NotifyInfo.time;
  289. this.node = node;
  290. this.state = 0;
  291. this._state_time = 0;
  292. var label = node.getComponentInChildren(Label);
  293. label.string = txt;
  294. node.parent = parent;
  295. node.setPosition(0, NotifyInfo.init_y, 0);
  296. node.setScale(NotifyInfo.sc_state0, NotifyInfo.sc_state0, NotifyInfo.sc_state0);
  297. node.active = true;
  298. }
  299. var _proto = NotifyInfo.prototype;
  300. _proto.up = function up() {
  301. // this.node.setPosition(this.node.position.x, this.node.position.y + NotifyInfo.up_y, this.node.position.z);
  302. };
  303. _proto.run = function run(dt) {
  304. this.time -= dt;
  305. if (this.time <= 0) {
  306. this.node.destroy();
  307. this.node = null;
  308. return true;
  309. } else if (this.time < 0.5) ;else {
  310. if (this.state === 0) {
  311. this._state_time += dt;
  312. var ratio = this._state_time / NotifyInfo.sc_state0_time;
  313. if (ratio >= 1) {
  314. this.state = 1;
  315. this._state_time = 0;
  316. this.node.setScale(NotifyInfo.sc_state1, NotifyInfo.sc_state1, NotifyInfo.sc_state1);
  317. } else {
  318. var sc = math.lerp(NotifyInfo.sc_state0, NotifyInfo.sc_state1, ratio);
  319. this.node.setScale(sc, sc, sc);
  320. }
  321. } else if (this.state === 1) {
  322. this._state_time += dt;
  323. var _ratio = this._state_time / NotifyInfo.sc_state1_time;
  324. if (_ratio >= 1) {
  325. this.state = 2;
  326. this._state_time = 0;
  327. this.node.setScale(NotifyInfo.sc_state2, NotifyInfo.sc_state2, NotifyInfo.sc_state2);
  328. } else {
  329. var _sc = math.lerp(NotifyInfo.sc_state1, NotifyInfo.sc_state2, _ratio);
  330. this.node.setScale(_sc, _sc, _sc);
  331. }
  332. }
  333. }
  334. return false;
  335. };
  336. return NotifyInfo;
  337. }();
  338. NotifyInfo.time = 2;
  339. NotifyInfo.init_y = 120;
  340. NotifyInfo.up_y = 80;
  341. //上升一格
  342. NotifyInfo.move_speed = 880;
  343. //向上移动速度
  344. NotifyInfo.sc_state0 = 0.8;
  345. //变小大小
  346. NotifyInfo.sc_state0_time = 0.22;
  347. NotifyInfo.sc_state1 = 1.2;
  348. //变大大小
  349. NotifyInfo.sc_state1_time = 0.41;
  350. NotifyInfo.sc_state2 = 1;
  351. var UINotify = exports('UINotify', /*#__PURE__*/function (_ui_base) {
  352. _inheritsLoose(UINotify, _ui_base);
  353. function UINotify() {
  354. var _this;
  355. _this = _ui_base.call(this, ModuleDef.BASIC, 'ui_notify/UI_Notify', GameUILayers.NOTICE, Layout_UI_Notify) || this;
  356. _this._info_prefab = void 0;
  357. _this.notifys = [];
  358. return _this;
  359. }
  360. UINotify.show = /*#__PURE__*/function () {
  361. var _show = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(msg) {
  362. var ui;
  363. return _regeneratorRuntime().wrap(function _callee$(_context) {
  364. while (1) switch (_context.prev = _context.next) {
  365. case 0:
  366. ui = gui.get(UINotify);
  367. if (ui) {
  368. _context.next = 5;
  369. break;
  370. }
  371. _context.next = 4;
  372. return gui.show(UINotify);
  373. case 4:
  374. ui = _context.sent;
  375. case 5:
  376. ui.newNotify(msg);
  377. case 6:
  378. case "end":
  379. return _context.stop();
  380. }
  381. }, _callee);
  382. }));
  383. function show(_x) {
  384. return _show.apply(this, arguments);
  385. }
  386. return show;
  387. }();
  388. var _proto2 = UINotify.prototype;
  389. _proto2.onCreated = function onCreated() {
  390. var layout = this.getLayout();
  391. this._info_prefab = layout.info_prefab;
  392. };
  393. _proto2.newNotify = function newNotify(txt) {
  394. var info = new NotifyInfo(instantiate(this._info_prefab), this.node, txt);
  395. for (var i = this.notifys.length - 1; i >= 0; i--) this.notifys[i].up();
  396. this.notifys.push(info);
  397. };
  398. _proto2.onUpdate = function onUpdate(dt) {
  399. for (var i = this.notifys.length - 1; i >= 0; i--) if (this.notifys[i].run(dt)) this.notifys.splice(i, 1);
  400. };
  401. _proto2.dispose = function dispose() {
  402. this._info_prefab = null;
  403. };
  404. return UINotify;
  405. }(ui_base));
  406. cclegacy._RF.pop();
  407. }
  408. };
  409. });
  410. System.register("chunks:///_virtual/UIWaiting.ts", ['./rollupPluginModLoBabelHelpers.js', 'cc', './ui.ts', './ModuleDef2.ts', './Layout_UIWaiting.ts', './ui_base.ts'], function (exports) {
  411. var _inheritsLoose, cclegacy, GameUILayers, gui, ModuleDef, Layout_UIWaiting, ui_base;
  412. return {
  413. setters: [function (module) {
  414. _inheritsLoose = module.inheritsLoose;
  415. }, function (module) {
  416. cclegacy = module.cclegacy;
  417. }, function (module) {
  418. GameUILayers = module.GameUILayers;
  419. gui = module.gui;
  420. }, function (module) {
  421. ModuleDef = module.ModuleDef;
  422. }, function (module) {
  423. Layout_UIWaiting = module.Layout_UIWaiting;
  424. }, function (module) {
  425. ui_base = module.default;
  426. }],
  427. execute: function () {
  428. cclegacy._RF.push({}, "0dda6mQNCdCo5GQ959qF/Db", "UIWaiting", undefined);
  429. var loadingTxtArr = ['.', '..', '...'];
  430. var _inst = null;
  431. var UIWaiting = exports('UIWaiting', /*#__PURE__*/function (_ui_base) {
  432. _inheritsLoose(UIWaiting, _ui_base);
  433. function UIWaiting() {
  434. var _this;
  435. _this = _ui_base.call(this, ModuleDef.BASIC, 'ui_waiting/UI_Waiting', GameUILayers.LOADING, Layout_UIWaiting) || this;
  436. _this._contentStr = 'Loading';
  437. return _this;
  438. }
  439. var _proto = UIWaiting.prototype;
  440. _proto.onCreated = function onCreated() {};
  441. UIWaiting.show = function show(contentStr) {
  442. if (!_inst) {
  443. gui.show(UIWaiting).then(function (ui) {
  444. _inst = ui;
  445. });
  446. }
  447. _inst._contentStr = contentStr || 'Loading';
  448. return _inst;
  449. };
  450. UIWaiting.hide = function hide() {
  451. if (_inst) {
  452. _inst.close();
  453. _inst = null;
  454. }
  455. };
  456. _proto.onUpdate = function onUpdate() {
  457. var layout = this.layout;
  458. if (layout.loadingIcon) {
  459. var euler = layout.loadingIcon.eulerAngles;
  460. var rot = Date.now() / 1000 * 90;
  461. layout.loadingIcon.setRotationFromEuler(euler.x, euler.y, rot);
  462. }
  463. if (layout.loadingTxt) {
  464. var idx = Math.floor(Date.now() / 500) % 3;
  465. layout.loadingTxt.string = this._contentStr + loadingTxtArr[idx];
  466. }
  467. };
  468. _proto.onDispose = function onDispose() {
  469. _inst = null;
  470. };
  471. return UIWaiting;
  472. }(ui_base));
  473. cclegacy._RF.pop();
  474. }
  475. };
  476. });
  477. (function(r) {
  478. r('virtual:///prerequisite-imports/module_basic', 'chunks:///_virtual/module_basic');
  479. })(function(mid, cid) {
  480. System.register(mid, [cid], function (_export, _context) {
  481. return {
  482. setters: [function(_m) {
  483. var _exportObj = {};
  484. for (var _key in _m) {
  485. if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key];
  486. }
  487. _export(_exportObj);
  488. }],
  489. execute: function () { }
  490. };
  491. });
  492. });