04087861-0b3c-4233-9430-2239d0ba6b4b.js 3.51 KB
"use strict";
cc._RF.push(module, '04087hhCzxCM5QwIjnQumtL', 'UIFreeDiamond');
// scripts/ui/uiView/UIFreeDiamond.ts

"use strict";
// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
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 });
var SaveDataManager_1 = require("../../component/SaveDataManager");
var Global_1 = require("../../Global");
var TableDefine_1 = require("../../kernel/table/TableDefine");
var UIBase_1 = require("../UIBase");
var UIManager_1 = require("../UIManager");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var UIFreeDiamond = /** @class */ (function (_super) {
    __extends(UIFreeDiamond, _super);
    function UIFreeDiamond() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.btn_ad = null;
        _this._num = 0;
        return _this;
    }
    UIFreeDiamond.prototype.onEnable = function () {
        this._num = Global_1.tMgr.getConfig(TableDefine_1.TableName.GAME_PLAY, 14).Value;
        this.node.getChildByName('txtNum').getComponent(cc.Label).string = this._num.toString();
    };
    UIFreeDiamond.prototype.onBtnGetClick = function () {
        //AD 放广告,放完后调get
        // HeyGamePlatform.instance.showVideoAd(ADID.ADID_ADDCOIN, (_result) => {
        if (true) {
            this.get();
        }
        else {
            console.log('视频播放失败');
        }
        // });
    };
    UIFreeDiamond.prototype.onBtnAdClick = function () {
        //AD 纯放广告
    };
    UIFreeDiamond.prototype.onCloseClick = function () {
        this.close();
    };
    UIFreeDiamond.prototype.get = function () {
        SaveDataManager_1.SaveDataManager.ins.adjustDiamond(this._num, true);
        this.close();
    };
    UIFreeDiamond.prototype.close = function () {
        UIManager_1.UIManager.ins.closeWindow(Global_1.WindowName.FREE_DIAMOND);
    };
    __decorate([
        property(cc.Node)
    ], UIFreeDiamond.prototype, "btn_ad", void 0);
    UIFreeDiamond = __decorate([
        ccclass
    ], UIFreeDiamond);
    return UIFreeDiamond;
}(UIBase_1.UIBase));
exports.default = UIFreeDiamond;

cc._RF.pop();