f6da47ee-6dae-4b75-8329-44a46c55944b.js 4.67 KB
"use strict";
cc._RF.push(module, 'f6da4fuba5LdYMpRKRsVZRL', 'DiscoverSettingViewPresenter');
// script/game/ui/presenter/discover/DiscoverSettingViewPresenter.ts

"use strict";
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 });
exports.DiscoverSettingViewPresenter = void 0;
const simba_cc_audio_manager_1 = require("simba-cc-audio-manager");
const simba_sdk_1 = require("simba-sdk");
const PresenterBase_1 = require("../../../../common/classbase/PresenterBase");
const GameTextData_1 = require("../../../../common/gameplay/gamedata/GameTextData");
const UIManager_1 = require("../../../../common/gameplay/managers/UIManager");
const GameDotMgr_1 = require("../../../GameDotMgr");
const GameModelManager_1 = require("../../../model/GameModelManager");
const PresenterCCViewFactory_1 = require("../../PresenterCCViewFactory");
const DiscoverSettingView_1 = require("../../view/type/discover/DiscoverSettingView");
const NewNoticeView_1 = require("../../view/type/notice/NewNoticeView");
const ExchangeCodeViewPresenter_1 = require("../ExchangeCodeViewPresenter");
const NewNoticeViewPresenter_1 = require("../notice/NewNoticeViewPresenter");
let DiscoverSettingViewPresenter = /** @class */ (() => {
    let DiscoverSettingViewPresenter = class DiscoverSettingViewPresenter extends PresenterBase_1.Presenter {
        constructor() {
            super(...arguments);
            this.toggleSound = () => {
                simba_cc_audio_manager_1.AudioSettings.soundVolume = simba_cc_audio_manager_1.AudioSettings.soundVolume > 0 ? 0 : 1;
                this.view.updateProps({
                    soundEnabled: simba_cc_audio_manager_1.AudioSettings.soundVolume > 0
                });
            };
            this.toggleMusic = () => {
                simba_cc_audio_manager_1.AudioSettings.musicVolume = simba_cc_audio_manager_1.AudioSettings.musicVolume > 0 ? 0 : 1;
                this.view.updateProps({
                    musicEnabled: simba_cc_audio_manager_1.AudioSettings.musicVolume > 0
                });
            };
            this.toggleNotice = () => {
                // GameDotMgr.getInstance().dotClickUI("click_notice");
                UIManager_1.UIManager.pushPresenter(NewNoticeViewPresenter_1.default, NewNoticeView_1.SourceView.SettingView);
            };
            this.toggleExchangeCode = () => {
                //点击兑换码打点
                GameDotMgr_1.default.getInstance().dotClickUI("exchange_code");
                let title = GameModelManager_1.GameModelManager.getLanguageTxt(GameTextData_1.GameTextData.TEXT_EXCHANGETITLE_VALUE);
                let content = "";
                UIManager_1.UIManager.pushPresenter(ExchangeCodeViewPresenter_1.default, {
                    titletxt: title,
                    contenttxt: content
                });
            };
            this.onCloseSettingView = (index) => {
                this.view.close(true);
                GameModelManager_1.GameModelManager.JumpToViewInGame.emit(index);
            };
        }
        onOpen() {
            super.onOpen(undefined);
            this.view.setProps({
                soundEnabled: simba_cc_audio_manager_1.AudioSettings.soundVolume > 0,
                musicEnabled: simba_cc_audio_manager_1.AudioSettings.musicVolume > 0,
                onToggleSound: this.toggleSound,
                onToggleMusic: this.toggleMusic,
                onToggleNotice: this.toggleNotice,
                onToggleExchangeCode: this.toggleExchangeCode
            });
            this._disposable.add(GameModelManager_1.GameModelManager.CloseSettingView.on(this.onCloseSettingView));
        }
        onClose() {
            super.onClose();
            UIManager_1.UIManager.popToPresenter(this);
            simba_sdk_1.SDK.showGameClubButton();
        }
    };
    DiscoverSettingViewPresenter.uuid = "DiscoverSettingViewPresenter";
    DiscoverSettingViewPresenter = __decorate([
        PresenterCCViewFactory_1.RegPresenter(DiscoverSettingView_1.DiscoverSettingViewType)
    ], DiscoverSettingViewPresenter);
    return DiscoverSettingViewPresenter;
})();
exports.DiscoverSettingViewPresenter = DiscoverSettingViewPresenter;

cc._RF.pop();