//收到添加好友协议 private void OnMsgAddFriend(Request request) { MsgAddFriend msgAddFriend = MsgAddFriend.Parser.ParseFrom(request.Msg); //是添加人显示结果 if (msgAddFriend.Id == GameMain.id) { if (msgAddFriend.Result == 0) { PanelManager.Open <TipPanel>("已发送添加请求"); } if (msgAddFriend.Result == 1) { PanelManager.Open <TipPanel>("玩家不存在"); } if (msgAddFriend.Result == 2) { PanelManager.Open <TipPanel>("玩家不在线"); } if (msgAddFriend.Result == 3) { PanelManager.Open <TipPanel>("此玩家已经是您的好友"); } } }
//添加好友按钮事件 private void OnAddFriendClick() { MsgAddFriend msgAddFriend = new MsgAddFriend(); msgAddFriend.Id = GameMain.id; msgAddFriend.FriendId = _idInput.transform.Find("Text").GetComponent <Text>().text; NetManager.Send(msgAddFriend); }
//收到添加好友协议 private void OnMsgAddFriend(Request request) { MsgAddFriend msgAddFriend = MsgAddFriend.Parser.ParseFrom(request.Msg); //是被添加人显示是否同意添加 if (msgAddFriend.FriendId == id) { PanelManager.Open <FriendApplyPanel>("是否同意" + msgAddFriend.Id + "的好友申请?"); FriendApplyPanel friendApplyPanel = (FriendApplyPanel)PanelManager.panels["FriendApplyPanel"]; friendApplyPanel.id = msgAddFriend.FriendId; friendApplyPanel.friendId = msgAddFriend.Id; } }