Exemple #1
0
        private void On_InviteGuild(CUIEvent evt)
        {
            CPlayerProfile profile = Singleton <CPlayerInfoSystem> .instance.GetProfile();

            if (profile == null)
            {
                return;
            }
            bool flag = CPlayerInfoSystem.isSelf(profile.m_uuid);

            if (flag)
            {
                return;
            }
            Singleton <EventRouter> .GetInstance().BroadCastEvent <ulong, int>("Guild_Invite", profile.m_uuid, profile.m_iLogicWorldId);
        }
Exemple #2
0
        private void OnHideShowCardConfirm(CUIEvent evt)
        {
            CPlayerProfile profile = Singleton <CPlayerInfoSystem> .instance.GetProfile();

            if (profile == null)
            {
                return;
            }
            if (!CPlayerInfoSystem.isSelf(profile.m_uuid))
            {
                return;
            }
            bool bOpen = !profile.IsPrivacyOpen(COM_USER_PRIVACY_MASK.COM_USER_PRIVACY_MASK_FRIEND_CARD);

            profile.SetPrivacyBit(bOpen, COM_USER_PRIVACY_MASK.COM_USER_PRIVACY_MASK_FRIEND_CARD);
            Singleton <CSettingsSys> .GetInstance().reqOperateUserPrivacyBit(bOpen, COM_USER_PRIVACY_MASK.COM_USER_PRIVACY_MASK_FRIEND_CARD);

            this.SetHideCardButton();
        }
        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")
            });
        }
        public void UpdateUI()
        {
            CUIFormScript form = Singleton <CUIManager> .instance.GetForm(CPlayerInfoSystem.sPlayerInfoFormPath);

            if (form == null)
            {
                return;
            }
            GameObject    widget           = form.GetWidget(2);
            CUIListScript componetInChild  = Utility.GetComponetInChild <CUIListScript>(widget, "panelTop/MenuList");
            CUIListScript componetInChild2 = Utility.GetComponetInChild <CUIListScript>(widget, "panelTop/DropList/List");
            GameObject    gameObject       = Utility.FindChild(widget, "panelTop");
            GameObject    gameObject2      = Utility.FindChild(widget, "panelLeft");
            GameObject    gameObject3      = Utility.FindChild(widget, "panelLeftGraph");
            GameObject    p              = Utility.FindChild(widget, "panelRight");
            int           selectedIndex  = componetInChild.GetSelectedIndex();
            int           selectedIndex2 = componetInChild2.GetSelectedIndex();

            if (selectedIndex < 0 || selectedIndex2 < 0 || selectedIndex >= Enum.GetValues(typeof(MainTab)).get_Length() || selectedIndex2 >= Enum.GetValues(typeof(SubTab)).get_Length())
            {
                return;
            }
            CPlayerPvpInfoController.CacheSubTab = selectedIndex2;
            this.InitBaseValue();
            MainTab mainTab = (MainTab)selectedIndex;
            SubTab  subTab  = (SubTab)selectedIndex2;

            Utility.GetComponetInChild <Text>(widget, "panelTop/DropList/Button_Down/Text").set_text(CPlayerPvpInfoController.sSubTitles[(int)subTab]);
            float          num     = 0f;
            float          num2    = 0f;
            int            num3    = 0;
            int            num4    = 0;
            int            num5    = 0;
            int            num6    = 0;
            float          num7    = 0f;
            uint           num8    = 0u;
            uint           num9    = 0u;
            uint           num10   = 0u;
            uint           num11   = 0u;
            uint           num12   = 0u;
            uint           num13   = 0u;
            int            num14   = 0;
            float          num15   = 0f;
            CPlayerProfile profile = Singleton <CPlayerInfoSystem> .instance.GetProfile();

            CPlayerPvpInfoController.ConvertAverageData(profile, mainTab, subTab, out num, out num2, out num3, out num4, out num5, out num6, out num7);
            CPlayerPvpInfoController.ConvertBaseData(profile, mainTab, subTab, out num8, out num9, out num10, out num11, out num12, out num13);
            CPlayerPvpInfoController.ConvertComplexData(profile, mainTab, subTab, out num14, out num15);
            CPlayerPvpInfoController.ConvertAbilityData(profile, mainTab, subTab, this.m_ability);
            for (int i = 0; i < this.m_ability.Length; i++)
            {
                this.m_ability[i] = Mathf.Clamp(this.m_ability[i], 0f, 1f);
            }
            if (subTab == SubTab.MatchAll || subTab == SubTab.Match5V5 || subTab == SubTab.MatchRank || subTab == SubTab.MatchGuild)
            {
                Utility.GetComponetInChild <Text>(gameObject2, "Content/txt1").set_text(num.ToString("F1"));
                Utility.GetComponetInChild <Text>(gameObject2, "Content/txt2").set_text(num2.ToString("P0"));
                Utility.GetComponetInChild <Text>(gameObject2, "Content/txt3").set_text(num3.ToString());
                Utility.GetComponetInChild <Text>(gameObject2, "Content/txt4").set_text(num4.ToString());
                Utility.GetComponetInChild <Text>(gameObject2, "Content/txt5").set_text(num5.ToString());
                Utility.GetComponetInChild <Text>(gameObject2, "Content/txt6").set_text(num6.ToString());
                Utility.GetComponetInChild <Text>(p, "DateBar3/txt9").set_text((this.m_ability[6] * 100f).ToString("F1"));
            }
            else
            {
                Utility.GetComponetInChild <Text>(gameObject2, "Content/txt1").set_text("-");
                Utility.GetComponetInChild <Text>(gameObject2, "Content/txt2").set_text("-");
                Utility.GetComponetInChild <Text>(gameObject2, "Content/txt3").set_text("-");
                Utility.GetComponetInChild <Text>(gameObject2, "Content/txt4").set_text("-");
                Utility.GetComponetInChild <Text>(gameObject2, "Content/txt5").set_text("-");
                Utility.GetComponetInChild <Text>(gameObject2, "Content/txt6").set_text("-");
                Utility.GetComponetInChild <Text>(p, "DateBar3/txt9").set_text("-");
            }
            if (subTab != SubTab.Match1V1)
            {
                Utility.GetComponetInChild <Text>(p, "txt1").set_text(num8.ToString());
                Utility.GetComponetInChild <Text>(p, "txt2").set_text(num9.ToString());
                Utility.GetComponetInChild <Text>(p, "txt3").set_text(num10.ToString());
                Utility.GetComponetInChild <Text>(p, "txt4").set_text(num11.ToString());
                Utility.GetComponetInChild <Text>(p, "txt5").set_text(num12.ToString());
                Utility.GetComponetInChild <Text>(p, "txt6").set_text(num13.ToString());
            }
            else
            {
                Utility.GetComponetInChild <Text>(p, "txt1").set_text("-");
                Utility.GetComponetInChild <Text>(p, "txt2").set_text("-");
                Utility.GetComponetInChild <Text>(p, "txt3").set_text("-");
                Utility.GetComponetInChild <Text>(p, "txt4").set_text("-");
                Utility.GetComponetInChild <Text>(p, "txt5").set_text("-");
                Utility.GetComponetInChild <Text>(p, "txt6").set_text("-");
            }
            Utility.GetComponetInChild <Text>(p, "DateBar1/txt7").set_text(num14.ToString());
            Utility.GetComponetInChild <Text>(p, "DateBar2/txt8").set_text((num15 == 1f) ? num15.ToString("P0") : num15.ToString("P1"));
            Utility.GetComponetInChild <Image>(p, "DateBar2/Bar").set_fillAmount(num15);
            Utility.GetComponetInChild <Image>(p, "DateBar3/Bar").set_fillAmount(CPlayerProfile.Divide(this.m_ability[6], 1f));
            this.InitTemVector();
            Vector3 a = Vector3.zero;

            Vector3[] array = new Vector3[6];
            for (int j = 1; j <= 6; j++)
            {
                GameObject gameObject4 = Utility.FindChild(widget, string.Format("panelLeftGraph/Content/p{0}", j));
                a            = CPlayerPvpInfoController.sTemVector[j] - CPlayerPvpInfoController.sTemVector[0];
                array[j - 1] = CPlayerPvpInfoController.sTemVector[0] + a * this.m_ability[j - 1];
                gameObject4.transform.localPosition = array[j - 1];
            }
            CUIPolygon componetInChild3 = Utility.GetComponetInChild <CUIPolygon>(gameObject3, "Content/Polygon");

            componetInChild3.vertexs = array;
            componetInChild3.SetAllDirty();
            GameObject gameObject5 = Utility.FindChild(widget, "btnGraph");
            GameObject gameObject6 = Utility.FindChild(widget, "btnDetail");
            GameObject obj         = Utility.FindChild(widget, "btnShare");

            gameObject2.CustomSetActive(gameObject5.activeSelf);
            gameObject3.CustomSetActive(gameObject6.activeSelf);
            obj.CustomSetActive(CPlayerInfoSystem.isSelf(Singleton <CPlayerInfoSystem> .instance.GetProfile().m_uuid));
            componetInChild2.gameObject.CustomSetActive(false);
            if (CSysDynamicBlock.bLobbyEntryBlocked)
            {
                CUICommonSystem.SetObjActive(form.transform.FindChild("pnlBg/pnlBody/pnlPvpInfo/btnShare"), false);
            }
        }
