// 收到服务器返回的历史战绩总览 public void RecvTotalStatistic(IntPtr ptrParam, int nPtrLen) { IntPtrVaArgParseHelper helper = new IntPtrVaArgParseHelper(ptrParam, nPtrLen); cmd_entity_update_warstatistic_total totalStatistic = helper.get <cmd_entity_update_warstatistic_total>(); ActorStatisticInfo info = null; if (actorStatistic.TryGetValue(totalStatistic.nActorID, out info) == false) { return; } info.totalStatistic = totalStatistic; info.totalStatisticWar.Clear(); for (int i = 0; i < info.totalStatistic.nWarInfoCount; ++i) { cmd_entity_update_warstatistic_total_warinfo data = helper.get <cmd_entity_update_warstatistic_total_warinfo>(); info.totalStatisticWar.Add(data); } UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_PLAYERWARSTATISTIC_UPDATETOTAL, null); }
public void SetStatisticInfo(cmd_entity_update_warstatistic_total sStatisticInfo, Dictionary <HeroType, int> dicMatchCount) { int nMaxCount = 0; HeroType nMaxType = HeroType.HEROTYPE_ALL; int nMinCount = int.MaxValue; HeroType nMinType = HeroType.HEROTYPE_ALL; int nSumCount = 0; foreach (var item in dicMatchCount) { if (item.Value > nMaxCount) { nMaxCount = item.Value; nMaxType = item.Key; } if (item.Value < nMinCount && item.Value != 0) { nMinCount = item.Value; nMinType = item.Key; } nSumCount += item.Value; } // 设置常用英雄及分布图 if (nMaxCount == 0) { mostUse.text = wndView.strHeroType[(int)HeroType.HEROTYPE_ALL]; useIcon[(int)HeroType.HEROTYPE_SOLDIER].SetActive(false); useIcon[(int)HeroType.HEROTYPE_MAGIC].SetActive(false); useIcon[(int)HeroType.HEROTYPE_ASSASSIN].SetActive(false); useIcon[(int)HeroType.HEROTYPE_SUPPORT].SetActive(false); useIcon[(int)HeroType.HEROTYPE_ADC].SetActive(false); } else { mostUse.text = GetPercentStr((int)nMaxType, dicMatchCount[nMaxType], nSumCount); foreach (var itemView in dicMatchCount) { if (itemView.Value != 0) { useIcon[(int)itemView.Key].SetActive(true); LayoutElement layout = useIcon[(int)itemView.Key].GetComponent <LayoutElement>(); UTooltipTrigger tooltip = useIcon[(int)itemView.Key].GetComponent <UTooltipTrigger>(); if (!layout || !tooltip) { return; } layout.flexibleWidth = (float)itemView.Value / nMinCount; tooltip.SetText(UTooltipParamName.BodyText, GetPercentStr((int)itemView.Key, itemView.Value, nSumCount)); } else { useIcon[(int)itemView.Key].SetActive(false); } } } kda.text = sStatisticInfo.nRecentKDAScore.ToString(); string strKillCount = sStatisticInfo.nRecentKillCount.ToString(); string strDieCount = sStatisticInfo.nRecentDieCount.ToString(); string strAssistCount = sStatisticInfo.nRecentAssistCount.ToString(); detailInfo.text = strKillCount + "/ " + strDieCount + "/ " + strAssistCount; }