mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
qqqq
This commit is contained in:
@@ -5,6 +5,7 @@ import { TD } from '../../App';
|
||||
import { Label } from 'cc';
|
||||
import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
|
||||
import GiftData from '../../data/GiftData';
|
||||
import NumberTools from '../../tools/NumberTools';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('ShopGiftItem')
|
||||
@@ -16,6 +17,9 @@ export class ShopGiftItem extends JNScrollViewItem<TB.TbGShop> {
|
||||
@property(Label)
|
||||
giftLimit:Label; //限购
|
||||
|
||||
@property(Label)
|
||||
giftPrice:Label; //价格
|
||||
|
||||
@property(JNScrollView)
|
||||
views:JNScrollView; //礼包列表
|
||||
|
||||
@@ -25,10 +29,6 @@ export class ShopGiftItem extends JNScrollViewItem<TB.TbGShop> {
|
||||
|
||||
this.gift = TD.TbGGift.get(data.giftId);
|
||||
|
||||
}
|
||||
|
||||
protected start(): void {
|
||||
|
||||
this.giftName.string = this.data.tig;
|
||||
|
||||
if(this.gift.limit == TbGEnum.TGiftLimit.Unlimited)
|
||||
@@ -38,10 +38,11 @@ export class ShopGiftItem extends JNScrollViewItem<TB.TbGShop> {
|
||||
if(this.gift.limit == TbGEnum.TGiftLimit.Limit)
|
||||
this.giftLimit.string = `限制( ${GiftData.getIns().getGiftRecordCount(this.gift.id)}/${this.gift.limitValue} )`;
|
||||
|
||||
this.giftPrice.string = `${NumberTools.NumberStr(this.gift.exchanges[0].value)} ${TD.TbGResource.get(this.gift.exchanges[0].id).name}`;
|
||||
this.views.refreshData(this.gift.rewards);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//点击购买礼包
|
||||
async onClickBuy(){
|
||||
|
@@ -3,6 +3,9 @@ import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLay
|
||||
import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
|
||||
import { app, TD } from '../../App';
|
||||
import GiftData, { GiftDataEnum } from '../../data/GiftData';
|
||||
import { Sprite } from 'cc';
|
||||
import { color } from 'cc';
|
||||
import { EventTouch } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//商店页面
|
||||
@@ -13,6 +16,13 @@ export class ShopView extends JNLayerBase {
|
||||
@property(JNScrollView)
|
||||
views:JNScrollView
|
||||
|
||||
//商店标签
|
||||
@property(Node)
|
||||
tigs:Node;
|
||||
|
||||
//页面下标
|
||||
index:number = 0;
|
||||
|
||||
async onJNLoad(data?: any) {
|
||||
|
||||
super.onJNLoad(data);
|
||||
@@ -31,13 +41,24 @@ export class ShopView extends JNLayerBase {
|
||||
|
||||
async onUpdateView() {
|
||||
|
||||
await GiftData.getIns().UpdateGiftRecord();
|
||||
await GiftData.getIns().UpdateGiftDayRecord();
|
||||
this.tigs.children.forEach((item,index) => {
|
||||
if(this.index == index){
|
||||
item.getComponentInChildren(Sprite).color = color(0,0,0);
|
||||
}else{
|
||||
item.getComponentInChildren(Sprite).color = color(255,255,255);
|
||||
}
|
||||
})
|
||||
|
||||
this.views.refreshData(TD.TbGShop.getDataList());
|
||||
this.views.refreshData(TD.TbGShop.getDataList().filter(item => item.type == this.index));
|
||||
|
||||
}
|
||||
|
||||
//切换下标
|
||||
onClickTigs(touch:EventTouch){
|
||||
this.index = touch.target.getSiblingIndex();
|
||||
this.onUpdateView();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user