public static void Send_Del_Friend(COMDT_FRIEND_INFO info, FriendShower.ItemType type)
 {
     if (type != FriendShower.ItemType.Mentor && type != FriendShower.ItemType.Apprentice)
     {
         CSPkg cSPkg = NetworkModule.CreateDefaultCSPKG(1208u);
         cSPkg.stPkgData.stFriendDelReq.stUin.ullUid         = info.stUin.ullUid;
         cSPkg.stPkgData.stFriendDelReq.stUin.dwLogicWorldId = info.stUin.dwLogicWorldId;
         Singleton <NetworkModule> .GetInstance().SendLobbyMsg(ref cSPkg, true);
     }
     else
     {
         CSPkg cSPkg2 = NetworkModule.CreateDefaultCSPKG(5406u);
         cSPkg2.stPkgData.stRemoveMasterReq.stTargetUin.ullUid         = info.stUin.ullUid;
         cSPkg2.stPkgData.stRemoveMasterReq.stTargetUin.dwLogicWorldId = info.stUin.dwLogicWorldId;
         cSPkg2.stPkgData.stRemoveMasterReq.bType = (byte)CFriendContoller.GetSrvMentorTypeByItemType(type);
         if (type != FriendShower.ItemType.Mentor)
         {
             if (type == FriendShower.ItemType.Apprentice)
             {
                 cSPkg2.stPkgData.stRemoveMasterReq.bSubStudentType = (info.bStudentType & 15);
             }
         }
         else
         {
             cSPkg2.stPkgData.stRemoveMasterReq.bSubStudentType = CFriendContoller.m_mentorInfo.bStudentType;
         }
         Singleton <NetworkModule> .GetInstance().SendLobbyMsg(ref cSPkg2, true);
     }
 }
