Exemple #1
0
        public void Load(string _strPath)
        {
            m_dicGoodsSchemeTable = new Dictionary <int, SSchemeMobaGoods>();

            ScpReader MobaGoodsReader = new ScpReader(_strPath, true, 2);//new ScpReader(SchemeAllText, "MobaGoods", 2);

            for (int i = 0; i < MobaGoodsReader.GetRecordCount(); i++)
            {
                SSchemeMobaGoods goods = new SSchemeMobaGoods();
                goods.GoodsID                   = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_ID, 0);
                goods.GoodsName                 = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_Name, string.Empty);
                goods.GoodsIconID               = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_IconID, 0);
                goods.GoodsCost                 = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_Cost, 0);
                goods.GoodsSoldOutCost          = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_SoldOutCost, 0);
                goods.GoodsDes                  = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_Description, string.Empty);
                goods.GoodsCanComposeList       = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_CanComposeList, string.Empty);
                goods.GoodsNeedComposeList      = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_NeedComposeList, string.Empty);
                goods.GoodsLabel                = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_Label, string.Empty);
                goods.GoodsWarLimit             = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_WarLimit, string.Empty);
                goods.GoodsSlotDes              = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_SlotDescription, string.Empty);
                goods.GoodsVocationLimit        = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_VocationTypeLimit, 0);
                goods.GoodsPreciousDegree       = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_PreciousDegree, 0);
                goods.GoodsFlag                 = MobaGoodsReader.GetInt(i, (int)EMobaGoods.EMG_Flag, 0);
                goods.GoodsLocationInstructions = MobaGoodsReader.GetString(i, (int)EMobaGoods.EMG_LocationInstructions, string.Empty);

                m_dicGoodsSchemeTable.Add(goods.GoodsID, goods);
            }
            // 需要加一列空值(服务端传过来时会传过来一个0  在这个容器里查找 如果不加会报错)
            if (m_dicGoodsSchemeTable.ContainsKey(0) == false)
            {
                m_dicGoodsSchemeTable.Add(0, new SSchemeMobaGoods());
            }

            MobaGoodsReader.Dispose();
        }
        public void setEquipInfo(cmd_war_persongoodsinfo cmdGoodsInfo, SSchemeMobaGoods schemeMobaGoods)
        {
            // 物品图标
            int nEquipIcon = schemeMobaGoods.GoodsIconID;

            playerEquipTipsTrigger.enabled = nEquipIcon > 0;
            this.goodsImage.sprite         = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_MobaGoods, WndID.WND_ID_WAR_RECORDTABLE_FIGHTING, 1, nEquipIcon);
            if (this.goodsImage.sprite == null && this.goodsImage.gameObject.activeSelf)
            {
                this.goodsImage.gameObject.SetActive(false);
            }
            else if (this.goodsImage.sprite && this.goodsImage.gameObject.activeSelf == false)
            {
                this.goodsImage.gameObject.SetActive(true);
            }

            // 物品数量
            int nTimes = cmdGoodsInfo.nCanUseTimes;

            if (nTimes != 0)
            {
                goodsCount.gameObject.SetActive(true);
            }
            else
            {
                goodsCount.gameObject.SetActive(false);
            }
            this.goodsCount.text = nTimes.ToString();

            m_sEquipDesc = schemeMobaGoods.GoodsDes;

            UBB.toHtml(ref schemeMobaGoods.GoodsName, UBB_FORMAT_TYPE.UGUI);
            playerEquipTipsTrigger.SetText(UTooltipParamName.ItemName, schemeMobaGoods.GoodsName);
            playerEquipTipsTrigger.SetText(UTooltipParamName.ItemCost, schemeMobaGoods.GoodsSoldOutCost.ToString());
        }
