ecb4190f-4737-4753-946a-2935bcc28037.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. "use strict";
  2. cc._RF.push(module, 'ecb41kPRzdHU5RqKTW8woA3', 'MissionPanel');
  3. // Script/view/missionPanel/MissionPanel.ts
  4. "use strict";
  5. var __extends = (this && this.__extends) || (function () {
  6. var extendStatics = function (d, b) {
  7. extendStatics = Object.setPrototypeOf ||
  8. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  10. return extendStatics(d, b);
  11. };
  12. return function (d, b) {
  13. extendStatics(d, b);
  14. function __() { this.constructor = d; }
  15. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16. };
  17. })();
  18. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  19. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  20. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  21. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  22. return c > 3 && r && Object.defineProperty(target, key, r), r;
  23. };
  24. Object.defineProperty(exports, "__esModule", { value: true });
  25. var BaseView_1 = require("../../../lightMVC/core/base/BaseView");
  26. var App_1 = require("../../Manager/App");
  27. var SuperScrollView_1 = require("../SuperScrollview/SuperScrollView");
  28. var ATRewardedVideoJSSDK_1 = require("../../AnyThinkAds/ATRewardedVideoJSSDK");
  29. var ATAndroidJS2_1 = require("../../ATAndroidJS2");
  30. var ATInterstitialJSSDK_1 = require("../../AnyThinkAds/ATInterstitialJSSDK");
  31. var ATAndroidJS2_2 = require("../../ATAndroidJS2");
  32. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  33. var MissionPanel = /** @class */ (function (_super) {
  34. __extends(MissionPanel, _super);
  35. function MissionPanel() {
  36. var _this = _super !== null && _super.apply(this, arguments) || this;
  37. _this.skinNum = 6;
  38. _this.currentNum = 1;
  39. _this.list = [];
  40. return _this;
  41. }
  42. MissionPanel.prototype.onLoad = function () {
  43. console.log('zh:MissionPanel.ts onload ');
  44. //这个地方加了会有问题,导致列表无法加载
  45. // this.initAdForPageInter();
  46. // setTimeout(() => {
  47. // this.showInterAd("callBackFor_ClickBackMain",false, null);
  48. // }, 100);
  49. };
  50. //add判断插屏 开屏等,需要多次准备
  51. //add判断插屏 开屏等,需要多次准备
  52. MissionPanel.prototype.initAdForPageInter = function () {
  53. if (cc.sys.os === cc.sys.OS_ANDROID) {
  54. console.log('zh:skillBox.ts 开始准备AD .....');
  55. var deviceId = ATAndroidJS2_1.default.getDeviceUserId();
  56. var setting = {};
  57. setting[ATRewardedVideoJSSDK_1.default.userIdKey] = deviceId;
  58. //add判断插屏 开屏等
  59. var pid_inter = ATAndroidJS2_1.default.getPlacementId2(ATAndroidJS2_2.AdType.Inter);
  60. console.log("zh: pid_inter checkstatus:", ATInterstitialJSSDK_1.default.checkAdStatus(pid_inter));
  61. ATInterstitialJSSDK_1.default.loadInterstitial(pid_inter, setting);
  62. }
  63. };
  64. MissionPanel.prototype.drawView = function () {
  65. var _this = this;
  66. console.log('zh:drawView');
  67. for (var i = 0; i < App_1.App.DataManager.MissionDataList.length; i++) {
  68. this.list[i] = i;
  69. }
  70. // 返回
  71. var closeBtn = this.ui.getNode("close");
  72. closeBtn.on(cc.Node.EventType.TOUCH_END, function () {
  73. _this.closeView();
  74. }, this);
  75. this.CreateLevel();
  76. this.ui.getNode("item").active = false;
  77. };
  78. /**
  79. * 生成皮肤列表
  80. */
  81. MissionPanel.prototype.CreateLevel = function () {
  82. console.log('zh:CreateLevel');
  83. var skinList = this.ui.getNode("List");
  84. skinList.getComponent(SuperScrollView_1.default).setData(this.list, false, null);
  85. };
  86. MissionPanel.path = function () {
  87. return "hallScene/prefabs/MissionPanel";
  88. };
  89. /**
  90. * 显示插屏广告
  91. *
  92. * @param adMarkForClose 插屏广告关闭后调用那个方法的具体指示标识
  93. * @param checkClose 是否需要判断关闭事件,有的不需要,如果AD占用游戏时间则为true
  94. * @param callback 插屏广告关闭(加载失败\非ANDROID平台)的回调
  95. */
  96. MissionPanel.prototype.showInterAd = function (adMarkForClose, checkClose, callback) {
  97. if (cc.sys.os === cc.sys.OS_ANDROID) {
  98. if (checkClose) {
  99. cc.sys.localStorage.setItem("adMarkForClose", adMarkForClose); //关闭后,调用哪个方法的标识
  100. }
  101. //add判断插屏 开屏等
  102. var pid_inter = ATAndroidJS2_1.default.getPlacementId2(ATAndroidJS2_2.AdType.Inter);
  103. var boo = ATInterstitialJSSDK_1.default.hasAdReady(pid_inter);
  104. if (boo) {
  105. // 暂停游戏
  106. cc.director.pause();
  107. console.log('zh:showInterAd AD OK');
  108. ATInterstitialJSSDK_1.default.showAd(pid_inter);
  109. //因为跨脚本,所以使用全局注册函数调用,后来发现切换APP,导致ad close事件失效
  110. if (!checkClose) { //如果不占用游戏时间
  111. this.safeCallback(callback);
  112. }
  113. }
  114. else {
  115. console.log('zh:showInterAd AD 没有准备好');
  116. //GlobalManager.getInstance().callMethod('initAdForPageInter');
  117. //this.initAdForPageInter();
  118. this.safeCallback(callback);
  119. }
  120. }
  121. else {
  122. this.safeCallback(callback);
  123. }
  124. };
  125. // 辅助方法:安全调用回调函数
  126. MissionPanel.prototype.safeCallback = function (callback) {
  127. if (callback) {
  128. callback();
  129. }
  130. };
  131. MissionPanel = __decorate([
  132. ccclass
  133. ], MissionPanel);
  134. return MissionPanel;
  135. }(BaseView_1.BaseView));
  136. exports.default = MissionPanel;
  137. cc._RF.pop();