|
@@ -16,7 +16,27 @@ cc.Class({
|
|
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
// LIFE-CYCLE CALLBACKS:
|
|
onLoad () {
|
|
onLoad () {
|
|
|
|
+ this.setUpNotification();
|
|
|
|
+ this.handelUserShops();
|
|
|
|
+ GameModule.userInfo.shop = this;
|
|
|
|
+ },
|
|
|
|
|
|
|
|
+ handelUserShops() {
|
|
|
|
+ let shops = Global.shops;
|
|
|
|
+ this._mtArr = [];
|
|
|
|
+ this._useTimeArr = [];
|
|
|
|
+ this._diamondShopCoinTime = 0;
|
|
|
|
+ if (shops == undefined || shops.length == 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ for (let i = 0; i < shops.length; ++ i) {
|
|
|
|
+ let shop = shops[i];
|
|
|
|
+ this.handelShop(shop);
|
|
|
|
+ }
|
|
|
|
+ this.updateTimeSchedule();
|
|
|
|
+ },
|
|
|
|
+ /// 设置通知
|
|
|
|
+ setUpNotification() {
|
|
GameEvent.on('store_buy_coin_updateDiamond', this, () => {
|
|
GameEvent.on('store_buy_coin_updateDiamond', this, () => {
|
|
/// 说明前面没有这个商品
|
|
/// 说明前面没有这个商品
|
|
if (this._diamondShopCoinTime === 0) {
|
|
if (this._diamondShopCoinTime === 0) {
|
|
@@ -76,7 +96,12 @@ cc.Class({
|
|
if (stringArr.length > 1) {
|
|
if (stringArr.length > 1) {
|
|
desc = stringArr[0] + '<br/>' + stringArr[1];
|
|
desc = stringArr[0] + '<br/>' + stringArr[1];
|
|
}
|
|
}
|
|
- AlertManager.showCommonAlert(iconPath, desc, shop.name);
|
|
|
|
|
|
+ /// 如果是每天获取钻石的数量 那么点击确定之后才更新砖石数量
|
|
|
|
+ if (shop.shopId === 0 && shop.diamond !== undefined && shop.diamond > 0) {
|
|
|
|
+ AlertManager.showGetDiamondEveryDayAlert(iconPath, desc, shop.name, shop.diamond);
|
|
|
|
+ } else {
|
|
|
|
+ AlertManager.showCommonAlert(iconPath, desc, shop.name);
|
|
|
|
+ }
|
|
/// 如果商品id小于等于0什么都不做
|
|
/// 如果商品id小于等于0什么都不做
|
|
if (shop.shopId > 0) {
|
|
if (shop.shopId > 0) {
|
|
this.reportShop(shop.shopId);
|
|
this.reportShop(shop.shopId);
|