RuyiNetFriendService Class |
[This is preliminary documentation and is subject to change.]
Namespace: Ruyi.SDK.Online
public class RuyiNetFriendService : RuyiNetService
The RuyiNetFriendService type exposes the following members.
Name | Description | |
---|---|---|
AddFriend |
Adds a user to the player's friend list.
| |
GetProfile |
Get the profile of the specified user.
| |
GetProfiles |
Get the profile of the specified users.
| |
ListFriends |
Returns a list of the user's friends.
| |
RemoveFriend |
Removes a user from the player's friend list.
|
using (var ruyi = RuyiSDK.CreateInstance(new RuyiSDKContext { endpoint = RuyiSDKContext.Endpoint.Console })) { void printFriends(RuyiNetFriendSummaryData[] friends) { if (friends == null) { Console.WriteLine("ListFriends() failed"); return; } foreach (var friend in friends) { Console.WriteLine(friend.Name); } } ruyi.RuyiNetService.Initialise(APP_ID, APP_SECRET, () => { // Get friends BEFORE adding a friend ruyi.RuyiNetService.FriendService.ListFriends(0, (RuyiNetFriendSummaryData[] friendsBefore) => { Console.WriteLine("Friends BEFORE:"); printFriends(friendsBefore); // Add a friend ruyi.RuyiNetService.FriendService.AddFriend(0, FRIEND_PROFILE_ID, (RuyiNetResponse response) => { // Get friends AFTER adding a friend ruyi.RuyiNetService.FriendService.ListFriends(0, (RuyiNetFriendSummaryData[] friendsAfter) => { Console.WriteLine("Friends After:"); printFriends(friendsAfter); } ); }); }); }); while (ruyi.RuyiNetService.IsWorking) { ruyi.Update(); } }