商店商品++
This commit is contained in:
@@ -1,21 +1,35 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { GoodsComp } from './GoodsComp';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
import { getRandomGoods } from '../common/config/Goods';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('ShopPageComp')
|
||||
export class ShopPageComp extends Component {
|
||||
daily_goods:any[]=[1001,1002,1004,1006]
|
||||
weekly_goods:any[]=[]
|
||||
monthly_goods:any[]=[]
|
||||
special_goods:any[]=[]
|
||||
daily:any[]=[]
|
||||
weekly:any[]=[]
|
||||
monthly:any[]=[]
|
||||
special:any[]=[]
|
||||
start() {
|
||||
this.update_daily_goods()
|
||||
this.update_daily()
|
||||
this.update_weekly()
|
||||
}
|
||||
update_daily_goods(){
|
||||
update_daily(){
|
||||
let items=this.node.getChildByName("daily").getChildByName("items").children
|
||||
for(let i=0;i<items.length;i++){
|
||||
let goods=items[i]
|
||||
goods.getComponent(GoodsComp).update_data(this.daily_goods[i],i)
|
||||
goods.getComponent(GoodsComp).update_data(smc.shop.daily[i],i)
|
||||
}
|
||||
}
|
||||
update_weekly(){
|
||||
if(smc.shop.weekly.length ==0) {
|
||||
this.weekly=getRandomGoods()
|
||||
}
|
||||
smc.shop.weekly=this.weekly
|
||||
let items=this.node.getChildByName("weekly").getChildByName("items").children
|
||||
for(let i=0;i<items.length;i++){
|
||||
let goods=items[i]
|
||||
goods.getComponent(GoodsComp).update_data(smc.shop.weekly[i],i+4)
|
||||
}
|
||||
}
|
||||
update(deltaTime: number) {
|
||||
|
||||
Reference in New Issue
Block a user