f1e5a8f8-9cc4-47ee-980d-98ec5ee51069.js 4.24 KB
"use strict";
cc._RF.push(module, 'f1e5aj4nMRH7pgNmOxe5RBp', 'DebugViewPresenter');
// script/game/ui/presenter/DebugViewPresenter.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 });
const simba_sdk_1 = require("simba-sdk");
const AVG_1 = require("../../../avg/AVG");
const PresenterBase_1 = require("../../../common/classbase/PresenterBase");
const UIManager_1 = require("../../../common/gameplay/managers/UIManager");
const UnlockSpecialPlotEventManager_1 = require("../../model/UnlockSpecialPlotEventManager");
const UnlockSpecialPlotModelManager_1 = require("../../model/UnlockSpecialPlotModelManager");
const PresenterCCViewFactory_1 = require("../PresenterCCViewFactory");
const DebugView_1 = require("../view/type/DebugView");
let DebugViewPresenter = /** @class */ (() => {
    let DebugViewPresenter = class DebugViewPresenter extends PresenterBase_1.Presenter {
        constructor() {
            var _a;
            super();
            this.onCopyIdBtnClickCallback = async () => {
                try {
                    await simba_sdk_1.SDK.setClipboardData(this._viewProps.playerID);
                    UIManager_1.UIManager.showToast("复制ID成功!");
                }
                catch (error) {
                    console.error(error);
                }
            };
            this.onClearRecordBtnClickCallback = () => {
                try {
                    AVG_1.PlotManager.stop();
                    AVG_1.GameRecord.emptyRecords();
                    UIManager_1.UIManager.showToast("清除成功,1秒后退出游戏!");
                    setTimeout(() => {
                        simba_sdk_1.SDK.exit();
                    }, 1000);
                }
                catch (error) {
                    console.error(error);
                }
            };
            this.onCopyRecordBtnClickCallback = async () => {
                try {
                    await simba_sdk_1.SDK.setClipboardData(AVG_1.GameRecord.getRecordAsString());
                    UIManager_1.UIManager.showToast("复制存档成功!");
                }
                catch (error) {
                    console.error(error);
                }
            };
            this.onYouHuaBtnClickCallback = () => {
                UnlockSpecialPlotEventManager_1.default.getInstance().cdKeyUnlockSpecialPlot(1, 1);
                UIManager_1.UIManager.showSceneToast("解锁了新的番外,记得去卧室查看哦~");
            };
            this.onShouBiaoBtnClickCallback = () => {
                UnlockSpecialPlotModelManager_1.UnlockSpecialPlotModelManager.saveUnlockedSpecialPlotIdByItemIdToGameRecord(4);
                UIManager_1.UIManager.showSceneToast("解锁了新的番外,记得去卧室查看哦~");
            };
            this._viewProps = {
                playerID: ((_a = simba_sdk_1.SDK.getLoginInfo()) === null || _a === void 0 ? void 0 : _a.playerId) + "",
                onCopyIdBtnClickCallback: this.onCopyIdBtnClickCallback,
                onClearRecordBtnClickCallback: this.onClearRecordBtnClickCallback,
                onCopyRecordBtnClickCallback: this.onCopyRecordBtnClickCallback,
                onYouHuaBtnClickCallback: this.onYouHuaBtnClickCallback,
                onShouBiaoBtnClickCallback: this.onShouBiaoBtnClickCallback,
            };
        }
        onOpen() {
            super.onOpen(undefined);
            this.view.setProps(this._viewProps);
        }
    };
    DebugViewPresenter.uuid = "DebugViewPresenter";
    DebugViewPresenter = __decorate([
        PresenterCCViewFactory_1.RegPresenter(DebugView_1.DebugViewType)
    ], DebugViewPresenter);
    return DebugViewPresenter;
})();
exports.default = DebugViewPresenter;

cc._RF.pop();