示例#1
0
    /// <summary>
    /// 邀请好友进入匹配桌子
    /// </summary>
    public void InviteFriendToGame()
    {
        if (nowFriendUid == 0)
        {
            return;
        }
        if (!PlayerInfo.canInviteFriend)
        {
            UIManager.instance.SetTileInfo("该比赛不可好友同玩");
            return;
        }
        if (nowWaitStatus == WaitStatus.matching)
        {
            UIManager.instance.SetTileInfo("正在匹配中,不可邀请");
            return;
        }
        if (PlayerInfo.waitPlayers.ContainsKey(nowFriendUid))
        {
            UIManager.instance.SetTileInfo("该好友已在桌子中");
            return;
        }
        var friendData = PlayerInfo.friends[nowFriendUid];

        if (friendData.sid == "")
        {
            UIManager.instance.SetTileInfo("该好友不在线");
            return;
        }
        Proto.Uidsid msg = new Proto.Uidsid();
        msg.uid = nowFriendUid;
        msg.sid = friendData.sid;
        SocketClient.SendMsg(Route.match_main_inviteFriend, msg);
        UIManager.instance.SetTileInfo("邀请成功");
    }
示例#2
0
 public void Btn_Yes()
 {
     Proto.Uidsid msg = new Proto.Uidsid();
     msg.uid = friendUid;
     SocketClient.SendMsg(Route.info_friend_agreeFriend, msg);
     Btn_Close();
 }
示例#3
0
 /// <summary>
 /// 添加排行榜中的人为好友
 /// </summary>
 /// <param name="uid"></param>
 public void WantAddFriend(int uid)
 {
     Proto.Uidsid msg = new Proto.Uidsid();
     msg.uid = uid;
     SocketClient.SendMsg(Route.info_friend_askFriend, msg);
     UIManager.instance.SetTileInfo("好友请求已发送");
 }
示例#4
0
    public void Btn_AddFriend()
    {
        int  friendUid = 0;
        bool ok        = int.TryParse(friendNameInput.text.Trim(), out friendUid);

        if (!ok)
        {
            return;
        }
        if (friendUid == PlayerInfo.uid)
        {
            UIManager.instance.SetSomeInfo("不可添加自己为好友");
            return;
        }
        if (PlayerInfo.friends.ContainsKey(friendUid))
        {
            UIManager.instance.SetSomeInfo("该玩家已经是您的好友了");
            return;
        }

        Proto.Uidsid msg = new Proto.Uidsid();
        msg.uid = friendUid;
        SocketClient.SendMsg(Route.info_friend_askFriend, msg);
        friendNameInput.text = "";
        UIManager.instance.SetTileInfo("好友申请已发送");
    }
示例#5
0
 void SVR_onDelFriend(string _msg)
 {
     Proto.Uidsid msg = JsonUtility.FromJson <Proto.Uidsid>(_msg);
     PlayerInfo.friends.Remove(msg.uid);
     if (commonCb.ContainsKey(CommonHandlerCb.onDelFriend))
     {
         commonCb[CommonHandlerCb.onDelFriend]?.Invoke(msg);
     }
 }
示例#6
0
 /// <summary>
 /// 删除好友
 /// </summary>
 public void Btn_Del()
 {
     if (!PlayerInfo.friends.ContainsKey(nowUid))
     {
         return;
     }
     Proto.Uidsid msg = new Proto.Uidsid();
     msg.uid = nowUid;
     SocketClient.SendMsg(Route.info_friend_delFriend, msg);
 }
示例#7
0
 public void KickPlayer(int uid)
 {
     if (nowWaitStatus == WaitStatus.matching)
     {
         UIManager.instance.SetTileInfo("匹配中,不可踢人");
         return;
     }
     Proto.Uidsid msg = new Proto.Uidsid();
     msg.uid = uid;
     SocketClient.SendMsg(Route.match_main_kickPlayer, msg);
 }
示例#8
0
    /// <summary>
    /// 添加等待桌子中的玩家为好友
    /// </summary>
    public void Btn_AddFriend(int uid)
    {
        if (uid == 0 || uid == PlayerInfo.uid || PlayerInfo.friends.ContainsKey(uid))
        {
            return;
        }
        var otherData = PlayerInfo.waitPlayers[uid];

        Proto.Uidsid msg = new Proto.Uidsid();
        msg.uid = uid;
        SocketClient.SendMsg(Route.info_friend_askFriend, msg);
        UIManager.instance.SetTileInfo("好友请求已发送");
    }