Beispiel #1
0
 public static string GetFriendSourceDesc(ulong friendUid, COMDT_FRIEND_SOURCE friendSource)
 {
     if (friendSource != null)
     {
         COM_ADD_FRIEND_TYPE bAddFriendType = friendSource.bAddFriendType;
         if (bAddFriendType == 1)
         {
             string heroName = CHeroInfo.GetHeroName(friendSource.stAddFriendInfo.get_stPvp().dwHeroID);
             if (!string.IsNullOrEmpty(heroName))
             {
                 return(Singleton <CTextManager> .GetInstance().GetText("Friend_Apply_Play_With_You_Tip", new string[]
                 {
                     heroName
                 }));
             }
             DebugHelper.Assert(false, "好友来源是PVP,但却获取不了英雄名,heroId={0}", new object[]
             {
                 friendSource.stAddFriendInfo.get_stPvp().dwHeroID
             });
         }
         else
         {
             if (CGuildHelper.IsInSameGuild(friendUid))
             {
                 return(Singleton <CTextManager> .GetInstance().GetText("Friend_Apply_Same_Guild_Tip"));
             }
             if (bAddFriendType == 2)
             {
                 return(Singleton <CTextManager> .GetInstance().GetText("Friend_Apply_Nearby_You_Tip"));
             }
         }
     }
     return(string.Empty);
 }
Beispiel #2
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();
        }