
                (function() {
                    var nodeEnv = typeof require !== 'undefined' && typeof process !== 'undefined';
                    var __module = nodeEnv ? module : {exports:{}};
                    var __filename = 'preview-scripts/assets/shop/script/shop.js';
                    var __require = nodeEnv ? function (request) {
                        return cc.require(request);
                    } : function (request) {
                        return __quick_compile_project__.require(request, __filename);
                    };
                    function __define (exports, require, module) {
                        if (!nodeEnv) {__quick_compile_project__.registerModule(__filename, module);}"use strict";
cc._RF.push(module, '48bfeZuYFZE2qmgxbW2IigB', 'shop');
// shop/script/shop.ts

"use strict";
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 NumberToImage_1 = require("../../Script/NumberToImage");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var NewClass = /** @class */ (function (_super) {
    __extends(NewClass, _super);
    function NewClass() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        //商店界面
        _this.shop = null;
        //商品列表
        _this.itemList = null;
        // onLoad () {}
        //金币数量
        _this.coin = null;
        return _this;
        // update (dt) {}
    }
    NewClass.prototype.start = function () {
        this.openShop();
    };
    //打开商店界面
    NewClass.prototype.openShop = function () {
        // 商品数据数组
        var products = [
            { product_id: "gold_pack_1", name: "金币包1", price: 600, title: "3x2六档金币" },
            { product_id: "gold_pack_2", name: "金币包2", price: 3600, title: "" },
            { product_id: "gold_pack_3", name: "金币包3", price: 6800, title: "" },
            { product_id: "gold_pack_4", name: "金币包4", price: 12800, title: "" },
            { product_id: "gold_pack_5", name: "金币包5", price: 32800, title: "" },
            { product_id: "gold_pack_6", name: "金币包6", price: 64800, title: "" },
        ];
        for (var i = 1; i <= 6 && i < this.itemList.children.length; i++) {
            var spriteComp = this.itemList.children[i].children[0].getComponent(cc.Sprite);
            var price = this.itemList.children[i].children[1];
            var title = this.itemList.children[i].children[2];
            var product = products[i - 1];
            if (spriteComp && product) {
                // TODO: 根据 product_id 或 name 设置 spriteComp.spriteFrame
            }
            if (price && product) {
                NumberToImage_1.default.numberToImageNodes(product.price / 100, 25, 20, "cost_", price, false);
            }
            if (title && product) {
                NumberToImage_1.default.numberToImageNodes(product.price / 100, 40, 25, "scoin_", title, false);
            }
        }
        NumberToImage_1.default.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
    };
    //关闭商店界面
    NewClass.prototype.closeShop = function () {
        //销毁预制体
        this.shop.destroy();
    };
    __decorate([
        property(cc.Node)
    ], NewClass.prototype, "shop", void 0);
    __decorate([
        property(cc.Node)
    ], NewClass.prototype, "itemList", void 0);
    __decorate([
        property(cc.Node)
    ], NewClass.prototype, "coin", void 0);
    NewClass = __decorate([
        ccclass
    ], NewClass);
    return NewClass;
}(cc.Component));
exports.default = NewClass;

cc._RF.pop();
                    }
                    if (nodeEnv) {
                        __define(__module.exports, __require, __module);
                    }
                    else {
                        __quick_compile_project__.registerModuleFunc(__filename, function () {
                            __define(__module.exports, __require, __module);
                        });
                    }
                })();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 6452 characters]