DebugUI.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. var s,
  5. e =
  6. (this && this.__decorate) ||
  7. function (t, e, i, s) {
  8. var o,
  9. a = arguments.length,
  10. n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s;
  11. if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s);
  12. else
  13. for (var r = t.length - 1; 0 <= r; r--)
  14. (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n);
  15. return 3 < a && n && Object.defineProperty(e, i, n), n;
  16. },
  17. o =
  18. (this && this.__awaiter) ||
  19. function (t, n, r, l) {
  20. return new (r = r || Promise)(function (i, e) {
  21. function s(t) {
  22. try {
  23. a(l.next(t));
  24. } catch (t) {
  25. e(t);
  26. }
  27. }
  28. function o(t) {
  29. try {
  30. a(l.throw(t));
  31. } catch (t) {
  32. e(t);
  33. }
  34. }
  35. function a(t) {
  36. var e;
  37. t.done
  38. ? i(t.value)
  39. : ((e = t.value) instanceof r
  40. ? e
  41. : new r(function (t) {
  42. t(e);
  43. })
  44. ).then(s, o);
  45. }
  46. a((l = l.apply(t, n || [])).next());
  47. });
  48. };
  49. Object.defineProperty(i, "__esModule", {value: !0}), (i.DebugUI = void 0);
  50. const a = t("App"),
  51. n = t("List"),
  52. r = t("BaseView"),
  53. l = t("Toast"),
  54. h = t("ControllerConst"),
  55. c = t("NotificationConst"),
  56. d = (t("ViewConst"), t("BagController")),
  57. u = t("CostumeController"),
  58. p = t("BuffConst"),
  59. f = t("BuffMgr"),
  60. g = t("MyBigLong"),
  61. m = t("CurrencyService"),
  62. _ = t("MachineService"),
  63. y = t("MapService"),
  64. v = t("StageUpgradeService"),
  65. U = t("GuideModel"),
  66. {ccclass: Z, property: C} = cc._decorator;
  67. t = s = class extends r.default {
  68. constructor() {
  69. super(...arguments),
  70. (this.toggleBtn = null),
  71. (this.uiNode = null),
  72. (this.editBox1 = null),
  73. (this.debugNode = null),
  74. (this.isMove = !1),
  75. (this.itemList = null),
  76. (this.itemDatas = null),
  77. (this.tempNode = null);
  78. }
  79. initUI() {
  80. super.initUI(),
  81. (this.uiNode = this.node.getChildByName("uiNode")),
  82. (this.toggleBtn = this.node.getChildByName("toggleBtn").getComponent(cc.Toggle)),
  83. (this.uiNode.active = !1),
  84. this.toggleBtn.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
  85. }
  86. onAutoCollection(t, e) {
  87. a.default.SettingManager.autoCollection = t.isChecked ? 1 : 0;
  88. }
  89. removeAllPet() {}
  90. onChange() {
  91. this.uiNode.active = this.toggleBtn.isChecked;
  92. }
  93. onTouchMove(t) {
  94. t = this.toggleBtn.node.parent.convertToNodeSpaceAR(t.getLocation());
  95. (this.toggleBtn.node.position = t), (this.isMove = !0);
  96. }
  97. showFps() {
  98. cc.debug.setDisplayStats(!cc.debug.isDisplayStats());
  99. }
  100. onSaveData() {
  101. return o(this, void 0, void 0, function* () {
  102. a.default.Platform.saveData();
  103. });
  104. }
  105. showMap() {
  106. a.default.NotificationCenter.dispatch(s.SHOW_MAP);
  107. }
  108. onChangeIsDrawPhy() {}
  109. clearData() {
  110. return o(this, void 0, void 0, function* () {
  111. var t = a.default.GameDataMsr.playerInfo.token,
  112. e = a.default.GameDataMsr.playerInfo.timestamp;
  113. a.default.SaveManage.clear(),
  114. a.default.SaveManage.clearAllItem(),
  115. (a.default.GameDataMsr.playerInfo.token = null),
  116. t &&
  117. ((e = yield a.default.Http.post(
  118. a.default.ConfigManager.gameConf.serverInfos.interface + "/api/user/file",
  119. {api_token: t, file: a.default.StringUtil.zipStr(""), loginTime: e},
  120. 1
  121. )),
  122. (e = JSON.parse(e)),
  123. console.log("======清理存档:", e));
  124. });
  125. }
  126. onSubmitBtn(t) {
  127. const e = t.target.parent.getChildByName("EditBox").getComponent(cc.EditBox).string;
  128. var i;
  129. e &&
  130. (!(i = e.match(/(-?)(\d+)([a-z]{2}|M|K|T|B)?/)) ||
  131. (-1 !==
  132. (t = [
  133. "",
  134. "K",
  135. "M",
  136. "B",
  137. "T",
  138. "aa",
  139. "ab",
  140. "ac",
  141. "ad",
  142. "ae",
  143. "af",
  144. "ag",
  145. "ah",
  146. "ai",
  147. "aj",
  148. "ak",
  149. "al",
  150. "am",
  151. "an",
  152. "ao",
  153. "ap",
  154. "aq",
  155. "ar",
  156. "as",
  157. "at",
  158. "au",
  159. "av",
  160. "aw",
  161. "ax",
  162. "ay",
  163. "az",
  164. "ba",
  165. "bb",
  166. "bc",
  167. "bd",
  168. "be",
  169. "bf",
  170. "bg",
  171. "bh",
  172. "bi",
  173. "bj",
  174. "bk",
  175. "bl",
  176. "bm",
  177. "bn",
  178. "bo",
  179. "bp",
  180. "bq",
  181. "br",
  182. "bs",
  183. "bt",
  184. "bu",
  185. "bv",
  186. "bw",
  187. "bx",
  188. "by",
  189. "bz",
  190. "ca",
  191. "cb",
  192. "cc",
  193. "cd",
  194. "ce",
  195. "cf",
  196. "cg",
  197. "ch",
  198. "ci",
  199. "cj",
  200. "ck",
  201. "cl",
  202. "cm",
  203. "cn",
  204. "co",
  205. "cp",
  206. "cq",
  207. "cr",
  208. "cs",
  209. "ct",
  210. "cu",
  211. "cv",
  212. "cw",
  213. "cx",
  214. "cy",
  215. "cz"
  216. ].indexOf(i[3])) &&
  217. ((t = g.default.tempNum.init(parseInt(i[2]), 3 * t)),
  218. i[1]
  219. ? m.default.ins.checkMoneyEnough(t.value)
  220. ? m.default.ins.moneyChange(-t.value)
  221. : (m.default.ins.mapSaveData.money = 0)
  222. : m.default.ins.moneyChange(t.value),
  223. a.default.NotificationCenter.dispatch(c.NotificationConst.UPDATE_MONEY))));
  224. }
  225. addSupperBuff(t) {
  226. var t = t.target.parent.getChildByName("EditBox").getComponent(cc.EditBox),
  227. e = parseInt(t.string) || 60;
  228. for (const i in p.BuffIndex) {
  229. const s = parseInt(i);
  230. if (!isNaN(parseInt(i))) {
  231. let t = 400;
  232. p.BuffIndex.COOK_SPEED === s && (t = 20),
  233. f.default.ins.addGlobalBuff({
  234. buffIndex: s,
  235. buffValue: t,
  236. buffEndTime: a.default.DateUtils.Now() + 1e3 * e
  237. });
  238. }
  239. }
  240. }
  241. addDiamond(t) {
  242. (t = t.target.parent.getChildByName("EditBox").getComponent(cc.EditBox)), (t = parseInt(t.string));
  243. isNaN(t) || m.default.ins.diamondChange(t);
  244. }
  245. onOpenArchiveonMgrView() {
  246. a.default.ViewManager.open(5), (this.toggleBtn.isChecked = !this.toggleBtn.isChecked), this.onChange();
  247. }
  248. addItem(t) {
  249. var e = t.target.getChildByName("EditBox1").getComponent(cc.EditBox),
  250. t = t.target.getChildByName("EditBox2").getComponent(cc.EditBox),
  251. e = parseInt(e.string),
  252. t = parseInt(t.string);
  253. d.default.ins.addItem(e, t);
  254. }
  255. useItem(t) {
  256. var e = t.target.getChildByName("EditBox1").getComponent(cc.EditBox),
  257. t = t.target.getChildByName("EditBox2").getComponent(cc.EditBox),
  258. e = parseInt(e.string),
  259. t = parseInt(t.string);
  260. d.default.ins.useItem(e, t);
  261. }
  262. Skiptheboot() {
  263. a.default.ControllerManager.applyFunc(h.ControllerConst.Guide, U.GuideConst.SKIN_GUIDE, !0);
  264. }
  265. onTouchSendLog() {
  266. var t;
  267. return o(this, void 0, void 0, function* () {
  268. a.default.EasyLoading.showLoadingByTime(15),
  269. (yield Log.getInstance().sendToNative(
  270. null === (t = null === (t = a.default.GameDataMsr) || void 0 === t ? void 0 : t.playerInfo) ||
  271. void 0 === t
  272. ? void 0
  273. : t.id
  274. )) && l.default.launch("发送日志成功!"),
  275. a.default.EasyLoading.hideLoading();
  276. });
  277. }
  278. startRecordNodeTouch() {
  279. (this.toggleBtn.isChecked = !this.toggleBtn.isChecked),
  280. this.onChange(),
  281. a.default.ControllerManager.applyFunc(h.ControllerConst.Guide, U.GuideConst.START_RECORD);
  282. }
  283. stopRecordNodeTouch() {
  284. (this.toggleBtn.isChecked = !this.toggleBtn.isChecked),
  285. this.onChange(),
  286. a.default.ControllerManager.applyFunc(h.ControllerConst.Guide, U.GuideConst.STOP_RECORD);
  287. }
  288. playRecordNodeTouch(t, e) {
  289. (this.toggleBtn.isChecked = !this.toggleBtn.isChecked),
  290. this.onChange(),
  291. a.default.ControllerManager.applyFunc(h.ControllerConst.Guide, U.GuideConst.PLAY_RECORD);
  292. }
  293. onTouchStartGuideBtn() {
  294. var t = this.editBox1.string;
  295. a.default.ControllerManager.applyFunc(h.ControllerConst.Guide, U.GuideConst.OPEN_GUIDE, t ? parseInt(t) : null),
  296. (this.toggleBtn.isChecked = !this.toggleBtn.isChecked),
  297. this.onChange();
  298. }
  299. setGuideStep(t) {
  300. (t = t.target.getComponentInChildren(cc.EditBox)), (t = parseInt(t.string));
  301. isNaN(t) || a.default.ControllerManager.applyFunc(h.ControllerConst.Guide, U.GuideConst.SET_STEP, t);
  302. }
  303. hideDebugBtn() {
  304. this.debugNode.opacity = 0;
  305. }
  306. showDebugBtn() {
  307. this.debugNode.opacity = 100;
  308. }
  309. initItemList() {
  310. Log.trace("initItemList");
  311. var t = Object.values(
  312. MaterialController.ins.model.getServiceByType(MaterialType.SCENEITEM).getAllConfig()
  313. ).filter(t => {
  314. if (
  315. !(
  316. t.id.toFixed().startsWith("127") ||
  317. t.id.toFixed().startsWith("12097") ||
  318. t.id.toFixed().startsWith("12912") ||
  319. t.id.toFixed().startsWith("12913") ||
  320. t.id.toFixed().startsWith("12906") ||
  321. t.id.toFixed().startsWith("12999") ||
  322. t.id.toFixed().startsWith("12602")
  323. )
  324. )
  325. return t.id.toFixed().endsWith("001") || !t.isSynthetic ? t : void 0;
  326. });
  327. (this.itemDatas = t), (this.itemList.numItems = t.length);
  328. }
  329. onTouchAddItem(t, e) {
  330. let i = t.target.parent.getChildByName("EditBox").getComponent(cc.EditBox),
  331. s = parseInt(e),
  332. o = parseInt(i.string),
  333. a = new MaterialData();
  334. (a.id = s), (a.count = o), (a.type = Math.floor(s / 1e6)), MaterialController.ins.addMaterials([a]);
  335. }
  336. showItemList() {
  337. (this.itemList.node.parent.active = !this.itemList.node.parent.active),
  338. this.itemList.numItems || this.initItemList();
  339. }
  340. onRenderItem(t, e) {
  341. e = this.itemDatas[e];
  342. t.getChildByName("ItemLab").getComponent(cc.RichText).string = `${e.name}(${e.id})${e.quality}`;
  343. let i = t.getChildByName("AddButton").getComponent(cc.Button);
  344. t.getChildByName("icon").getComponent(MaterialShowIcon).setData(e.id, !1),
  345. (i.clickEvents[0].customEventData = e.id + "");
  346. }
  347. closeTimeCheck() {
  348. localStorage.setItem("TimeCheck", "1");
  349. }
  350. openTimeCheck() {
  351. localStorage.removeItem("TimeCheck");
  352. }
  353. onReStartGame() {
  354. a.default.Platform.resetGame();
  355. }
  356. onTestNotOrder(e) {
  357. return o(this, void 0, void 0, function* () {
  358. var t = e.target.parent.getChildByName("EditBox").getComponent(cc.EditBox),
  359. t = yield a.default.Http.requestAsync(
  360. a.default.ConfigManager.gameConf.serverInfos.interface + "/Interface/midas/not_received_order.php",
  361. {token: t.string}
  362. ),
  363. t = JSON.parse(t);
  364. if (0 === t.code) {
  365. const e = a.default.Platform.getProductConfigById(t.data[0].gid);
  366. console.log("+=========未消耗订单: ", t, e);
  367. }
  368. });
  369. }
  370. onTestRecharge(e) {
  371. return o(this, void 0, void 0, function* () {
  372. var t = e.target.parent.getChildByName("EditBox").getComponent(cc.EditBox);
  373. t.string && (a.default.Platform.playerSpendMoney = parseInt(t.string));
  374. });
  375. }
  376. onTouchRechargeToggle() {
  377. this.rechargeToggel.isChecked
  378. ? (cc.sys.localStorage.setItem("vipTest", "vip"), console.log("========不同步服务器充值额度"))
  379. : (cc.sys.localStorage.removeItem("vipTest"), console.log("========同步服务器充值额度"));
  380. }
  381. onEnterMap(t) {
  382. t = t.target.parent.getChildByName("EditBox").getComponent(cc.EditBox);
  383. Log.trace("box:", t.string), y.default.ins.loadMap(parseInt(t.string), !0);
  384. }
  385. onUnlockAllAbilityType(t) {
  386. v.default.ins.unlockAll();
  387. }
  388. addCostume(t) {
  389. var e = t.target.parent.getChildByName("EditBox1").getComponent(cc.EditBox),
  390. t = t.target.parent.getChildByName("EditBox2").getComponent(cc.EditBox),
  391. e = parseInt(e.string),
  392. t = parseInt(t.string);
  393. u.default.ins.createNewCostume(e, t);
  394. }
  395. showIdleRate(i) {
  396. return o(this, void 0, void 0, function* () {
  397. let t = i.target.parent.getChildByName("Label").getComponent(cc.Label),
  398. e = _.default.ins.getIdleRate();
  399. (t.string = e < 1e3 ? e.toString() : g.default.toString(e)), a.default.Platform.buy("test");
  400. });
  401. }
  402. };
  403. (t.className = "DebugUI"),
  404. (t.SHOW_MAP = "SHOW_MAP"),
  405. e([C(cc.EditBox)], t.prototype, "editBox1", void 0),
  406. e([C(cc.Node)], t.prototype, "debugNode", void 0),
  407. e([C({type: n.default})], t.prototype, "itemList", void 0),
  408. (t = s = e([Z], t)),
  409. (i.DebugUI = t = s);