Exemple #5
0
        public void UpdateUI()
        {
            CUIFormScript form = Singleton <CUIManager> .instance.GetForm(CPlayerInfoSystem.sPlayerInfoFormPath);

            if (form == null)
            {
                return;
            }
            GameObject widget = form.GetWidget(32);

            if (widget == null)
            {
                return;
            }
            CPlayerProfile profile = Singleton <CPlayerInfoSystem> .instance.GetProfile();

            if (profile == null)
            {
                return;
            }
            this.CheckLoadAddressBook();
            this.SetFriendCardByWidgets(ref profile._socialCardInfo, true);
            bool      flag       = CPlayerInfoSystem.isSelf(profile.m_uuid);
            Transform transform  = widget.transform.Find("pnlContainer/Social_BtnGroupTop");
            Transform transform2 = widget.transform.Find("pnlContainer/Social_BtnGroupTopWatch");
            Transform transform3 = widget.transform.Find("pnlContainer/Social_BtnGroupBottom");
            Transform transform4 = widget.transform.Find("pnlContainer/Social_Sign");

            if (!flag)
            {
                this.m_isInEditmode = false;
                Singleton <CPlayerMentorInfoController> .GetInstance().MentorBtnUIUpdate();
            }
            for (int i = 0; i < this.m_searchTypeNodes.Length; i++)
            {
                if (this.m_searchTypeNodes[i] != null)
                {
                    this.m_searchTypeNodes[i].gameObject.CustomSetActive(this.m_isInEditmode);
                }
            }
            string[]   array      = null;
            GameObject gameObject = this.m_displyTypeNodes[0].gameObject;

            if (!this.m_isInEditmode)
            {
                string srvAddr = StringHelper.UTF8BytesToString(ref profile._socialCardInfo.szPlace);
                array = this.GetLocations(srvAddr);
                gameObject.GetComponent <Text>().set_color(this.m_colorHighlight);
                gameObject.transform.parent.Find("Title").GetComponent <Text>().set_color(this.m_colorHighlight);
            }
            else
            {
                gameObject.GetComponent <Text>().set_color(this.m_colorNormal);
                gameObject.transform.parent.Find("Title").GetComponent <Text>().set_color(this.m_colorNormal);
            }
            try
            {
                GameObject gameObject2 = this.m_displyTypeNodes[3].transform.parent.Find("img1").gameObject;
                GameObject gameObject3 = this.m_displyTypeNodes[3].transform.parent.Find("img2").gameObject;
                gameObject2.CustomSetActive(!this.m_isInEditmode);
                gameObject3.CustomSetActive(!this.m_isInEditmode);
                for (int j = 0; j < this.m_searchTypeNodes.Length; j++)
                {
                    if (this.m_displyTypeNodes[j] != null)
                    {
                        this.m_displyTypeNodes[j].gameObject.CustomSetActive(!this.m_isInEditmode);
                        Text component = this.m_displyTypeNodes[j].GetComponent <Text>();
                        if (!this.m_isInEditmode)
                        {
                            switch (j)
                            {
                            case 0:
                                component.set_text(this.GetSearchStr(j, (int)profile._socialCardInfo.dwSearchType));
                                break;

                            case 1:
                                component.set_text(this.GetSearchStr(j, (int)profile._socialCardInfo.dwDay));
                                break;

                            case 2:
                                component.set_text(this.GetSearchStr(j, (int)profile._socialCardInfo.dwHour));
                                break;

                            case 3:
                                try
                                {
                                    string searchStr = this.GetSearchStr(j, (int)profile._socialCardInfo.wHeroTypeOne);
                                    int    num       = Convert.ToInt32(searchStr);
                                    gameObject2.CustomSetActive(num != 0);
                                    if (num == 0)
                                    {
                                        component.set_text("-");
                                    }
                                    else
                                    {
                                        component.set_text(CHeroInfo.GetHeroJobStr((RES_HERO_JOB)num));
                                        CUICommonSystem.SetHeroJob(form, gameObject2, (enHeroJobType)num);
                                    }
                                    this.m_searchTypeNodes[j].transform.FindChild("List").GetComponent <CUIListScript>().SelectElement(this.GetIndexByString(j, searchStr), true);
                                }
                                catch (Exception var_18_38C)
                                {
                                    Debug.LogError("social 配置表JOB错误,找jason");
                                }
                                break;

                            case 4:
                                try
                                {
                                    string searchStr2 = this.GetSearchStr(j, (int)profile._socialCardInfo.wHeroTypeTwo);
                                    int    num2       = Convert.ToInt32(searchStr2);
                                    gameObject3.CustomSetActive(num2 != 0);
                                    if (num2 == 0)
                                    {
                                        component.set_text("-");
                                    }
                                    else
                                    {
                                        component.set_text(CHeroInfo.GetHeroJobStr((RES_HERO_JOB)num2));
                                        CUICommonSystem.SetHeroJob(form, gameObject3, (enHeroJobType)num2);
                                    }
                                    this.m_searchTypeNodes[j].transform.FindChild("List").GetComponent <CUIListScript>().SelectElement(this.GetIndexByString(j, searchStr2), true);
                                }
                                catch (Exception var_21_431)
                                {
                                    Debug.LogError("social 配置表JOB错误,找jason");
                                }
                                break;

                            case 5:
                                if (array != null && array.Length > 0)
                                {
                                    component.set_text(array[0]);
                                }
                                else
                                {
                                    component.set_text("-");
                                }
                                break;

                            case 6:
                                if (array != null && array.Length > 1)
                                {
                                    component.set_text(array[1]);
                                }
                                else
                                {
                                    component.set_text("-");
                                }
                                break;
                            }
                            if (flag && j != 3 && j != 4 && this.m_searchStrings[j] != null)
                            {
                                this.m_searchTypeNodes[j].transform.FindChild("List").GetComponent <CUIListScript>().SelectElement(this.GetIndexByString(j, component.get_text()), true);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.LogError("social card setting error:" + ex);
            }
            if (transform != null)
            {
                transform.gameObject.CustomSetActive(flag && !this.m_isInEditmode);
                if (flag)
                {
                    this.SetHideCardButton();
                }
            }
            if (transform3 != null)
            {
                transform3.gameObject.CustomSetActive(flag && this.m_isInEditmode);
            }
            if (transform2 != null)
            {
                transform2.gameObject.CustomSetActive(!flag);
                if (!flag)
                {
                    GameObject gameObject4 = transform2.transform.FindChild("AddFriendBtn").gameObject;
                    bool       flag2       = Singleton <CFriendContoller> .GetInstance().model.IsContain(CFriendModel.FriendType.GameFriend, profile.m_uuid, (uint)profile.m_iLogicWorldId);

                    gameObject4.CustomSetActive(!flag2);
                    GameObject gameObject5 = transform2.transform.FindChild("AddGuildBtn").gameObject;
                    bool       bActive     = Singleton <CGuildSystem> .GetInstance().IsInNormalGuild() && !CGuildHelper.IsInSameGuild((ulong)((long)profile.m_iLogicWorldId));

                    gameObject5.CustomSetActive(bActive);
                    GameObject gameObject6 = transform2.transform.FindChild("AddMentorBtn").gameObject;
                    Singleton <CPlayerMentorInfoController> .GetInstance().MentorBtnUIUpdate();

                    gameObject6.CustomSetActive(Singleton <CPlayerMentorInfoController> .GetInstance().mentorBtnStr != null);
                    if (Singleton <CPlayerMentorInfoController> .GetInstance().mentorBtnStr != null)
                    {
                        gameObject6.transform.Find("Text").GetComponent <Text>().set_text(Singleton <CPlayerMentorInfoController> .GetInstance().mentorBtnStr);
                    }
                }
            }
            if (transform4 != null)
            {
                GameObject gameObject7   = transform4.FindChild("InputCtrl").gameObject;
                InputField signInputText = this.GetSignInputText();
                gameObject7.CustomSetActive(true);
                gameObject7.GetComponent <InputField>().set_interactable(this.m_isInEditmode);
            }
            if (!this.m_isInEditmode)
            {
                string     text           = StringHelper.UTF8BytesToString(ref profile._socialCardInfo.szDatingDeclaration);
                InputField signInputText2 = this.GetSignInputText();
                if (signInputText2)
                {
                    signInputText2.set_text(text);
                }
            }
            this.UpdateTags();
        }