少年修仙传客户端代码仓库
client_Zxw
2018-11-14 252d46b8642ad4ecebe1a8b9d3a0678913413ebf
System/Store/StoreModel.cs
@@ -35,15 +35,31 @@
    public string UNIONSTORESAVE_KEY { get; private set; }
    public string MUSTBUYSAVE_KEY { get; private set; }
    public string StoreEffectRecord_Key { get; private set; }
    public List<StoreConfig> shoplist;
    public Dictionary<int,Dictionary<int,int>> JobReplaceIdDict = new Dictionary<int, Dictionary<int, int>>();
    public Dictionary<int, string> resetTimeDict { get; private set; }
    public Dictionary<int, int> showCoinsUIDict { get; private set; }
    public int[] StoreRedIdlist { get; private set;}
    public int storeTrailerLv { get; private set; }
    bool isLogin = true;
    RuneModel runeModel { get { return ModelCenter.Instance.GetModel<RuneModel>(); } }
    ItemTipsModel _itemTipsModel;
    ItemTipsModel itemTipsModel
    {
        get
        {
            return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
        }
    }
    public override void Init()
    {
        PlayerPrefs.DeleteAll();
        ParseFuncConfig();
        ParseStoreConfig();
        SetShopRedpoint();
        FuncConfigConfig buyItemHinit = Config.Instance.Get<FuncConfigConfig>("BuyItemHinit");
        normalBuyCoinsTypes = ConfigParse.GetMultipleStr<int>(buyItemHinit.Numerical1);
        FuncConfigConfig restTimeConfig = Config.Instance.Get<FuncConfigConfig>("RefreshText");
@@ -52,6 +68,7 @@
        showCoinsUIDict = ConfigParse.GetDic<int, int>(mallCurrency.Numerical1);
        FuncConfigConfig mallPush = Config.Instance.Get<FuncConfigConfig>("MallPush");
        StoreRedIdlist = ConfigParse.GetMultipleStr<int>(mallPush.Numerical2);
        storeTrailerLv = int.Parse(mallPush.Numerical1);
        MainInterfaceWin.IsCopyOfThePanel += OnMoveTopPart;
    }
@@ -96,17 +113,19 @@
        WindowCenter.Instance.windowAfterOpenEvent += windowAfterOpen;
        WindowCenter.Instance.windowAfterCloseEvent += windowAfterClose;
        NewBieCenter.Instance.guideBeginEvent += GuidBegin;
        UpdateShowStore();
        SetIsMustBuyDay();
        shoplist = null;
        CheckWeekStoreIsShopBuy(out shoplist);
        ControllerRedPoint();
        SetShopRedpoint();
        UpdateFreeShopRedpoint();
        UpdateCanBuyRedpoint();
        SetJobReplaceIDDict();
        UpdateMustBuyRedpoint();
        UpdatePetAndMountPutAwayRedpoint();
        isLogin = false;
    }
    public override void UnInit()
    {
        MainInterfaceWin.IsCopyOfThePanel -= OnMoveTopPart;
    }
    #region 解析本地数据