Exemple #3
0
        /// <summary>
        /// 添加物品数据
        /// </summary>
        /// <param name="_SchemeGoods"></param>
        protected void AddGoodsItemDataSource(SSchemeMobaGoods _SchemeGoods)
        {
            UWarGoodsStoreItem goods = new UWarGoodsStoreItem(_SchemeGoods);

            goods.OnPropertyChange += OnDataPropertyChange;
            m_SchemeMobaGoodsDataSource.Add(goods);
        }
        private void setEquipTips(SSchemeMobaGoods goods)
        {
            UTooltipTrigger equipTipsTrigger = EquipImage.GetComponent <UTooltipTrigger>();

            if (equipTipsTrigger == null)
            {
                return;
            }

            int    nEquipID  = goods.GoodsID;
            string equipDesc = goods.GoodsDes;

            if (nEquipID <= 0)
            {
                equipTipsTrigger.enabled = false;
                return;
            }

            equipTipsTrigger.enabled = true;

            string sGoodsDes = equipDesc;

            UBBProperty.GetInstance().getRatio(sGoodsDes);
            UBB.toHtml(ref sGoodsDes, UBB_FORMAT_TYPE.UGUI);
            equipTipsTrigger.SetText(UTooltipParamName.ItemDesc, sGoodsDes);

            string sGoodsName = goods.GoodsName;

            UBB.toHtml(ref sGoodsName, UBB_FORMAT_TYPE.UGUI);
            equipTipsTrigger.SetText(UTooltipParamName.ItemName, sGoodsName);
            equipTipsTrigger.SetText(UTooltipParamName.ItemCost, goods.GoodsCost.ToString());
        }
Exemple #5
0
 public UWarGoodsStoreItem(SSchemeMobaGoods _schemes)
 {
     SchemeGoodsInfo = _schemes;
     m_nGoodsCost    = SchemeGoodsInfo.GoodsCost;
     m_nGoodsID      = SchemeGoodsInfo.GoodsID;
     m_nFlag         = SchemeGoodsInfo.GoodsFlag;
 }
 protected override void AlwaysChangeData(SSchemeMobaGoods item)
 {
     base.AlwaysChangeData(item);
     if (GoodsCost != null)
     {
         GoodsCost.text = item.GoodsCost.ToString();
     }
 }
Exemple #7
0
        /// <summary>
        /// 根据配置信息获取物品数据
        /// </summary>
        /// <param name="_goodsScheme"></param>
        /// <returns></returns>
        internal UWarGoodsStoreItem GetWarGoodsStoreItem(SSchemeMobaGoods _goodsScheme, bool _bFilterGood = true)
        {
            if (_goodsScheme == null || _goodsScheme.GoodsID <= 0)
            {
                Trace.LogWarning("GetWarGoodsStoreItem 的参数是空或者GoodsID为0");
                return(null);
            }

            return(GetWarGoodsStoreItem(_goodsScheme.GoodsID, _bFilterGood));
        }
Exemple #8
0
        /// <summary>
        /// 通过物品ID查找物品图标ID
        /// </summary>
        /// <param name="_nGoodsID"></param>
        /// <returns></returns>
        public int GetGoodsIconID(int _nGoodsID)
        {
            SSchemeMobaGoods goods = null;

            if (GetMobaGoods_Out(_nGoodsID, out goods))
            {
                return(goods.GoodsIconID);
            }
            return(0);
        }
Exemple #9
0
 /// <summary>
 /// 取引用,如果 “不会改变里面的值” 的话尽量用这个方法
 /// </summary>
 /// <param name="_goodsID"></param>
 /// <param name="_goods"></param>
 public bool GetMobaGoods_Out(int _goodsID, out SSchemeMobaGoods _goods)
 {
     if (!IsHasGoods(_goodsID))
     {
         //Trace.LogWarning("没找到ID为:" + _goodsID + "的物品");
         _goods = null;
         return(false);
     }
     _goods = m_dicGoodsSchemeTable[_goodsID];
     return(true);
 }
