usermessagemanager - TogetherGames/Public-Unity-CSharp GitHub Wiki

UserMessageManager

together.UserMessageManager

Overview

The UserMessageManager class is used to find and fetch messages directly sent to the current session's User account. With this class, a developer will be able to create a message, delete a message, get all messages, and mark a message as read. A Developer can use UserMessages as in-game email.


Members

List<UserMessage> UserMessages

Stores all the UserMessages contained in the Manager.


Methods


Add()

Adds a UserMessage to the internally managed list without persistence.

Note
This method is deprecated

Returns void
Syntax
UserMessageManager.Add( userMessage )
Parameters

UserMessage userMessage

Instance of a UserMessage to add internally

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

FindByUserMessageID()

Finds the UserMessage with the specified UserMessageID if it exists, otherwise returns null.

Returns UserMessage
Syntax
UserMessageManager.FindByUserMessageID( userMessageID )
Parameters

long userMessageID

The ID of the UserMessage to find

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

GetCount()

Gets the number of UserMessages currently managed internally.

Returns int
Syntax
UserMessageManager.GetCount(  )

Get()

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

Returns UserMessage
Syntax
UserMessageManager.Get( index )
Parameters

int index

The index of the UserMessage to find

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

IndexOf()

Returns the index of the specified UserMessage if it exists, otherwise returns -1.

Returns int
Syntax
UserMessageManager.IndexOf( userMessage )
Parameters

UserMessage userMessage

Instance of the UserMessage to find the index of

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

IndexOfByUserMessageID()

Returns the index of the UserMessage with the specified UserMessageID if it exists, otherwise returns -1.

Returns int
Syntax
UserMessageManager.IndexOfByUserMessageID( userMessageID )
Parameters

long userMessageID

The ID of the UserMessage to find the index of

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

Remove()

Removes a UserMessage from the internally managed list. This does not delete the message from the user's mailbox persistently.

Note
This method is deprecated

Returns void
Syntax
UserMessageManager.Remove( index )
Parameters

int index

The index of the UserMessage to remove internally

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

GetAll()

Gets all UserMessages assigned to the User. Upon success, this will automatically update the internal mailbox.

Returns void
Syntax
UserMessageManager.GetAll( unreadOnly, startID, count, callbackFunc )
Parameters

bool unreadOnly

A Boolean indicating whether only unread messages should be retrieved.

[long](#) startID

The ID of the UserMessage to start with when returning UserMessages.

[int](#) count

The max number of UserMessages to return.

[OnCompleteHandler](./oncompletehandler) callbackFunc

The function to call upon completion.

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

CreateMessage()

Sends a message to a specific User. Upon success, this will automatically update the internal mailbox.

Returns void
Syntax
UserMessageManager.CreateMessage( destinationUserID, title, message, isGameIndependent, messageProperties, callbackFunc )
Parameters

long destinationUserID

The ID of the User to send the UserMessage to.

[string](#) title

The title of the UserMessage.

[string](#) message

The message of the UserMessage.

[bool](#) isGameIndependent

A boolean indicating whether the generated UserMessage is assigned to the Game being played.

[PropertyCollection](./propertycollection) messageProperties

The properties to assign to the UserMessage. Pass in null to assign no properties.

[OnCompleteHandler](./oncompletehandler) callbackFunc

The function to call upon completion.

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

MarkMessageAsRead()

Marks a UserMessage as read. Upon success, this will automatically update the internal mailbox.

Returns void
Syntax
UserMessageManager.MarkMessageAsRead( userMessageID, callbackFunc )
Parameters

long userMessageID

The ID of the UserMessage to mark as read.

[OnCompleteHandler](./oncompletehandler) callbackFunc

The function to call upon completion.

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

DeleteMessage()

Deletes a UserMessage. Upon success, this will automatically update the internal mailbox.

Returns void
Syntax
UserMessageManager.DeleteMessage( userMessageID, callbackFunc )
Parameters

long userMessageID

The ID of the UserMessage to delete.

[OnCompleteHandler](./oncompletehandler) callbackFunc

The function to call upon completion.

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