少年修仙传客户端代码仓库
client_LCJ
2018-08-10 6102258de40f51e6262de5ea0f40928ea9e835e4
System/Store/StoreModel.cs
@@ -37,6 +37,7 @@
    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 override void Init()
    {
        FuncConfigConfig buyItemHinit = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("BuyItemHinit");
@@ -45,6 +46,8 @@
        resetTimeDict = ConfigParse.GetDic<int, string>(restTimeConfig.Numerical1);
        FuncConfigConfig mallCurrency = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("MallCurrency");
        showCoinsUIDict = ConfigParse.GetDic<int, int>(mallCurrency.Numerical1);
        FuncConfigConfig mallPush = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("MallPush");
        StoreRedIdlist = ConfigParse.GetMultipleStr<int>(mallPush.Numerical2);
    }
    public void OnBeforePlayerDataInitialize()
@@ -68,8 +71,8 @@
        PlayerDatas.Instance.fairyData.OnRefreshFairyInfo += RefreshFamilyLv;
        FuncOpen.Instance.OnFuncStateChangeEvent -= FuncStateChange;
        FuncOpen.Instance.OnFuncStateChangeEvent += FuncStateChange;
        PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= RefreshPlayerLv;
        PlayerDatas.Instance.PlayerDataRefreshInfoEvent += RefreshPlayerLv;
        RefreshTCBPlayerDataEvent -= RefreshPlayerLv;
        RefreshTCBPlayerDataEvent += RefreshPlayerLv;
        TimeMgr.Instance.OnHourEvent -= RefreshServerHour;
        TimeMgr.Instance.OnHourEvent += RefreshServerHour;
        shoplist = null;
@@ -120,9 +123,16 @@
    private void RefreshPlayerLv(PlayerDataRefresh type)
    {
        if (type != PlayerDataRefresh.LV && type != PlayerDataRefresh.VIPLv) return;
        CheckShopRedpoint();
        switch(type)
        {
            case PlayerDataRefresh.LV:
            case PlayerDataRefresh.VIPLv:
            case PlayerDataRefresh.Gold:
            case PlayerDataRefresh.GoldPaper:
            case PlayerDataRefresh.FBHelpPoint:
                CheckShopRedpoint();
                break;
        }
    }
    public override void UnInit()
@@ -765,17 +775,7 @@
            StoreConfig storeConfig = ConfigManager.Instance.GetTemplate<StoreConfig>(key);
            if (storeConfig.MoneyNumber == 0)
            {
                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))
                if(CheckShopIsCanBuy(storeConfig))
                {
                    shopRedDict[storeConfig.ID].state = RedPointState.Simple;
                }
@@ -783,15 +783,56 @@
                {
                    shopRedDict[storeConfig.ID].state = RedPointState.None;
                }
            }
            else
            {
                shopRedDict[storeConfig.ID].state = RedPointState.None;
                if(CheckScoreStoreIsCanBuy(storeConfig))
                {
                    shopRedDict[storeConfig.ID].state = RedPointState.Simple;
                }
                else
                {
                    shopRedDict[storeConfig.ID].state = RedPointState.None;
                }
            }
        }
    }
    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))
        {
            return true;
        }
        return false;
    }
    #endregion
}