Exemple #10
0
 /// <summary>
 /// 拷贝一份新的,如果 “会改变里面值” 的话尽量用这方法
 /// </summary>
 /// <param name="_goodsID"></param>
 /// <param name="_goods"></param>
 public bool GetMobaGoods_Ref(int _goodsID, ref SSchemeMobaGoods _goods)
 {
     if (!IsHasGoods(_goodsID))
     {
         //Trace.LogWarning("没找到ID为:" + _goodsID + "的物品");
         _goods = null;
         return(false);
     }
     m_dicGoodsSchemeTable[_goodsID].CopyTo(ref _goods);
     return(true);
 }
        protected virtual void AlwaysChangeData(SSchemeMobaGoods item)
        {
            if (GoodsCost != null)
            {
                GoodsCost.text = item.GoodsName + "\n" + item.GoodsCost.ToString();
            }


            if (IsTooltipInit())
            {
                GoodsTooltips.SetText(GoodsTooltip_CostParamName, item.GoodsCost.ToString());
            }
        }
 public void Clear()
 {
     GoodsDepth         = 0;
     GoodsChildCount    = 0;
     ParentNode         = null;
     GoodsItem          = null;
     GoodsNodeComponent = null;
     if (ChildsNodeList != null)
     {
         ChildsNodeList.Clear();
     }
     ParentNodeWidth = 0;
 }
Exemple #13
0
 public void CopyTo(ref SSchemeMobaGoods _nOtherGoods)
 {
     _nOtherGoods.GoodsID              = GoodsID;
     _nOtherGoods.GoodsName            = GoodsName;
     _nOtherGoods.GoodsIconID          = GoodsIconID;
     _nOtherGoods.GoodsCost            = GoodsCost;
     _nOtherGoods.GoodsSoldOutCost     = GoodsSoldOutCost;
     _nOtherGoods.GoodsDes             = GoodsDes;
     _nOtherGoods.GoodsCanComposeList  = GoodsCanComposeList;
     _nOtherGoods.GoodsNeedComposeList = GoodsNeedComposeList;
     _nOtherGoods.GoodsLabel           = GoodsLabel;
     _nOtherGoods.GoodsWarLimit        = GoodsWarLimit;
     _nOtherGoods.GoodsSlotDes         = GoodsSlotDes;
     _nOtherGoods.GoodsVocationLimit   = GoodsVocationLimit;
     _nOtherGoods.GoodsPreciousDegree  = GoodsPreciousDegree;
 }
        public void SetData(SSchemeMobaGoods item)
        {
            //if (item.SchemeGoodsInfo != null && gameObject != null)
            //    Debug.Log(item.SchemeGoodsInfo.GoodsName + ",Enable:" + this.enabled + ",go.active:" + this.gameObject.activeInHierarchy);
            //else
            //    Debug.Log("null 不能设置颜色");
            if (CurrentGoodsID != item.GoodsID)
            {
                CurrentGoodsID = item.GoodsID;
                NonAlwaysChangeData(item);
            }

            AlwaysChangeData(item);

            GoodsTooltips.enabled = CurrentGoodsID > 0;
        }
Exemple #15
0
        /// <summary>
        /// 从配置获取各推荐物品
        /// </summary>
        /// <param name="_list">推荐物品列表</param>
        /// <param name="_schemesStage">推荐物品配置值</param>
        private void SetRecommendGoodsStage(List <SSchemeMobaGoods> _list, string _schemesStage)
        {
            char[]     charSeparator = new char[] { MobaSchemesConfig.separator };
            List <int> intArray      = ScpReader.ConvertStringToIntArray(_schemesStage, charSeparator);

            for (int index = 0; index < intArray.Count; index++)
            {
                SSchemeMobaGoods goods = null;

                if (!LogicDataCenter.warMobaGoodsDataManager.GetMobaGoods_Out(intArray[index], out goods))
                {
                    goods = new SSchemeMobaGoods();
                }

                _list.Add(goods);
            }
        }
        protected virtual void NonAlwaysChangeData(SSchemeMobaGoods item)
        {
            UGoodsDispositionView.GetGoodsIcon(item != null ? item.GoodsIconID : 0, GoodsIcon);



            if (IsTooltipInit() && item != null)
            {
                GoodsTooltips.SetImage(GoodsTooltip_IconParamName, UGoodsDispositionView.GetGoodsIcon(item.GoodsIconID));
                GoodsTooltips.SetText(GoodsTooltip_NameParamName, item.GoodsName);
                string GoodsDes = item.GoodsDes;
                UBBProperty.GetInstance().getRatio(GoodsDes);
                U3D_Render.Common.UBB.toHtml(ref GoodsDes, UBB_FORMAT_TYPE.UGUI);
                GoodsTooltips.SetText(GoodsTooltip_InfoParamName, GoodsDes);
            }
            else
            {
                GoodsTooltips.SetImage(GoodsTooltip_IconParamName, null);
                GoodsTooltips.SetText(GoodsTooltip_NameParamName, "");
                GoodsTooltips.SetText(GoodsTooltip_InfoParamName, "");
            }
        }
