private static void ConvertAverageData(CPlayerProfile profile, MainTab mainTab, SubTab subTab, out float kda, out float joinFight, out int totalCoinGet, out int totalHurtToEnemy, out int totalBeHurt, out int totalHurtToOrgan, out float totalDead) { kda = 0f; joinFight = 0f; totalCoinGet = 0; totalHurtToEnemy = 0; totalBeHurt = 0; totalHurtToOrgan = 0; totalDead = 0f; if (mainTab == MainTab.MatchAll) { if (subTab == SubTab.Match5V5 || subTab == SubTab.MatchRank || subTab == SubTab.MatchGuild) { COMDT_HERO_STATISTIC_INFO cOMDT_HERO_STATISTIC_INFO = null; if (subTab == SubTab.Match5V5) { cOMDT_HERO_STATISTIC_INFO = profile.pvpExtraDetail.st5v5; } else if (subTab == SubTab.MatchRank) { cOMDT_HERO_STATISTIC_INFO = profile.pvpExtraDetail.stLadder; } else if (subTab == SubTab.MatchGuild) { cOMDT_HERO_STATISTIC_INFO = profile.pvpExtraDetail.stGuildMatch; } uint b = cOMDT_HERO_STATISTIC_INFO.dwWinNum + cOMDT_HERO_STATISTIC_INFO.dwLoseNum; kda = CPlayerProfile.Divide(cOMDT_HERO_STATISTIC_INFO.ullKDAPct, b) / 100f; joinFight = CPlayerProfile.Divide(cOMDT_HERO_STATISTIC_INFO.dwBattleRatioPct, b) / 100f; totalCoinGet = (int)CPlayerProfile.Divide(cOMDT_HERO_STATISTIC_INFO.dwGPM, b); totalHurtToEnemy = (int)CPlayerProfile.Divide(cOMDT_HERO_STATISTIC_INFO.dwHurtPM, b); totalBeHurt = (int)CPlayerProfile.Divide(cOMDT_HERO_STATISTIC_INFO.ullTotalBeHurt, b); totalHurtToOrgan = (int)CPlayerProfile.Divide(cOMDT_HERO_STATISTIC_INFO.ullTotalHurtOrgan, b); totalDead = CPlayerProfile.Divide(cOMDT_HERO_STATISTIC_INFO.dwDead, b); } else if (subTab == SubTab.MatchAll) { uint num = profile.pvpExtraDetail.st5v5.dwWinNum + profile.pvpExtraDetail.st5v5.dwLoseNum; ulong ullKDAPct = profile.pvpExtraDetail.st5v5.ullKDAPct; uint dwBattleRatioPct = profile.pvpExtraDetail.st5v5.dwBattleRatioPct; uint dwGPM = profile.pvpExtraDetail.st5v5.dwGPM; uint dwHurtPM = profile.pvpExtraDetail.st5v5.dwHurtPM; ulong ullTotalBeHurt = profile.pvpExtraDetail.st5v5.ullTotalBeHurt; ulong ullTotalHurtOrgan = profile.pvpExtraDetail.st5v5.ullTotalHurtOrgan; uint dwDead = profile.pvpExtraDetail.st5v5.dwDead; uint num2 = profile.pvpExtraDetail.stLadder.dwWinNum + profile.pvpExtraDetail.stLadder.dwLoseNum; ulong ullKDAPct2 = profile.pvpExtraDetail.stLadder.ullKDAPct; uint dwBattleRatioPct2 = profile.pvpExtraDetail.stLadder.dwBattleRatioPct; uint dwGPM2 = profile.pvpExtraDetail.stLadder.dwGPM; uint dwHurtPM2 = profile.pvpExtraDetail.stLadder.dwHurtPM; ulong ullTotalBeHurt2 = profile.pvpExtraDetail.stLadder.ullTotalBeHurt; ulong ullTotalHurtOrgan2 = profile.pvpExtraDetail.stLadder.ullTotalHurtOrgan; uint dwDead2 = profile.pvpExtraDetail.stLadder.dwDead; uint num3 = profile.pvpExtraDetail.stGuildMatch.dwWinNum + profile.pvpExtraDetail.stGuildMatch.dwLoseNum; ulong ullKDAPct3 = profile.pvpExtraDetail.stGuildMatch.ullKDAPct; uint dwBattleRatioPct3 = profile.pvpExtraDetail.stGuildMatch.dwBattleRatioPct; uint dwGPM3 = profile.pvpExtraDetail.stGuildMatch.dwGPM; uint dwHurtPM3 = profile.pvpExtraDetail.stGuildMatch.dwHurtPM; ulong ullTotalBeHurt3 = profile.pvpExtraDetail.stGuildMatch.ullTotalBeHurt; ulong ullTotalHurtOrgan3 = profile.pvpExtraDetail.stGuildMatch.ullTotalHurtOrgan; uint dwDead3 = profile.pvpExtraDetail.stGuildMatch.dwDead; uint num4 = num + num2 + num3; if (num4 == 0u) { num4 = 1u; } kda = CPlayerProfile.Divide(ullKDAPct + ullKDAPct2 + ullKDAPct3, num4) / 100f; joinFight = CPlayerProfile.Divide(dwBattleRatioPct + dwBattleRatioPct2 + dwBattleRatioPct3, num4) / 100f; totalCoinGet = (int)((dwGPM + dwGPM2 + dwGPM3) / num4); totalHurtToEnemy = (int)((dwHurtPM + dwHurtPM2 + dwHurtPM3) / num4); totalBeHurt = (int)((ullTotalBeHurt + ullTotalBeHurt2 + ullTotalBeHurt3) / (ulong)num4); totalHurtToOrgan = (int)((ullTotalHurtOrgan + ullTotalHurtOrgan2 + ullTotalHurtOrgan3) / (ulong)num4); totalDead = CPlayerProfile.Divide(dwDead + dwDead2 + dwDead3, num4); } } else if (mainTab == MainTab.Match100) { uint num5 = 0u; uint num6 = 0u; byte b2 = 0; byte b3 = 0; CPlayerPvpInfoController.GetGameTypeAcntNum(subTab, out b2, out b3); ulong num7 = 0uL; ulong num8 = 0uL; ulong num9 = 0uL; ulong num10 = 0uL; ulong num11 = 0uL; ulong num12 = 0uL; ulong num13 = 0uL; int num14 = 0; while ((long)num14 < (long)((ulong)profile.pvpExtraDetail.dwRecentNum)) { if ((b2 == 0 || (profile.pvpExtraDetail.astRecentDetail[num14].bGameType == b2 && b3 == profile.pvpExtraDetail.astRecentDetail[num14].bMapAcntNum)) && (profile.pvpExtraDetail.astRecentDetail[num14].bGameType != 5 || profile.pvpExtraDetail.astRecentDetail[num14].bMapAcntNum >= 10) && profile.pvpExtraDetail.astRecentDetail[num14].bGameType != 9) { num7 += profile.pvpExtraDetail.astRecentDetail[num14].ullKDAPct; num8 += (ulong)profile.pvpExtraDetail.astRecentDetail[num14].dwBattleRatioPct; num6 += profile.pvpExtraDetail.astRecentDetail[num14].dwCampKill; num9 += (ulong)profile.pvpExtraDetail.astRecentDetail[num14].dwGPM; num10 += (ulong)profile.pvpExtraDetail.astRecentDetail[num14].dwHurtPM; num11 += profile.pvpExtraDetail.astRecentDetail[num14].ullTotalBeHurt; num12 += profile.pvpExtraDetail.astRecentDetail[num14].ullTotalHurtOrgan; num13 += (ulong)profile.pvpExtraDetail.astRecentDetail[num14].dwDead; num5 += 1u; } num14++; } kda = CPlayerProfile.Divide(num7, num5) / 100f; joinFight = CPlayerProfile.Divide(num8, num5) / 100f; totalCoinGet = (int)CPlayerProfile.Divide(num9, num5); totalHurtToEnemy = (int)CPlayerProfile.Divide(num10, num5); totalBeHurt = (int)CPlayerProfile.Divide(num11, num5); totalHurtToOrgan = (int)CPlayerProfile.Divide(num12, num5); totalDead = CPlayerProfile.Divide(num13, num5); } }
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") }); }
private static void ConvertBaseData(CPlayerProfile profile, MainTab mainTab, SubTab subTab, out uint winMvp, out uint loseMvp, out uint godLike, out uint tripleKill, out uint quataryKill, out uint pentaKill) { winMvp = 0u; loseMvp = 0u; godLike = 0u; tripleKill = 0u; quataryKill = 0u; pentaKill = 0u; if (mainTab == MainTab.MatchAll) { if (subTab == SubTab.MatchAll) { winMvp = profile.MVPCnt(); loseMvp = profile.LoseSoulCnt(); godLike = profile.HolyShit(); tripleKill = profile.TripleKill(); quataryKill = profile.QuataryKill(); pentaKill = profile.PentaKill(); } else { COMDT_HERO_STATISTIC_INFO cOMDT_HERO_STATISTIC_INFO = null; if (subTab == SubTab.Match5V5) { cOMDT_HERO_STATISTIC_INFO = profile.pvpExtraDetail.st5v5; } else if (subTab == SubTab.MatchRank) { cOMDT_HERO_STATISTIC_INFO = profile.pvpExtraDetail.stLadder; } else if (subTab == SubTab.MatchGuild) { cOMDT_HERO_STATISTIC_INFO = profile.pvpExtraDetail.stGuildMatch; } else if (subTab == SubTab.Match3V3) { cOMDT_HERO_STATISTIC_INFO = profile.pvpExtraDetail.st3v3; } else if (subTab == SubTab.Match1V1) { cOMDT_HERO_STATISTIC_INFO = profile.pvpExtraDetail.st1v1; } else if (subTab == SubTab.MatchEntertainment) { cOMDT_HERO_STATISTIC_INFO = profile.pvpExtraDetail.stEntertainment; } winMvp = cOMDT_HERO_STATISTIC_INFO.dwMvp; loseMvp = cOMDT_HERO_STATISTIC_INFO.dwLoseSoul; godLike = cOMDT_HERO_STATISTIC_INFO.dwGodLike; tripleKill = cOMDT_HERO_STATISTIC_INFO.dwTripleKill; quataryKill = cOMDT_HERO_STATISTIC_INFO.dwUltraKill; pentaKill = cOMDT_HERO_STATISTIC_INFO.dwRampage; } } else if (mainTab == MainTab.Match100) { byte b = 0; byte b2 = 0; CPlayerPvpInfoController.GetGameTypeAcntNum(subTab, out b, out b2); int num = 0; while ((long)num < (long)((ulong)profile.pvpExtraDetail.dwRecentNum)) { if (b == 0 || (profile.pvpExtraDetail.astRecentDetail[num].bGameType == b && profile.pvpExtraDetail.astRecentDetail[num].bMapAcntNum == b2)) { winMvp += profile.pvpExtraDetail.astRecentDetail[num].dwMvp; loseMvp += profile.pvpExtraDetail.astRecentDetail[num].dwLoseSoul; godLike += profile.pvpExtraDetail.astRecentDetail[num].dwGodLike; tripleKill += profile.pvpExtraDetail.astRecentDetail[num].dwTripleKill; quataryKill += profile.pvpExtraDetail.astRecentDetail[num].dwUltraKill; pentaKill += profile.pvpExtraDetail.astRecentDetail[num].dwRampage; } num++; } } }