Skip to content

How to use sharpchievements

sebingel edited this page Dec 1, 2015 · 5 revisions

Setting up achievementtracking with sharpchievements ist pretty easy.
At first you need to create some AchievementConditions:

AchievementCondition aC = new AchievementCondition("This is the Titel", "aCKey", 5);

An AchievmentCondition describes what has to be done to progress in an achievements completion. AchievementConditions are created with three parameters in the constructor:

  1. The Title
    The Title should be unique per application. It is used to make sure that an AchievementCondition is only registered once when loading from a file and registering achievements programatically.

  2. The Key
    The Key is used to track the progress of an AchievementCondition. The Key can be shared by multiple AchievementConditions in order to track more than one AchievementConditions with only one action i.e. if you have an Achievement for starting the program once and another Achievement for starting the programm twice you can create two AchievementConditions with the key "appStarted" and both would register a progress when the key is called.

  3. The Counter
    Defines how often a key has to be called to unlock the AchievementCondition.

Now after creating an AchievementCondition we need the Achievement that we want to unlock by progressing with our AchievementCondition:

Achievement a = new Achievement("The Title", "The Description", aC, "/sebingel.sharpchievements;component/Images/award71.png");

TBC