Method | Description | |
---|---|---|
CleanUp ( ) : void |
Cleans up the challenge list, moving expired transient challenges to the archive and refreshing persistent challenges. Should be called daily at the challenge cutoff time.
|
|
CreateChallenge ( string name, string description, int points, bool persistent, System.DateTime start, int durationInDays, Statistic statistic, float requirement ) : int |
Creates a new Challenge and adds it to the collection.
|
|
GenerateNewChallenges ( ) : void |
Creates new challenges such that the correct number of each type of challenge (daily, weekly, monthly) are active.
|
|
GetChallenge ( int id, int userId ) : |
Retrieves an active challenge based on its ID.
|
|
GetFormattedProgress ( int challengeId, int userId ) : string |
Returns the formatted text progress report for the Challenge (e.g., "34.5 / 40.0").
|
|
GetProgress ( int challengeId, int userId ) : int |
Gets the progress made by a user in the challenge as a percentage (0-100).
|
|
InitializeUser ( int challengeId, int userId ) : void |
Sets a user's initial value for a challenge (to allow calculation of the user's delta from the beginning of the challenge).
|
|
IsComplete ( int challengeId, int userId ) : bool |
Returns true if the user has met the requirements to complete the challenge, false otherwise.
|
Method | Description | |
---|---|---|
ChallengeManager ( ) : System |
Private constructor, can't instantiate class.
|
public static CreateChallenge ( string name, string description, int points, bool persistent, System.DateTime start, int durationInDays, Statistic statistic, float requirement ) : int | ||
name | string | Challenge Name. |
description | string | Challenge Description. |
points | int | Points to be awarded upon completion of the Challenge. |
persistent | bool | True if the Challenge is persistent, false otherwise. |
start | System.DateTime | Time at which the challenge should begin. |
durationInDays | int | Number of days that the challenge should be active. |
statistic | Statistic | Statistic on which the Challenge is based. |
requirement | float | Statistic value required to complete the challenge. |
return | int |
public static GenerateNewChallenges ( ) : void | ||
return | void |
public static GetChallenge ( int id, int userId ) : |
||
id | int | ID of the Challenge to be retrieved. |
userId | int | Optional. UserID to load progress from. |
return |
public static GetFormattedProgress ( int challengeId, int userId ) : string | ||
challengeId | int | Challenge to report progress for. |
userId | int | User to evaluate. |
return | string |
public static GetProgress ( int challengeId, int userId ) : int | ||
challengeId | int | The challenge to evaluate progress for. |
userId | int | The user to evaluate. |
return | int |
public static InitializeUser ( int challengeId, int userId ) : void | ||
challengeId | int | |
userId | int | |
return | void |
public static IsComplete ( int challengeId, int userId ) : bool | ||
challengeId | int | Challenge to test for completion. |
userId | int | User to evaluate. |
return | bool |