123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- "use strict";
- cc._RF.push(module, 'b8857ikWK9ByKZXy/MzWhtd', 'SetNormalPanel');
- // Script/view/setNormal/SetNormalPanel.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 (Object.prototype.hasOwnProperty.call(b, 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 BaseView_1 = require("../../../lightMVC/core/base/BaseView");
- var App_1 = require("../../Manager/App");
- var SDK_1 = require("../../sdk/SDK");
- var Interstitial_1 = require("../../sdk/vivo/Interstitial");
- var TimeControl_1 = require("../../TimeControl");
- var ATAndroidJS2_1 = require("../../ATAndroidJS2");
- var ATInterstitialJSSDK_1 = require("../../AnyThinkAds/ATInterstitialJSSDK");
- var ATAndroidJS2_2 = require("../../ATAndroidJS2");
- var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
- var SetNormalPanel = /** @class */ (function (_super) {
- __extends(SetNormalPanel, _super);
- function SetNormalPanel() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- SetNormalPanel.prototype.drawView = function () {
- var _this = this;
- SDK_1.default.Instance.showInterstitial(Interstitial_1.InterstitialType.INTERSTITIAL_GAME_PAUSE);
- // 返回
- var closeBtn = this.ui.getNode("close");
- closeBtn.on(cc.Node.EventType.TOUCH_END, function () {
- cc.director.resume();
- _this.closeView();
- }, this);
- var btnBack = this.ui.getNode("btnBackhall");
- btnBack.on(cc.Node.EventType.TOUCH_END, function () {
- _this.showInterAd("callBackFor_btnBackhall", false, _this.callBackFor_btnBackhall);
- // console.log('zh:btnBackhall111 ')
- // cc.director.resume();
- // cc.director.loadScene("hallScene");
- }, this);
- this.setMusic();
- this.setEffect();
- var button_debug = this.ui.getNode("button_debug");
- button_debug.on(cc.Node.EventType.TOUCH_END, function () {
- console.log('zh:button_debug ');
- TimeControl_1.default.instance.currentTili = 1;
- App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_Tili, TimeControl_1.default.instance.currentTili);
- }, this);
- };
- SetNormalPanel.prototype.callBackFor_btnBackhall = function () {
- cc.director.resume();
- cc.director.loadScene("hallScene");
- };
- SetNormalPanel.prototype.debugTest = function () {
- };
- //设置音乐
- SetNormalPanel.prototype.setMusic = function () {
- var MusicBtn = this.ui.getNode("music");
- var musicOn = MusicBtn.getChildByName('on');
- var musicOff = MusicBtn.getChildByName('off');
- musicOn.active = (App_1.App.SoundManager.allowPlayBGM) ? true : false;
- musicOff.active = (App_1.App.SoundManager.allowPlayBGM) ? false : true;
- MusicBtn.on(cc.Node.EventType.TOUCH_END, function () {
- App_1.App.SoundManager.allowPlayBGM = !App_1.App.SoundManager.allowPlayBGM;
- musicOn.active = (App_1.App.SoundManager.allowPlayBGM) ? true : false;
- musicOff.active = (App_1.App.SoundManager.allowPlayBGM) ? false : true;
- App_1.App.LocalStorageUtil.setBoolean(App_1.App.LocalStorageUtil.lst_music, App_1.App.SoundManager.allowPlayBGM);
- console.log('点击音乐', App_1.App.SoundManager.allowPlayBGM);
- }, this);
- };
- //设置音效
- SetNormalPanel.prototype.setEffect = function () {
- var EffectBtn = this.ui.getNode("audio");
- var effectOn = EffectBtn.getChildByName('on');
- var effectOff = EffectBtn.getChildByName('off');
- effectOn.active = (App_1.App.SoundManager.allowPlayEffect) ? true : false;
- effectOff.active = (App_1.App.SoundManager.allowPlayEffect) ? false : true;
- EffectBtn.on(cc.Node.EventType.TOUCH_END, function () {
- App_1.App.SoundManager.allowPlayEffect = !App_1.App.SoundManager.allowPlayEffect;
- effectOn.active = (App_1.App.SoundManager.allowPlayEffect) ? true : false;
- effectOff.active = (App_1.App.SoundManager.allowPlayEffect) ? false : true;
- App_1.App.LocalStorageUtil.setBoolean(App_1.App.LocalStorageUtil.lst_effect, App_1.App.SoundManager.allowPlayEffect);
- console.log('点击音效', App_1.App.SoundManager.allowPlayEffect);
- }, this);
- };
- SetNormalPanel.path = function () {
- return "hallScene/prefabs/SetNormalPanel";
- };
- /**
- * 显示插屏广告
- *
- * @param adMarkForClose 插屏广告关闭后调用那个方法的具体指示标识
- * @param checkClose 是否需要判断关闭事件,有的不需要,如果AD占用游戏时间则为true
- * @param callback 插屏广告关闭(加载失败\非ANDROID平台)的回调
- */
- SetNormalPanel.prototype.showInterAd = function (adMarkForClose, checkClose, callback) {
- if (cc.sys.os === cc.sys.OS_ANDROID) {
- if (checkClose) {
- cc.sys.localStorage.setItem("adMarkForClose", adMarkForClose); //关闭后,调用哪个方法的标识
- }
- //add判断插屏 开屏等
- var pid_inter = ATAndroidJS2_1.default.getPlacementId2(ATAndroidJS2_2.AdType.Inter);
- var boo = ATInterstitialJSSDK_1.default.hasAdReady(pid_inter);
- if (boo) {
- // 暂停游戏
- cc.director.pause();
- console.log('zh:showInterAd AD OK');
- ATInterstitialJSSDK_1.default.showAd(pid_inter);
- //因为跨脚本,所以使用全局注册函数调用,后来发现切换APP,导致ad close事件失效
- if (!checkClose) { //如果不占用游戏时间
- this.safeCallback(callback);
- }
- }
- else {
- console.log('zh:showInterAd AD 没有准备好');
- //GlobalManager.getInstance().callMethod('initAdForPageInter');
- //this.initAdForPageInter();
- this.safeCallback(callback);
- }
- }
- else {
- this.safeCallback(callback);
- }
- };
- // 辅助方法:安全调用回调函数
- SetNormalPanel.prototype.safeCallback = function (callback) {
- if (callback) {
- callback();
- }
- };
- SetNormalPanel = __decorate([
- ccclass
- ], SetNormalPanel);
- return SetNormalPanel;
- }(BaseView_1.BaseView));
- exports.default = SetNormalPanel;
- cc._RF.pop();
|