Exemple #17
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);
                }
            }
        }
        // 设置玩家信息
        public void setPlayerInfo(WarRecordTableDataManager.WarPersonInfo personInfo, int nMoneyTop, int nKillTop, int nDieTop, int nAssTop, bool isSelfCamp)
        {
            if (!m_isInit)
            {
                Debug.LogError("There is not init player info.");
                return;
            }

            // 设置玩家信息
            heroLv.text = personInfo.nLevel.ToString();

            if (isSelfCamp)
            {
                playerName.text = "<color=#9CDBFF>" + personInfo.playerName + "</color>";
            }
            else
            {
                playerName.text = "<color=#E95A5A>" + personInfo.playerName + "</color>";
            }

            String strKillState = "";

            if (nKillTop != 0 && personInfo.nKillNum == nKillTop)
            {
                strKillState += "<color=#FF7800>" + personInfo.nKillNum + "</color>";
            }
            else
            {
                strKillState += personInfo.nKillNum.ToString();
            }
            strKillState += "/";

            if (nDieTop != 0 && personInfo.nDeadNum == nDieTop)
            {
                strKillState += "<color=#FF6E2E>" + personInfo.nDeadNum + "</color>";
            }
            else
            {
                strKillState += personInfo.nDeadNum.ToString();
            }
            strKillState += "/";

            if (nAssTop != 0 && personInfo.nAssists == nAssTop)
            {
                strKillState += "<color=#FF6E2E>" + personInfo.nAssists + "</color>";
            }
            else
            {
                strKillState += personInfo.nAssists.ToString();
            }

            playerState.text = strKillState;

            //playerGold.text = personInfo.nMobaWarMoney.ToString();

            if (personInfo.nMobaWarMoney >= 10000)
            {
                float fAllGold = (personInfo.nMobaWarMoney) / 10000.0f;
                playerGold.text = fAllGold.ToString("0.00") + ULocalizationService.Instance.Get("UIView", "Common", "TenThousand");
            }
            else
            {
                playerGold.text = personInfo.nMobaWarMoney.ToString();
            }

            Color clr;

            if (personInfo.nMobaWarMoney == nMoneyTop)
            {
                ColorUtility.TryParseHtmlString("#FF6E2E", out clr);
            }
            else
            {
                ColorUtility.TryParseHtmlString("#FFd52E", out clr);
            }
            this.playerGold.color = clr;


            // 性别显示
            if (personInfo.nPlayerType == (int)EPlayerType.EWPT_COMPUTER)
            {
                SexImage.gameObject.SetActive(false);
            }
            else //if(personInfo.nPlayerType == (int)EPlayerType.EWPT_REALPEOPLE)
            {
                SexImage.gameObject.SetActive(true);
                WarRecordTableDataManager.WarPlayerVsInfo playerInfo = LogicDataCenter.recordTableDataManager.GetWarPlayerVsInfo(personInfo.uPDBID);
                if (playerInfo != null)
                {
                    SexImage.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_KinSex, WndID.WND_ID_SOCIALCONTACT, playerInfo.nSex + 1);
                }
            }

            // 设置装备信息
            SSchemeMobaGoods schemeMobaGoods             = new SSchemeMobaGoods();
            ulong            uPDBID                      = personInfo.uPDBID;
            List <cmd_war_persongoodsinfo> listEquipInfo = LogicDataCenter.warMobaGoodsDataManager.GetPlayerGoodsInfo(uPDBID);

            if (listEquipInfo != null && goodsFrame != null)
            {
                int nCount = listEquipInfo.Count;
                for (int i = 0; i < nCount; ++i)
                {
                    int nIndex = listEquipInfo[i].nSlotIndex;
                    if (nIndex >= goodsFrame.Length || goodsFrame[nIndex] == null)
                    {
                        Debug.LogWarning("nIndex >= goodsFrame.Length || goodsFrame[nIndex], nIndex=" + nIndex);
                        continue;
                    }
                    LogicDataCenter.warMobaGoodsDataManager.GetMobaGoods_Out(listEquipInfo[i].nGoodID, out schemeMobaGoods);
                    goodsFrame[nIndex].setEquipInfo(listEquipInfo[i], schemeMobaGoods);
                }
            }

            int nHeroID = personInfo.nHeroId;

            // 设置天赋信息
            cmd_war_active_talent_list listTalent;

            if (LogicDataCenter.heroTalentDataManager.getActiveTalentList(uPDBID, out listTalent))
            {
                for (int i = 0; i < listTalent.nTalentList.Length; ++i)
                {
                    int nTalentID = listTalent.nTalentList[i];
                    if (nTalentID <= 0)
                    {
                        continue;
                    }

                    if (i >= talentFrame.Length || talentFrame[i] == null)
                    {
                        Debug.LogWarning("i >= talentFrame.Length || talentFrame[i] == null, i=" + i + ",length=" + talentFrame.Length);
                        continue;
                    }

                    talentFrame[i].setTalentInfo(nHeroID, nTalentID);
                }
            }
        }
