Public Member Functions | Static Public Member Functions | Properties

OFAchievement Class Reference

#import <OFAchievement.h>

List of all members.

Public Member Functions

(OFRequestHandle *) - updateProgressionComplete:andShowNotification:
(void) - deferUpdateProgressionComplete:andShowNotification:
(OFRequestHandle *) - getIcon
(id) - initWithLocalSQL:
(OFRequestHandle *) - unlock
(void) - unlockAndDefer

Static Public Member Functions

(void) + setDelegate:
(NSArray *) + achievements
(OFAchievement *) + achievement:
(OFRequestHandle *) + submitDeferredAchievements
(void) + setCustomUrlForSocialNotificaion:
(NSString *) + getResourceName
(void) + forceSyncGameCenterAchievements

Properties

NSString * title
NSString * description
NSUInteger gamerscore
BOOL isSecret
NSDate * unlockDate
BOOL isUnlocked
double percentComplete
BOOL isUnlockedByComparedToUser
NSString * comparedToUserId
NSString * endVersion
NSString * startVersion
NSUInteger position
NSString * iconUrl

Detailed Description

The public interface for OFAchievement exposes information about a particular achievement and it's unlock state for the local user


Member Function Documentation

+ (OFAchievement*) achievement: (NSString *)  achievementId

Retrieves a achievement based on the achievement id on the developer dashboard

Parameters:
achievementIDThe leaderboard id
Returns:
OFAchievement corresponding to the achievement id
+ (NSArray*) achievements

Retrieves all of the achievements for this application.

Note:
The returned achievements will contain unlock information for the local user.
Returns:
NSArray populated with OFAchievement objects representing each achievement
- (void) deferUpdateProgressionComplete: (double)  updatePercentComplete
andShowNotification: (BOOL)  showUpdateNotification 

Updates an achievement's progression for the current user, but deffers the submition of this information to the server until "submitDeferredAchievements" is called in your app.

Parameters:
floatupdatePercentComplete. Number between 0.0f and 100.0f for which you would like to update the progression of this achievement.
Note:
If you defer achievements, the user will still see the achievement unlock immediately and it will be stored locally that it is unlocked. If the user quits the app before you have a chance to submit the defered achievments, the next time the app is started up online and logged into OpenFeint, we will sync to the server automatically all defered achievements from previous games.
+ (void) forceSyncGameCenterAchievements

Resend all achievement info to the GameCenter server. This may be used to make sure that GameCenter achievements are properly synchronized with OpenFeint achievements. The recommended place for this to be called is from the userLoggedInToGameCenter delegate method.

- (OFRequestHandle*) getIcon

Get the icon for this achievement

Returns:
OFRequestHandle for the server request. Use this to cancel the request
Note:
Invokes - (void)didGetIcon:(UIImage*)image OFAchievement:(OFAchievement*)achievement; on success and
  • (void)didFailGetIconOFAchievement:(OFAchievement*)achievement; on failure
+ (NSString*) getResourceName
- (id) initWithLocalSQL: (OFSqlQuery *)  queryRow
+ (void) setCustomUrlForSocialNotificaion: (NSString *)  url

Set a url to goto when someone clicks the social post.

+ (void) setDelegate: (id< OFAchievementDelegate >)  delegate

Set a delegate for all OFAchievement related actions. Must adopt the OFAchievementDelegate protocol.

Note:
Defaults to nil. Weak reference
+ (OFRequestHandle*) submitDeferredAchievements

Submits all deferred achievement unlocks to the server

Note:
Invokes -(void)didSubmitDeferredAchievements on success and -(void)didFailSubmittingDeferredAchievements: on failure.
Returns:
OFRequestHandle for the server request. Use this to cancel the request. nil if there were no deferred unlocks
- (OFRequestHandle*) unlock

Unlocks an achievement for the local user

Parameters:
achievementIdThe unique Achievement id from api.openfeint.com
Returns:
OFRequestHandle for the server request. Use this to cancel the request
- (void) unlockAndDefer

Unlocks an achievement for the current user, but deffers the submition of this information to the server until "submitDeferredAchievements" is called in your app.

Note:
If you defer achievements, the user will still see the achievement unlock immediately and it will be stored locally that it is unlocked. If the user quits the app before you have a chance to submit the defered achievments, the next time the app is started up online and logged into OpenFeint, we will sync to the server automatically all defered achievements from previous games.
- (OFRequestHandle*) updateProgressionComplete: (double)  updatePercentComplete
andShowNotification: (BOOL)  showUpdateNotification 

Updates the progression of an achievement. Set to 100.0f to unlock the achievement

Parameters:
floatupdatePercentComplete. Number between 0.0f and 100.0f for which you would like to update the progression of this achievement.
Returns:
OFRequestHandle for the server request. Use this to cancel the request
Note:
Invokes - (void)didUpdateProgressionCompleteOFAchievement:(OFAchievement*)achievement; on success and
  • (void)didFailUpdateProgressionCompleteOFAchievement:(OFAchievement*)achievement; on failure

Property Documentation

- (NSString *) comparedToUserId [read, assign]
- (NSString *) description [read, assign]

Achievement description

- (NSString *) endVersion [read, assign]
- (NSUInteger) gamerscore [read, assign]

Gamerscore value for the achievement

- (NSString *) iconUrl [read, assign]
- (BOOL) isSecret [read, assign]

If YES then this achievement is secret. This means that it's details are hidden from users who have not yet unlocked it.

- (BOOL) isUnlocked [read, assign]

If YES then this achievement completely unlocked, (i.e. percentComplete is 100%)

- (BOOL) isUnlockedByComparedToUser [read, assign]
- (double) percentComplete [read, assign]

returns the whole percent complete for this achievement. i.e. 60.5 is 60.5%

- (NSUInteger) position [read, assign]
- (NSString *) startVersion [read, assign]
- (NSString *) title [read, assign]

Achievement title

- (NSDate *) unlockDate [read, assign]

The date that this achievement was unlocked, if it is unlocked, nil otherwise.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations Enumerator Properties