2efeef402d71ac0671decf5095bbb112f5b4027a.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5", "__unresolved_6", "__unresolved_7", "__unresolved_8", "__unresolved_9", "__unresolved_10", "__unresolved_11", "__unresolved_12"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Node, Label, Animation, List, Utils, MsgHints, userIns, BaseExp, autoBind, Constants, uiMgr, TaskItem, stateMgr, Game, i18n, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _crd, ccclass, property, Main;
  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 _reportPossibleCrUseOfList(extras) {
  8. _reporterNs.report("List", "../third/List", _context.meta, extras);
  9. }
  10. function _reportPossibleCrUseOfUtils(extras) {
  11. _reporterNs.report("Utils", "../utils/Utils", _context.meta, extras);
  12. }
  13. function _reportPossibleCrUseOfMsgHints(extras) {
  14. _reporterNs.report("MsgHints", "../utils/MsgHints", _context.meta, extras);
  15. }
  16. function _reportPossibleCrUseOfuserIns(extras) {
  17. _reporterNs.report("userIns", "../data/UserData", _context.meta, extras);
  18. }
  19. function _reportPossibleCrUseOfBaseExp(extras) {
  20. _reporterNs.report("BaseExp", "../core/base/BaseExp", _context.meta, extras);
  21. }
  22. function _reportPossibleCrUseOfautoBind(extras) {
  23. _reporterNs.report("autoBind", "../extend/AutoBind", _context.meta, extras);
  24. }
  25. function _reportPossibleCrUseOfConstants(extras) {
  26. _reporterNs.report("Constants", "../data/Constants", _context.meta, extras);
  27. }
  28. function _reportPossibleCrUseOfuiMgr(extras) {
  29. _reporterNs.report("uiMgr", "../core/manager/UIManager", _context.meta, extras);
  30. }
  31. function _reportPossibleCrUseOfTaskItem(extras) {
  32. _reporterNs.report("TaskItem", "../items/item/TaskItem", _context.meta, extras);
  33. }
  34. function _reportPossibleCrUseOfstateMgr(extras) {
  35. _reporterNs.report("stateMgr", "../core/manager/StateManager", _context.meta, extras);
  36. }
  37. function _reportPossibleCrUseOfGame(extras) {
  38. _reporterNs.report("Game", "../game/Game", _context.meta, extras);
  39. }
  40. function _reportPossibleCrUseOfi18n(extras) {
  41. _reporterNs.report("i18n", "../core/i18n/runtime-scripts/LanguageData", _context.meta, extras);
  42. }
  43. return {
  44. setters: [function (_unresolved_) {
  45. _reporterNs = _unresolved_;
  46. }, function (_cc) {
  47. _cclegacy = _cc.cclegacy;
  48. __checkObsolete__ = _cc.__checkObsolete__;
  49. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  50. _decorator = _cc._decorator;
  51. Node = _cc.Node;
  52. Label = _cc.Label;
  53. Animation = _cc.Animation;
  54. }, function (_unresolved_2) {
  55. List = _unresolved_2.default;
  56. }, function (_unresolved_3) {
  57. Utils = _unresolved_3.Utils;
  58. }, function (_unresolved_4) {
  59. MsgHints = _unresolved_4.default;
  60. }, function (_unresolved_5) {
  61. userIns = _unresolved_5.userIns;
  62. }, function (_unresolved_6) {
  63. BaseExp = _unresolved_6.BaseExp;
  64. }, function (_unresolved_7) {
  65. autoBind = _unresolved_7.autoBind;
  66. }, function (_unresolved_8) {
  67. Constants = _unresolved_8.Constants;
  68. }, function (_unresolved_9) {
  69. uiMgr = _unresolved_9.uiMgr;
  70. }, function (_unresolved_10) {
  71. TaskItem = _unresolved_10.TaskItem;
  72. }, function (_unresolved_11) {
  73. stateMgr = _unresolved_11.stateMgr;
  74. }, function (_unresolved_12) {
  75. Game = _unresolved_12.Game;
  76. }, function (_unresolved_13) {
  77. i18n = _unresolved_13.default;
  78. }],
  79. execute: function () {
  80. _crd = true;
  81. _cclegacy._RF.push({}, "534c6zwQJ5OqoEYReOC1WY6", "Main", undefined);
  82. __checkObsolete__(['_decorator', 'EventTouch', 'Node', 'Label', 'Animation', 'Vec3']);
  83. ({
  84. ccclass,
  85. property
  86. } = _decorator);
  87. _export("Main", Main = (_dec = ccclass('Main'), _dec2 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  88. error: Error()
  89. }), autoBind) : autoBind)({
  90. type: Label,
  91. tooltip: "金币文本"
  92. }), _dec3 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  93. error: Error()
  94. }), autoBind) : autoBind)({
  95. type: Label,
  96. tooltip: "钻石文本"
  97. }), _dec4 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  98. error: Error()
  99. }), autoBind) : autoBind)({
  100. type: Label,
  101. tooltip: "任务描述"
  102. }), _dec5 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  103. error: Error()
  104. }), autoBind) : autoBind)({
  105. type: Label,
  106. tooltip: "关卡等级"
  107. }), _dec6 = (_crd && autoBind === void 0 ? (_reportPossibleCrUseOfautoBind({
  108. error: Error()
  109. }), autoBind) : autoBind)({
  110. type: _crd && List === void 0 ? (_reportPossibleCrUseOfList({
  111. error: Error()
  112. }), List) : List,
  113. tooltip: "任务数据"
  114. }), _dec7 = property({
  115. type: Animation,
  116. tooltip: "进入游戏动画"
  117. }), _dec8 = property({
  118. type: [Node],
  119. tooltip: "动画位置节点数组"
  120. }), _dec(_class = (_class2 = class Main extends (_crd && BaseExp === void 0 ? (_reportPossibleCrUseOfBaseExp({
  121. error: Error()
  122. }), BaseExp) : BaseExp) {
  123. constructor() {
  124. super(...arguments);
  125. _initializerDefineProperty(this, "gold_lable", _descriptor, this);
  126. _initializerDefineProperty(this, "diamond_lable", _descriptor2, this);
  127. _initializerDefineProperty(this, "task_des_lable", _descriptor3, this);
  128. _initializerDefineProperty(this, "level_lable", _descriptor4, this);
  129. _initializerDefineProperty(this, "task_scrollView", _descriptor5, this);
  130. _initializerDefineProperty(this, "enterAnim", _descriptor6, this);
  131. _initializerDefineProperty(this, "animPosArr", _descriptor7, this);
  132. //所有主要页面
  133. this.sceneNames = [(_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  134. error: Error()
  135. }), Constants) : Constants).mainUIs.main];
  136. //tabBars数组下标
  137. this._tabBarIndex = -1;
  138. //保存点击的页面
  139. this.preIndexs = [0];
  140. //任务数据
  141. this.taskDatas = [];
  142. //属性存储初始位置
  143. this.originalPositions = [];
  144. }
  145. set tabBarIndex(index) {
  146. this.cutTabBarIndex(null, index);
  147. }
  148. get tabBarIndex() {
  149. return this._tabBarIndex;
  150. }
  151. start() {
  152. this.hasAnim = false;
  153. this.closeOnBlank = false; //存储初始位置到类属性
  154. this.originalPositions = this.animPosArr.map(e => e.position.clone());
  155. (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  156. error: Error()
  157. }), uiMgr) : uiMgr).panels.set((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  158. error: Error()
  159. }), Constants) : Constants).mainUIs.main, this.node); //注册动态变化值
  160. (_crd && stateMgr === void 0 ? (_reportPossibleCrUseOfstateMgr({
  161. error: Error()
  162. }), stateMgr) : stateMgr).registerUI((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  163. error: Error()
  164. }), Constants) : Constants).gold, this.gold_lable);
  165. (_crd && stateMgr === void 0 ? (_reportPossibleCrUseOfstateMgr({
  166. error: Error()
  167. }), stateMgr) : stateMgr).registerUI((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  168. error: Error()
  169. }), Constants) : Constants).diamond, this.diamond_lable); //加载数据
  170. this.loadData(); //注册事件
  171. this.node.on(Node.EventType.TOUCH_START, this.playBtn.bind(this), this);
  172. }
  173. /**
  174. * 加载数据
  175. */
  176. loadData() {
  177. var data = (_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  178. error: Error()
  179. }), userIns) : userIns).getCurLevelData();
  180. if (!data) return; //设置任务描述关卡任务:%{value}
  181. this.task_des_lable.string = (_crd && i18n === void 0 ? (_reportPossibleCrUseOfi18n({
  182. error: Error()
  183. }), i18n) : i18n).isZh ? data.task : data.task_lang;
  184. this.level_lable.string = (_crd && i18n === void 0 ? (_reportPossibleCrUseOfi18n({
  185. error: Error()
  186. }), i18n) : i18n)("main.关卡任务:%{value}", {
  187. value: data.id
  188. });
  189. this.taskDatas = []; //拆分并处理每个敌人配置
  190. data.dispose.split('|').forEach(item => {
  191. var [enemyId, count] = item.split('_').map(Number);
  192. var enemyData = (_crd && Utils === void 0 ? (_reportPossibleCrUseOfUtils({
  193. error: Error()
  194. }), Utils) : Utils).clone((_crd && userIns === void 0 ? (_reportPossibleCrUseOfuserIns({
  195. error: Error()
  196. }), userIns) : userIns).enemyTable).find(e => e.id === enemyId);
  197. enemyData.count = count;
  198. this.taskDatas.push(enemyData);
  199. });
  200. if (this.taskDatas.length <= 0) return;
  201. this.task_scrollView.numItems = this.taskDatas.length;
  202. }
  203. /**
  204. * 任务数据
  205. * @param item item节点
  206. * @param idx 数据下标
  207. */
  208. setTaskItemData(item, idx) {
  209. var task = this.taskDatas[idx];
  210. item.getComponent(_crd && TaskItem === void 0 ? (_reportPossibleCrUseOfTaskItem({
  211. error: Error()
  212. }), TaskItem) : TaskItem).init(task);
  213. }
  214. /**
  215. * 开始游戏
  216. */
  217. playBtn() {
  218. this.enterAnim.play();
  219. this.scheduleOnce(() => {
  220. (_crd && Game === void 0 ? (_reportPossibleCrUseOfGame({
  221. error: Error()
  222. }), Game) : Game).I.isPause = false;
  223. (_crd && Game === void 0 ? (_reportPossibleCrUseOfGame({
  224. error: Error()
  225. }), Game) : Game).I.isGameOver = false;
  226. (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  227. error: Error()
  228. }), uiMgr) : uiMgr).hide((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  229. error: Error()
  230. }), Constants) : Constants).mainUIs.main, () => {
  231. (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  232. error: Error()
  233. }), uiMgr) : uiMgr).show((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  234. error: Error()
  235. }), Constants) : Constants).popUIs.gunfightShootUI);
  236. }); //加载敌人
  237. (_crd && Game === void 0 ? (_reportPossibleCrUseOfGame({
  238. error: Error()
  239. }), Game) : Game).I.buildEnemys.loadLevelEnemys();
  240. }, 0.4);
  241. }
  242. /**
  243. * 点击事件
  244. * @param event 事件
  245. * @param customEventData 数据
  246. */
  247. onBtnClicked(event, customEventData) {
  248. super.onBtnClicked(event, customEventData);
  249. var btnName = event.target.name;
  250. if (btnName === 'set_btn') {
  251. // 设置页面
  252. (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  253. error: Error()
  254. }), uiMgr) : uiMgr).show((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  255. error: Error()
  256. }), Constants) : Constants).popUIs.settingUI);
  257. } else if (btnName === 'shop_btn') {
  258. //商店
  259. (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  260. error: Error()
  261. }), uiMgr) : uiMgr).show((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  262. error: Error()
  263. }), Constants) : Constants).popUIs.storeUI);
  264. } else if (btnName === 'arsenal_btn') {
  265. //武器库
  266. (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  267. error: Error()
  268. }), uiMgr) : uiMgr).show((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  269. error: Error()
  270. }), Constants) : Constants).popUIs.arsenalUI);
  271. } else if (btnName === 'boomerang_btn') {
  272. //扔飞镖
  273. (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  274. error: Error()
  275. }), uiMgr) : uiMgr).show((_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  276. error: Error()
  277. }), Constants) : Constants).popUIs.tossBoomerangUI);
  278. } else if (btnName === 'ads_free_btn') {
  279. //免广告按钮
  280. (_crd && MsgHints === void 0 ? (_reportPossibleCrUseOfMsgHints({
  281. error: Error()
  282. }), MsgHints) : MsgHints).show('免广告按钮');
  283. } else if (btnName === 'bulls_eye_btn') {
  284. //准心开始按钮
  285. this.playBtn();
  286. }
  287. }
  288. /**
  289. * 切换游戏主页面
  290. * @param idx
  291. */
  292. cutTabBarIndex(event, param) {
  293. var index = parseInt(param);
  294. this._tabBarIndex = index;
  295. this.preIndexs.push(index); //设置层级
  296. var path = this.sceneNames[index];
  297. if (path == (_crd && Constants === void 0 ? (_reportPossibleCrUseOfConstants({
  298. error: Error()
  299. }), Constants) : Constants).mainUIs.main) {
  300. this.animPosArr.forEach((e, index) => e.position = this.originalPositions[index]);
  301. } //加载页面
  302. (_crd && uiMgr === void 0 ? (_reportPossibleCrUseOfuiMgr({
  303. error: Error()
  304. }), uiMgr) : uiMgr).show(path);
  305. if (this.preIndexs.length > 2) {
  306. this.preIndexs.shift();
  307. }
  308. }
  309. }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "gold_lable", [_dec2], {
  310. configurable: true,
  311. enumerable: true,
  312. writable: true,
  313. initializer: null
  314. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "diamond_lable", [_dec3], {
  315. configurable: true,
  316. enumerable: true,
  317. writable: true,
  318. initializer: null
  319. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "task_des_lable", [_dec4], {
  320. configurable: true,
  321. enumerable: true,
  322. writable: true,
  323. initializer: null
  324. }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "level_lable", [_dec5], {
  325. configurable: true,
  326. enumerable: true,
  327. writable: true,
  328. initializer: null
  329. }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "task_scrollView", [_dec6], {
  330. configurable: true,
  331. enumerable: true,
  332. writable: true,
  333. initializer: null
  334. }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "enterAnim", [_dec7], {
  335. configurable: true,
  336. enumerable: true,
  337. writable: true,
  338. initializer: null
  339. }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "animPosArr", [_dec8], {
  340. configurable: true,
  341. enumerable: true,
  342. writable: true,
  343. initializer: function initializer() {
  344. return [];
  345. }
  346. })), _class2)) || _class));
  347. _cclegacy._RF.pop();
  348. _crd = false;
  349. }
  350. };
  351. });
  352. //# sourceMappingURL=2efeef402d71ac0671decf5095bbb112f5b4027a.js.map