1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- const WeChat = require('../net/WeChat');
- const GameModule = require("../utils/GameModule");
- cc.Class({
- extends: cc.Component,
- properties: {
- content: cc.Node,
- item: cc.Prefab,
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- /// 初始化 四个
- let contentWidth = this.content.width;
- let itemWith = Math.floor((contentWidth - 75) / 2);
- for(let i = 0; i < 4; ++i) {
- let itemNode = cc.instantiate(this.item);
- itemNode.getComponent('StoreDiamondItem').init(i);
- let itemNodeWidth = itemNode.width;
- let itemNodeHeight = itemNode.height;
- let radio = itemNodeHeight / itemNodeWidth;
- itemNode.width = itemWith;
- itemNode.height = itemNodeHeight * radio;
- this.content.addChild(itemNode);
- }
- },
- init(index) {
- GameEvent.fire('StoreDiamondSelect', index);
- },
- start () {
- },
- /// 购买
- buyAction() {
- GameModule.audioMng.playClickButton();
- WeChat.jumpCustomerServices();
- },
- closeAction() {
- GameModule.audioMng.playClickButton();
- this.node.destroy();
- }
- // update (dt) {},
- });
|