| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- cc.Class({
- extends: cc.Component,
- properties: {
- TopBtnImg_OnChecked: {
- default: null,
- type: cc.Texture2D,
- serializable: true,
- },
- TopBtnImg_UnChecked: {
- default: null,
- type: cc.Texture2D,
- serializable: true,
- },
- GoodsList_Diamonds: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- GoodsList_Tools: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- TopBtn_Diamond: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- TopBtn_Tools: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- PayPage: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- Tip_AfterPay: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- GoodsPriceList_Diamonds:null,
- GoodsPriceList_Tools:null,
- },
- OnActive()
- {
- },
- start () {
- this.GoodsPriceList_Diamonds=[
- {
- GoodsID: 0,
- GoodsPrice:1,
- GoodsNum:10
- },
- {
- GoodsID: 1,
- GoodsPrice:2,
- GoodsNum:20
- },
- {
- GoodsID: 2,
- GoodsPrice:3,
- GoodsNum:30
- },
- {
- GoodsID: 3,
- GoodsPrice:5,
- GoodsNum:80
- },
- {
- GoodsID: 4,
- GoodsPrice:10,
- GoodsNum:180
- },
- {
- GoodsID: 5,
- GoodsPrice:20,
- GoodsNum:500
- },
- ];
- this.GoodsPriceList_Tools=[
- {
- GoodsID: 0,
- GoodsName:'矿泉水',
- GoodsPrice:10,
- GoodsNum:1
- },
- {
- GoodsID: 1,
- GoodsName:'乳酸',
- GoodsPrice:20,
- GoodsNum:1
- }
- ]
- },
- //0钻石1道具
- ShopTypeOnChecked(event,customData){
- if(customData==0){
- this.TopBtn_Diamond.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(this.TopBtnImg_OnChecked);
- this.TopBtn_Tools.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(this.TopBtnImg_UnChecked);
- this.GoodsList_Diamonds.active = true;
- this.GoodsList_Tools.active = false;
- }else if(customData==1){
- this.TopBtn_Diamond.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(this.TopBtnImg_UnChecked);
- this.TopBtn_Tools.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(this.TopBtnImg_OnChecked);
- this.GoodsList_Diamonds.active = false;
- this.GoodsList_Tools.active = true;
- }
- },
- //钻石购买customData传回来GoodsID
- GoodsDiamondsPriceBtnOnClick(event,customData){
- for(var i = 0;i<this.GoodsPriceList_Diamonds.length;i++){
- if(customData == this.GoodsPriceList_Diamonds[i].GoodsID){
- var PayPageCtrl = this.PayPage.getComponent('PayPage');
- var Tip_AfterPayText = '钻石+'+this.GoodsPriceList_Diamonds[i].GoodsNum;
- PayPageCtrl.PayPageInit(Tip_AfterPayText,this.GoodsPriceList_Diamonds[i].GoodsPrice);
- this.PayPage.active = true;
- }
- }
- },
- //道具购买customData传回来GoodsID
- GoodsToolsPriceBtnOnClick(event,customData){
- for(var i = 0;i<this.GoodsPriceList_Tools.length;i++){
- if(customData == this.GoodsPriceList_Tools[i].GoodsID){
- var Tip_AfterPayText = this.GoodsPriceList_Tools[i].GoodsName+'+'+this.GoodsPriceList_Tools[i].GoodsNum;
- this.Tip_AfterPay.getChildByName('TipText').getComponent(cc.Label).string = Tip_AfterPayText;
- this.Tip_AfterPay.active = true;
- var animCtrl = this.Tip_AfterPay.getComponent(cc.Animation);
- animCtrl.play();
- }
- }
- },
- });
|