a20974c8-7c92-402f-af9c-b882e50935e2.js 3.67 KB
"use strict";
cc._RF.push(module, 'a2097TIfJJAL6+cuILlCTXi', 'ExchangeCodeViewImpl');
// script/game/ui/view/impl/ExchangeCodeViewImpl.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.ExchangeCodeViewImpl = void 0;
const ExChangeCodeView_1 = require("../type/ExChangeCodeView");
const CCViewBase_1 = require("../../../../common/classbase/CCViewBase");
const PresenterCCViewFactory_1 = require("../../PresenterCCViewFactory");
const CCDummyObjects_1 = require("../../../../common/CCDummyObjects");
const simba_sdk_1 = require("simba-sdk");
const GameConstData_1 = require("../../../../common/gameplay/gamedata/GameConstData");
const { ccclass, property } = cc._decorator;
let ExchangeCodeViewImpl = /** @class */ (() => {
    let ExchangeCodeViewImpl = class ExchangeCodeViewImpl extends CCViewBase_1.CCPureView {
        constructor() {
            super(...arguments);
            this.titlelbl = CCDummyObjects_1.DummyLabel;
            this.editbox = CCDummyObjects_1.DymmyEditBox;
            this.banner = CCDummyObjects_1.DummyNode;
        }
        setContentTxt(title, content) {
            this.titlelbl.string = title;
            this.editbox.string = content;
        }
        onLoad() {
        }
        onCancleClickCallback() {
            this._props.onActionClick(false);
            this.showBanner(false);
            this.close();
        }
        onOkClickCallback() {
            this._props.onActionClick(true, this.editbox.string);
            this.showBanner(false);
            this.close();
        }
        showBanner(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();
            }
        }
    };
    __decorate([
        property(cc.Label)
    ], ExchangeCodeViewImpl.prototype, "titlelbl", void 0);
    __decorate([
        property(cc.EditBox)
    ], ExchangeCodeViewImpl.prototype, "editbox", void 0);
    __decorate([
        property(cc.Node)
    ], ExchangeCodeViewImpl.prototype, "banner", void 0);
    ExchangeCodeViewImpl = __decorate([
        ccclass,
        PresenterCCViewFactory_1.RegView(ExChangeCodeView_1.ExchangeCodeViewType, "prefab/ui/ExchangeCodeView")
    ], ExchangeCodeViewImpl);
    return ExchangeCodeViewImpl;
})();
exports.ExchangeCodeViewImpl = ExchangeCodeViewImpl;

cc._RF.pop();