Artenus 2D Framework
Artenus Reference
Interface for classes that provide game services, such as achievements and leaderboards. An implementation of unified services should provide an implementation of this interface if it supports game services.

See Also:

public interface GameServices

Method Summary

Modifier and TypeMethod and Description
public voidensureAchievements(List<String> achievementIds)
Ensures that all the achievements in a given list are unlocked.
public voidincrementAchievement(String achievementId, int amount, int max)
Increments a progressive achievement.
public booleanisAchievementUnlocked(String achievementId)
Indicates whether an achievement is unlocked (achieved).
public voidrevealAchievement(String achievementId)
Reveals a hidden achievement.
public voidshowAchievements()
Displays an achievements dialog.
public voidshowLeaderboard()
Displays all leaderboards associated with this game.
public voidshowLeaderboard(String lbId)
Displays the desired leaderboard.
public voidsubmitScore(String lbId, int score, Object payload)
Submits a score to a given leaderboard.
public booleansupportsAchievements()
Indicates whether this GameServices supports achievements.
public voidunlockAchievement(String achievementId)
Unlocks an achievement and considers it as achieved.

Method Detail

ensureAchievements
public void ensureAchievements(
    List<String> achievementIds
)
Ensures that all the achievements in a given list are unlocked. This method will unlock any achievement in the list that is not unlocked. For other items, it has no effect.
Parameters:
achievementIdsThe list of string identifiers for the achievements
incrementAchievement
public void incrementAchievement(
    String achievementId,
    int amount,
    int max
)
Increments a progressive achievement. Once the progress is complete, the achievement will be unlocked.
Parameters:
achievementIdThe string identifier of the achievement
amountThe number of steps to progress
maxMaximum step count. Some providers have this already in their database. But it is recommended that you provide this number for global support.
isAchievementUnlocked
public boolean isAchievementUnlocked(
    String achievementId
)
Indicates whether an achievement is unlocked (achieved). Depending on the app-store, there may be a loading delay before this method returns up-to-date results for all achievements.
Parameters:
achievementIdAchievement identifier
Returns:
true if the achievement is unlocked, false otherwise
revealAchievement
public void revealAchievement(
    String achievementId
)
Reveals a hidden achievement. This is different from unlocking, as it is still going to be displayed as not achieved. Some providers do not support this function, in which case this method will have no effect.
Parameters:
achievementIdThe string identifier of the achievement
showAchievements
public void showAchievements()
Displays an achievements dialog.
showLeaderboard
public void showLeaderboard()
Displays all leaderboards associated with this game.
showLeaderboard
public void showLeaderboard(
    String lbId
)
Displays the desired leaderboard.
Parameters:
lbIdThe string identifier of the leaderboard
submitScore
public void submitScore(
    String lbId,
    int score,
    Object payload
)
Submits a score to a given leaderboard.
Parameters:
lbIdLeaderboard string identifier
scoreThe score to be submitted
payloadAdditional information to accompany the score. This parameter is not necessarily used by a unified services provider. An example use case of this parameter is score validation using some extra in-game states and information.
supportsAchievements
public boolean supportsAchievements()
Indicates whether this GameServices supports achievements.
Returns:
true if achievements are supported, and false otherwise
unlockAchievement
public void unlockAchievement(
    String achievementId
)
Unlocks an achievement and considers it as achieved.
Parameters:
achievementIdThe string identifier of the achievement