/// <summary> /// 某个玩家(不包括自己)有物品栏有更新的时候存储他的物品栏数据 /// </summary> /// <param name="_nPtrParam"></param> /// <param name="_nPtrLen"></param> public void UpdatePlayersGoods(IntPtr _nPtrParam, int _nPtrLen) { IntPtrVaArgParseHelper helper = new IntPtrVaArgParseHelper(_nPtrParam, _nPtrLen); cmd_war_persongoodsinfo_count dataCount = helper.get <cmd_war_persongoodsinfo_count>(); uint pdbid = dataCount.idActor; if (dataCount.nCount == 0 || pdbid == 0) { return; } if (!m_dicPlayersGoodsTable.ContainsKey(pdbid)) { m_dicPlayersGoodsTable.Add(pdbid, new List <cmd_war_persongoodsinfo>()); } m_dicPlayersGoodsTable[pdbid].Clear(); for (int i = 0; i < dataCount.nCount; ++i) { cmd_war_persongoodsinfo data = helper.get <cmd_war_persongoodsinfo>(); m_dicPlayersGoodsTable[pdbid].Add(data); } if (LogicDataCenter.recordTableDataManager.isOneRequest == true) { LogicDataCenter.recordTableDataManager.OnTabClick(); } //通知战绩表更新数据 if (LogicDataCenter.recordTableDataManager.IsWarRecordTableVisible) { UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_RECORDTABLE_FIGHTING_UPDATERECORDINFO, null); } }
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()); }
/// <summary> /// 更新本地玩家所有物品购买物品数据 /// </summary> /// <param name="_nHelper"></param> /// <param name="_nDataCount"></param> private void UpdataMainPlayerAllGoods(IntPtrVaArgParseHelper _nHelper, int _nDataCount) { ResetAssociatedWithPurchasedGoodsSlot(); for (int i = 0; i < _nDataCount; i++) { cmd_war_persongoodsinfo data = _nHelper.get <cmd_war_persongoodsinfo>(); m_dicPlayersGoodsTable[MainHeroPDBID].Add(data); } }
private void SetPurchasedGoodsSlot(cmd_war_persongoodsinfo data) { //Value ASGoodsValue; ////GameMobaSchemesManager.Instance.GetASMobaGoods(data.nGoodID, out ASGoodsValue, this); //if (!Value.IsValueValid(ASGoodsValue) || vStoreWindow.Invoke("SetPurchasedGoodsSlot", data.nSlotIndex, ASGoodsValue, data.nCanUseTimes, 1) == null) //{ // Trace.LogError("error call SetPurchasedGoodsSlot failed"); // return; //} }
/// <summary> /// 清除已购买物品槽 /// </summary> public void ClearPurchasedGoodsSlot() { cmd_war_persongoodsinfo data = new cmd_war_persongoodsinfo(); data.nGoodID = 0; data.nCanUseTimes = 0; for (int i = 0; i < 7; i++) { data.nSlotIndex = i; SetPurchasedGoodsSlot(data); } vRecommendedGoodsPage.Invoke("Clear"); GameMobaSchemesManager.MobaGoodsSchemesInitEndEvent += GetMobaGoodsFromSchemes; }
private void AddGoodsButtonToSlot(cmd_war_persongoodsinfo data, Value asGoodsValue) { if (!Value.IsValueValid(vPurchasedSlotMgr)) { return; } bool bCanUse = data.nCanUse == 1 ? true : false; //AddGoodsButtonToSlot(_nSlotID:int,_goods:Object,_nCanUseTimes:int,_nDisplayMaxUseTime:int,_bCanUse:Boolean,_nFreezeID:int,_nBuffID:int,_nSkillID:int):void if (vPurchasedSlotMgr.Invoke("AddGoodsButtonToSlot", data.nSlotIndex, asGoodsValue, data.nCanUseTimes, 0, bCanUse, data.nFreezeID, data.nBuffID, data.nSkillID) == null) { Trace.LogError("call AddGoodsButtonToSlot failed"); return; } }
/// <summary> /// 接受逻辑层下发的当前购买物品信息 /// </summary> /// <param name="_data">当前购买物品信息</param> public void WarGoodsStoreBuyGoods(IntPtr ptrParam, int nPtrLen) { if (!Value.IsValueValid(vStoreWindow)) { return; } ResetAssociatedWithPurchasedGoodsSlot(); IntPtrVaArgParseHelper helper = new IntPtrVaArgParseHelper(ptrParam, nPtrLen); cmd_war_persongoodsinfo_count obj = helper.get <cmd_war_persongoodsinfo_count>(); for (int i = 0; i < obj.nCount; ++i) { cmd_war_persongoodsinfo data = helper.get <cmd_war_persongoodsinfo>(); SetPurchasedGoodsSlot(data); //Value ASGoodsValue; //GameMobaSchemesManager.Instance.GetASMobaGoods(data.nGoodID, out ASGoodsValue, this); //if (!Value.IsValueValid(ASGoodsValue) || vStoreWindow.Invoke("SetPurchasedGoodsSlot", data.nSlotIndex, ASGoodsValue, data.nCanUseTimes,1) == null) //{ // Trace.LogError("error call SetPurchasedGoodsSlot failed"); // return; //} curPurchasedGoodsList.Add(data); } //等逻辑层发完整个已购买物品列表,再做判断 //判断哪些物品的价格需要变更的 { //这里没用FindWhichGoodsCanEffect()方法,因为该方法好像会重复迭代很多次 FindWhichGoodsCanEffect();// IteratorFindCanComposeGoods(curPurchasedGoodsList[0].nGoodID, ref allCanComposeGoodsMap); //curPurchasedGoodsList = null; } }
/// <summary> /// 更新本地玩家使用物品数据 /// </summary> /// <param name="_nHelper"></param> /// <param name="_nDataCount"></param> private void UpdateMainPlayerUseGoods(IntPtrVaArgParseHelper _nHelper, int _nDataCount) { for (int i = 0; i < _nDataCount; i++) { cmd_war_persongoodsinfo data = _nHelper.get <cmd_war_persongoodsinfo>(); if (data.nSlotType != (int)SLOT_TYPE.SLOT_TYPE_GOODS) { Trace.LogWarning("UpdateMainPlayerUseGoods 这里有个非物品槽位的数据。检查下"); continue; } int nIndex = m_dicPlayersGoodsTable[MainHeroPDBID].FindIndex(x => x.nSlotIndex == data.nSlotIndex); if (nIndex == -1) { Trace.LogWarning("UpdateMainPlayerUseGoods 这里有个使用的物品槽位" + data.nSlotIndex + "与当前数据不符,请检查。"); continue; } //使用次数为0,移除 m_dicPlayersGoodsTable[MainHeroPDBID][nIndex] = data; } }