This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2024-01-23 02:53:23 +08:00
parent c6710e7dfa
commit 26cc480866
27 changed files with 2061 additions and 988 deletions

View File

@@ -25,8 +25,6 @@ export class PetIcon extends Component {
info:PlayerPetOV;
onLoad(){
this.reset();
//监听
app.event.on(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this)
}
@@ -35,13 +33,6 @@ export class PetIcon extends Component {
app.event.off(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this)
}
//初始化
reset(){
this.starNode.active = false;
}
//信息更新
onUpdateInfo(info:PlayerPetOV){
if(this.info && info.petId == this.info.petId){
@@ -51,6 +42,9 @@ export class PetIcon extends Component {
//刷新页面
onUpdateView(){
this.starNode.active = false;
this.spine.skeletonData = app.battleRes.getRoleSpine(this.info.petTbId);
this.spine.setAnimation(0,UIPetAnim.std,true);
@@ -67,7 +61,6 @@ export class PetIcon extends Component {
//设置icon
set(info:PlayerPetOV){
this.reset();
this.info = info;
this.onUpdateView();
}

View File

@@ -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(){

View File

@@ -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();
}
}