|
@@ -10,6 +10,7 @@ namespace GFGGame
|
|
public static int NONE = 0;
|
|
public static int NONE = 0;
|
|
public static int STORY_LV = 1;
|
|
public static int STORY_LV = 1;
|
|
public static int ROLE_LV = 2;
|
|
public static int ROLE_LV = 2;
|
|
|
|
+ public static int MONTH_CARD_TYPE = 3;
|
|
}
|
|
}
|
|
|
|
|
|
public class CostType
|
|
public class CostType
|
|
@@ -24,12 +25,12 @@ namespace GFGGame
|
|
public string[] refreshType = { "永久限购", "每日限购", "每周限购", "每月限购" };
|
|
public string[] refreshType = { "永久限购", "每日限购", "每周限购", "每月限购" };
|
|
|
|
|
|
private Dictionary<int, int> _rechargeDic = new Dictionary<int, int>();
|
|
private Dictionary<int, int> _rechargeDic = new Dictionary<int, int>();
|
|
- private Dictionary<int, int> _giftDic = new Dictionary<int, int>();
|
|
|
|
|
|
+ private Dictionary<int, int> _goodsDic = new Dictionary<int, int>();
|
|
private Dictionary<int, int> _exchangeDic = new Dictionary<int, int>();
|
|
private Dictionary<int, int> _exchangeDic = new Dictionary<int, int>();
|
|
public void Clear()
|
|
public void Clear()
|
|
{
|
|
{
|
|
_rechargeDic.Clear();
|
|
_rechargeDic.Clear();
|
|
- _giftDic.Clear();
|
|
|
|
|
|
+ _goodsDic.Clear();
|
|
_exchangeDic.Clear();
|
|
_exchangeDic.Clear();
|
|
}
|
|
}
|
|
public void UpdateRechargeData(int rechargeId, int num)
|
|
public void UpdateRechargeData(int rechargeId, int num)
|
|
@@ -45,13 +46,13 @@ namespace GFGGame
|
|
}
|
|
}
|
|
public void UpdateGiftData(int giftId, int num)
|
|
public void UpdateGiftData(int giftId, int num)
|
|
{
|
|
{
|
|
- if (!_giftDic.ContainsKey(giftId))
|
|
|
|
|
|
+ if (!_goodsDic.ContainsKey(giftId))
|
|
{
|
|
{
|
|
- _giftDic.Add(giftId, num);
|
|
|
|
|
|
+ _goodsDic.Add(giftId, num);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- _giftDic[giftId] = num;
|
|
|
|
|
|
+ _goodsDic[giftId] = num;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public void UpdateExchangeData(int exchangeId, int num)
|
|
public void UpdateExchangeData(int exchangeId, int num)
|
|
@@ -140,13 +141,13 @@ namespace GFGGame
|
|
return !_rechargeDic.ContainsKey(rechargeId) ? 0 : _rechargeDic[rechargeId];
|
|
return !_rechargeDic.ContainsKey(rechargeId) ? 0 : _rechargeDic[rechargeId];
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 根据礼包id获取购买次数
|
|
|
|
|
|
+ /// 根据商品id获取购买次数
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="giftId"></param>
|
|
|
|
|
|
+ /// <param name="goodsId"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public int GetGiftBuyNumById(int giftId)
|
|
|
|
|
|
+ public int GetGoodsBuyNumById(int goodsId)
|
|
{
|
|
{
|
|
- return !_giftDic.ContainsKey(giftId) ? 0 : _giftDic[giftId];
|
|
|
|
|
|
+ return !_goodsDic.ContainsKey(goodsId) ? 0 : _goodsDic[goodsId];
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 根据充值id获取购买次数
|
|
/// 根据充值id获取购买次数
|
|
@@ -181,14 +182,14 @@ namespace GFGGame
|
|
{
|
|
{
|
|
|
|
|
|
//未售罄的>未解锁>已售罄的
|
|
//未售罄的>未解锁>已售罄的
|
|
- int buyTypeA = (a.maxBuyNum == 0 || a.maxBuyNum - GetGiftBuyNumById(a.id) > 0) ? 1 : -1;
|
|
|
|
- int buyTypeB = (b.maxBuyNum == 0 || b.maxBuyNum - GetGiftBuyNumById(b.id) > 0) ? 1 : -1;
|
|
|
|
|
|
+ int buyTypeA = (a.maxBuyNum == 0 || a.maxBuyNum - GetGoodsBuyNumById(a.id) > 0) ? 1 : -1;
|
|
|
|
+ int buyTypeB = (b.maxBuyNum == 0 || b.maxBuyNum - GetGoodsBuyNumById(b.id) > 0) ? 1 : -1;
|
|
if (buyTypeA > buyTypeB) return -1;
|
|
if (buyTypeA > buyTypeB) return -1;
|
|
if (buyTypeA < buyTypeB) return 1;
|
|
if (buyTypeA < buyTypeB) return 1;
|
|
|
|
|
|
//解锁状态
|
|
//解锁状态
|
|
- int lockA = GetGiftStateById(a.id) ? 1 : -1;
|
|
|
|
- int lockB = GetGiftStateById(b.id) ? 1 : -1;
|
|
|
|
|
|
+ int lockA = GetShopGoodsStateById(a.id) ? 1 : -1;
|
|
|
|
+ int lockB = GetShopGoodsStateById(b.id) ? 1 : -1;
|
|
if (lockA > lockB) return -1;
|
|
if (lockA > lockB) return -1;
|
|
if (lockA < lockB) return 1;
|
|
if (lockA < lockB) return 1;
|
|
|
|
|
|
@@ -246,7 +247,7 @@ namespace GFGGame
|
|
});
|
|
});
|
|
for (int i = 0; i < giftBagCfgs.Count; i++)
|
|
for (int i = 0; i < giftBagCfgs.Count; i++)
|
|
{
|
|
{
|
|
- if (GetGiftStateById(giftBagCfgs[i].id) && (GetGiftBuyNumById(giftBagCfgs[i].id) < giftBagCfgs[i].maxBuyNum)) return giftBagCfgs[i];
|
|
|
|
|
|
+ if (GetShopGoodsStateById(giftBagCfgs[i].id) && (GetGoodsBuyNumById(giftBagCfgs[i].id) < giftBagCfgs[i].maxBuyNum)) return giftBagCfgs[i];
|
|
}
|
|
}
|
|
return giftBagCfgs[0];
|
|
return giftBagCfgs[0];
|
|
}
|
|
}
|
|
@@ -264,7 +265,7 @@ namespace GFGGame
|
|
});
|
|
});
|
|
for (int i = 0; i < giftBagCfgs.Count; i++)
|
|
for (int i = 0; i < giftBagCfgs.Count; i++)
|
|
{
|
|
{
|
|
- if (GetGiftStateById(giftBagCfgs[i].id) && (GetGiftBuyNumById(giftBagCfgs[i].id) < giftBagCfgs[i].maxBuyNum)) return giftBagCfgs[i];
|
|
|
|
|
|
+ if (GetShopGoodsStateById(giftBagCfgs[i].id) && (GetGoodsBuyNumById(giftBagCfgs[i].id) < giftBagCfgs[i].maxBuyNum)) return giftBagCfgs[i];
|
|
}
|
|
}
|
|
return giftBagCfgs[0];
|
|
return giftBagCfgs[0];
|
|
}
|
|
}
|
|
@@ -284,13 +285,13 @@ namespace GFGGame
|
|
return shopExchangeCfgs;
|
|
return shopExchangeCfgs;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 根据礼包Id获取礼包解锁状态
|
|
|
|
|
|
+ /// 根据商品Id获取商品是否解锁解锁
|
|
/// /// </summary>
|
|
/// /// </summary>
|
|
- /// <param name="giftId"></param>
|
|
|
|
|
|
+ /// <param name="goodsId"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public bool GetGiftStateById(int giftId)
|
|
|
|
|
|
+ public bool GetShopGoodsStateById(int goodsId)
|
|
{
|
|
{
|
|
- GiftBagCfg cfg = GiftBagCfgArray.Instance.GetCfg(giftId);
|
|
|
|
|
|
+ ShopCfg cfg = ShopCfgArray.Instance.GetCfg(goodsId);
|
|
|
|
|
|
if (cfg.lockType == LockType.NONE)
|
|
if (cfg.lockType == LockType.NONE)
|
|
{
|
|
{
|
|
@@ -300,6 +301,10 @@ namespace GFGGame
|
|
{
|
|
{
|
|
return InstanceZonesDataManager.CheckLevelPass(cfg.storyLevelId);
|
|
return InstanceZonesDataManager.CheckLevelPass(cfg.storyLevelId);
|
|
}
|
|
}
|
|
|
|
+ else if (cfg.lockType == LockType.MONTH_CARD_TYPE)
|
|
|
|
+ {
|
|
|
|
+ return RoleDataManager.CheckIsMonthCardOpenByType(cfg.MonthlyCardType);
|
|
|
|
+ }
|
|
else
|
|
else
|
|
{
|
|
{
|
|
return GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl) >= cfg.lv;
|
|
return GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl) >= cfg.lv;
|