9a23ef30-372d-4009-a04f-9b41a7c3944c.js 4.86 KB
"use strict";
cc._RF.push(module, '9a23e8wNy1ACaBPm0Gnw5RM', 'PlotStopViewPresenter');
// script/game/ui/presenter/PlotStopViewPresenter.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 });
// import { DailyQuestType } from "../../../avg/EditorEnums";
const PresenterBase_1 = require("../../../common/classbase/PresenterBase");
const GameEnumData_1 = require("../../../common/gameplay/gamedata/GameEnumData");
const GameTextData_1 = require("../../../common/gameplay/gamedata/GameTextData");
const UIManager_1 = require("../../../common/gameplay/managers/UIManager");
const Enums_1 = require("../../Enums");
const GameDotMgr_1 = require("../../GameDotMgr");
const GameModelManager_1 = require("../../model/GameModelManager");
const PresenterCCViewFactory_1 = require("../PresenterCCViewFactory");
const PlotStopView_1 = require("../view/type/PlotStopView");
let PlotStopViewPresenter = /** @class */ (() => {
    let PlotStopViewPresenter = class PlotStopViewPresenter extends PresenterBase_1.Presenter {
        constructor() {
            super();
            this.unlockPlotCallbackFunc = () => {
            };
            this.onAdBtnOption = (optionType, adType, ret) => {
                let location = Enums_1.CommonLocation.Nextplot;
                if (adType === "share") {
                    GameDotMgr_1.default.getInstance().dotShare(optionType, Enums_1.ShowLocationType.Share + location);
                }
                if (adType === "video") {
                    GameDotMgr_1.default.getInstance().dotVideo(optionType, Enums_1.ShowLocationType.Video + location);
                }
                if (optionType === Enums_1.ShowType.FINISH && ret && adType === "video") {
                    // GameModelManager.addDailyTasks(DailyQuestType.Dq_AdsWatch, 1);
                }
            };
            this.onAddRes = (type) => {
                if (type === "video") {
                    GameModelManager_1.GameModelManager.dealBlockedPlot(true);
                }
                else {
                    if (cc.sys.browserType == cc.sys.BROWSER_TYPE_CHROME) {
                        GameModelManager_1.GameModelManager.dealBlockedPlot(true);
                    }
                    else {
                        UIManager_1.UIManager.showToast(GameModelManager_1.GameModelManager.getLanguageTxt(GameTextData_1.GameTextData.GAME_TEXT_DEAL_BLOCKED_PLOT_FAIL));
                    }
                }
                this.view.closeView();
            };
        }
        initViewProps() {
            this._viewProps = {
                unlockPlotCallbackFunc: this.unlockPlotCallbackFunc,
                onAdBtnOption: this.onAdBtnOption,
                onAddRes: this.onAddRes,
                onCancelAdCallback: this.onCancelAdCallback,
            };
        }
        onOpen() {
            super.onOpen(undefined);
            this.onShow();
        }
        onShow() {
            super.onShow();
            this.initViewProps();
            this._view.setProps(this._viewProps);
            this.view.adButton.loadSVConfig();
            let t = this.view.getSvBtnType();
            if (t && t === "share" || t === "video") {
                this.onAdBtnOption(Enums_1.ShowType.SHOW, t);
            }
        }
        onClose() {
            super.onClose();
        }
        onEnterForeground() {
            super.onEnterForeground();
        }
        onEnterBackground() {
            super.onEnterBackground();
        }
        onHide() {
        }
        onCancelAdCallback(type) {
            let content = "";
            if (type == GameEnumData_1.GetRewardType.Ad) {
                content = GameModelManager_1.GameModelManager.getLanguageTxt(GameTextData_1.GameTextData.GAME_TEXT_MALL_GIFT_ADFAILED_VALUE);
            }
            else {
                content = GameModelManager_1.GameModelManager.getLanguageTxt(GameTextData_1.GameTextData.GAME_TEXT_MALL_GIFT_SHAREFAILED_VALUE);
            }
            UIManager_1.UIManager.showToast(content);
            this.view.closeView();
        }
    };
    PlotStopViewPresenter.uuid = "PlotStopViewPresenter";
    PlotStopViewPresenter = __decorate([
        PresenterCCViewFactory_1.RegPresenter(PlotStopView_1.PlotStopViewType)
    ], PlotStopViewPresenter);
    return PlotStopViewPresenter;
})();
exports.default = PlotStopViewPresenter;

cc._RF.pop();