Exemple #19
0
        public override void ProcessNPCResponse(UNPCResponseData data)
        {
            m_responseData = data;
            m_Title.text   = data.npcResp.NpcName;
            ObservableList <UNPCGoodsItem> dataSource = new ObservableList <UNPCGoodsItem>();
            bool allFree = true;

            foreach (var item in data.npcResp.NPCTopicList)
            {
                if (item.ParamList.Length > 6)
                {
                    int goodsID;
                    int goodsCost;
                    int lastBuyTime;
                    int coolTime;
                    if (!Int32.TryParse(item.ParamList[4], out goodsID))
                    {
                        return;
                    }

                    if (!Int32.TryParse(item.ParamList[5], out goodsCost))
                    {
                        return;
                    }

                    if (!Int32.TryParse(item.ParamList[6], out lastBuyTime))
                    {
                        return;
                    }

                    if (!Int32.TryParse(item.ParamList[7], out coolTime))
                    {
                        return;
                    }

                    SSchemeMobaGoods schemeGoods = new SSchemeMobaGoods();
                    if (GoodsSchemesDataManager.Instance.GetMobaGoods_Ref(goodsID, ref schemeGoods))
                    {
                        UNPCGoodsItem goodItem = new UNPCGoodsItem();
                        goodItem.schemeGoods = schemeGoods;
                        if (goodsCost >= 0)
                        {
                            goodItem.schemeGoods.GoodsCost = goodsCost;
                            if (allFree && goodsCost > 0)
                            {
                                allFree = false;
                            }
                        }

                        goodItem.nLastBuyTime = lastBuyTime;
                        goodItem.nCoolTime    = coolTime;
                        goodItem.uidNPC       = (int)data.npcResp.NpcUID;
                        dataSource.Add(goodItem);
                    }
                    else
                    {
                        Debug.LogWarningFormat("not find goods by goodsID={0}", goodsID);
                    }
                }
            }
            goodsTile.SetAllDeselect();
            goodsTile.DataSource = dataSource;
            if (goodsTile.DataSource.Count > 0)
            {
                goodsTile.Select(0);
            }
            if (buyGoodsBtnDesc != null)
            {
                if (allFree && data.npcResp.TopicCount == 1)
                {
                    buyGoodsBtnDesc.text = "拾取";
                }
                else
                {
                    buyGoodsBtnDesc.text = "购买";
                }
            }

            InvokeRepeating("SetGoodsMask", 0.1f, 0.5f);
        }