@@ -165,25 +184,59 @@
        }
    }
    public Dictionary<int,List<StoreConfig>> storeTypeDict { get; private set; }
    public Dictionary<int,List<StoreData>> storeTypeDict { get; private set; }
    public Dictionary<int, List<StoreData>> theOnlyShopDict { get; private set; } //key 物品id
    public Dictionary<string, List<StoreData>> limitValueShopDict { get; private set; } //key 商品类型和限制条件
    private void ParseStoreConfig()
    {
        storeTypeDict = new Dictionary<int, List<StoreConfig>>();
        storeTypeDict = new Dictionary<int, List<StoreData>>();
        theOnlyShopDict = new Dictionary<int, List<StoreData>>();
        limitValueShopDict = new Dictionary<string, List<StoreData>>();
        List<StoreConfig> storeConfigs = Config.Instance.GetAllValues<StoreConfig>();
        for(int i = 0; i < storeConfigs.Count; i++)
        {
            var config = storeConfigs[i];
            if(config.ShopType != 0)
            {
                if(!storeTypeDict.ContainsKey(config.ShopType))
                StoreData storeData = new StoreData();
                storeData.shopId = config.ID;
                storeData.storeConfig = config;
                storeData.jobReplaceDict = AnalysisJobReplace(config);
                if (!storeTypeDict.ContainsKey(config.ShopType))
                {
                    List<StoreConfig> configs = new List<StoreConfig>();
                    configs.Add(config);
                    storeTypeDict.Add(config.ShopType,configs);
                    List<StoreData> storeDatas = new List<StoreData>();
                    storeDatas.Add(storeData);
                    storeTypeDict.Add(config.ShopType, storeDatas);
                }
                else
                {
                    storeTypeDict[config.ShopType].Add(config);
                    storeTypeDict[config.ShopType].Add(storeData);
                }
                if (config.TheOnlyShop == 1)
                {
                    if (!theOnlyShopDict.ContainsKey(config.ItemID))
                    {
                        List<StoreData> storeDatas = new List<StoreData>();
                        storeDatas.Add(storeData);
                        theOnlyShopDict.Add(config.ItemID, storeDatas);
                    }
                    else
                    {
                        theOnlyShopDict[config.ItemID].Add(storeData);
                    }
                }
                string key = StringUtility.Contact(config.ShopType,config.LimitValue);
                if(!limitValueShopDict.ContainsKey(key))
                {
                    List<StoreData> storeDatas = new List<StoreData>();
                    storeDatas.Add(storeData);
                    limitValueShopDict.Add(key,storeDatas);
                }
                else
                {
                    limitValueShopDict[key].Add(storeData);
                }
            }
        }
@@ -195,17 +248,187 @@
        }
    }
    public int CompareByShopSort(StoreConfig start, StoreConfig end)
    private Dictionary<int,List<int>> AnalysisJobReplace(StoreConfig storeConfig)
    {
        int sort1 = start.ShopSort;
        int sort2 = end.ShopSort;
        if (storeConfig == null || string.IsNullOrEmpty(storeConfig.JobItem)) return null;
        Dictionary<int,List<int>> replaceDict = new Dictionary<int, List<int>>();
        JsonData jsonData = JsonMapper.ToObject(storeConfig.JobItem);
        if (jsonData.IsArray)
        {
            for (int i = 0; i < jsonData.Count; i++)
            {
                List<int> idlist = new List<int>();
                replaceDict.Add(i, idlist);
                if (jsonData[i].IsArray)
                {
                    for (int j = 0; j < jsonData[i].Count; j++)
                    {
                        int itemId = int.Parse(jsonData[i][j].ToString());
                        idlist.Add(itemId);
                    }
                }
            }
        }
        return replaceDict;
    }
    public int CompareByShopSort(StoreData start, StoreData end)
    {
        int sort1 = start.storeConfig.ShopSort;
        int sort2 = end.storeConfig.ShopSort;
        if (sort1.CompareTo(sort2) != 0) return sort1.CompareTo(sort2);
        return 0;
    }
    public class StoreData
    {
        public int shopId;
        public StoreConfig storeConfig;
        public Dictionary<int,List<int>> jobReplaceDict;
    }
    #endregion
    #region 获取数据
    private Dictionary<int, List<StoreData>> showStoreTypeDict = new Dictionary<int, List<StoreData>>();
    public void UpdateShowStore()
    {
        showStoreTypeDict.Clear();
        int playeLv = PlayerDatas.Instance.baseData.LV;
        foreach (var type in storeTypeDict.Keys)
        {
            var storeDatas = storeTypeDict[type];
            List<StoreData> showStoreDatas = new List<StoreData>();
            if (!showStoreTypeDict.ContainsKey(type))
            {
                for (int i = 0; i < storeDatas.Count; i++)
                {
                    var storeData = storeDatas[i];
                    bool isReachLv = playeLv >= storeData.storeConfig.LV ? true : false;
                    bool isReachSpec = true;
                    switch (storeData.storeConfig.ShopType)
                    {
                        case 12:
                            isReachSpec = TryGetUnlockRune(storeData.storeConfig.ItemID);
                            break;
                    }
                    bool isReach = isReachSpec && isReachLv;
                    if (isReach)
                    {
                        int remainNum = 0;
                        bool isSellOut = TryGetIsSellOut(storeData.storeConfig, out remainNum);
                        if (storeData.storeConfig.IsHideSellOut != 1)
                        {
                            showStoreDatas.Add(storeData);
                        }
                        else
                        {
                            if (storeData.storeConfig.TheOnlyShop == 1)
                            {
                                if(!CheckTheOnlyShopSellOut(storeData.shopId))
                                {
                                    showStoreDatas.Add(storeData);
                                }
                            }
                            else
                            {
                                if (!isSellOut)
                                {
                                    showStoreDatas.Add(storeData);
                                }
                            }
                        }
                    }
                }
                showStoreTypeDict.Add(type, showStoreDatas);
            }
        }
    }
    /// <summary>
    /// 检测唯一商品是否已售罄
    /// </summary>
    /// <param name="shopIndex"></param>
    /// <param name="isTheOnlyShop"></param>
    /// <returns></returns>
    public bool CheckTheOnlyShopSellOut(int shopIndex)
    {
        StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(shopIndex);
        if (storeConfig == null || storeConfig.TheOnlyShop != 1) return false;
        if (theOnlyShopDict.ContainsKey(storeConfig.ItemID))
        {
            List<StoreData> datas = theOnlyShopDict[storeConfig.ItemID];
            for (int i = 0; i < datas.Count; i++)
            {
                var data = datas[i];
                int remainNum = 0;
                if (TryGetIsSellOut(data.storeConfig, out remainNum))
                {
                    return true;
                }
            }
        }
        return false;
    }
    public List<StoreData> TryGetStoreDatas(int type)
    {
        List<StoreData> datas = null;
        showStoreTypeDict.TryGetValue(type,out datas);
        return datas;
    }
    public StoreData GetStoreData(int shopId)
    {
        StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(shopId);
        if (storeConfig == null) return null;
        List<StoreData> storeDatas = null;
        storeTypeDict.TryGetValue(storeConfig.ShopType, out storeDatas);
        if (storeDatas != null)
        {
            for(int i = 0; i < storeDatas.Count; i++)
            {
                var storeData = storeDatas[i];
                if(storeData.shopId == shopId)
                {
                    return storeData;
                }
            }
        }
        return null;
    }
    public int GetReplaceId(int shopId)
    {
        var storeData = GetStoreData(shopId);
        if (storeData == null) return 0;
        StoreConfig config = Config.Instance.Get<StoreConfig>(shopId);
        int job = PlayerDatas.Instance.baseData.Job;
        var replaceDict = storeData.jobReplaceDict;
        if(replaceDict != null)
        {
            foreach (var index in replaceDict.Keys)
            {
                var idlist = replaceDict[index];
                if (idlist.Contains(config.ItemID))
                {
                    int replaceIndex = job - 1;
                    return idlist[replaceIndex];
                }
            }
        }
        return config.ItemID;
    }
    public bool TryGetRedTypeByShopId(int shopId, out int type)
    {
        type = 0;
@@ -236,30 +459,6 @@
        return false;
    }
    private Dictionary<int, List<StoreConfig>> showStoreTypeDict = new Dictionary<int, List<StoreConfig>>();
    public void UpdateShowStore()
    {
        showStoreTypeDict.Clear();
        foreach(var type in storeTypeDict.Keys)
        {
            var configs = storeTypeDict[type];
            List<StoreConfig> showConfigs = new List<StoreConfig>();
            if(!showStoreTypeDict.ContainsKey(type))
            {
                for (int i = 0; i < configs.Count; i++)
                {
                    var config = configs[i];
                    int remainNum = 0;
                    bool isSellOut = TryGetIsSellOut(config, out remainNum);
                    if(isSellOut && config.TheOnlyShop == 1)
                    {
                    }
                }
            }
        }
    }
    public bool TryGetIsSellOut(StoreConfig storeConfig, out int remainCnt)
    {
        int canBuyCnt = 0;
@@ -361,6 +560,30 @@
        return isVipBuy;
    }
    public bool TryGetUnlockRune(int runeId)
    {
        Dictionary<int, List<int>> unlockRunelist = runeModel.GetAllUnlockRuneIdlist();
        if (unlockRunelist != null)
        {
            foreach (var tower in unlockRunelist.Keys)
            {
                if (unlockRunelist[tower].Contains(runeId))
                {
                    return true;
                }
            }
        }
        return false;
    }
    public List<StoreData> TryGetStoreDatasByLimit(int type,int limitValue)
    {
        string key = StringUtility.Contact(type,limitValue);
        List<StoreData> datas = null;
        limitValueShopDict.TryGetValue(key,out datas);
        return datas;
    }
    #endregion
    public string GetStoreRefreshTimeByType(int type)
