Ejemplo n.º 1
0
        private int CommonHeroSortUsedHurt(COMDT_MOST_USED_HERO_INFO left, COMDT_MOST_USED_HERO_INFO right)
        {
            float num  = (left.stStatisticDetail.dwNum > 0u) ? (CPlayerProfile.Divide(left.stStatisticDetail.astTypeDetail[0].dwHurtPM, left.stStatisticDetail.astTypeDetail[0].dwWinNum + left.stStatisticDetail.astTypeDetail[0].dwLoseNum) * 100f) : 0f;
            float num2 = (right.stStatisticDetail.dwNum > 0u) ? (CPlayerProfile.Divide(right.stStatisticDetail.astTypeDetail[0].dwHurtPM, right.stStatisticDetail.astTypeDetail[0].dwWinNum + right.stStatisticDetail.astTypeDetail[0].dwLoseNum) * 100f) : 0f;

            return(((this.m_lastIsUp == 1) ? -1 : 1) * ((int)num2 - (int)num));
        }
        private int CommonHeroSortUsedBeHurt(COMDT_MOST_USED_HERO_INFO left, COMDT_MOST_USED_HERO_INFO right)
        {
            float num  = (left.stStatisticDetail.dwNum <= 0u) ? 0f : (CPlayerProfile.Divide(left.stStatisticDetail.astTypeDetail[0].ullTotalBeHurt, left.stStatisticDetail.astTypeDetail[0].dwWinNum + left.stStatisticDetail.astTypeDetail[0].dwLoseNum) * 100f);
            float num2 = (right.stStatisticDetail.dwNum <= 0u) ? 0f : (CPlayerProfile.Divide(right.stStatisticDetail.astTypeDetail[0].ullTotalBeHurt, right.stStatisticDetail.astTypeDetail[0].dwWinNum + right.stStatisticDetail.astTypeDetail[0].dwLoseNum) * 100f);

            return(((this.m_lastIsUp != 1) ? 1 : -1) * ((int)num2 - (int)num));
        }
        private int CommonHeroSortOrder(COMDT_MOST_USED_HERO_INFO left, COMDT_MOST_USED_HERO_INFO right)
        {
            ResHeroCfgInfo dataByKey  = GameDataMgr.heroDatabin.GetDataByKey(left.dwHeroID);
            ResHeroCfgInfo dataByKey2 = GameDataMgr.heroDatabin.GetDataByKey(right.dwHeroID);

            if (dataByKey == null || dataByKey2 == null)
            {
                return(0);
            }
            return((int)(((this.m_lastIsUp != 1) ? 1u : 4294967295u) * (dataByKey2.dwShowSortId - dataByKey.dwShowSortId)));
        }
 private int CommonHeroSortWins(COMDT_MOST_USED_HERO_INFO left, COMDT_MOST_USED_HERO_INFO right)
 {
     return((int)(((this.m_lastIsUp != 1) ? 1u : 4294967295u) * (1000u * right.dwGameWinNum / (right.dwGameWinNum + right.dwGameLoseNum) - 1000u * left.dwGameWinNum / (left.dwGameWinNum + left.dwGameLoseNum))));
 }
 private int CommonHeroSortUsedCnt(COMDT_MOST_USED_HERO_INFO left, COMDT_MOST_USED_HERO_INFO right)
 {
     return((int)(((this.m_lastIsUp != 1) ? 1u : 4294967295u) * (right.dwGameWinNum + right.dwGameLoseNum - left.dwGameWinNum - left.dwGameLoseNum)));
 }
        public void OnCommonHeroListEnable(CUIEvent uiEvent)
        {
            CUIFormScript form = Singleton <CUIManager> .get_instance().GetForm(CPlayerCommonHeroInfoController.sPlayerInfoCommonHeroFormPath);

            if (form == null)
            {
                return;
            }
            int        srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;
            GameObject srcWidget = uiEvent.m_srcWidget;

            if (srcWidgetIndexInBelongedList >= 0 && srcWidgetIndexInBelongedList < this.m_commonHeroList.get_Count())
            {
                Text componetInChild  = Utility.GetComponetInChild <Text>(srcWidget, "NameTxt");
                Text componetInChild2 = Utility.GetComponetInChild <Text>(srcWidget, "UsedCntTxt");
                Text componetInChild3 = Utility.GetComponetInChild <Text>(srcWidget, "WinsTxt");
                Text componetInChild4 = Utility.GetComponetInChild <Text>(srcWidget, "KdaTxt");
                Text componetInChild5 = Utility.GetComponetInChild <Text>(srcWidget, "GoldTxt");
                Text componetInChild6 = Utility.GetComponetInChild <Text>(srcWidget, "HurtTxt");
                Text componetInChild7 = Utility.GetComponetInChild <Text>(srcWidget, "BeHurtTxt");
                COMDT_MOST_USED_HERO_INFO cOMDT_MOST_USED_HERO_INFO = this.m_commonHeroList.get_Item(srcWidgetIndexInBelongedList);
                ResHeroCfgInfo            dataByKey = GameDataMgr.heroDatabin.GetDataByKey(cOMDT_MOST_USED_HERO_INFO.dwHeroID);
                string prefabPath = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, CSkinInfo.GetHeroSkinPic(this.m_commonHeroList.get_Item(srcWidgetIndexInBelongedList).dwHeroID, 0u));
                Utility.GetComponetInChild <Image>(srcWidget, "HeadImg").SetSprite(prefabPath, form, true, false, false, false);
                Utility.GetComponetInChild <Text>(srcWidget, "NameTxt").text    = ((dataByKey != null) ? dataByKey.szName : string.Empty);
                Utility.GetComponetInChild <Text>(srcWidget, "UsedCntTxt").text = (cOMDT_MOST_USED_HERO_INFO.dwGameWinNum + cOMDT_MOST_USED_HERO_INFO.dwGameLoseNum).ToString();
                Utility.GetComponetInChild <Text>(srcWidget, "WinsTxt").text    = CPlayerProfile.Divide(cOMDT_MOST_USED_HERO_INFO.dwGameWinNum, cOMDT_MOST_USED_HERO_INFO.dwGameWinNum + cOMDT_MOST_USED_HERO_INFO.dwGameLoseNum).ToString("P0");
                if (cOMDT_MOST_USED_HERO_INFO.stStatisticDetail.dwNum > 0u)
                {
                    GameObject    widget           = form.GetWidget(0);
                    CUIListScript componetInChild8 = Utility.GetComponetInChild <CUIListScript>(widget, "SubMenuList/List");
                    int           selectedIndex    = componetInChild8.GetSelectedIndex();
                    byte          gameType         = CPlayerCommonHeroInfoController.GetGameType(selectedIndex);
                    uint          num  = 0u;
                    uint          num2 = 0u;
                    uint          num3 = 0u;
                    uint          num4 = 0u;
                    uint          num5 = 0u;
                    uint          num6 = 0u;
                    uint          num7 = 0u;
                    ulong         num8 = 0uL;
                    int           num9 = 0;
                    while ((long)num9 < (long)((ulong)cOMDT_MOST_USED_HERO_INFO.stStatisticDetail.dwNum))
                    {
                        if (gameType == 0 || cOMDT_MOST_USED_HERO_INFO.stStatisticDetail.astTypeDetail[num9].bGameType == gameType)
                        {
                            num  += cOMDT_MOST_USED_HERO_INFO.stStatisticDetail.astTypeDetail[num9].dwWinNum;
                            num2 += cOMDT_MOST_USED_HERO_INFO.stStatisticDetail.astTypeDetail[num9].dwLoseNum;
                            num3 += cOMDT_MOST_USED_HERO_INFO.stStatisticDetail.astTypeDetail[num9].dwKill;
                            num4 += cOMDT_MOST_USED_HERO_INFO.stStatisticDetail.astTypeDetail[num9].dwDead;
                            num5 += cOMDT_MOST_USED_HERO_INFO.stStatisticDetail.astTypeDetail[num9].dwAssist;
                            num6 += cOMDT_MOST_USED_HERO_INFO.stStatisticDetail.astTypeDetail[num9].dwGPM;
                            num7 += cOMDT_MOST_USED_HERO_INFO.stStatisticDetail.astTypeDetail[num9].dwHurtPM;
                            num8 += cOMDT_MOST_USED_HERO_INFO.stStatisticDetail.astTypeDetail[num9].ullTotalBeHurt;
                        }
                        num9++;
                    }
                    uint b = num + num2;
                    componetInChild4.text = string.Format("{0}/{1}/{2}", CPlayerProfile.Divide(num3, b).ToString("F1"), CPlayerProfile.Divide(num4, b).ToString("F1"), CPlayerProfile.Divide(num5, b).ToString("F1"));
                    componetInChild5.text = CPlayerProfile.Divide(num6, b).ToString("F0");
                    componetInChild6.text = CPlayerProfile.Divide(num7, b).ToString("F0");
                    componetInChild7.text = CPlayerProfile.Divide(num8, b).ToString("F0");
                }
                else
                {
                    componetInChild4.text = "0.0/0.0/0.0";
                    componetInChild5.text = "0";
                    componetInChild6.text = "0";
                    componetInChild7.text = "0";
                }
            }
        }
        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")
            });
        }