| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 | using System.Collections.Generic;namespace GFGGame{    public class ClothingShopCfgManager : SingletonBase<ClothingShopCfgManager>    {        private Dictionary<int, Dictionary<int, List<ShopCfg>>> _dataDic = new Dictionary<int, Dictionary<int, List<ShopCfg>>>();        public List<ShopCfg> GetList(int storeId, int typeIndex, int scoreType)        {            List<ShopCfg> 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;            }            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);            }            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;            }            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<ShopCfg> SortItemListByScore(List<ShopCfg> arrayList, int scoreType)        {            arrayList.Sort((ShopCfg a, ShopCfg b) =>            {                int numA = ItemDataManager.GetItemNum(a.itemID);                int 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 = DressUpMenuItemDataManager.GetItemScore(a.itemID, scoreType);                    int scoreB = DressUpMenuItemDataManager.GetItemScore(b.itemID, scoreType);                    if (scoreB > scoreA)                    {                        return 1;                    }                    else if (scoreB < scoreA)                    {                        return -1;                    }                }                return a.itemID.CompareTo(b.itemID);            });            return arrayList;        }    }}
 |