/// <summary> /// 获取商城物品每日购买次数限制---目前VIP等级会影响到这里,后期可能还会增加其他限制; /// </summary> /// <param name="shopT"></param> /// <param name="vipLv"></param> /// <returns></returns> public int GetShopItemDailyBuyTimes(ShopTemplate shopT, int vipLv) { if (shopT.getDailyMaxBuy() < 0) { return(-1); } int vipCount = 0;//根据VIP算出的附加值; //行动力补满药水; if (shopT.getId() == GetGameConfig().getEp_supplement_goods()) { VipTemplate vip = GetVipTemplateById(vipLv); vipCount = vip.getMaxBuyEp(); } //活力补满药水; if (shopT.getId() == GetGameConfig().getAp_supplement_goods()) { VipTemplate vip = GetVipTemplateById(vipLv); vipCount = vip.getMaxBuyAp(); } return(shopT.getDailyMaxBuy() + vipCount); }
public static SHOP_LIMIT_TYPE GetShopLimitType(ShopTemplate shopT) { if (shopT == null) { return(SHOP_LIMIT_TYPE.NONE); } int daily = shopT.getDailyMaxBuy(); int total = shopT.getShelveMaxBuy(); if (daily != -1) { return(SHOP_LIMIT_TYPE.DAILY); } if (daily == -1 && total != -1) { return(SHOP_LIMIT_TYPE.TOTAL); } if (daily != -1 && total != -1) { LogManager.LogError("策划说不会有每天限购且永久限购类型的商品"); return(SHOP_LIMIT_TYPE.NONE); } return(SHOP_LIMIT_TYPE.NONE); }
/// <summary> /// 活力商品显示 /// </summary> private void InitPowerShopUI() { int surplusNum_0 = 0; //可用次数 goods = config.getAp_supplement_goods(); //活力补满商品的ID ShopTemplate shopDate = (ShopTemplate)DataTemplate.GetInstance().m_ShopTable.getTableData(goods); if (shopDate == null) { LogManager.Log("is Shop null !!!!"); return; } m_NameTxt_0.text = GameUtils.getString(shopDate.getCommodityName()); m_DesTxt_0.text = GameUtils.getString(shopDate.getCommodityDes()); //商品使用次数+Vip的使用次数 surplusNum_0 = shopDate.getDailyMaxBuy() + vipData.getMaxBuyAp(); //剩余使用次数 Shopbuy shop = ObjectSelf.GetInstance().GetShopBuyInfoByShopId(goods); m_curSurpNum_0 = surplusNum_0 - shop.todaynum; _SurplusNumTxt_0.text = m_curSurpNum_0.ToString(); _Icon_0.sprite = UIResourceMgr.LoadSprite(common.defaultPath + shopDate.getResourceName()); //消耗钻石显示 m_conDiamNum = DataTemplate.GetInstance().GetShopBuyCost(shopDate, shop.todaynum); _ConDiamNumTxt.text = m_conDiamNum.ToString(); SetBtnColor(m_curSurpNum_0, _UserBtn_0, ObjectSelf.GetInstance().Gold); }
/// <summary> /// 该物品是否限购; /// </summary> /// <param name="shopT"></param> /// <returns></returns> public static bool IsShopBuyLimited(ShopTemplate shopT) { if (shopT == null) { return(false); } return(shopT.getDailyMaxBuy() > 0 || shopT.getShelveMaxBuy() > 0); }
/****************检测商店的可购买礼包*****************/ /// <summary> /// 检测商店的可购买礼包 /// </summary> /// <returns></returns> public bool CheckNonPurchasedGiftSet() { bool _result = false; m_NonPurchasedGiftSetList.Clear(); for (int i = 0; i < m_GiftSetList.Count; i++) { bool _timesResult = true; ShopTemplate _shopT = m_GiftSetList[i]; if (_shopT.getVipLimit() > m_ObjectSelf.VipLevel) { continue; } int _maxTimes = _shopT.getDailyMaxBuy(); int _maxTotalTimes = _shopT.getShelveMaxBuy(); var _shopBuy = m_ObjectSelf.GetShopBuyInfoByShopId(_shopT.GetID()); if (_maxTimes > 0) { _timesResult &= _maxTimes > _shopBuy.todaynum; } if (_maxTotalTimes > 0) { _timesResult &= _maxTotalTimes > _shopBuy.buyallnum; } if (_timesResult) { _result |= true; m_NonPurchasedGiftSetList.Add(_shopT.GetID()); } } return(_result); }