friendusermanager - TogetherGames/Public-Unity-CSharp GitHub Wiki

FriendUserManager

together.FriendUserManager

Overview

The FriendUserManager class contains a collection of Friends.


Members

List<FriendUser> Friends

Stores all the Friends contained in the Manager.

Dictionary<long, FriendUser> FriendsDictionaryByUserID

A table used to store all together friends in a dictionary form by their UserID.

Dictionary<string, FriendUser> FriendsDictionaryBySocialID

A table used to store all together friends in a dictionary form by their SocialID.


Methods


Add()

Adds a FriendUser to the manager internally without persistence.

Note
This method is deprecated

Returns void
Syntax
FriendUserManager.Add( friend )
Parameters

FriendUser friend

Instance of the FriendUser to add

--------------------------------------------------------------------------------

FindByUserID()

Finds a FriendUser by UserID if it exists, otherwise returns null.

Returns FriendUser
Syntax
FriendUserManager.FindByUserID( userID )
Parameters

long userID

The ID of the User to find

--------------------------------------------------------------------------------

FindBySocialID()

Finds the FriendUser by SocialID if it exists, otherwise returns null.

Returns FriendUser
Syntax
FriendUserManager.FindBySocialID( socialID )
Parameters

long socialID

The SocialID of the User to find

--------------------------------------------------------------------------------

GetCount()

Gets the number of FriendUsers currently managed internally.

Returns int
Syntax
FriendUserManager.GetCount(  )

Get()

Gets the FriendUser at the specified index if it exists, otherwise returns null.

Returns FriendUser
Syntax
FriendUserManager.Get( index )
Parameters

int index

The index of the Friend to find

--------------------------------------------------------------------------------

IndexOf()

Gets the Index of the specified Friend if it exists, otherwise returns -1.

Returns int
Syntax
FriendUserManager.IndexOf( friend )
Parameters

FriendUser friend

Instance of the Friend to get the index of

--------------------------------------------------------------------------------

IndexOfByUserID()

Returns the index of the FriendUser with the specified UserID if it exists, otherwise returns -1.

Returns int
Syntax
FriendUserManager.IndexOfByUserID( userID )
Parameters

long userID

The ID of the User to get the index of

--------------------------------------------------------------------------------

IndexOfBySocialID()

Returns the index of the FriendUser with the specified SocialID if it exists, otherwise returns -1.

Returns int
Syntax
FriendUserManager.IndexOfBySocialID( socialID )
Parameters

string socialID

The social ID of the User to get the index of

--------------------------------------------------------------------------------

Remove()

Removes a FriendUser from the internally managed list. This does not delete the Friend from the user's list persistently.

Note
This method is deprecated

Returns void
Syntax
FriendUserManager.Remove(  )
Parameters

int

AddFriend()

Adds a new friend to the current session's User account. Upon success, this will automatically update the internal list.

Returns void
Syntax
FriendUserManager.AddFriend( friendUserID, callbackFunc )
Parameters

long friendUserID

The ID of the User to add as a friend.

[OnCompleteHandler](./oncompletehandler) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

GetAll()

Gets all Friends from the current session's User account. Upon success, this will automatically update the internal list.

Returns void
Syntax
FriendUserManager.GetAll( callbackFunc )
Parameters

OnCompleteHandler callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

RemoveFriend()

Removes a Friend from the current session's User account. Upon succes, this will automatically update the internal list.

Returns void
Syntax
FriendUserManager.RemoveFriend( friendUserID, callbackFunc )
Parameters

long friendUserID

The ID of a User to remove as a friend

[OnCompleteHandler](./oncompletehandler) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

SyncFriends()

Synchronizes the Friend list. This method is called whenever you initially log into Facebook. For each Facebook friend, if they are also a registered Together User, they become a Together friend on the User account. Upon success, this will automatically update the internal list.

Returns void
Syntax
FriendUserManager.SyncFriends( syncType, externalFriends, callbackFunc )
Parameters

string syncType

The type of synchronization to be done. Pass "FB" for Facebook. This parameter exists for future expandability to other social networks.

[ExternalFriend](./externalfriend)[] externalFriends

The array full of external (Facebook) friends.

[OnCompleteHandler](./oncompletehandler) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------
⚠️ **GitHub.com Fallback** ⚠️