//向服务器发起添加好友请求
        public void ReqAddFriend(UInt64 guid)
        {
            //判断guid合法性
            if (guid == GlobeVar.INVALID_GUID)
            {
                return;
            }

            //超过上限,不进行添加操作
            if (GameManager.gameManager.PlayerDataPool.FriendList.GetRelationNum() >= GlobeVar.MAX_FRIEND_NUM)
            {
                //您当前的好友列表已满。
                SendNoticMsg(false, "#{1080}");
                return;
            }

            //是否已经是好友,已经是则不添加
            if (GameManager.gameManager.PlayerDataPool.FriendList.RelationDataList.ContainsKey(guid))
            {
                SendNoticMsg(false, "#{2394}");
                return;
            }

            //自己不能加自己
            if (GUID == guid)
            {
                return;
            }

            /*if (GameManager.gameManager.PlayerDataPool.BlackList.IsExist(guid))
             * {
             *  SendNoticMsg(false, "#{4723}");
             *  return;
             * }  */

            //向服务器发送添加好友包
            CG_ADDFRIEND msg = (CG_ADDFRIEND)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ADDFRIEND);

            msg.Guid = guid;
            msg.SendPacket();

            SendNoticMsg(false, "#{2906}");
        }
Beispiel #2
0
    //////////////////////////////////////////////////////////////////////////
    //PopMenu下的一些通用方法,只要在弹出PopMenu的时候记录了弹出目标的Guid与Name即可
    //////////////////////////////////////////////////////////////////////////
    //加好友
    void PopMenuAddFriend()
    {
        //如果非玩家,则不显示
        if (GlobeVar.INVALID_GUID == m_PopMenuSelectGuid)
        {
            return;
        }

        if (null == Singleton <ObjManager> .GetInstance().MainPlayer)
        {
            return;
        }

        //如果目标是自己也不发送加好友
        if (Singleton <ObjManager> .GetInstance().MainPlayer.GUID == m_PopMenuSelectGuid)
        {
            return;
        }

        if (GameManager.gameManager.PlayerDataPool.FriendList.IsExist(m_PopMenuSelectGuid))
        {
            Singleton <ObjManager> .Instance.MainPlayer.SendNoticMsg(false, "#{2394}");

            return;
        }

        /* if (GameManager.gameManager.PlayerDataPool.BlackList.IsExist(m_PopMenuSelectGuid))
         * {
         *   Singleton<ObjManager>.Instance.MainPlayer.SendNoticMsg(false, "#{4723}");
         *   return;
         * }
         *
         */

        CG_ADDFRIEND msg = (CG_ADDFRIEND)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ADDFRIEND);

        msg.Guid = m_PopMenuSelectGuid;
        msg.SendPacket();

        Singleton <ObjManager> .Instance.MainPlayer.SendNoticMsg(false, "#{2906}");
    }
Beispiel #3
0
    //点击 加为好友
    void OnClickFriend()
    {
        //如果非玩家,则不显示
        if (m_CurSelectMemberGuid == GlobeVar.INVALID_GUID || m_CurSelectMemberGuid == 0)
        {
            return;
        }

        Games.LogicObj.Obj_MainPlayer mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

        if (null == mainPlayer)
        {
            return;
        }
        //如果目标是自己也不发送加好友
        if (m_CurSelectMemberGuid == mainPlayer.GUID)
        {
            return;
        }

        if (GameManager.gameManager.PlayerDataPool.FriendList.IsExist(m_CurSelectMemberGuid))
        {
            mainPlayer.SendNoticMsg(false, "#{2394}");
            return;
        }

        /* if (GameManager.gameManager.PlayerDataPool.BlackList.IsExist(m_CurSelectMemberGuid))
         * {
         *   mainPlayer.SendNoticMsg(false, "#{4723}");
         *   return;
         * }  */

        CG_ADDFRIEND msg = (CG_ADDFRIEND)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ADDFRIEND);

        msg.Guid = m_CurSelectMemberGuid;
        msg.SendPacket();

        mainPlayer.SendNoticMsg(false, "#{2906}");
    }