ServerHandler.ts 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. /*
  2. * @Author: mojunshou 1637302775@qq.com
  3. * @Date: 2025-04-11 10:16:41
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-04-25 18:14:33
  6. * @Description:
  7. */
  8. // ServerHandler.ts
  9. import { smc } from '../SingletonModuleComp';
  10. import { GameEvent } from '../config/GameEvent';
  11. import { oops } from 'db://oops-framework/core/Oops';
  12. import { CocosHandler, CocosHandlerType } from './CocosHandler';
  13. import { ProtocolEvent } from './ProtocolEvent';
  14. import { DCHandler } from './DCHandler';
  15. export class ServerHandler {
  16. private static _inst: ServerHandler;
  17. public static get inst(): ServerHandler {
  18. if (!this._inst) {
  19. this._inst = new ServerHandler();
  20. }
  21. return this._inst;
  22. }
  23. private buildCallback(success: string, fail?: string) {
  24. const callback: any = { onSuccess: success };
  25. if (fail) callback.onFail = fail;
  26. return callback;
  27. }
  28. async sendMsgToServer(param: any) {
  29. const data: CocosHandlerType = {
  30. method: 'request.post',
  31. param: JSON.stringify(param)
  32. };
  33. return await CocosHandler.inst.sendMessageToAndroid(data, '服务器请求');
  34. }
  35. //微信登录
  36. wxLogin(code: string) {
  37. const param = {
  38. url: ProtocolEvent.WechatLogin,
  39. param: {
  40. code: code
  41. },
  42. callback: this.buildCallback('ServerHandler.inst.onWxLoginInfo', 'ServerHandler.inst.onRequestFail')
  43. };
  44. this.sendMsgToServer(param);
  45. }
  46. onWxLoginInfo(str: string) {
  47. console.log('[服务器] 微信登录返回', str);
  48. // let
  49. this.getAccountInfo();
  50. }
  51. getAccountInfo() {
  52. const param = {
  53. url: ProtocolEvent.AccountInfo,
  54. callback: this.buildCallback('ServerHandler.inst.onAccountInfo', 'ServerHandler.inst.onRequestFail')
  55. };
  56. this.sendMsgToServer(param);
  57. }
  58. onAccountInfo(str: string) {
  59. console.log('[服务器] 获取账号信息返回', str);
  60. const data = JSON.parse(str);
  61. const account = smc.account.AccountModel;
  62. const game = smc.game.GameModel;
  63. account.uid = data.uid;
  64. account.accountName = data.nickname;
  65. account.headUrl = data.headImgUrl;
  66. account.isLogined = data.isBand;
  67. account.curLevel = data.currentLevelInfo.level || 0;
  68. game.curScore = data.currentLevelInfo.score || 0;
  69. game.targetScore = data.currentLevelConf.score || 0;
  70. game.curLevelConfig = data.currentLevelConf;
  71. game.costInfo = data.handlingChargeConf;
  72. game.eventType = data.currentLevelConf.eventType || "";
  73. game.popupType = data.currentLevelConf.popupType || "";
  74. account.wxCoin = data.props['1005'];
  75. account.hbCoin = data.props['1004'];
  76. account.goldCoin = data.props['1006'];
  77. game.popupShow = data.currentLevelInfo.popupStatus
  78. game.skipAdConfig = data.currentLevelConf.skipCount || -1;
  79. oops.message.dispatchEvent(GameEvent.UserLogin);
  80. }
  81. getDailyReward(level: number) {
  82. const param = {
  83. url: ProtocolEvent.GetDailyReward,
  84. param: {
  85. level: level
  86. },
  87. callback: this.buildCallback('ServerHandler.inst.onDailyReward', 'ServerHandler.inst.onRequestFail')
  88. };
  89. this.sendMsgToServer(param);
  90. }
  91. onDailyReward(str: string) {
  92. console.log('[服务器] 每日奖励返回', str);
  93. let result = JSON.parse(str);
  94. smc.account.AccountModel.hbCoin = result.props["1004"];
  95. smc.account.AccountModel.xcCount = result.props["1007"]; //消除次数
  96. smc.account.AccountModel.goldCoin = result.props["1006"] //金砖数量
  97. smc.game.GameModel.wxCash = result.money;
  98. //status2在最后1在最前边0排第二
  99. let taskList = result.taskList.sort((a: any, b: any) => {
  100. if (a.status === 1 && b.status !== 1) return -1; // a 在前
  101. })
  102. smc.game.GameModel.taskList = taskList;
  103. oops.message.dispatchEvent(GameEvent.updateRedPackeTaskList);
  104. }
  105. //获取红包页信息
  106. getHbTxInfo() {
  107. const param = {
  108. url: ProtocolEvent.GetHbWithdrawInfo,
  109. callback: this.buildCallback('ServerHandler.inst.onHbTxInfo', 'ServerHandler.instonRequestFail')
  110. };
  111. this.sendMsgToServer(param);
  112. }
  113. onHbTxInfo(str: string) {
  114. console.log('[服务器] 获取红包页面信息返回', str);
  115. let result = JSON.parse(str);
  116. smc.account.AccountModel.hbCoin = result.props["1004"] || 0;
  117. smc.account.AccountModel.xcCount = result.props["1007"] || 0; //消除次数
  118. smc.account.AccountModel.goldCoin = result.props["1006"] || 0; //金砖数量
  119. //要根据taskList的status排序,可领取再在前边,领取完在最后0 进行中 1 可领取 2已经领取
  120. let taskList = result.taskList.sort((a: any, b: any) => {
  121. if (a.status === 1 && b.status !== 1) return -1; // a 在前
  122. })
  123. smc.game.GameModel.taskList = taskList;
  124. smc.game.GameModel.wxCash = result.money;
  125. oops.message.dispatchEvent(GameEvent.openView, "openRedBagView");
  126. }
  127. //获取用户信息
  128. getUserItemInfo() {
  129. const param = {
  130. url: ProtocolEvent.UserItemInfo,
  131. callback: this.buildCallback('ServerHandler.inst.onUserItemInfo', 'ServerHandler.instonRequestFail')
  132. };
  133. this.sendMsgToServer(param);
  134. }
  135. onUserItemInfo(str: string) {
  136. const result = JSON.parse(str);
  137. const props = result.data.props;
  138. const account = smc.account.AccountModel;
  139. const game = smc.game.GameModel;
  140. account.wxCoin = props['1005'] || 0;
  141. account.hbCoin = props['1004'] || 0;
  142. account.goldCoin = props['1006'] || 0;
  143. game.handlingCharge = props['1009'] || 0;
  144. //返回成功才登录
  145. }
  146. //获取提现记录
  147. getRecordList() {
  148. const param = {
  149. url: ProtocolEvent.GetWithdrawRecord,
  150. param: {
  151. offset: 0,
  152. limit: 10
  153. },
  154. callback: this.buildCallback('ServerHandler.inst.onRecordList', 'ServerHandler.inst.onRequestFail')
  155. };
  156. this.sendMsgToServer(param);
  157. }
  158. //提现列表
  159. onRecordList(str: string) {
  160. console.log('[服务器] 提现列表返回', str);
  161. const result = JSON.parse(str);
  162. if (result.count > 0) {
  163. smc.game.GameModel.recordList = result.list;
  164. }
  165. oops.message.dispatchEvent(GameEvent.openView, "openRecordView");
  166. }
  167. getGameAwardInfo() {
  168. const param = {
  169. url: ProtocolEvent.GetGameAward,
  170. callback: this.buildCallback('ServerHandler.inst.onGameAwardInfo', 'ServerHandler.inst.onRequestFail')
  171. };
  172. this.sendMsgToServer(param);
  173. }
  174. onGameAwardInfo(str: string) {
  175. const result = JSON.parse(str);
  176. smc.game.GameModel.passViewInfo = result;
  177. oops.message.dispatchEvent(GameEvent.openView, 'openPassView');
  178. }
  179. getTxbfInfo() {
  180. const param = {
  181. url: ProtocolEvent.GetWithdrawReward,
  182. callback: this.buildCallback('ServerHandler.inst.onRebates', 'ServerHandler.inst.onRequestFail')
  183. };
  184. this.sendMsgToServer(param);
  185. }
  186. //提现返利
  187. onRebates(str: string) {
  188. console.log('[服务器] 提现返利信息', str);
  189. let result = JSON.parse(str);
  190. smc.game.GameModel.cashNum = result.props["1004"];
  191. smc.account.AccountModel.hbCoin = result.props["1004"];
  192. smc.game.GameModel.changeHbCoin = result.changes["1004"];
  193. oops.message.dispatchEvent(GameEvent.openView, "openRebateView")
  194. }
  195. //获取双倍奖励返回
  196. getDoubleSurprise() {
  197. const param = {
  198. url: ProtocolEvent.GetDoubleAwardInfo,
  199. callback: this.buildCallback('ServerHandler.inst.onDoubleSurprise', 'ServerHandler.inst.onRequestFail')
  200. };
  201. this.sendMsgToServer(param);
  202. }
  203. //双倍惊喜返回
  204. onDoubleSurprise(str: string) {
  205. console.log('[服务器] 恭喜翻倍信息', str);
  206. let result = JSON.parse(str);
  207. smc.game.GameModel.doubleRewardInfo = result;
  208. oops.message.dispatchEvent(GameEvent.openView, "openDoubleSurprise");
  209. }
  210. //更新消除奖励
  211. updateEliminationReward(data: { level: number, score: number, count: number }) {
  212. const param = {
  213. url: ProtocolEvent.GetEliminationReward,
  214. param: {
  215. eliminationCount: data.count,
  216. // level: data.level,
  217. score: data.score
  218. },
  219. callback: this.buildCallback('ServerHandler.inst.onEliminationSuccess', 'ServerHandler.inst.onRequestFail')
  220. };
  221. this.sendMsgToServer(param);
  222. }
  223. onEliminationSuccess(str: string) {
  224. console.log('[服务器] 消除成功返回', str);
  225. let result = JSON.parse(str);
  226. if (result?.props && result?.changes) {
  227. const props = result.props;
  228. const changes = result.changes;
  229. const account = smc.account.AccountModel;
  230. const game = smc.game.GameModel;
  231. //全部取小数点后两位
  232. account.hbCoin = props['1004'] || 0;
  233. account.wxCoin = props['1005'] || 0;
  234. game.changeHbCoin = changes['1004'] || 0;
  235. game.changeWxCoin = changes['1005'] || 0;
  236. oops.message.dispatchEvent(GameEvent.showCoinAnimation);
  237. }
  238. }
  239. getSign(price: number) {
  240. const param = {
  241. url: ProtocolEvent.AdVideoStart,
  242. param: { ecpm: price },
  243. callback: this.buildCallback('ServerHandler.inst.onSign')
  244. };
  245. this.sendMsgToServer(param);
  246. }
  247. onSign(str: string) {
  248. console.log('[服务器] 签名返回', str);
  249. let result = JSON.parse(str);
  250. smc.game.GameModel.sign = result?.sign || "";
  251. }
  252. //直接领取通关奖励
  253. getPassRewards() {
  254. // const level = smc.account.AccountModel.curLevel;
  255. const param = {
  256. url: ProtocolEvent.GetPassReward,
  257. // param: {
  258. // level: level,
  259. // },
  260. callback: this.buildCallback('ServerHandler.inst.onGetPassRewards', 'ServerHandler.inst.onRequestFail')
  261. }
  262. this.sendMsgToServer(param);
  263. }
  264. //直接领取通关奖励返回
  265. onGetPassRewards(str: string) {
  266. console.log('[服务器] 直接领取通关奖励成功返回', str);
  267. let result = JSON.parse(str);
  268. //全部取小数点后两位
  269. smc.game.GameModel.changeHbCoin = result.changes['1004'] || 0;
  270. smc.game.GameModel.changeWxCoin = result.changes['1005'] || 0;
  271. smc.account.AccountModel.hbCoin = result.props["1004"] || 0;
  272. smc.account.AccountModel.wxCoin = result.props["1005"] || 0;
  273. oops.message.dispatchEvent(GameEvent.showCoinAnimation);
  274. //请求下一局
  275. //如果是提现点,就展示提现,然后展示提现返利
  276. if (smc.game.GameModel.curLevelConfig.eventType && smc.game.GameModel.curLevelConfig.eventType == "WITHDRAW_POINT") {
  277. //展示提现信息
  278. this.WechatReward();
  279. smc.game.GameModel.curLevelConfig.eventType = "";
  280. } else {
  281. this.getNextLevel();
  282. }
  283. }
  284. //少量领取翻倍奖励
  285. getLittleRewards() {
  286. // const level = smc.account.AccountModel.curLevel;
  287. const param = {
  288. url: ProtocolEvent.GetLittlePassReward,
  289. // param: {
  290. // level: level,
  291. // },
  292. callback: this.buildCallback('ServerHandler.inst.onGetDoubleRewards', 'ServerHandler.inst.onRequestFail')
  293. }
  294. this.sendMsgToServer(param);
  295. }
  296. //少量领取翻倍奖励返回
  297. onGetDoubleRewards(str: string) {
  298. console.log('[服务器] 直接领取通关奖励成功返回', str);
  299. let result = JSON.parse(str);
  300. smc.game.GameModel.changeHbCoin = result.changes['1004'] || 0;
  301. smc.game.GameModel.changeWxCoin = result.changes['1005'] || 0;
  302. smc.account.AccountModel.hbCoin = result.props["1004"] || 0;
  303. smc.account.AccountModel.wxCoin = result.props["1005"] || 0;
  304. smc.game.GameModel.skipAdCount = result.props["1008"] || 0;//广告跳过次数
  305. oops.message.dispatchEvent(GameEvent.showCoinAnimation);
  306. }
  307. //获取视频奖励
  308. getVideorReward() {
  309. const sign = smc.game.GameModel.sign;
  310. // const level = smc.account.AccountModel.curLevel;
  311. let type = smc.game.GameModel.viewType;
  312. console.log("获取视频奖励类型", type)
  313. const param = {
  314. url: ProtocolEvent.GetVideorReward,
  315. param: {
  316. // level: level,
  317. type: type,
  318. transId: "",
  319. sign: sign
  320. },
  321. callback: this.buildCallback('ServerHandler.inst.onGetVideorReward', 'ServerHandler.inst.onRequestFail')
  322. }
  323. this.sendMsgToServer(param);
  324. }
  325. onGetVideorReward(str: string) {
  326. console.log('[服务器] 获取视频奖励放回', str);
  327. let result = JSON.parse(str);
  328. if (result.tipThreshold) {
  329. oops.gui.toast("今日奖励已领取,请明天再来吧")
  330. return
  331. }
  332. if (result?.props && !result.tipThreshold) {
  333. console.log(">>>>>>>>>>>>>>发放奖励了")
  334. const props = result.props;
  335. const changes = result.changes;
  336. const account = smc.account.AccountModel;
  337. const game = smc.game.GameModel;
  338. account.wxCoin = props['1005'] || 0;
  339. account.hbCoin = props['1004'] || 0;
  340. game.changeHbCoin = changes['1004'] || 0;
  341. game.changeWxCoin = changes['1005'] || 0;
  342. //是不是通关奖励点击的
  343. if (smc.game.GameModel.viewType == "pass_reward") {
  344. smc.game.GameModel.viewType = "";
  345. this.getNextLevel();
  346. }
  347. oops.message.dispatchEvent(GameEvent.showCoinAnimation);
  348. }
  349. }
  350. //下一关
  351. getNextLevel() {
  352. // const level = smc.account.AccountModel.curLevel;
  353. const param = {
  354. url: ProtocolEvent.NextLevel,
  355. // param: {
  356. // nextLevel: level + 1
  357. // },
  358. callback: this.buildCallback('ServerHandler.inst.onGetNextLevel', 'ServerHandler.inst.onRequestFail')
  359. }
  360. this.sendMsgToServer(param);
  361. }
  362. onGetNextLevel(str: string) {
  363. console.log('[服务器] 下一关数据返回', str);
  364. let result = JSON.parse(str);
  365. smc.account.AccountModel.curLevel = result.currentLevelData.level;
  366. smc.game.GameModel.curScore = result.currentLevelData.score;
  367. smc.game.GameModel.targetScore = result.currentLevelConf.score;
  368. smc.game.GameModel.eventType = result.currentLevelConf.eventType || "";
  369. smc.game.GameModel.curLevelConfig = result.currentLevelConf;
  370. smc.account.AccountModel.goldCoin = result.props["1006"] || 0//金砖数量
  371. smc.game.GameModel.popupType = result.currentLevelConf.popupType || "";
  372. smc.game.GameModel.popupShow = result.currentLevelData.popupStatus || false;
  373. smc.game.GameModel.skipAdConfig = result.currentLevelConf.skipCount || -1;
  374. oops.message.dispatchEvent(GameEvent.RestartGame);
  375. }
  376. //重新开始游戏
  377. RestartGame() {
  378. const param = {
  379. url: ProtocolEvent.RestartGame,
  380. callback: this.buildCallback('ServerHandler.inst.onRestartGame', 'ServerHandler.inst.onRequestFail')
  381. }
  382. this.sendMsgToServer(param);
  383. }
  384. onRestartGame(str: string) {
  385. console.log('[服务器] 重新开始游戏返回', str);
  386. let result = JSON.parse(str);
  387. smc.account.AccountModel.curLevel = result.currentLevelData.level;
  388. smc.game.GameModel.curScore = result.currentLevelData.score;
  389. smc.game.GameModel.targetScore = result.currentLevelConf.score;
  390. oops.message.dispatchEvent(GameEvent.RestartGame);
  391. }
  392. //微信提现页面
  393. WechatReward() {
  394. const param = {
  395. url: ProtocolEvent.GetWelfarePointCash,
  396. param: {
  397. level: smc.account.AccountModel.curLevel,
  398. riskToken: "",
  399. riskBusinessId: ""
  400. },
  401. callback: this.buildCallback('ServerHandler.inst.onWechatReward', 'ServerHandler.inst.onRequestFail')
  402. }
  403. this.sendMsgToServer(param);
  404. }
  405. onWechatReward(str: string) {
  406. console.log("[服务器] 微信提现请求成功", str);
  407. let result = JSON.parse(str);
  408. smc.game.GameModel.txNum = result.changes["8001"];
  409. smc.game.GameModel.txType = 1;
  410. oops.message.dispatchEvent(GameEvent.openView, "openCashWithdrawalView")
  411. const curLevel = smc.account.AccountModel.curLevel;
  412. DCHandler.inst.reportData(3000101, curLevel);
  413. }
  414. //红包币页提现
  415. HbReward() {
  416. const param = {
  417. url: ProtocolEvent.GetRedPacketCash,
  418. param: {
  419. riskToken: "",
  420. riskBusinessId: ""
  421. },
  422. callback: this.buildCallback('ServerHandler.inst.onHbReward', 'ServerHandler.inst.onHbRewardFail')
  423. }
  424. this.sendMsgToServer(param);
  425. }
  426. onHbReward(str: string) {
  427. console.log('[服务器] 红包币提现返回', str);
  428. let result = JSON.parse(str);
  429. const wxCash = result.changes["8001"];
  430. smc.game.GameModel.txNum = wxCash;
  431. smc.game.GameModel.txType = 2;
  432. smc.account.AccountModel.hbCoin = result.props["1004"];
  433. smc.account.AccountModel.wxCoin = result.props["1005"];
  434. smc.game.GameModel.wxCash = result.money || 0;
  435. oops.message.dispatchEvent(GameEvent.openView, "openCashWithdrawalView");
  436. oops.message.dispatchEvent(GameEvent.updateHbAndWxCoin);
  437. }
  438. onHbRewardFail(code: number, str: string) {
  439. oops.gui.toast(str);
  440. }
  441. //获取微信提现页信息
  442. getWechatTxInfo() {
  443. const param = {
  444. url: ProtocolEvent.GetWechatTxInfo,
  445. callback: this.buildCallback('ServerHandler.inst.onGetWechatTxInfo', 'ServerHandler.inst.onRequestFail')
  446. }
  447. this.sendMsgToServer(param);
  448. }
  449. onGetWechatTxInfo(str: string) {
  450. console.log('[服务器] 获取微信提现页信息返回', str);
  451. let result = JSON.parse(str);
  452. smc.game.GameModel.wechat_tx_info = result;
  453. oops.message.dispatchEvent(GameEvent.openView, "openWechatWithdrawalView");
  454. }
  455. //获取二倍速时长信息
  456. getDoubleSpeedTime() {
  457. const param = {
  458. url: ProtocolEvent.GetDoubleSpeedAward,
  459. callback: this.buildCallback('ServerHandler.inst.onGetDoubleSpeedTime', 'ServerHandler.inst.onRequestFail')
  460. }
  461. this.sendMsgToServer(param);
  462. }
  463. onGetDoubleSpeedTime(str: string) {
  464. console.log('[服务器] 获取二倍速时长返回', str);
  465. let result = JSON.parse(str);
  466. smc.game.GameModel.doubleSpeedTime = result.duration;
  467. oops.message.dispatchEvent(GameEvent.openView, "openDoubleSpeedView");
  468. }
  469. //获取引导界面信息
  470. getGuideInfo() {
  471. const param = {
  472. url: ProtocolEvent.GetGuideInfo,
  473. callback: this.buildCallback('ServerHandler.inst.onGetGuideInfo', 'ServerHandler.inst.onRequestFail')
  474. }
  475. this.sendMsgToServer(param);
  476. }
  477. onGetGuideInfo(str: string) {
  478. console.log('[服务器] 获取引导界面信息返回', str);
  479. let result = JSON.parse(str);
  480. smc.game.GameModel.loadbarInfo = result;
  481. }
  482. //更新弹出事件
  483. async updatePopupState(data: { level: number, type: string }) {
  484. const param = {
  485. url: ProtocolEvent.UpdatePopUpState,
  486. param: {
  487. level: data.level,
  488. type: data.type,
  489. callback: this.buildCallback('ServerHandler.inst.onUpdatePopupState', 'ServerHandler.inst.onRequestFail')
  490. },
  491. }
  492. this.sendMsgToServer(param);
  493. }
  494. onUpdatePopupState(str: string) {
  495. console.log('[服务器] 更新弹出事件返回', str);
  496. let result = JSON.parse(str);
  497. smc.game.GameModel.popupShow = result.status || true;
  498. }
  499. //领取手续费
  500. getFee() {
  501. const param = {
  502. url: ProtocolEvent.GetFee,
  503. // param: {
  504. // level: smc.account.AccountModel.curLevel,
  505. // },
  506. callback: this.buildCallback('ServerHandler.inst.onGetFee', 'ServerHandler.inst.onRequestFail')
  507. }
  508. this.sendMsgToServer(param);
  509. }
  510. onGetFee(str: string) {
  511. console.log('[服务器] 领取手续费返回', str);
  512. let result = JSON.parse(str);
  513. // smc.game.GameModel.fee = result.fee;
  514. }
  515. //保存当前关卡信息
  516. saveCurLevelInfo() {
  517. const param = {
  518. url: ProtocolEvent.SaveCurrentLevelInfo,
  519. param: {
  520. level: smc.account.AccountModel.curLevel,
  521. skipCount: smc.game.GameModel.curScore,
  522. },
  523. callback: this.buildCallback('ServerHandler.inst.onSaveCurLevelInfo', 'ServerHandler.inst.onRequestFail')
  524. }
  525. this.sendMsgToServer(param);
  526. }
  527. onSaveCurLevelInfo(str: string) {
  528. console.log('[服务器] 保存当前关卡信息返回', str);
  529. let result = JSON.parse(str);
  530. }
  531. onRequestFail(code: number, str: string) {
  532. console.log('[服务器] 请求失败', code, str);
  533. }
  534. }
  535. window["ServerHandler"] = ServerHandler;