673a781b-d296-4975-b641-63300e136dcd.js 4.07 KB
"use strict";
cc._RF.push(module, '673a7gb0pZJdbZBYzAOE23N', 'PlotStopViewImpl');
// script/game/ui/view/impl/PlotStopViewImpl.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 simba_sdk_ccsvbutton_1 = require("simba-sdk-ccsvbutton");
const CCDummyObjects_1 = require("../../../../common/CCDummyObjects");
const CCViewBase_1 = require("../../../../common/classbase/CCViewBase");
const GameConstData_1 = require("../../../../common/gameplay/gamedata/GameConstData");
const GameEnumData_1 = require("../../../../common/gameplay/gamedata/GameEnumData");
const PresenterCCViewFactory_1 = require("../../PresenterCCViewFactory");
const PlotStopView_1 = require("../type/PlotStopView");
const { ccclass, property } = cc._decorator;
let PlotStopViewImpl = /** @class */ (() => {
    let PlotStopViewImpl = class PlotStopViewImpl extends CCViewBase_1.CCPureView {
        constructor() {
            super(...arguments);
            this.banner = CCDummyObjects_1.DummyNode;
            this.adButton = undefined;
            this.svType = GameEnumData_1.GetRewardType.Ad;
            this.isShowViewBanner = (isShow) => {
                if (isShow) {
                    let info = simba_sdk_1.SDK.systemInfo.displayInfo;
                    let aspect = info.windowSize.height / cc.view.getVisibleSize().height;
                    this.node.getComponent(cc.Widget).updateAlignment();
                    let _width = this.banner.width * aspect;
                    let _height = this.banner.height * aspect;
                    let _left = (info.windowSize.width - _width) * 0.5;
                    let _top = info.windowSize.height - _height;
                    let style = {
                        left: _left,
                        top: _top,
                        width: _width,
                        height: _height,
                        anchorX: 0.5,
                        anchorY: 1,
                    };
                    simba_sdk_1.SDK.showBannerAd(style, GameConstData_1.GameConstData.GAME_CONST_BANNER_REFRESH_TIME);
                }
                else {
                    simba_sdk_1.SDK.hideBannerAd();
                }
            };
            this.getSvBtnType = () => {
                let ret = "share";
                if (this.adButton.svPoint) {
                    ret = this.adButton.svPoint.type;
                }
                return ret;
            };
        }
        onLoad() {
            this.adButton.onResult = (type, ret) => {
                if (ret) {
                    this._props.onAddRes(type);
                }
                else {
                    this._props.onCancelAdCallback(this.svType);
                }
            };
        }
        closeView() {
            this.isShowViewBanner(false);
            this.close();
        }
        onEnable() {
            this.isShowViewBanner(true);
            this.adButton.loadSVConfig();
        }
        unlockPlotCallback(event) {
            this._props.unlockPlotCallbackFunc();
        }
    };
    __decorate([
        property(cc.Node)
    ], PlotStopViewImpl.prototype, "banner", void 0);
    __decorate([
        property({ type: simba_sdk_ccsvbutton_1.default })
    ], PlotStopViewImpl.prototype, "adButton", void 0);
    PlotStopViewImpl = __decorate([
        ccclass,
        PresenterCCViewFactory_1.RegView(PlotStopView_1.PlotStopViewType, "prefab/ui/PlotStopView")
    ], PlotStopViewImpl);
    return PlotStopViewImpl;
})();
exports.default = PlotStopViewImpl;

cc._RF.pop();