@@ -372,14 +595,6 @@
            case 7:
                int willRefreshTime = GetWillRefreshTime();
                return Language.Get(resetTimeDict[type],UIHelper.AppendStringColor(TextColType.Green, TimeUtility.SecondsToHMS(willRefreshTime),true));
                //if(willRefreshTime == 0)
                //{
                //    return Language.Get("StoreWin201");
                //}
                //else
                //{
                //    return Language.Get(resetTimeDict[type],willRefreshTime);
                //}
            default:
                return Language.Get(resetTimeDict[type]);
        }
@@ -406,6 +621,7 @@
        switch(type)
        {
            case PlayerDataRefresh.LV:
                UpdateShowStore();
                UpdateFreeShopRedpoint();
                UpdateCanBuyRedpoint();
                UpdateMustBuyRedpoint();
@@ -420,84 +636,6 @@
                break;
        }
    }
    public override void UnInit()
    {
        MainInterfaceWin.IsCopyOfThePanel -= OnMoveTopPart;
    }
    ItemTipsModel _itemTipsModel;
    ItemTipsModel itemTipsModel
    {
        get
        {
            return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
        }
    }
    #region 职业替换商品逻辑处理
    public void SetJobReplaceIDDict()
    {
        JobReplaceIdDict.Clear();
        List<StoreConfig> storeConfigs = Config.Instance.GetAllValues<StoreConfig>();
        for(int i = 0; i < storeConfigs.Count; i++)
        {
            Dictionary<int, int> replaceItemDict = new Dictionary<int, int>();
            JobReplaceIdDict.Add(storeConfigs[i].ID,replaceItemDict);
            AnalysisJobReplace(storeConfigs[i]);
            List<ShopItemInfo> shopItems = GetShopItemlistByIndex(storeConfigs[i]);
            for(int j = 0; j < shopItems.Count; j++)
            {
                foreach (var index in jobReplaceDic.Keys)
                {
                    if (jobReplaceDic[index].Contains(shopItems[j].itemId))
                    {
                        int replaceIndex = PlayerDatas.Instance.baseData.Job - 1;
                        int replaceId = jobReplaceDic[index][replaceIndex];
                        replaceItemDict.Add(shopItems[j].itemId,replaceId);
                        break;
                    }
                }
            }
        }
    }
    Dictionary<int, List<int>> jobReplaceDic = new Dictionary<int, List<int>>();
    private void AnalysisJobReplace(StoreConfig storeConfig)
    {
        jobReplaceDic.Clear();
        JsonData jsonData = JsonMapper.ToObject(storeConfig.JobItem);
        if (jsonData.IsArray)
        {
            for (int i = 0; i < jsonData.Count; i++)
            {
                List<int> idlist = new List<int>();
                jobReplaceDic.Add(i, idlist);
                if (jsonData[i].IsArray)
                {
                    for (int j = 0; j < jsonData[i].Count; j++)
                    {
                        int itemId = int.Parse(jsonData[i][j].ToString());
                        idlist.Add(itemId);
                    }
                }
            }
        }
    }
    public int ReplaceItemIdByJob(int storeId,int itemId)
    {
       if(JobReplaceIdDict.ContainsKey(storeId))
        {
            if(JobReplaceIdDict[storeId].ContainsKey(itemId))
            {
                return JobReplaceIdDict[storeId][itemId];
            }
        }
        return itemId;
    }
    #endregion
    private void RefreshFamilyLv()
    {
@@ -569,6 +707,7 @@
    
        if(!isLogin)
        {
            UpdateShowStore();
            UpdateFreeShopRedpoint();
            UpdateCanBuyRedpoint();
            UpdateMustBuyRedpoint();
@@ -627,16 +766,16 @@
    public bool TryGetShopItemInfo(StoreFunc _type, int _id, out List<ShopItemInfo> _shopItems)
    {
        _shopItems = null;
        var _list = StoreConfig.GetTypeStoreModel((int)_type, true);
        var _list = TryGetStoreDatas((int)_type);
        var _index = _list.FindIndex((x) =>
        {
            return x.ID == _id;
            return x.shopId == _id;
        });
        if (_index == -1)
        {
            return false;
        }
        _shopItems = GetShopItemlistByIndex(_list[_index]);
        _shopItems = GetShopItemlistByIndex(_list[_index].storeConfig);
        return _shopItems != null;
    }
@@ -673,8 +812,8 @@
    public void OnClickShopCell(StoreConfig shopInfo)
    {
        BuyItemPopModel.Instance.SetModel(shopInfo.ID);
        //SetOpenBuyType(chinModel);
        ItemAttrData attrData = new ItemAttrData(ReplaceItemIdByJob(shopInfo.ID,shopInfo.ItemID),true, (ulong)shopInfo.ItemCnt,-1,shopInfo.IsBind,true,PackType.rptDeleted
        int itemId = GetReplaceId(shopInfo.ID);
        ItemAttrData attrData = new ItemAttrData(itemId,true, (ulong)shopInfo.ItemCnt,-1,shopInfo.IsBind,true,PackType.rptDeleted
            ,"",null,ItemTipChildType.Buy);
        itemTipsModel.SetItemTipsModel(attrData,false);
        attrData.SetTipsFuncBtn(ItemWinBtnType.buy,(ItemWinBtnType type ,string id) => { OnClickBuyBtn(ItemWinBtnType.buy, shopInfo.ID); });
@@ -692,7 +831,7 @@
        StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(shopId);
        int curVipIndex = -1;
        int nextVipIndex = -1;
        bool isVipBuy = BuyItemPopModel.Instance.CheckIsVipBuy(storeConfig, out curVipIndex, out nextVipIndex);
        bool isVipBuy = TryGetVipBuy(storeConfig, out curVipIndex, out nextVipIndex);
        if (shopItemLimit != null)
        {
            int remainNum = 0;
@@ -773,7 +912,7 @@
        StoreConfig tagStore = Config.Instance.Get<StoreConfig>((int)result.ItemIndex);
        if (tagStore != null)
        {
            ItemConfig chinModel = Config.Instance.Get<ItemConfig>(ReplaceItemIdByJob(tagStore.ID, tagStore.ItemID));
            ItemConfig chinModel = Config.Instance.Get<ItemConfig>(GetReplaceId(tagStore.ID));
            if (!normalBuyCoinsTypes.Contains(tagStore.MoneyType))
            {
                if (tagStore.RemindSuccess == 0)
@@ -806,7 +945,7 @@
    /// <returns></returns>
    public bool IsCanBuyItem(int limitTower)
    {
        int playerTower = (int)ModelCenter.Instance.GetModel<RuneModel>().RuneTowerOpenLV;
        int playerTower = (int)runeModel.RuneTowerOpenLV;
        int offset = playerTower - limitTower;
        if (offset >= 0)
            return true;
@@ -831,34 +970,75 @@
    {
        jumpToItemId = itemId;
    }
   #region 仙盟商店逻辑处理
    public event Action StoreFuncOpenAct;
    private void FuncStateChange(int funcId)
    {
        if (funcId != (int)FuncOpenEnum.Store) return;
        if (StoreFuncOpenAct != null)
        {
            StoreFuncOpenAct();
        }
        UpdateFreeShopRedpoint();
        UpdateCanBuyRedpoint();
        UpdateMustBuyRedpoint();
        UpdatePetAndMountPutAwayRedpoint();
    }
    public bool IsNewDay(string recordKey)
    {
        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return false;
        if (PlayerPrefs.HasKey(recordKey))
        {
            int day = LocalSave.GetInt(recordKey);
            if(day != TimeUtility.ServerNow.Day)
            {
                LocalSave.SetInt(recordKey, TimeUtility.ServerNow.Day);
                return true;
            }
            else
            {
                return false;
            }
        }
        else
        {
            LocalSave.SetInt(recordKey, TimeUtility.ServerNow.Day);
            return true;
        }
    }
    #region 商城红点
    #region 仙盟红点逻辑处理
    private bool CheckIsBuyNewItem(int fairyLv)
    {
        if(fairyLv > GetSaveFairyLV())
        if (fairyLv > GetSaveFairyLV())
        {
            if (StoreConfig.GetCanBuyShopModel((int)StoreFunc.ToolStore, fairyLv).Count > 0
              || StoreConfig.GetCanBuyShopModel((int)StoreFunc.MountStoneStore, fairyLv).Count > 0
               || StoreConfig.GetCanBuyShopModel((int)StoreFunc.MountSkillBookStore, fairyLv).Count > 0)
            var toolStoreDatas = TryGetStoreDatasByLimit((int)StoreFunc.ToolStore, fairyLv);
            var mountStoreDatas = TryGetStoreDatasByLimit((int)StoreFunc.MountStoneStore, fairyLv);
            var skillBookStoreData = TryGetStoreDatasByLimit((int)StoreFunc.MountSkillBookStore, fairyLv);
            if ((toolStoreDatas != null && toolStoreDatas.Count > 0)
                || (mountStoreDatas != null && mountStoreDatas.Count > 0)
                || (skillBookStoreData != null && skillBookStoreData.Count > 0))
            {
                return true;
            }
        }
        return false;
    }
    private bool CheckIsNewMonth()
    {
        GetSaveDateTime();
        if(datelist.Count > 0)
        if (datelist.Count > 0)
        {
            if(TimeUtility.ServerNow.Month == datelist[0])
            if (TimeUtility.ServerNow.Month == datelist[0])
            {
                if(TimeUtility.ServerNow.Day >= 1
                if (TimeUtility.ServerNow.Day >= 1
                    && TimeUtility.ServerNow.Hour >= 5
                    && datelist[1] <= 1 && datelist[2] < 5)
                {
@@ -867,7 +1047,7 @@
            }
            else
            {
                if(TimeUtility.ServerNow.Day >= 1
                if (TimeUtility.ServerNow.Day >= 1
                    && TimeUtility.ServerNow.Hour >= 5)
                {
                    return true;
@@ -895,7 +1075,7 @@
    {
        int[] unionArray = LocalSave.GetIntArray(UNIONSTORESAVE_KEY);
        int fairyLv = 0;
        if(unionArray != null)
        if (unionArray != null)
        {
            return unionArray[0];
        }
@@ -904,22 +1084,22 @@
    //1仙盟等级 2 月份 3 号 4 几点
    public void SetStoreLocalSave(LocalSaveStoreType saveStoreType,params int[] infos)
    public void SetStoreLocalSave(LocalSaveStoreType saveStoreType, params int[] infos)
    {
        string key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, saveStoreType);
        LocalSave.SetIntArray(key,infos);
        LocalSave.SetIntArray(key, infos);
    }
    public void ControllerRedPoint(bool isLook = false)
    {
        MainRedDot.Instance.fairyStoreRedPoint.state = RedPointState.None;
        if(!ModelCenter.Instance.GetModel<FairyModel>().fairyStoreOpen)
        if (!ModelCenter.Instance.GetModel<FairyModel>().fairyStoreOpen)
        {
            return;
        }
        int familyLv = PlayerDatas.Instance.fairyData.fairy.FamilyLV;
        if(!isLook)
        if (!isLook)
        {
            if (CheckIsBuyNewItem(familyLv))
            {
@@ -940,126 +1120,6 @@
    #endregion
    #endregion
    public event Action StoreFuncOpenAct;
    private void FuncStateChange(int funcId)
    {
        if (funcId != (int)FuncOpenEnum.Store) return;
        shoplist = null;
        CheckWeekStoreIsShopBuy(out shoplist);
        if(shoplist.Count > 0)
        {
            if (StoreFuncOpenAct != null)
            {
                StoreFuncOpenAct();
            }
        }
        SetShopRedpoint();
        UpdateFreeShopRedpoint();
        UpdateCanBuyRedpoint();
        UpdateMustBuyRedpoint();
        UpdatePetAndMountPutAwayRedpoint();
    }
    public bool CheckWeekStoreIsShopBuy(out List<StoreConfig> buylist)
    {
        buylist = new List<StoreConfig>();
        if (!IsNewDay(StoreEffectRecord_Key)) return false;
        List<StoreConfig> shoplist = StoreConfig.GetTypeStoreModel((int)StoreFunc.WeekStore);
        for(int i = 0; i < shoplist.Count; i++)
        {
            int canBuyCnt = 0;
            int addBuyCnt = 0;
            bool isLimitBuy = BuyItemPopModel.Instance.CheckIsLimitBuyCnt(shoplist[i], out canBuyCnt, out addBuyCnt);
            BuyShopItemLimit shopItemLimit = GetBuyShopLimit((uint)shoplist[i].ID);
            if (isLimitBuy)
            {
                int remainNum = canBuyCnt;
                if (shopItemLimit != null)
                {
                    remainNum = canBuyCnt - shopItemLimit.BuyCnt;
                }
                if (remainNum > 0)
                {
                    buylist.Add(shoplist[i]);
                }
            }
            else
            {
                buylist.Add(shoplist[i]);
            }
        }
        if(buylist.Count > 0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    private bool IsNewDay(string recordKey)
    {
        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return false;
        if (PlayerPrefs.HasKey(recordKey))
        {
            int day = LocalSave.GetInt(recordKey);
            if(day != TimeUtility.ServerNow.Day)
            {
                LocalSave.SetInt(recordKey, TimeUtility.ServerNow.Day);
                return true;
            }
            else
            {
                return false;
            }
        }
        else
        {
            LocalSave.SetInt(recordKey, TimeUtility.ServerNow.Day);
            return true;
        }
    }
    /// <summary>
    /// 检测唯一商品是否已售罄
    /// </summary>
    /// <param name="shopIndex"></param>
    /// <param name="isTheOnlyShop"></param>
    /// <returns></returns>
    public bool CheckTheOnlyShopSellOut(int shopIndex,out bool isTheOnlyShop)
    {
        StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(shopIndex);
        isTheOnlyShop = false;
        if (storeConfig == null) return false;
        if(storeConfig.TheOnlyShop == 1)
        {
            if(StoreConfig.GetTheOnlyShopDict().ContainsKey(storeConfig.ItemID))
            {
                List<StoreConfig> storelist = StoreConfig.GetTheOnlyShopDict()[storeConfig.ItemID];
                for(int i = 0; i < storelist.Count; i++)
                {
                    BuyShopItemLimit shoplimit = GetBuyShopLimit((uint)storelist[i].ID);
                    if(shoplimit != null && shoplimit.BuyCnt >= storelist[i].PurchaseNumber[0])
                    {
                        return true;
                    }
                }
            }
        }
        return false;
    }
    #region 商城红点
    public const int StoreFunc_RedKey = 22;
    public const int StoreFunc1_RedKey = 2201;
    public const int StoreFunc2_RedKey = 2202;
@@ -1076,9 +1136,7 @@
    public void SetShopRedpoint()
    {
        shopRedDict.Clear();
        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
        List<StoreConfig> storelist = StoreConfig.GetAllShoplist();
        List<StoreConfig> storelist = Config.Instance.GetAllValues<StoreConfig>();
        for(int i = 0; i < storelist.Count; i++)
        {
            StoreConfig storeConfig = storelist[i];
@@ -1089,25 +1147,29 @@
                case 1:
                    redKey = StoreFunc1_RedKey*10000 + storeConfig.ID;
                    redpoint = new Redpoint(StoreFunc1_RedKey,redKey);
                    shopRedDict.Add(storeConfig.ID, redpoint);
                    break;
                case 2:
                    redKey = StoreFunc2_RedKey * 10000 + storeConfig.ID;
                    redpoint = new Redpoint(StoreFunc2_RedKey, redKey);
                    shopRedDict.Add(storeConfig.ID,redpoint);
                    break;
                case 3:
                    redKey = StoreFunc3_RedKey * 10000 + storeConfig.ID;
                    redpoint = new Redpoint(StoreFunc3_RedKey, redKey);
                    shopRedDict.Add(storeConfig.ID, redpoint);
                    break;
                case 4:
                    redKey = StoreFunc4_RedKey * 10000 + storeConfig.ID;
                    redpoint = new Redpoint(StoreFunc4_RedKey, redKey);
                    shopRedDict.Add(storeConfig.ID, redpoint);
                    break;
                case 5:
                    redKey = StoreFunc5_RedKey * 10000 + storeConfig.ID;
                    redpoint = new Redpoint(StoreFunc5_RedKey, redKey);
                    shopRedDict.Add(storeConfig.ID, redpoint);
                    break;
            }
            shopRedDict.Add(storeConfig.ID,redpoint);
        }
    }
@@ -1115,20 +1177,26 @@
    {
        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
        foreach (var key in shopRedDict.Keys)
        foreach (var key in showStoreTypeDict.Keys)
        {
            StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(key);
            if (storeConfig.MoneyNumber == 0)
            var storeDatas = showStoreTypeDict[key];
            for(int i = 0; i < storeDatas.Count; i++)
            {
                if (CheckShopIsCanBuy(storeConfig))
                var storeConfig = storeDatas[i].storeConfig;
                if (storeConfig.MoneyNumber == 0)
                {
                    shopRedDict[storeConfig.ID].state = RedPointState.Simple;
                }
                else
                {
                    shopRedDict[storeConfig.ID].state = RedPointState.None;
                    int remainNum = 0;
                    if (!TryGetIsSellOut(storeConfig, out remainNum))
                    {
                        shopRedDict[storeConfig.ID].state = RedPointState.Simple;
                    }
                    else
                    {
                        shopRedDict[storeConfig.ID].state = RedPointState.None;
                    }
                }
            }
        }
    }
    public event Action<int> UpdateHelpPointExchangeEvent;
@@ -1136,22 +1204,31 @@
    {
        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
        foreach (var key in shopRedDict.Keys)
        foreach (var key in showStoreTypeDict.Keys)
        {
            StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(key);
            if (StoreRedIdlist.Contains(storeConfig.ID))
            var storeDatas = showStoreTypeDict[key];
            for (int i = 0; i < storeDatas.Count; i++)
            {
                if (CheckShopIsCanBuy(storeConfig))
                var storeConfig = storeDatas[i].storeConfig;
                if (StoreRedIdlist.Contains(storeConfig.ID))
                {
                    if (UIHelper.GetMoneyCnt(storeConfig.MoneyType) >= (ulong)storeConfig.MoneyNumber)
                    int remainNum = 0;
                    if (!TryGetIsSellOut(storeConfig, out remainNum))
                    {
                        shopRedDict[storeConfig.ID].state = RedPointState.Simple;
                        if(storeConfig.ShopType == (int)StoreFunc.IntegralStore)
                        if (UIHelper.GetMoneyCnt(storeConfig.MoneyType) >= (ulong)storeConfig.MoneyNumber)
                        {
                            if(UpdateHelpPointExchangeEvent != null)
                            shopRedDict[storeConfig.ID].state = RedPointState.Simple;
                            if (storeConfig.ShopType == (int)StoreFunc.IntegralStore)
                            {
                                UpdateHelpPointExchangeEvent(key);
                                if (UpdateHelpPointExchangeEvent != null)
                                {
                                    UpdateHelpPointExchangeEvent(key);
                                }
                            }
                        }
                        else
                        {
                            shopRedDict[storeConfig.ID].state = RedPointState.None;
                        }
                    }
                    else
@@ -1159,11 +1236,8 @@
                        shopRedDict[storeConfig.ID].state = RedPointState.None;
                    }
                }
                else
                {
                    shopRedDict[storeConfig.ID].state = RedPointState.None;
                }
            }
        }
    }
@@ -1171,20 +1245,25 @@
    {
        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
        foreach (var key in shopRedDict.Keys)
        foreach (var key in showStoreTypeDict.Keys)
        {
            StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(key);
            if(mustIdlist.Contains(storeConfig.ItemID))
            var storeDatas = showStoreTypeDict[key];
            for (int i = 0; i < storeDatas.Count; i++)
            {
                if (CheckIsMustBuy(storeConfig))
                var storeConfig = storeDatas[i].storeConfig;
                if (mustIdlist.Contains(storeConfig.ItemID))
                {
                    shopRedDict[storeConfig.ID].state = RedPointState.Simple;
                }
                else
                {
                    shopRedDict[storeConfig.ID].state = RedPointState.None;
                    if (CheckIsMustBuy(storeConfig))
                    {
                        shopRedDict[storeConfig.ID].state = RedPointState.Simple;
                    }
                    else
                    {
                        shopRedDict[storeConfig.ID].state = RedPointState.None;
                    }
                }
            }
        }
    }
@@ -1230,42 +1309,8 @@
    public List<int> mustIdlist = new List<int>() { 4741};
    public bool CheckIsMustBuy(StoreConfig config)
    {
        if(CheckShopIsCanBuy(config) && IsMustBuyDay)
        {
            return true;
        }
        return false;
    }
    public bool CheckScoreStoreIsCanBuy(StoreConfig storeConfig)
    {
        List<StoreConfig> list = StoreConfig.GetSellShoplist();
        if(StoreRedIdlist.Contains(storeConfig.ID))
        {
            if (CheckShopIsCanBuy(storeConfig))
            {
                if(UIHelper.GetMoneyCnt(storeConfig.MoneyType) >= (ulong)storeConfig.MoneyNumber)
                {
                    return true;
                }
            }
        }
        return false;
    }
    public bool CheckShopIsCanBuy(StoreConfig storeConfig)
    {
        int canBuyCnt = 0;
        int addBuyCnt = 0;
        bool isLimitBuy = BuyItemPopModel.Instance.CheckIsLimitBuyCnt(storeConfig, out canBuyCnt, out addBuyCnt);
        BuyShopItemLimit shopItemLimit = GetBuyShopLimit((uint)storeConfig.ID);
        int remainNum = canBuyCnt;
        if (shopItemLimit != null)
        {
            remainNum -= shopItemLimit.BuyCnt;
        }
        List<StoreConfig> list = StoreConfig.GetSellShoplist();
        if (remainNum > 0 && list.Contains(storeConfig))
        int remainNum = 0;
        if(!TryGetIsSellOut(config,out remainNum) && IsMustBuyDay)
        {
            return true;
        }
@@ -1279,34 +1324,36 @@
    {
        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
        List<StoreConfig> storelist = StoreConfig.GetAllShoplist();
        List<StoreData> storelist = TryGetStoreDatas((int)StoreFunc.BindStore);
        if (storelist == null) return;
        for(int i = 0; i < storelist.Count; i++)
        {
            if (storelist[i].ShopType != (int)StoreFunc.BindStore) continue;
            ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(storelist[i].ItemID);
            string key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID,"ShopId",storelist[i].ID);
            var storeData = storelist[i];
            ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(storeData.storeConfig.ItemID);
            string key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID,"ShopId",storeData.shopId);
            int remainNum = 0;
            switch(itemConfig.Type)
            {
                case 26:
                case 41:
                    if(CheckShopIsCanBuy(storelist[i]))
                    if(!TryGetIsSellOut(storeData.storeConfig,out remainNum))
                    {
                        if (!PlayerPrefs.HasKey(key))
                        {
                            shopRedDict[storelist[i].ID].state = RedPointState.Simple;
                            shopRedDict[storeData.shopId].state = RedPointState.Simple;
                            LocalSave.SetBool(key,true);
                            SetPetAndMountPushData(storelist[i].ID);
                            SetPetAndMountPushData(storeData.shopId);
                        }
                        else
                        {
                            if(LocalSave.GetBool(key))
                            {
                                shopRedDict[storelist[i].ID].state = RedPointState.Simple;
                                shopRedDict[storeData.shopId].state = RedPointState.Simple;
                            }
                            else
                            {
                                shopRedDict[storelist[i].ID].state = RedPointState.None;
                                shopRedDict[storeData.shopId].state = RedPointState.None;
                            }
                            
                        }
@@ -1314,7 +1361,7 @@
                    else
                    {
                        //PlayerPrefs.DeleteKey(key);
                        shopRedDict[storelist[i].ID].state = RedPointState.None;
                        shopRedDict[storeData.shopId].state = RedPointState.None;
                    }
                    break;
            }