|
@@ -10,26 +10,12 @@ namespace GFGGame
|
|
|
{
|
|
|
public string[] refreshType = { "永久限购", "每日限购", "每周限购", "每月限购" };
|
|
|
|
|
|
- // private Dictionary<int, int> _rechargeDic = new Dictionary<int, int>();
|
|
|
private Dictionary<int, int> _goodsDic = new Dictionary<int, int>();
|
|
|
- // private Dictionary<int, int> _exchangeDic = new Dictionary<int, int>();
|
|
|
public void Clear()
|
|
|
{
|
|
|
- // _rechargeDic.Clear();
|
|
|
_goodsDic.Clear();
|
|
|
- // _exchangeDic.Clear();
|
|
|
}
|
|
|
- // public void UpdateRechargeData(int rechargeId, int num)
|
|
|
- // {
|
|
|
- // if (!_rechargeDic.ContainsKey(rechargeId))
|
|
|
- // {
|
|
|
- // _rechargeDic.Add(rechargeId, num);
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // _rechargeDic[rechargeId] = num;
|
|
|
- // }
|
|
|
- // }
|
|
|
+
|
|
|
public void UpdateGiftData(int giftId, int num)
|
|
|
{
|
|
|
if (!_goodsDic.ContainsKey(giftId))
|
|
@@ -41,17 +27,7 @@ namespace GFGGame
|
|
|
_goodsDic[giftId] = num;
|
|
|
}
|
|
|
}
|
|
|
- // public void UpdateExchangeData(int exchangeId, int num)
|
|
|
- // {
|
|
|
- // if (!_exchangeDic.ContainsKey(exchangeId))
|
|
|
- // {
|
|
|
- // _exchangeDic.Add(exchangeId, num);
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // _exchangeDic[exchangeId] = num;
|
|
|
- // }
|
|
|
- // }
|
|
|
+
|
|
|
/************************************************************************************************************/
|
|
|
|
|
|
public List<ShopCfg> GetList(int storeId, int typeIndex, int scoreType)
|
|
@@ -60,10 +36,10 @@ namespace GFGGame
|
|
|
switch (storeId)
|
|
|
{
|
|
|
case ConstStoreId.CLOTHING_STORE_ID:
|
|
|
- shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2AndtypeIndex(ConstStoreTabId.FU_ZHUANG_DIAN, ConstStoreSubId.FU_ZHUANG_DIAN, typeIndex);
|
|
|
+ shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2AndtypeIndex(ConstStoreTabId.FU_ZHUANG_DIAN, ConstStoreSubId.FU_ZHUANG_DIAN, typeIndex.ToString());
|
|
|
break;
|
|
|
case ConstStoreId.GALLERY_STORE_ID:
|
|
|
- shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2AndtypeIndex(ConstStoreTabId.STORE_EXCHANGE, ConstStoreSubId.STORE_EXCHANGE_GALLERY, typeIndex);
|
|
|
+ shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2AndtypeIndex(ConstStoreTabId.STORE_EXCHANGE, ConstStoreSubId.STORE_EXCHANGE_GALLERY, typeIndex.ToString());
|
|
|
break;
|
|
|
}
|
|
|
SortItemListByScore(shopCfgs, scoreType);
|
|
@@ -117,15 +93,7 @@ namespace GFGGame
|
|
|
|
|
|
|
|
|
/**************************************************************************************************************************/
|
|
|
- // /// <summary>
|
|
|
- // /// 根据充值id获取购买次数
|
|
|
- // /// </summary>
|
|
|
- // /// <param name="rechargeId"></param>
|
|
|
- // /// <returns></returns>
|
|
|
- // public int GetRechargeBuyNumById(int rechargeId)
|
|
|
- // {
|
|
|
- // return !_rechargeDic.ContainsKey(rechargeId) ? 0 : _rechargeDic[rechargeId];
|
|
|
- // }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 根据商品id获取购买次数
|
|
|
/// </summary>
|
|
@@ -135,33 +103,22 @@ namespace GFGGame
|
|
|
{
|
|
|
return !_goodsDic.ContainsKey(goodsId) ? 0 : _goodsDic[goodsId];
|
|
|
}
|
|
|
- // /// <summary>
|
|
|
- // /// 根据充值id获取购买次数
|
|
|
- // /// </summary>
|
|
|
- // /// <param name="exchangeId"></param>
|
|
|
- // /// <returns></returns>
|
|
|
- // public int GetExchangeBuyNumById(int exchangeId)
|
|
|
- // {
|
|
|
- // return !_exchangeDic.ContainsKey(exchangeId) ? 0 : _exchangeDic[exchangeId];
|
|
|
- // }
|
|
|
-
|
|
|
|
|
|
- public List<GiftBagCfg> GetGiftBagCfgs()
|
|
|
+ //移除未上架商品
|
|
|
+ public List<ShopCfg> RemoveNotOpenCfg(List<ShopCfg> shop)
|
|
|
{
|
|
|
- // List<GiftBagCfg> giftBagCfgs = new List<GiftBagCfg>();
|
|
|
-
|
|
|
- // List<GiftBagCfg> noneGiftBagCfgs = GetNoneGiftCfg();
|
|
|
- // giftBagCfgs = giftBagCfgs.Concat(noneGiftBagCfgs).ToList<GiftBagCfg>();
|
|
|
-
|
|
|
- // GiftBagCfg StoryLvGiftCfg = GetStoryLvGiftCfg();
|
|
|
- // if (StoryLvGiftCfg != null) giftBagCfgs.Add(StoryLvGiftCfg);
|
|
|
- // GiftBagCfg RoleLvGiftCfg = GetRoleLvGiftCfg();
|
|
|
- // if (RoleLvGiftCfg != null) giftBagCfgs.Add(RoleLvGiftCfg);
|
|
|
- // giftBagCfgs = RemoveNotOpenCfg(giftBagCfgs);
|
|
|
- // SortGiftBagCfgs(giftBagCfgs);
|
|
|
- // return giftBagCfgs;
|
|
|
- return null;
|
|
|
+ List<ShopCfg> shopCfgs = new List<ShopCfg>();
|
|
|
+ for (int i = shop.Count - 1; i >= 0; i--)
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(shop[i].startTime) && !TimeUtil.IsBeforeCurTime(shop[i].startTime) || !string.IsNullOrEmpty(shop[i].endTime) && !TimeUtil.IsLaterCurTime(shop[i].endTime))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ shopCfgs.Add(shop[i]);
|
|
|
+ }
|
|
|
+ return shopCfgs;
|
|
|
}
|
|
|
+ //商品排序
|
|
|
public List<ShopCfg> SortShopGoodsCfgs(List<ShopCfg> shopCfgs)
|
|
|
{
|
|
|
shopCfgs.Sort((ShopCfg a, ShopCfg b) =>
|
|
@@ -176,6 +133,7 @@ namespace GFGGame
|
|
|
});
|
|
|
return shopCfgs;
|
|
|
}
|
|
|
+ //获取商店所有消耗品id列表
|
|
|
public List<int> GetShopCostIds(List<ShopCfg> shopCfgs)
|
|
|
{
|
|
|
List<int> costIds = new List<int>();
|
|
@@ -189,123 +147,6 @@ namespace GFGGame
|
|
|
}
|
|
|
return costIds;
|
|
|
}
|
|
|
- // public List<ShopCfg> SortGiftBagCfgs(List<ShopCfg> shopCfgs)
|
|
|
- // {
|
|
|
- // shopCfgs.Sort((ShopCfg a, ShopCfg b) =>
|
|
|
- // {
|
|
|
-
|
|
|
- // //未售罄的>未解锁>已售罄的
|
|
|
- // 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;
|
|
|
-
|
|
|
- // //解锁状态
|
|
|
- // 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 (a.costType < b.costType) return -1;
|
|
|
- // if (a.costType > b.costType) return 1;
|
|
|
-
|
|
|
- // //有下架时间的 > 没有下架时间的
|
|
|
- // int endTimeA = a.endTime != "" ? 1 : -1;
|
|
|
- // int endTimeB = b.endTime != "" ? 1 : -1;
|
|
|
- // if (endTimeA > endTimeB) return -1;
|
|
|
- // if (endTimeA < endTimeB) return 1;
|
|
|
-
|
|
|
-
|
|
|
- // //折扣打的>折扣小的
|
|
|
- // int disCountA = GetShopGoodsDiscount(a.id);
|
|
|
- // int disCountB = GetShopGoodsDiscount(b.id);
|
|
|
- // if (disCountA > disCountB) return -1;
|
|
|
- // if (disCountA < disCountB) return 1;
|
|
|
-
|
|
|
- // //价格低的>价格高的
|
|
|
- // if (a.price != b.price) return a.price - b.price;
|
|
|
-
|
|
|
-
|
|
|
- // return 0;
|
|
|
- // });
|
|
|
- // return shopCfgs;
|
|
|
- // }
|
|
|
- //获取商品折扣百分比
|
|
|
- public int GetShopGoodsDiscount(int goodsId)
|
|
|
- {
|
|
|
- ShopCfg shopCfg = ShopCfgArray.Instance.GetCfg(goodsId);
|
|
|
- if (shopCfg.price == 0) return 0;
|
|
|
- return (int)(((double)shopCfg.originalPrice / (double)shopCfg.price) * 100);
|
|
|
- }
|
|
|
- private List<GiftBagCfg> RemoveNotOpenCfg(List<GiftBagCfg> giftBagCfgs)
|
|
|
- {
|
|
|
- for (int i = giftBagCfgs.Count - 1; i >= 0; i--)
|
|
|
- {
|
|
|
- if (giftBagCfgs[i].startTime != "" && !TimeUtil.IsBeforeCurTime(giftBagCfgs[i].startTime) || giftBagCfgs[i].endTime != "" && !TimeUtil.IsLaterCurTime(giftBagCfgs[i].endTime))
|
|
|
- {
|
|
|
- giftBagCfgs.RemoveAt(i);
|
|
|
- }
|
|
|
- }
|
|
|
- return giftBagCfgs;
|
|
|
- }
|
|
|
- private List<GiftBagCfg> GetNoneGiftCfg()
|
|
|
- {
|
|
|
- List<GiftBagCfg> giftBagCfgs = new List<GiftBagCfg>(GiftBagCfgArray.Instance.GetCfgsBylockType(LockType.NONE));
|
|
|
-
|
|
|
- return giftBagCfgs;
|
|
|
- }
|
|
|
- private GiftBagCfg GetStoryLvGiftCfg()
|
|
|
- {
|
|
|
- List<GiftBagCfg> giftBagCfgs = GiftBagCfgArray.Instance.GetCfgsBylockType(LockType.STORY_LV);
|
|
|
- if (giftBagCfgs.Count == 0) return null;
|
|
|
- giftBagCfgs.Sort((GiftBagCfg a, GiftBagCfg b) =>
|
|
|
- {
|
|
|
- if (a.storyLevelId.CompareTo(b.storyLevelId) != 0)
|
|
|
- {
|
|
|
- return a.storyLevelId.CompareTo(b.storyLevelId);
|
|
|
- }
|
|
|
- return -1;
|
|
|
- });
|
|
|
- for (int i = 0; i < giftBagCfgs.Count; i++)
|
|
|
- {
|
|
|
- if (GetShopGoodsStateById(giftBagCfgs[i].id) && (GetGoodsBuyNumById(giftBagCfgs[i].id) < giftBagCfgs[i].maxBuyNum)) return giftBagCfgs[i];
|
|
|
- }
|
|
|
- return giftBagCfgs[0];
|
|
|
- }
|
|
|
- private GiftBagCfg GetRoleLvGiftCfg()
|
|
|
- {
|
|
|
- List<GiftBagCfg> giftBagCfgs = GiftBagCfgArray.Instance.GetCfgsBylockType(LockType.ROLE_LV);
|
|
|
- if (giftBagCfgs.Count == 0) return null;
|
|
|
- giftBagCfgs.Sort((GiftBagCfg a, GiftBagCfg b) =>
|
|
|
- {
|
|
|
- if (a.lv.CompareTo(b.lv) != 0)
|
|
|
- {
|
|
|
- return a.lv.CompareTo(b.lv);
|
|
|
- }
|
|
|
- return -1;
|
|
|
- });
|
|
|
- for (int i = 0; i < giftBagCfgs.Count; i++)
|
|
|
- {
|
|
|
- if (GetShopGoodsStateById(giftBagCfgs[i].id) && (GetGoodsBuyNumById(giftBagCfgs[i].id) < giftBagCfgs[i].maxBuyNum)) return giftBagCfgs[i];
|
|
|
- }
|
|
|
- return giftBagCfgs[0];
|
|
|
- }
|
|
|
-
|
|
|
- // public List<ShopExchangeCfg> GetExchangeCfgs()
|
|
|
- // {
|
|
|
- // List<ShopExchangeCfg> shopExchangeCfgs = new List<ShopExchangeCfg>(ShopExchangeCfgArray.Instance.dataArray);
|
|
|
- // shopExchangeCfgs.Sort((ShopExchangeCfg a, ShopExchangeCfg b) =>
|
|
|
- // {
|
|
|
- // //未售罄的>已售罄的
|
|
|
- // int buyTypeA = (a.maxLimit == 0 || a.maxLimit - GetExchangeBuyNumById(a.id) > 0) ? 1 : -1;
|
|
|
- // int buyTypeB = (b.maxLimit == 0 || b.maxLimit - GetExchangeBuyNumById(b.id) > 0) ? 1 : -1;
|
|
|
- // if (buyTypeA > buyTypeB) return -1;
|
|
|
- // if (buyTypeA < buyTypeB) return 1;
|
|
|
- // return 0;
|
|
|
- // });
|
|
|
- // return shopExchangeCfgs;
|
|
|
- // }
|
|
|
/// <summary>
|
|
|
/// 根据商品Id获取商品是否已解锁
|
|
|
/// /// </summary>
|
|
@@ -337,7 +178,7 @@ namespace GFGGame
|
|
|
if (shopCfg.menu1 == ConstStoreTabId.STORE_ARENA && shopCfg.menu2 != ConstStoreSubId.STORE_ARENA_ITEM)
|
|
|
{
|
|
|
bool isDown = ArenaDataManager.Instance.SeasonId - GlobalCfgArray.globalCfg.seasonReduce >= 0;
|
|
|
- lockValue = isDown ? Math.Min(1, shopCfg.lockValue - GlobalCfgArray.globalCfg.rankReduce) : shopCfg.lockValue;
|
|
|
+ lockValue = isDown ? Math.Max(1, shopCfg.lockValue - GlobalCfgArray.globalCfg.rankReduce) : shopCfg.lockValue;
|
|
|
}
|
|
|
return ArenaDataManager.Instance.Grade >= lockValue;
|
|
|
}
|
|
@@ -392,5 +233,121 @@ namespace GFGGame
|
|
|
endTime = TimeUtil.DateTimeToTimestamp(cfg.endTime);
|
|
|
return TimeUtil.FormattingTime(TimeHelper.ServerNow(), endTime);
|
|
|
}
|
|
|
+
|
|
|
+ //获取商品折扣百分比
|
|
|
+ public int GetShopGoodsDiscount(int goodsId)
|
|
|
+ {
|
|
|
+ ShopCfg shopCfg = ShopCfgArray.Instance.GetCfg(goodsId);
|
|
|
+ if (shopCfg.price == 0) return 0;
|
|
|
+ return (int)(((double)shopCfg.originalPrice / (double)shopCfg.price) * 100);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // public List<ShopCfg> SortGiftBagCfgs(List<ShopCfg> shopCfgs)
|
|
|
+ // {
|
|
|
+ // shopCfgs.Sort((ShopCfg a, ShopCfg b) =>
|
|
|
+ // {
|
|
|
+
|
|
|
+ // //未售罄的>未解锁>已售罄的
|
|
|
+ // 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;
|
|
|
+
|
|
|
+ // //解锁状态
|
|
|
+ // 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 (a.costType < b.costType) return -1;
|
|
|
+ // if (a.costType > b.costType) return 1;
|
|
|
+
|
|
|
+ // //有下架时间的 > 没有下架时间的
|
|
|
+ // int endTimeA = a.endTime != "" ? 1 : -1;
|
|
|
+ // int endTimeB = b.endTime != "" ? 1 : -1;
|
|
|
+ // if (endTimeA > endTimeB) return -1;
|
|
|
+ // if (endTimeA < endTimeB) return 1;
|
|
|
+
|
|
|
+
|
|
|
+ // //折扣打的>折扣小的
|
|
|
+ // int disCountA = GetShopGoodsDiscount(a.id);
|
|
|
+ // int disCountB = GetShopGoodsDiscount(b.id);
|
|
|
+ // if (disCountA > disCountB) return -1;
|
|
|
+ // if (disCountA < disCountB) return 1;
|
|
|
+
|
|
|
+ // //价格低的>价格高的
|
|
|
+ // if (a.price != b.price) return a.price - b.price;
|
|
|
+
|
|
|
+
|
|
|
+ // return 0;
|
|
|
+ // });
|
|
|
+ // return shopCfgs;
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
+ // private List<GiftBagCfg> GetNoneGiftCfg()
|
|
|
+ // {
|
|
|
+ // List<GiftBagCfg> giftBagCfgs = new List<GiftBagCfg>(GiftBagCfgArray.Instance.GetCfgsBylockType(LockType.NONE));
|
|
|
+
|
|
|
+ // return giftBagCfgs;
|
|
|
+ // }
|
|
|
+ // private GiftBagCfg GetStoryLvGiftCfg()
|
|
|
+ // {
|
|
|
+ // List<GiftBagCfg> giftBagCfgs = GiftBagCfgArray.Instance.GetCfgsBylockType(LockType.STORY_LV);
|
|
|
+ // if (giftBagCfgs.Count == 0) return null;
|
|
|
+ // giftBagCfgs.Sort((GiftBagCfg a, GiftBagCfg b) =>
|
|
|
+ // {
|
|
|
+ // if (a.storyLevelId.CompareTo(b.storyLevelId) != 0)
|
|
|
+ // {
|
|
|
+ // return a.storyLevelId.CompareTo(b.storyLevelId);
|
|
|
+ // }
|
|
|
+ // return -1;
|
|
|
+ // });
|
|
|
+ // for (int i = 0; i < giftBagCfgs.Count; i++)
|
|
|
+ // {
|
|
|
+ // if (GetShopGoodsStateById(giftBagCfgs[i].id) && (GetGoodsBuyNumById(giftBagCfgs[i].id) < giftBagCfgs[i].maxBuyNum)) return giftBagCfgs[i];
|
|
|
+ // }
|
|
|
+ // return giftBagCfgs[0];
|
|
|
+ // }
|
|
|
+ // private GiftBagCfg GetRoleLvGiftCfg()
|
|
|
+ // {
|
|
|
+ // List<GiftBagCfg> giftBagCfgs = GiftBagCfgArray.Instance.GetCfgsBylockType(LockType.ROLE_LV);
|
|
|
+ // if (giftBagCfgs.Count == 0) return null;
|
|
|
+ // giftBagCfgs.Sort((GiftBagCfg a, GiftBagCfg b) =>
|
|
|
+ // {
|
|
|
+ // if (a.lv.CompareTo(b.lv) != 0)
|
|
|
+ // {
|
|
|
+ // return a.lv.CompareTo(b.lv);
|
|
|
+ // }
|
|
|
+ // return -1;
|
|
|
+ // });
|
|
|
+ // for (int i = 0; i < giftBagCfgs.Count; i++)
|
|
|
+ // {
|
|
|
+ // if (GetShopGoodsStateById(giftBagCfgs[i].id) && (GetGoodsBuyNumById(giftBagCfgs[i].id) < giftBagCfgs[i].maxBuyNum)) return giftBagCfgs[i];
|
|
|
+ // }
|
|
|
+ // return giftBagCfgs[0];
|
|
|
+ // }
|
|
|
+
|
|
|
+ // public List<ShopExchangeCfg> GetExchangeCfgs()
|
|
|
+ // {
|
|
|
+ // List<ShopExchangeCfg> shopExchangeCfgs = new List<ShopExchangeCfg>(ShopExchangeCfgArray.Instance.dataArray);
|
|
|
+ // shopExchangeCfgs.Sort((ShopExchangeCfg a, ShopExchangeCfg b) =>
|
|
|
+ // {
|
|
|
+ // //未售罄的>已售罄的
|
|
|
+ // int buyTypeA = (a.maxLimit == 0 || a.maxLimit - GetExchangeBuyNumById(a.id) > 0) ? 1 : -1;
|
|
|
+ // int buyTypeB = (b.maxLimit == 0 || b.maxLimit - GetExchangeBuyNumById(b.id) > 0) ? 1 : -1;
|
|
|
+ // if (buyTypeA > buyTypeB) return -1;
|
|
|
+ // if (buyTypeA < buyTypeB) return 1;
|
|
|
+ // return 0;
|
|
|
+ // });
|
|
|
+ // return shopExchangeCfgs;
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|