b88578a4-58af-41c8-a657-cbf3335a1b5d.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. "use strict";
  2. cc._RF.push(module, 'b8857ikWK9ByKZXy/MzWhtd', 'SetNormalPanel');
  3. // Script/view/setNormal/SetNormalPanel.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 SDK_1 = require("../../sdk/SDK");
  28. var Interstitial_1 = require("../../sdk/vivo/Interstitial");
  29. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  30. var SetNormalPanel = /** @class */ (function (_super) {
  31. __extends(SetNormalPanel, _super);
  32. function SetNormalPanel() {
  33. return _super !== null && _super.apply(this, arguments) || this;
  34. }
  35. SetNormalPanel.prototype.drawView = function () {
  36. var _this = this;
  37. SDK_1.default.Instance.showInterstitial(Interstitial_1.InterstitialType.INTERSTITIAL_GAME_PAUSE);
  38. // 返回
  39. var closeBtn = this.ui.getNode("close");
  40. closeBtn.on(cc.Node.EventType.TOUCH_END, function () {
  41. cc.director.resume();
  42. _this.closeView();
  43. }, this);
  44. var btnBack = this.ui.getNode("btnBackhall");
  45. btnBack.on(cc.Node.EventType.TOUCH_END, function () {
  46. cc.director.resume();
  47. cc.director.loadScene("hallScene");
  48. }, this);
  49. this.setMusic();
  50. this.setEffect();
  51. };
  52. //设置音乐
  53. SetNormalPanel.prototype.setMusic = function () {
  54. var MusicBtn = this.ui.getNode("music");
  55. var musicOn = MusicBtn.getChildByName('on');
  56. var musicOff = MusicBtn.getChildByName('off');
  57. musicOn.active = (App_1.App.SoundManager.allowPlayBGM) ? true : false;
  58. musicOff.active = (App_1.App.SoundManager.allowPlayBGM) ? false : true;
  59. MusicBtn.on(cc.Node.EventType.TOUCH_END, function () {
  60. App_1.App.SoundManager.allowPlayBGM = !App_1.App.SoundManager.allowPlayBGM;
  61. musicOn.active = (App_1.App.SoundManager.allowPlayBGM) ? true : false;
  62. musicOff.active = (App_1.App.SoundManager.allowPlayBGM) ? false : true;
  63. App_1.App.LocalStorageUtil.setBoolean(App_1.App.LocalStorageUtil.lst_music, App_1.App.SoundManager.allowPlayBGM);
  64. console.log('点击音乐', App_1.App.SoundManager.allowPlayBGM);
  65. }, this);
  66. };
  67. //设置音效
  68. SetNormalPanel.prototype.setEffect = function () {
  69. var EffectBtn = this.ui.getNode("audio");
  70. var effectOn = EffectBtn.getChildByName('on');
  71. var effectOff = EffectBtn.getChildByName('off');
  72. effectOn.active = (App_1.App.SoundManager.allowPlayEffect) ? true : false;
  73. effectOff.active = (App_1.App.SoundManager.allowPlayEffect) ? false : true;
  74. EffectBtn.on(cc.Node.EventType.TOUCH_END, function () {
  75. App_1.App.SoundManager.allowPlayEffect = !App_1.App.SoundManager.allowPlayEffect;
  76. effectOn.active = (App_1.App.SoundManager.allowPlayEffect) ? true : false;
  77. effectOff.active = (App_1.App.SoundManager.allowPlayEffect) ? false : true;
  78. App_1.App.LocalStorageUtil.setBoolean(App_1.App.LocalStorageUtil.lst_effect, App_1.App.SoundManager.allowPlayEffect);
  79. console.log('点击音效', App_1.App.SoundManager.allowPlayEffect);
  80. }, this);
  81. };
  82. SetNormalPanel.path = function () {
  83. return "hallScene/prefabs/SetNormalPanel";
  84. };
  85. SetNormalPanel = __decorate([
  86. ccclass
  87. ], SetNormalPanel);
  88. return SetNormalPanel;
  89. }(BaseView_1.BaseView));
  90. exports.default = SetNormalPanel;
  91. cc._RF.pop();