private void ProcessSubscribeToFriendsResponse(SubscribeToFriendsResponse response) { if (response.HasMaxFriends) { this.m_maxFriends = response.MaxFriends; } if (response.HasMaxReceivedInvitations) { this.m_maxReceivedInvitations = response.MaxReceivedInvitations; } if (response.HasMaxSentInvitations) { this.m_maxSentInvitations = response.MaxSentInvitations; } for (int i = 0; i < response.FriendsCount; i++) { Friend item = response.Friends[i]; BnetEntityId bnetEntityId = new BnetEntityId(); bnetEntityId.SetLo(item.Id.Low); bnetEntityId.SetHi(item.Id.High); this.AddFriendInternal(bnetEntityId); } for (int j = 0; j < response.ReceivedInvitationsCount; j++) { this.AddInvitationInternal(FriendsUpdate.Action.FRIEND_INVITE, response.ReceivedInvitations[j], 0); } for (int k = 0; k < response.SentInvitationsCount; k++) { this.AddInvitationInternal(FriendsUpdate.Action.FRIEND_SENT_INVITE, response.SentInvitations[k], 0); } }
private void ProcessSubscribeToFriendsResponse(SubscribeToFriendsResponse response) { if (response.HasMaxFriends) { this.m_maxFriends = response.MaxFriends; } if (response.HasMaxReceivedInvitations) { this.m_maxReceivedInvitations = response.MaxReceivedInvitations; } if (response.HasMaxSentInvitations) { this.m_maxSentInvitations = response.MaxSentInvitations; } for (int i = 0; i < response.FriendsCount; i++) { Friend friend = response.Friends.get_Item(i); BnetEntityId bnetEntityId = new BnetEntityId(); bnetEntityId.SetLo(friend.Id.Low); bnetEntityId.SetHi(friend.Id.High); this.AddFriendInternal(bnetEntityId); } for (int j = 0; j < response.ReceivedInvitationsCount; j++) { Invitation invitation = response.ReceivedInvitations.get_Item(j); this.AddInvitationInternal(FriendsUpdate.Action.FRIEND_INVITE, invitation, 0); } for (int k = 0; k < response.SentInvitationsCount; k++) { Invitation invitation2 = response.SentInvitations.get_Item(k); this.AddInvitationInternal(FriendsUpdate.Action.FRIEND_SENT_INVITE, invitation2, 0); } }
public override void SubscribeToFriends(Google.ProtocolBuffers.IRpcController controller, SubscribeToFriendsRequest request, Action <SubscribeToFriendsResponse> done) { var response = SubscribeToFriendsResponse.CreateBuilder(); response.SetMaxFriends(127).SetMaxReceivedInvitations(127).SetMaxSentInvitations(127); done(response.Build()); }
public override void SubscribeToFriends(IRpcController controller, SubscribeToFriendsRequest request, Action <SubscribeToFriendsResponse> done) { Logger.Trace("SubscribeToFriends()"); var builder = SubscribeToFriendsResponse.CreateBuilder() .SetMaxFriends(127) .SetMaxReceivedInvitations(127) .SetMaxSentInvitations(127); done(builder.Build()); }
private void SubscribeToFriendsCallback(RPCContext context) { if (this.m_state != FriendsAPI.FriendsAPIState.INITIALIZING) { return; } if (context.Header.Status != 0) { this.m_state = FriendsAPI.FriendsAPIState.FAILED_TO_INITIALIZE; base.ApiLog.LogWarning("Battle.net Friends API C#: Failed to initialize."); } else { this.m_state = FriendsAPI.FriendsAPIState.INITIALIZED; base.ApiLog.LogDebug("Battle.net Friends API C#: Initialized."); this.ProcessSubscribeToFriendsResponse(SubscribeToFriendsResponse.ParseFrom(context.Payload)); } }