Exemple #2
0
        public void ShowMentorSearchInfo(COMDT_FRIEND_INFO info, CFriendModel.FriendType friendType, FriendShower.ItemType type)
        {
            enMentorState mentorState = CFriendContoller.GetMentorState(0u, null);
            bool          bActive     = UT.NeedShowGenderGradeByMentor(type, friendType) && (mentorState == enMentorState.IWantMentor || mentorState == enMentorState.IHasMentor);

            if (this.m_mentorTitleObj != null)
            {
                this.m_mentorTitleObj.transform.parent.gameObject.CustomSetActive(true);
                this.m_mentorTitleObj.gameObject.CustomSetActive(bActive);
                string text = string.Empty;
                try
                {
                    text = GameDataMgr.famousMentorDatabin.GetDataByKey(info.dwMasterLvl).szTitle;
                }
                catch (Exception var_3_84)
                {
                }
                this.m_mentorTitleObj.GetComponent <Text>().text = text;
            }
            if (this.m_mentorFamousObj != null)
            {
                this.m_mentorFamousObj.gameObject.CustomSetActive(bActive);
                this.m_mentorFamousObj.text = Singleton <CTextManager> .GetInstance().GetText("Mentor_LvNApprenticeCountInfo", new string[]
                {
                    info.dwMasterLvl.ToString(),
                    info.dwStudentNum.ToString()
                });
            }
            if (this.m_RankIconObj != null)
            {
                int num = CLadderSystem.ConvertEloToRank(info.RankVal[7]);
                CLadderView.ShowRankDetail(this.m_RankIconObj.transform.parent.gameObject, (byte)num, Singleton <RankingSystem> .GetInstance().GetRankClass(info.stUin.ullUid), 1u, false, true, false, false, true);
            }
            if (UT.NeedShowGenderGradeByMentor(type, friendType))
            {
                this.ShowGenderType(info.bGender);
            }
        }
        public void MentorBtnUIUpdate()
        {
            this.mentorStateStr = null;
            this.mentorBtnStr   = null;
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            CPlayerProfile profile = Singleton <CPlayerInfoSystem> .instance.GetProfile();

            if (!profile.isMasterData)
            {
                int           bLogicGrade  = (int)CLadderSystem.GetGradeDataByShowGrade((int)masterRoleInfo.m_rankHistoryHighestGrade).bLogicGrade;
                int           bLogicGrade2 = (int)CLadderSystem.GetGradeDataByShowGrade((int)profile.GetHistoryHighestRankGrade()).bLogicGrade;
                enMentorState mentorState  = CFriendContoller.GetMentorState((int)profile.GetHistoryHighestRankGrade(), null);
                enMentorState mentorState2 = CFriendContoller.GetMentorState(bLogicGrade, null);
                if ((mentorState == enMentorState.IHasApprentice || mentorState == enMentorState.IWantApprentice) && bLogicGrade2 > bLogicGrade)
                {
                    this.mentorStateStr = Singleton <CTextManager> .GetInstance().GetText("Mentor_GetMentor");

                    this.mentorBtnStr = Singleton <CTextManager> .GetInstance().GetText("Mentor_ProposeMentor");

                    this.m_addViewtype = 2;
                    if (masterRoleInfo.m_mentorInfo != null && masterRoleInfo.m_mentorInfo.ullMasterUid != 0uL)
                    {
                        this.mentorStateStr = null;
                    }
                }
                else if ((mentorState2 == enMentorState.IHasApprentice || mentorState2 == enMentorState.IWantApprentice) && bLogicGrade2 < bLogicGrade)
                {
                    this.mentorBtnStr = Singleton <CTextManager> .GetInstance().GetText("Mentor_ProposeApprentice");

                    this.mentorStateStr = Singleton <CTextManager> .GetInstance().GetText("Mentor_GetApprentice");

                    this.m_addViewtype = 3;
                }
            }
        }
        public void UpdateUI()
        {
            CUIFormScript form = Singleton <CUIManager> .instance.GetForm(CPlayerInfoSystem.sPlayerInfoFormPath);

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

            if (profile == null)
            {
                return;
            }
            this.m_famousMentorData = null;
            GameObject widget   = form.GetWidget(21);
            GameObject widget2  = form.GetWidget(18);
            GameObject widget3  = form.GetWidget(19);
            GameObject widget4  = form.GetWidget(20);
            GameObject widget5  = form.GetWidget(22);
            GameObject widget6  = form.GetWidget(23);
            GameObject widget7  = form.GetWidget(24);
            GameObject widget8  = form.GetWidget(25);
            GameObject widget9  = form.GetWidget(26);
            GameObject widget10 = form.GetWidget(27);
            GameObject widget11 = form.GetWidget(28);
            GameObject widget12 = form.GetWidget(29);
            GameObject widget13 = form.GetWidget(30);

            widget12.CustomSetActive(true);
            widget13.CustomSetActive(false);
            string text = Singleton <CTextManager> .GetInstance().GetText("Common_NoData");

            widget7.CustomSetActive(profile._mentorInfo.ullMasterUid == 0uL);
            widget5.CustomSetActive(profile._mentorInfo.ullMasterUid != 0uL);
            if (profile._mentorInfo.dwStudentNum != 0u)
            {
                widget3.GetComponent <Text>().set_text(profile._mentorInfo.dwStudentNum.ToString());
            }
            else
            {
                widget3.GetComponent <Text>().set_text(text);
            }
            if (profile._mentorInfo.dwFinishStudentNum != 0u)
            {
                widget4.GetComponent <Text>().set_text(profile._mentorInfo.dwFinishStudentNum.ToString());
            }
            else
            {
                widget4.GetComponent <Text>().set_text(text);
            }
            string text2 = Utility.UTF8Convert(profile._mentorInfo.szRoleName);

            if (string.IsNullOrEmpty(text2))
            {
                text2 = text;
            }
            enMentorState mentorState = CFriendContoller.GetMentorState((int)profile.GetHistoryHighestRankGrade(), null);

            if (mentorState == enMentorState.IWantMentor || mentorState == enMentorState.IHasMentor || profile._mentorInfo.dwMasterPoint == 0u)
            {
                this.SetTempNoData(form, text2);
            }
            else
            {
                widget10.CustomSetActive(true);
                widget8.CustomSetActive(true);
                widget9.CustomSetActive(true);
                GameDataMgr.famousMentorDatabin.Accept(new Action <ResFamousMentor>(this.FamousMentorInVisitor));
                if (this.m_famousMentorData == null)
                {
                    this.SetTempNoData(form, text2);
                    return;
                }
                widget11.CustomSetActive(true);
                widget8.GetComponent <Text>().set_text(this.m_famousMentorData.szTitle);
                string prefabPath = string.Format("{0}{1}.prefab", CUIUtility.s_Sprite_System_ShareUI_Dir, this.m_famousMentorData.iLevel.ToString());
                CUIUtility.SetImageSprite(widget11.GetComponent <Image>(), prefabPath, null, true, false, false, false);
                widget2.GetComponent <Text>().set_text(Singleton <CTextManager> .GetInstance().GetText("Mentor_PlayerInfo", new string[]
                {
                    this.m_famousMentorData.iLevel.ToString(),
                    this.m_famousMentorData.szTitle,
                    profile._mentorInfo.dwMasterPoint.ToString(),
                    text2
                }));
                ResFamousMentor dataByKey = GameDataMgr.famousMentorDatabin.GetDataByKey(this.m_famousMentorData.dwID + 1u);
                if (dataByKey == null)
                {
                    widget9.GetComponent <Text>().set_text(profile._mentorInfo.dwMasterPoint + string.Empty);
                }
                else
                {
                    widget9.GetComponent <Text>().set_text(profile._mentorInfo.dwMasterPoint + "/" + dataByKey.dwPoint);
                }
                uint num = 0u;
                if (this.m_famousMentorData.dwID != 1u)
                {
                    ResFamousMentor dataByKey2 = GameDataMgr.famousMentorDatabin.GetDataByKey(this.m_famousMentorData.dwID - 1u);
                    if (dataByKey2 != null)
                    {
                        num = dataByKey2.dwPoint;
                    }
                }
                if (this.m_famousMentorData.dwPoint == num)
                {
                    widget10.GetComponent <Image>().set_fillAmount(0f);
                }
                else
                {
                    widget10.GetComponent <Image>().set_fillAmount((profile._mentorInfo.dwMasterPoint - num) / (this.m_famousMentorData.dwPoint - num));
                }
            }
            this.MentorBtnUIUpdate();
            widget6.CustomSetActive(this.mentorBtnStr != null);
            if (this.mentorBtnStr != null)
            {
                widget6.transform.Find("Text").GetComponent <Text>().set_text(this.mentorBtnStr);
            }
        }
        public void UpdateUI()
        {
            CUIFormScript form = Singleton <CUIManager> .get_instance().GetForm(CPlayerInfoSystem.sPlayerInfoFormPath);

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

            if (profile == null)
            {
                return;
            }
            this.m_famousMentorData = null;
            GameObject widget   = form.GetWidget(21);
            GameObject widget2  = form.GetWidget(18);
            GameObject widget3  = form.GetWidget(19);
            GameObject widget4  = form.GetWidget(20);
            GameObject widget5  = form.GetWidget(22);
            GameObject widget6  = form.GetWidget(23);
            GameObject widget7  = form.GetWidget(24);
            GameObject widget8  = form.GetWidget(25);
            GameObject widget9  = form.GetWidget(26);
            GameObject widget10 = form.GetWidget(27);
            GameObject widget11 = form.GetWidget(28);
            GameObject widget12 = form.GetWidget(29);
            GameObject widget13 = form.GetWidget(30);

            widget12.CustomSetActive(true);
            widget13.CustomSetActive(false);
            string text = Singleton <CTextManager> .GetInstance().GetText("Common_NoData");

            widget6.CustomSetActive(!profile.isMasterData);
            widget7.CustomSetActive(profile._mentorInfo.ullMasterUid == 0uL);
            widget5.CustomSetActive(profile._mentorInfo.ullMasterUid != 0uL);
            enMentorState mentorState = CFriendContoller.GetMentorState(profile.PvpLevel(), null);

            if (!profile.isMasterData)
            {
                switch (mentorState)
                {
                case enMentorState.IWantMentor:
                case enMentorState.IHasMentor:
                    widget6.transform.Find("Text").GetComponent <Text>().text = Singleton <CTextManager> .GetInstance().GetText("Mentor_ProposeApprentice");

                    break;

                case enMentorState.IWantApprentice:
                case enMentorState.IHasApprentice:
                    widget6.transform.Find("Text").GetComponent <Text>().text = Singleton <CTextManager> .GetInstance().GetText("Mentor_ProposeMentor");

                    break;

                default:
                    widget6.CustomSetActive(false);
                    break;
                }
            }
            if (profile._mentorInfo.dwStudentNum != 0u)
            {
                widget3.GetComponent <Text>().text = profile._mentorInfo.dwStudentNum.ToString();
            }
            else
            {
                widget3.GetComponent <Text>().text = text;
            }
            if (profile._mentorInfo.dwFinishStudentNum != 0u)
            {
                widget4.GetComponent <Text>().text = profile._mentorInfo.dwFinishStudentNum.ToString();
            }
            else
            {
                widget4.GetComponent <Text>().text = text;
            }
            string text2 = Utility.UTF8Convert(profile._mentorInfo.szRoleName);

            if (string.IsNullOrEmpty(text2))
            {
                text2 = text;
            }
            if (mentorState == enMentorState.IWantMentor || mentorState == enMentorState.IHasMentor || profile._mentorInfo.dwMasterPoint == 0u)
            {
                this.SetTempNoData(form, text2);
            }
            else
            {
                widget10.CustomSetActive(true);
                widget8.CustomSetActive(true);
                widget9.CustomSetActive(true);
                GameDataMgr.famousMentorDatabin.Accept(new Action <ResFamousMentor>(this.FamousMentorInVisitor));
                if (this.m_famousMentorData == null)
                {
                    this.SetTempNoData(form, text2);
                    return;
                }
                widget11.CustomSetActive(true);
                widget8.GetComponent <Text>().text = this.m_famousMentorData.szTitle;
                string prefabPath = string.Format("{0}{1}.prefab", CUIUtility.s_Sprite_System_ShareUI_Dir, this.m_famousMentorData.iLevel.ToString());
                CUIUtility.SetImageSprite(widget11.GetComponent <Image>(), prefabPath, null, true, false, false, false);
                widget2.GetComponent <Text>().text = Singleton <CTextManager> .GetInstance().GetText("Mentor_PlayerInfo", new string[]
                {
                    this.m_famousMentorData.iLevel.ToString(),
                    this.m_famousMentorData.szTitle,
                    profile._mentorInfo.dwMasterPoint.ToString(),
                    text2
                });

                ResFamousMentor dataByKey = GameDataMgr.famousMentorDatabin.GetDataByKey(this.m_famousMentorData.dwID + 1u);
                if (dataByKey == null)
                {
                    widget9.GetComponent <Text>().text = profile._mentorInfo.dwMasterPoint + string.Empty;
                }
                else
                {
                    widget9.GetComponent <Text>().text = profile._mentorInfo.dwMasterPoint + "/" + dataByKey.dwPoint;
                }
                uint num = 0u;
                if (this.m_famousMentorData.dwID != 1u)
                {
                    ResFamousMentor dataByKey2 = GameDataMgr.famousMentorDatabin.GetDataByKey(this.m_famousMentorData.dwID - 1u);
                    if (dataByKey2 != null)
                    {
                        num = dataByKey2.dwPoint;
                    }
                }
                if (this.m_famousMentorData.dwPoint == num)
                {
                    widget10.GetComponent <Image>().fillAmount = 0f;
                }
                else
                {
                    widget10.GetComponent <Image>().fillAmount = (profile._mentorInfo.dwMasterPoint - num) / (this.m_famousMentorData.dwPoint - num);
                }
            }
            this.mentorStateStr = null;
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            enMentorState mentorState2 = CFriendContoller.GetMentorState(profile.PvpLevel(), null);
            enMentorState mentorState3 = CFriendContoller.GetMentorState(masterRoleInfo.PvpLevel, null);

            if ((mentorState2 == enMentorState.IHasApprentice || mentorState2 == enMentorState.IWantApprentice) && (mentorState3 == enMentorState.IHasMentor || mentorState3 == enMentorState.IWantMentor))
            {
                this.mentorStateStr = Singleton <CTextManager> .GetInstance().GetText("Mentor_GetMentor");

                this.m_addViewtype = 2;
                if (masterRoleInfo.m_mentorInfo != null && masterRoleInfo.m_mentorInfo.ullMasterUid != 0uL)
                {
                    this.mentorStateStr = null;
                }
            }
            else if ((mentorState3 == enMentorState.IHasApprentice || mentorState3 == enMentorState.IWantApprentice) && (mentorState2 == enMentorState.IHasMentor || mentorState2 == enMentorState.IWantMentor))
            {
                this.mentorStateStr = Singleton <CTextManager> .GetInstance().GetText("Mentor_GetApprentice");

                this.m_addViewtype = 3;
            }
            widget6.CustomSetActive(this.mentorStateStr != null);
        }