public void InitCommonHeroUI() { CUIFormScript form = Singleton <CUIManager> .get_instance().GetForm(CPlayerInfoSystem.sPlayerInfoFormPath); if (form == null) { return; } CPlayerProfile profile = Singleton <CPlayerInfoSystem> .get_instance().GetProfile(); GameObject widget = form.GetWidget(7); if (widget == null) { return; } CUIListScript componetInChild = Utility.GetComponetInChild <CUIListScript>(widget, "BaseList"); if (componetInChild == null) { return; } int num = profile.MostUsedHeroList().get_Count(); uint dwConfValue = GameDataMgr.globalInfoDatabin.GetDataByKey(178u).dwConfValue; if ((long)num > (long)((ulong)dwConfValue)) { num = (int)dwConfValue; } componetInChild.SetElementAmount(num); }
private void OnCommonHeroItemEnable(CUIEvent uiEvent) { CPlayerProfile profile = Singleton <CPlayerInfoSystem> .get_instance().GetProfile(); int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList; GameObject srcWidget = uiEvent.m_srcWidget; GameObject gameObject = Utility.FindChild(srcWidget, "heroItem"); ListView <COMDT_MOST_USED_HERO_INFO> listView = profile.MostUsedHeroList(); if (listView == null || srcWidgetIndexInBelongedList >= listView.get_Count()) { return; } COMDT_MOST_USED_HERO_INFO cOMDT_MOST_USED_HERO_INFO = listView.get_Item(srcWidgetIndexInBelongedList); CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo == null) { return; } IHeroData heroData = CHeroDataFactory.CreateHeroData(cOMDT_MOST_USED_HERO_INFO.dwHeroID); GameObject proficiencyIcon = Utility.FindChild(gameObject, "heroProficiencyImg"); GameObject proficiencyBg = Utility.FindChild(gameObject, "heroProficiencyBgImg"); CUICommonSystem.SetHeroProficiencyIconImage(uiEvent.m_srcFormScript, proficiencyIcon, (int)cOMDT_MOST_USED_HERO_INFO.dwProficiencyLv); CUICommonSystem.SetHeroProficiencyBgImage(uiEvent.m_srcFormScript, proficiencyBg, (int)cOMDT_MOST_USED_HERO_INFO.dwProficiencyLv, false); if (!CPlayerInfoSystem.isSelf(profile.m_uuid)) { CUICommonSystem.SetHeroItemImage(uiEvent.m_srcFormScript, gameObject, CSkinInfo.GetHeroSkinPic(cOMDT_MOST_USED_HERO_INFO.dwHeroID, cOMDT_MOST_USED_HERO_INFO.dwSkinID), enHeroHeadType.enBust, false, true); } else { CUICommonSystem.SetHeroItemImage(uiEvent.m_srcFormScript, gameObject, masterRoleInfo.GetHeroSkinPic(cOMDT_MOST_USED_HERO_INFO.dwHeroID), enHeroHeadType.enBust, false, true); } GameObject root = Utility.FindChild(gameObject, "profession"); CUICommonSystem.SetHeroJob(uiEvent.m_srcFormScript, root, (enHeroJobType)heroData.heroType); Text componetInChild = Utility.GetComponetInChild <Text>(gameObject, "heroNameText"); componetInChild.text = heroData.heroName; Text componetInChild2 = Utility.GetComponetInChild <Text>(gameObject, "TotalCount"); componetInChild2.text = Singleton <CTextManager> .get_instance().GetText("Player_Info_PVP_Total_Count", new string[] { (cOMDT_MOST_USED_HERO_INFO.dwGameWinNum + cOMDT_MOST_USED_HERO_INFO.dwGameLoseNum).ToString() }); Text componetInChild3 = Utility.GetComponetInChild <Text>(gameObject, "WinRate"); componetInChild3.text = Singleton <CTextManager> .get_instance().GetText("Player_Info_PVP_Win_Rate", new string[] { CPlayerProfile.Round(CPlayerProfile.Divide(cOMDT_MOST_USED_HERO_INFO.dwGameWinNum, cOMDT_MOST_USED_HERO_INFO.dwGameWinNum + cOMDT_MOST_USED_HERO_INFO.dwGameLoseNum) * 100f) }); ulong num = 0uL; ulong num2 = 0uL; ulong num3 = 0uL; uint num4 = 0u; COMDT_HERO_STATISTIC_DETAIL stStatisticDetail = cOMDT_MOST_USED_HERO_INFO.stStatisticDetail; uint dwNum = stStatisticDetail.dwNum; int num5 = 0; while ((long)num5 < (long)((ulong)dwNum)) { COMDT_HERO_STATISTIC_INFO cOMDT_HERO_STATISTIC_INFO = stStatisticDetail.astTypeDetail[num5]; num += cOMDT_HERO_STATISTIC_INFO.ullKDAPct; num2 += cOMDT_HERO_STATISTIC_INFO.ullTotalHurtHero; num3 += cOMDT_HERO_STATISTIC_INFO.ullTotalBeHurt; num4 = num4 + cOMDT_HERO_STATISTIC_INFO.dwWinNum + cOMDT_HERO_STATISTIC_INFO.dwLoseNum; num5++; } num4 = ((num4 != 0u) ? num4 : 1u); Utility.GetComponetInChild <Text>(gameObject, "AverKDA").text = Singleton <CTextManager> .get_instance().GetText("Player_Info_PVP_AverKDA", new string[] { (num / (ulong)num4 / 100uL).ToString("0.0") }); Utility.GetComponetInChild <Text>(gameObject, "AverHurt").text = Singleton <CTextManager> .get_instance().GetText("Player_Info_PVP_AverHurt", new string[] { (num2 / (ulong)num4).ToString("d") }); Utility.GetComponetInChild <Text>(gameObject, "AverTakenHurt").text = Singleton <CTextManager> .get_instance().GetText("Player_Info_PVP_AverTakenHurt", new string[] { (num3 / (ulong)num4).ToString("d") }); }