f6da47ee-6dae-4b75-8329-44a46c55944b.js
4.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
"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 PresenterCCViewFactory_1 = require("../../PresenterCCViewFactory");
const DiscoverSettingView_1 = require("../../view/type/discover/DiscoverSettingView");
const PresenterBase_1 = require("../../../../common/classbase/PresenterBase");
const GameBasicSettings_1 = require("../../../../common/gameplay/settings/GameBasicSettings");
const HttpRequests_1 = require("../../../network/HttpRequests");
const GameModelManager_1 = require("../../../model/GameModelManager");
const GameTextData_1 = require("../../../../common/gameplay/gamedata/GameTextData");
const UIManager_1 = require("../../../../common/gameplay/managers/UIManager");
const NoticeViewPresenter_1 = require("../NoticeViewPresenter");
const GameConfig_1 = require("../../../../GameConfig");
const ExchangeCodeViewPresenter_1 = require("../ExchangeCodeViewPresenter");
let DiscoverSettingViewPresenter = /** @class */ (() => {
let DiscoverSettingViewPresenter = class DiscoverSettingViewPresenter extends PresenterBase_1.Presenter {
constructor() {
super(...arguments);
this.toggleSound = () => {
GameBasicSettings_1.GameBasicSettings.soundVolume = GameBasicSettings_1.GameBasicSettings.soundVolume > 0 ? 0 : 1;
this.view.updateProps({
soundEnabled: GameBasicSettings_1.GameBasicSettings.soundVolume > 0
});
};
this.toggleMusic = () => {
GameBasicSettings_1.GameBasicSettings.musicVolume = GameBasicSettings_1.GameBasicSettings.musicVolume > 0 ? 0 : 1;
this.view.updateProps({
musicEnabled: GameBasicSettings_1.GameBasicSettings.musicVolume > 0
});
};
this.toggleNotice = () => {
HttpRequests_1.HttpRequests.getNotice().then((ret) => {
if (ret != null && ret.length > 0) {
let titleTxt = GameModelManager_1.GameModelManager.getLanguageTxt(GameTextData_1.GameTextData.TEXT_NOTICETITLE_VALUE);
let contentTxt = ret[0].msg;
UIManager_1.UIManager.pushPresenter(NoticeViewPresenter_1.default, {
title: titleTxt,
content: contentTxt
});
}
else {
console.log("notice is not setting:" + `notice_${GameConfig_1.GameConfig.gameVersion}.json`);
}
});
};
this.toggleExchangeCode = () => {
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
});
};
}
onOpen() {
super.onOpen(undefined);
this.view.setProps({
soundEnabled: GameBasicSettings_1.GameBasicSettings.soundVolume > 0,
musicEnabled: GameBasicSettings_1.GameBasicSettings.musicVolume > 0,
onToggleSound: this.toggleSound,
onToggleMusic: this.toggleMusic,
onToggleNotice: this.toggleNotice,
onToggleExchangeCode: this.toggleExchangeCode
});
}
onClose() {
super.onClose();
UIManager_1.UIManager.popToPresenter(this);
}
};
DiscoverSettingViewPresenter.uuid = "DiscoverSettingViewPresenter";
DiscoverSettingViewPresenter = __decorate([
PresenterCCViewFactory_1.RegPresenter(DiscoverSettingView_1.DiscoverSettingViewType)
], DiscoverSettingViewPresenter);
return DiscoverSettingViewPresenter;
})();
exports.DiscoverSettingViewPresenter = DiscoverSettingViewPresenter;
cc._RF.pop();