API methods related to the friends and so on of one gamer.
You may also want to subscribe to related events (see CotcSdk.GamerCommunity.OnFriendStatusChange).
◆ OnFriendStatusChange
Event triggered when someone adds this gamer as a friend or changes his friendship status.
◆ AddFriend()
Easy way to add a friend knowing his gamer ID inside the CotC community.
- Returns
- Promise resolved when the operation has completed.
- Parameters
-
gamerId | ID of the gamer to add as a friend (fetched using ListFriends for instance). |
notification | Optional OS notification to be sent to indicate the player that the status has changed. |
◆ ChangeRelationshipStatus()
Allows to change the relation of a friendship inside the application.
- Returns
- Promise resolved when the operation has completed.
- Parameters
-
gamerId | ID of the gamer to change the relationship (fetched using ListFriends for instance). |
state | The new state to set. |
notification | Optional OS notification to be sent to indicate the player that the status has changed. |
◆ DiscardEventHandlers()
void CotcSdk.GamerCommunity.DiscardEventHandlers |
( |
| ) |
|
Clears all event handlers subscribed, ensuring that a match object can be dismissed without causing further actions in the background.
◆ Domain()
Changes the domain affected by the next operations. You should typically use it this way: gamer.Community.Domain("private").ListFriends(...);
- Parameters
-
domain | Domain on which to scope the next operations. |
- Returns
- This object for operation chaining.
◆ ListFriends()
Method used to retrieve the application's friends of the currently logged in profile.
- Returns
- Promise resolved when the operation has completed, with the fetched list of friends.
- Parameters
-
filterBlacklisted | When set to true, restricts to blacklisted friends. |
◆ ListNetworkFriends()
When you have data about friends from another social network, you can post them to CotC servers using these function. This will automatically add them as a friend on CotC as they get recognized on our servers. The friends get associated to the domain of this object. Note: this function was once called PostSocialNetworkFriends but renamed due to it being misleading.
- Returns
- Promise resolved when the operation has completed. The attached value is the same list as passed, enriched with potential information about the gamer (member CotcSdk.SocialNetworkFriend.ClanInfo) for gamers who are already registered on CotC servers.
- Parameters
-
network | The network with which these friends are associated. |
friends | A list of data about the friends fetched on the social network. |
automatching | If true, synchronizes the CotC friends with the list. That is, the provided social network friends become your friends on CotC as well (reported on ListFriends and such). |
◆ SendEvent()
Use this method to send a message to another user from your game.
Messages are sent to a specific user, in a specific domain. You can use domains to send messages across games (or use private for messages sent to your game only).
- Returns
- Promise resolved when the operation has completed.
- Parameters
-
gamerId | ID of the recipient gamer. |
eventData | JSON object representing the event to be sent. The recipient will receive it as is when subscribed to a CotcSdk.DomainEventLoop (ReceivedEvent property). If the application is not active, the message will be queued and transmitted the next time the domain event loop is started. |
notification | Push notification to send to the recipient player if not currently active. |