using System.Collections.Generic; namespace GFGGame { public class ClothingShopCfgManager : SingletonBase { private Dictionary>> _dataDic = new Dictionary>>(); public List GetList(int storeId, int typeIndex, int scoreType) { List shopCfgs = null; switch (storeId) { case ConstStoreId.CLOTHING_STORE_ID: shopCfgs = ShopCfgClothingArray.Instance.GetCfgsBytypeIndex(typeIndex); break; case ConstStoreId.LUCKY_BOX_STORE_ID: shopCfgs = ShopCfgCJArray.Instance.GetCfgsBytypeIndex(typeIndex); break; case ConstStoreId.LUCKY_BOX_ACTIVITY_STORE_ID: shopCfgs = ShopCfgCJAArray.Instance.GetCfgsBytypeIndex(typeIndex); break; case ConstStoreId.GALLERY_STORE_ID: shopCfgs = ShopCfgGalleryArray.Instance.GetCfgsBytypeIndex(typeIndex); break; } SortItemListByScore(shopCfgs, scoreType); return shopCfgs; } public ShopCfg GetShopCfg(int buyId, int shopType) { switch (shopType) { case ConstStoreId.CLOTHING_STORE_ID: return ShopCfgClothingArray.Instance.GetCfg(buyId); case ConstStoreId.LUCKY_BOX_STORE_ID: return ShopCfgCJArray.Instance.GetCfg(buyId); case ConstStoreId.LUCKY_BOX_ACTIVITY_STORE_ID: return ShopCfgCJAArray.Instance.GetCfg(buyId); case ConstStoreId.GALLERY_STORE_ID: return ShopCfgGalleryArray.Instance.GetCfg(buyId); } return null; } public ShopCfg[] GetShopCfgs(int shopType) { switch (shopType) { case ConstStoreId.CLOTHING_STORE_ID: return ShopCfgClothingArray.Instance.dataArray; case ConstStoreId.LUCKY_BOX_STORE_ID: return ShopCfgCJArray.Instance.dataArray; case ConstStoreId.LUCKY_BOX_ACTIVITY_STORE_ID: return ShopCfgCJAArray.Instance.dataArray; case ConstStoreId.GALLERY_STORE_ID: return ShopCfgGalleryArray.Instance.dataArray; } return null; } public void GetMoneyIdAndNum(int buyId, int count, int shopType, out int costId, out int costNum, out int buyNum) { ShopCfg shopCfg = GetShopCfg(buyId, shopType); costId = shopCfg.costID; costNum = shopCfg.costNum * count; buyNum = count; } private List SortItemListByScore(List arrayList, int scoreType) { arrayList.Sort((ShopCfg a, ShopCfg b) => { long numA = ItemDataManager.GetItemNum(a.itemID); long numB = ItemDataManager.GetItemNum(b.itemID); bool hasA = numA > 0; bool hasB = numB > 0; if (hasA && !hasB) { return 1; } else if (!hasA && hasB) { return -1; } else if (scoreType > 0 && !hasA && !hasB) { int scoreA = ItemDataManager.GetItemAdditionScore(a.itemID, scoreType); int scoreB = ItemDataManager.GetItemAdditionScore(b.itemID, scoreType); if (scoreB > scoreA) { return 1; } else if (scoreB < scoreA) { return -1; } } return a.itemID.CompareTo(b.itemID); }); return arrayList; } } }