NetworkingPeer.OpFindFriends C# (CSharp) Method

OpFindFriends() public method

Request the rooms and online status for a list of friends. All client must set a unique username via PlayerName property. The result is available in this.Friends.
Used on Master Server to find the rooms played by a selected list of users. The result will be mapped to LoadBalancingClient.Friends when available. The list is initialized by OpFindFriends on first use (before that, it is null). Users identify themselves by setting a PlayerName in the LoadBalancingClient instance. This in turn will send the name in OpAuthenticate after each connect (to master and game servers). Note: Changing a player's name doesn't make sense when using a friend list. The list of usernames must be fetched from some other source (not provided by Photon). Internal: The server response includes 2 arrays of info (each index matching a friend from the request): ParameterCode.FindFriendsResponseOnlineList = bool[] of online states ParameterCode.FindFriendsResponseRoomIdList = string[] of room names (empty string if not in a room)
public OpFindFriends ( string friendsToFind ) : bool
friendsToFind string Array of friend's names (make sure they are unique).
return bool
    public override bool OpFindFriends(string[] friendsToFind)
    {
        if (this.isFetchingFriends)
        {
            return false;   // fetching friends currently, so don't do it again (avoid changing the list while fetching friends)
        }

        this.friendListRequested = friendsToFind;
        this.isFetchingFriends = true;

        return base.OpFindFriends(friendsToFind);
    }

Usage Example

Exemplo n.º 1
0
 public static bool FindFriends(string[] friendsToFind)
 {
     if (networkingPeer == null || isOfflineMode)
     {
         return(false);
     }
     return(networkingPeer.OpFindFriends(friendsToFind));
 }
All Usage Examples Of NetworkingPeer::OpFindFriends
NetworkingPeer