userachievementmanager - TogetherGames/Public-Corona-Lua GitHub Wiki

UserAchievementManager

together.UserAchievementManager

Overview

The UserAchievementManager is used for fetching and finding achievements that exist for the current user.


Members

table UserAchievements

Stores all the UserAchievements contained in the Manager.


Methods


Add()

Adds a UserAchievement to the internally managed list without persistence.

Note
This method is deprecated

Returns void
Syntax
UserAchievementManager:Add( userAchievement )
Parameters

TogetherUserAchievement userAchievement

Instance of a UserAchievement to add internally

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

FindByUserAchievementID()

Finds the UserAchievement with the specified UserAchievementID if it exists, otherwise returns nil.

Syntax
UserAchievementManager:FindByUserAchievementID( userAchievementID )
Parameters

number userAchievementID

The ID of the UserAchievement to find

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

FindByAchievementID()

Finds the UserAchievement with the specified AchievementID if it exists, otherwise returns nil.

Syntax
UserAchievementManager:FindByAchievementID( achievementID )
Parameters

number achievementID

The ID of the Achievement to find

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

GetCount()

Gets the number of UserAchievements currently managed internally.

Returns number
Syntax
UserAchievementManager:GetCount(  )

Get()

Gets the UserAchievement at the specified index if it exists, otherwise returns nil.

Syntax
UserAchievementManager:Get( index )
Parameters

number index

The index of the UserAchievement to find

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

IndexOf()

Returns the index of the specified UserAchievement if it exists, otherwise returns nil.

Returns number
Syntax
UserAchievementManager:IndexOf( userAchievement )
Parameters

TogetherUserAchievement userAchievement

Instance of the UserAchievement to find the index of

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

IndexOfByUserAchievementID()

Returns the index of the UserAchievement with the specified UserAchievementID if it exists, otherwise returns -1.

Returns number
Syntax
UserAchievementManager:IndexOfByUserAchievementID( userAchievementID )
Parameters

number userAchievementID

The ID of the UserAchievement to find the index of

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

Remove()

Removes a UserAchievement from the internally managed list. This does not delete the user achievement from the session's account persistently.

Note
This method is deprecated

Returns void
Syntax
UserAchievementManager:Remove( index )
Parameters

number index

The index of the UserAchievement to be removed.

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

Award()

Awards a UserAchievement. Upon success, this will automatically update the internal list.

Returns void
Syntax
UserAchievementManager:Award( achievementID, actionName, roomID, userAchievementProperties, notificationMessage, callbackFunc )
Parameters

number achievementID

The ID of the Achievement to award.

[string](#) actionName

The Action of the Achievements to award.

[number](#) roomID

The ID of the Room the UserAchievement is being awarded in.

[PropertyCollection](./propertycollection) userAchievementProperties

The properties to assign to the UserAchievement. Pass in nil to assign no properties.

[string](#) notificationMessage

The notification message to send to the User. Pass in "" if no notification should be sent.

[function](#) callbackFunc

The function to call upon completion.

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

Delete()

Deletes a UserAchievement. Upon success, this will automatically update the internal list.

Returns void
Syntax
UserAchievementManager:Delete( userAchievementID, callbackFunc )
Parameters

number userAchievementID

The ID of the UserAchievement to delete.

[function](#) callbackFunc

The function to call upon completion.

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

GetAll()

Gets all UserAchievements assigned to the User. Upon success, this will automatically update the internal list.

Returns void
Syntax
UserAchievementManager:GetAll( callbackFunc )
Parameters

function callbackFunc

The function to call upon completion.

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

Purchase()

Purchases a UserAchievement. Upon success, this will automatically update the internal list.

Note
This method is deprecated

Returns void
Syntax
UserAchievementManager:Purchase( achievementID, roomID, userAchievementProperties, useGameUserProfileProperties, callbackFunc )
Parameters

number achievementID

The ID of the Achievement to purchase.

[number](#) roomID

The ID of the Room the UserAchievement is being purchased in.

[PropertyCollection](./propertycollection) userAchievementProperties

The properties to assign to the UserAchievement. Pass in nil to assign no properties.

[boolean](#) useGameUserProfileProperties

This has not effect, pass false.

[function](#) callbackFunc

The function to call upon completion.

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

Sell()

Sells a UserAchievement. Upon success, this will automatically update the internal list.

Note
This method is deprecated

Returns void
Syntax
UserAchievementManager:Sell( userAchievementID, callbackFunc )
Parameters

number userAchievementID

The ID of the Achievement to sell.

[function](#) callbackFunc

The function to call upon completion.

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