
                (function() {
                    var nodeEnv = typeof require !== 'undefined' && typeof process !== 'undefined';
                    var __module = nodeEnv ? module : {exports:{}};
                    var __filename = 'preview-scripts/assets/Script/setUi.js';
                    var __require = nodeEnv ? function (request) {
                        return cc.require(request);
                    } : function (request) {
                        return __quick_compile_project__.require(request, __filename);
                    };
                    function __define (exports, require, module) {
                        if (!nodeEnv) {__quick_compile_project__.registerModule(__filename, module);}"use strict";
cc._RF.push(module, '19d952d5kVBrLSzAIGeElFK', 'setUi');
// Script/setUi.ts

"use strict";
// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
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 _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var setUi = /** @class */ (function (_super) {
    __extends(setUi, _super);
    function setUi() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.time = 0;
        _this.music = null;
        _this.effect = null;
        _this.vibrate = null;
        // mapInfo: number[][] = [];
        _this.musicState = true;
        _this.effectState = true;
        _this.vibrateState = true;
        return _this;
        // update (dt) {}
    }
    setUi.prototype.onLoad = function () {
        this.musicState = cc.fx.GameConfig.GM_INFO.musicOpen;
        this.effectState = cc.fx.GameConfig.GM_INFO.effectOpen;
        this.vibrateState = cc.fx.GameConfig.GM_INFO.vibrateOpen;
        console.log("音乐状态", this.musicState);
        console.log("音效状态", this.effectState);
        console.log("震动状态", this.vibrateState);
        this.syncToggleState();
    };
    setUi.prototype.start = function () {
    };
    setUi.prototype.init = function (time) {
    };
    setUi.prototype.clickMusic = function () {
        if (this.musicState) {
            this.musicState = false;
            cc.fx.GameConfig.GM_INFO.musicOpen = this.musicState;
            this.setMusicConfig();
            cc.fx.AudioManager._instance.stopMusic();
        }
        else {
            this.musicState = true;
            cc.fx.GameConfig.GM_INFO.musicOpen = this.musicState;
            this.setMusicConfig();
            cc.fx.AudioManager._instance.playMusicGame();
        }
    };
    setUi.prototype.setMusicConfig = function () {
        var audioInfo = {
            "musicOpen": cc.fx.GameConfig.GM_INFO.musicOpen,
            "effectOpen": cc.fx.GameConfig.GM_INFO.effectOpen,
            "vibrateOpen": cc.fx.GameConfig.GM_INFO.vibrateOpen,
        };
        cc.fx.StorageMessage.setStorage("music", audioInfo);
    };
    setUi.prototype.clickEffect = function () {
        if (this.effectState) {
            this.effectState = false;
            cc.fx.GameConfig.GM_INFO.effectOpen = this.effectState;
            this.setMusicConfig();
        }
        else {
            this.effectState = true;
            cc.fx.GameConfig.GM_INFO.effectOpen = this.effectState;
            this.setMusicConfig();
        }
    };
    setUi.prototype.clickVibrate = function () {
        if (this.vibrateState) {
            this.vibrateState = false;
            cc.fx.GameConfig.GM_INFO.vibrateOpen = this.vibrateState;
            this.setMusicConfig();
        }
        else {
            this.vibrateState = true;
            cc.fx.GameConfig.GM_INFO.vibrateOpen = this.vibrateState;
            this.setMusicConfig();
        }
    };
    setUi.prototype.syncToggleState = function () {
        this.music.getComponent(cc.Toggle).isChecked = !this.musicState;
        this.effect.getComponent(cc.Toggle).isChecked = !this.effectState;
        this.vibrate.getComponent(cc.Toggle).isChecked = !this.vibrateState;
    };
    //关闭ui
    setUi.prototype.closeUi = function () {
        this.node.active = false;
    };
    __decorate([
        property(cc.Node)
    ], setUi.prototype, "music", void 0);
    __decorate([
        property(cc.Node)
    ], setUi.prototype, "effect", void 0);
    __decorate([
        property(cc.Node)
    ], setUi.prototype, "vibrate", void 0);
    setUi = __decorate([
        ccclass
    ], setUi);
    return setUi;
}(cc.Component));
exports.default = setUi;

cc._RF.pop();
                    }
                    if (nodeEnv) {
                        __define(__module.exports, __require, __module);
                    }
                    else {
                        __quick_compile_project__.registerModuleFunc(__filename, function () {
                            __define(__module.exports, __require, __module);
                        });
                    }
                })();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 8748 characters]