include/OFHighScore.h

Go to the documentation of this file.
00001 //  Copyright 2009-2010 Aurora Feint, Inc.
00002 // 
00003 //  Licensed under the Apache License, Version 2.0 (the "License");
00004 //  you may not use this file except in compliance with the License.
00005 //  You may obtain a copy of the License at
00006 //  
00007 //      http://www.apache.org/licenses/LICENSE-2.0
00008 //      
00009 //  Unless required by applicable law or agreed to in writing, software
00010 //  distributed under the License is distributed on an "AS IS" BASIS,
00011 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012 //  See the License for the specific language governing permissions and
00013 //  limitations under the License.
00014 
00015 #pragma once
00016 
00017 #import "OFResource.h"
00018 #import "OFSqlQuery.h"
00019 
00020 @class OFService;
00021 @class OFUser;
00022 @class OFS3UploadParameters;
00023 @class OFLeaderboard;
00024 @class OFRequestHandle;
00025 @protocol OFHighScoreDelegate;
00026 
00030 typedef enum
00031 {
00032     // The Filter has not been set yet because nothing has been downloaded for this leaderboard
00033     OFScoreFilter_None = 0,
00035     OFScoreFilter_FriendsOnly,
00037     OFScoreFilter_Everybody
00038 } OFScoreFilter;
00039 
00045 @interface OFHighScore : OFResource<OFCallbackable>
00046 {
00047 @private
00048     OFUser* user;
00049     int64_t score;
00050     NSInteger rank;
00051     NSString* leaderboardId;
00052     NSString* displayText;
00053     NSString* customData;
00054     NSData* blob;
00055     NSString* blobUrl;
00056     NSString* toHighRankText;
00057     NSUInteger gameCenterSeconds;
00058     NSString* gameCenterId;
00059     NSString* gameCenterName;
00060     OFS3UploadParameters* blobUploadParameters;
00061     double latitude;
00062     double longitude;
00063     double distance;
00064 }
00065 
00072 + (void)setDelegate:(id<OFHighScoreDelegate>)delegate;
00073 
00082 + (NSArray*)allHighScoresForCurrentUser;
00083 
00096 + (OFRequestHandle*)getHighScoresNearCurrentUserForLeaderboard:(OFLeaderboard*)leaderboard andBetterCount:(uint)betterCount andWorseCount:(uint)worseCount;
00097 
00112 - (OFHighScore*)initForSubmissionWithScore:(int64_t)submitScore;
00113 
00124 - (void)submitTo:(OFLeaderboard*)leaderboard;
00125 
00135 - (OFRequestHandle*)downloadBlob;
00136 
00140 @property (nonatomic, assign)           int64_t     score;
00141 
00145 @property (nonatomic, retain)           NSString*   displayText;
00146 
00150 @property (nonatomic, retain)           NSString*   customData;
00151 
00157 @property (nonatomic, retain)           NSData* blob;
00158 
00165 @property (nonatomic, readonly)         NSInteger   rank;
00166 
00170 @property (nonatomic, readonly)         OFUser*     user;
00171 
00175 @property (nonatomic, readonly, retain) NSString*   leaderboardId;
00176 @property (nonatomic, readonly, retain) NSString* toHighRankText;
00177 @property (nonatomic, readonly, retain) NSString* blobUrl;
00178 @property (nonatomic, readonly, retain) OFS3UploadParameters* blobUploadParameters;
00179 @property (nonatomic, readonly)         double latitude;
00180 @property (nonatomic, readonly)         double longitude;
00181 @property (nonatomic, readonly)         double distance;
00182 @property (nonatomic, readonly)         NSUInteger gameCenterSeconds;
00183 @property (nonatomic, readonly, retain) NSString* gameCenterId;
00184 @property (nonatomic, retain) NSString* gameCenterName;
00185 
00186 - (id)initWithLocalSQL:(OFSqlQuery*)queryRow forUser:(OFUser*)hsUser rank:(NSUInteger)scoreRank;
00187 - (BOOL)hasBlob;
00188 - (void)_setBlob:(NSData*)_blob;
00189 + (NSString*)getResourceName;
00190 
00191 @end
00192 
00198 @protocol OFHighScoreDelegate
00199 @optional
00200 
00206 - (void)didSubmit:(OFHighScore*)score;
00207 
00213 - (void)didFailSubmit:(OFHighScore*)score;
00214 
00220 - (void)didDownloadBlob:(OFHighScore*)score;
00221 
00227 - (void)didFailDownloadBlob:(OFHighScore*)score;
00228 
00235 - (void)didGetHighScoresNearCurrentUser:(NSArray*)scores;
00236 
00240 - (void)didFailGetHighScoresNearCurrentUser;
00241 
00242 @end
 All Classes Files Functions Variables Enumerations Enumerator Properties