"use strict"; cc._RF.push(module, '003c2RLzLtIya/ty0NNYWCD', 'UIADPanel'); // scripts/UI/UIADPanel.ts "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); var Utils_1 = require("../../common-plugin/Scripts/Utils"); var CocosZ_1 = require("../Framework/CocosZ"); var Msg_1 = require("../Framework/Msg"); var ATRewardedVideoJSSDK_1 = require("../AnyThinkAds/ATRewardedVideoJSSDK"); var ATAndroidJS2_1 = require("../ATAndroidJS2"); var GlobalManager_1 = require("../GlobalManager"); // @ts-ignore var i18n = require('LanguageData'); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var NewClass = /** @class */ (function (_super) { __extends(NewClass, _super); function NewClass() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.btnAD = null; _this.btnSkip = null; _this.adKey = "zh_ad_type"; _this.isDiamond = false; return _this; } NewClass.prototype.start = function () { console.log('zh:uiadpanel start '); if (CocosZ_1.cocosz.isADON) { this.node.scale = 0; cc.tween(this.node).to(0.3, { scale: 1 }, { easing: "backOut" }).start(); Utils_1.utils.SendEvent("页面-" + (this.isDiamond ? "钻石" : "金币")); } else { this.node.destroy(); } this.initAdForPage(); }; NewClass.prototype.initAdForPage = function () { if (cc.sys.os === cc.sys.OS_ANDROID) { var deviceId = ATAndroidJS2_1.default.getDeviceUserId(); console.log("zh:checkstatus:", ATRewardedVideoJSSDK_1.default.checkAdStatus(ATAndroidJS2_1.default.getPlacementId())); var setting = {}; setting[ATRewardedVideoJSSDK_1.default.userIdKey] = deviceId; ATRewardedVideoJSSDK_1.default.loadRewardedVideo(ATAndroidJS2_1.default.getPlacementId(), setting); } }; NewClass.prototype.setDiamond = function () { this.isDiamond = true; this.node.getChildByName("bg").active = false; this.node.getChildByName("bg1").active = true; }; NewClass.prototype.watchAD = function () { var _this = this; Utils_1.utils.SendEvent("\u89C6\u9891-" + (this.isDiamond ? "钻石购买" : "金币购买") + "-\u64AD\u653E"); // 注册方法 , this.ClickClose.bind(this)); GlobalManager_1.default.getInstance().registerMethod('event_UIADPanel_forAd', this.event_UIADPanel_forAd.bind(this)); cc.sys.localStorage.setItem(this.adKey, 'event_UIADPanel_forAd'); // if (ATRewardedVideoJSSDK_1.default.hasAdReady(ATAndroidJS2_1.default.getPlacementId())) { console.log('zh:AD ready for event_UIADPanel_forAd'); ATRewardedVideoJSSDK_1.default.showAd(ATAndroidJS2_1.default.getPlacementId()); } else { console.log('zh:AD not ready for event_UIADPanel_forAd'); this.event_UIADPanel_forAd(); this.initAdForPage(); } if (2 > 1) { return; //下面是原始的代码 } CocosZ_1.cocosz.watchAD(function () { Utils_1.utils.SendEvent("\u89C6\u9891-" + (_this.isDiamond ? "钻石购买" : "金币购买") + "-\u6210\u529F"); if (_this.isDiamond) { var num = CocosZ_1.cocosz.isDeBug ? 10000 : 200; CocosZ_1.cocosz.dataMgr.DiamondCount += num; Msg_1.default.Show(i18n.t("msg.gxhdzs") + num); //恭喜获得钻石 } else { var num = CocosZ_1.cocosz.isDeBug ? 10000 : 500; CocosZ_1.cocosz.dataMgr.CoinCount += num; Msg_1.default.Show(i18n.t("msg.gxhdjb") + num); //恭喜获得金币 } _this.node.destroy(); }, function () { Utils_1.utils.SendEvent("\u89C6\u9891-" + (_this.isDiamond ? "钻石购买" : "金币购买") + "-\u5931\u8D25"); }); }; //zh: NewClass.prototype.event_UIADPanel_forAd = function () { console.log('zh:event_UIADPanel_forAd 被触发'); if (this.isDiamond) { var num = CocosZ_1.cocosz.isDeBug ? 10000 : 200; CocosZ_1.cocosz.dataMgr.DiamondCount += num; Msg_1.default.Show(i18n.t("msg.gxhdzs") + num); //恭喜获得钻石 } else { var num = CocosZ_1.cocosz.isDeBug ? 10000 : 500; CocosZ_1.cocosz.dataMgr.CoinCount += num; Msg_1.default.Show(i18n.t("msg.gxhdjb") + num); //恭喜获得金币 } this.node.destroy(); }; NewClass.prototype.exit = function () { CocosZ_1.cocosz.audioMgr.playBtnEffect(); this.node.destroy(); }; __decorate([ property(cc.Node) ], NewClass.prototype, "btnAD", void 0); __decorate([ property(cc.Node) ], NewClass.prototype, "btnSkip", void 0); NewClass = __decorate([ ccclass ], NewClass); return NewClass; }(cc.Component)); exports.default = NewClass; cc._RF.pop();