Exemple #1
0
        public void SetRecommendedGoods(int[] _newGoodsIDs, EMobaRecommendGoods _eRecommendType)
        {
            for (int i = 0; i < _newGoodsIDs.Length; ++i)
            {
                if (_newGoodsIDs[i] == 0)
                {
                    continue;
                }
                //判断下是否已购买,已购买则不显示
                foreach (var PurchasedInfo in LogicDataCenter.warMobaGoodsDataManager.GetMainPlayerGoodsInfo())
                {
                    if (PurchasedInfo.nGoodID == _newGoodsIDs[i])
                    {
                        _newGoodsIDs[i] = 0;
                    }
                }
            }

            int recommendIndex = -1;

            for (int i = 0; i < _newGoodsIDs.Length; ++i)
            {
                if (_newGoodsIDs[i] == 0)
                {
                    continue;
                }

                UWarGoodsStoreItem newItem = LogicDataCenter.warMobaGoodsDataManager.GetWarGoodsStoreItem(_newGoodsIDs[i]);//m_MyParent.GetWarGoodsStoreItem(schemeGoods);

                recommendIndex = _eRecommendType == EMobaRecommendGoods.EMRG_MiddleStage ? i + 6 : i;
                m_ReCommendGoodsItemList[recommendIndex] = newItem;
            }
        }
Exemple #2
0
        public void BoxRecommendedGoodsByGoodsType(System.Collections.Generic.List <SSchemeMobaGoods> _typeList, List <int> _dispositionTypeList, EMobaRecommendGoods _eRecommendType)
        {
            m_nUsedRecommendType++;
            //取显示对象挂载容器
            Transform containner = GetCurrentContainer();
            ResNode   go         = AssetBundleManager.GetAssets(AssetType.Asset_Prefab, "UI/Prefabs/" + UPath.UDynamicMobaState + "/WarGoodsStore/WarGoodsStoreRecommendComponent");
            UWarGoodsStoreRecommendComponent component;

            //取该类型标题本地化文本
            if (GetCurrentContainerTitleText() != null)
            {
                ULocalizationService.Instance.Get(GetCurrentContainerTitleText(), "UIView", "WarGoodsStore", _eRecommendType.ToString());
            }
            //移除英雄限制的装备
            int nHeroId = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION);
            PersonSkinModelItem ModelItem = new PersonSkinModelItem();

            GameLogicAPI.GetPersonModel((UInt16)nHeroId, ref ModelItem);

            var list = _typeList.Select(d => d).Where(s => (s.GoodsVocationLimit != 0 && s.GoodsVocationLimit == ModelItem.nTraits)).ToList();

            foreach (var i in list)
            {
                _typeList.Remove(i);
            }

            int count = _typeList.Count >= 6 ? 6 : _typeList.Count;

            for (int i = 0; i < count; ++i) //each (var schemeGoods in _typeList)
            {
                SSchemeMobaGoods   schemeGoods = _typeList[i];
                UWarGoodsStoreItem newItem     = LogicDataCenter.warMobaGoodsDataManager.GetWarGoodsStoreItem(schemeGoods);//m_MyParent.GetWarGoodsStoreItem(schemeGoods);
                if (newItem != null)
                {
                    m_ReCommendGoodsItemList.Add(newItem);

                    component = go.InstanceMainRes <UWarGoodsStoreRecommendComponent>();
                    component.gameObject.name = newItem.SchemeGoodsInfo.GoodsName;
                    component.SetData(newItem);

                    component.Group = m_RecommendGoodsGroup;
                    component.transform.SetParent(containner, false);

                    component.onSelectedChangedEx.AddListener(OnMobaGoodsSelected);
                    component.onDoubleClick.AddListener(OnMobaGoodsBuy);
                    component.onRightClick.AddListener(OnMobaGoodsBuy);
                }
                else
                {
                    newItem = new UWarGoodsStoreItem(schemeGoods);

                    if (LogicDataCenter.warMobaGoodsDataManager.EnableGoodsFilter && newItem.IsFiltered)
                    {
                        continue;
                    }

                    newItem.GoodsComponentVisible = false;
                    m_ReCommendGoodsItemList.Add(newItem);
                    component       = go.InstanceMainRes <UWarGoodsStoreRecommendComponent>();
                    component.Group = m_RecommendGoodsGroup;
                    component.transform.SetParent(containner, false);

                    component.onSelectedChangedEx.AddListener(OnMobaGoodsSelected);
                    component.onDoubleClick.AddListener(OnMobaGoodsBuy);
                    component.onRightClick.AddListener(OnMobaGoodsBuy);

                    component.SetData(newItem);
                }
                //存下更改物品配置时需要替换的推荐类型
                if (_dispositionTypeList != null && _dispositionTypeList.Contains((int)_eRecommendType))
                {
                    LogicDataCenter.warMobaGoodsDataManager.SetHeroDefaultGoods(i, schemeGoods.GoodsID, m_nUsedRecommendType);
                }
            }
        }