Ejemplo n.º 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);
 }
        public static void Send_Request_BeFriend(ulong ullUid, uint dwLogicWorldId, string veriyText = "", COM_ADD_FRIEND_TYPE addFriendType = COM_ADD_FRIEND_TYPE.COM_ADD_FRIEND_NULL, int useHeroId = -1)
        {
            if (Singleton <CFriendContoller> .GetInstance().model.IsContain(CFriendModel.FriendType.GameFriend, ullUid, dwLogicWorldId))
            {
                Singleton <CUIManager> .GetInstance().OpenTips(UT.GetText("Friend_Tips_AlreadyBeFriend"), false, 1.5f, null, new object[0]);

                return;
            }
            CSPkg cSPkg = NetworkModule.CreateDefaultCSPKG(1206u);

            cSPkg.stPkgData.stFriendAddReq.stUin.ullUid         = ullUid;
            cSPkg.stPkgData.stFriendAddReq.stUin.dwLogicWorldId = dwLogicWorldId;
            if (!string.IsNullOrEmpty(veriyText))
            {
                StringHelper.StringToUTF8Bytes(veriyText, ref cSPkg.stPkgData.stFriendAddReq.szVerificationInfo);
            }
            cSPkg.stPkgData.stFriendAddReq.stUserSource.bAddFriendType                 = (byte)addFriendType;
            cSPkg.stPkgData.stFriendAddReq.stUserSource.stAddFriendInfo.stPvp          = new COMDT_ADDFRIEND_PVP();
            cSPkg.stPkgData.stFriendAddReq.stUserSource.stAddFriendInfo.stPvp.dwHeroID = (uint)useHeroId;
            Singleton <NetworkModule> .GetInstance().SendLobbyMsg(ref cSPkg, true);
        }