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 "OFHighScore.h" 00018 #import "OFResource.h" 00019 00020 @class OFRequestHandle; 00021 @protocol OFLeaderboardDelegate; 00022 00023 00028 @interface OFLeaderboard : OFResource <OFCallbackable> 00029 { 00030 NSString* name; 00031 OFHighScore* currentUserScore; 00032 OFHighScore* comparedUserScore; 00033 BOOL descendingScoreOrder; 00034 OFScoreFilter filter; 00035 } 00036 00043 + (void)setDelegate:(id<OFLeaderboardDelegate>)delegate; 00044 00050 + (NSArray*)leaderboards; 00051 00059 + (OFLeaderboard*)leaderboard:(NSString*)leaderboardID; 00060 00070 - (OFHighScore*)highScoreForCurrentUser; 00071 00080 - (NSArray*)locallySubmittedScores; 00081 00097 - (OFRequestHandle*)downloadHighScoresWithFilter:(OFScoreFilter)downloadFilter; 00098 00102 @property (nonatomic, readonly) NSString* name; 00103 00107 @property (nonatomic, readonly) NSString* leaderboardId; 00108 00115 @property (nonatomic, readonly) OFHighScore* currentUserScore; 00116 00121 @property (nonatomic, readonly) BOOL descendingScoreOrder; 00122 00128 @property (nonatomic, readonly) OFScoreFilter filter; 00129 00133 - (id)initWithLocalSQL:(OFSqlQuery*)queryRow localUserScore:(OFHighScore*) locUserScore comparedUserScore:(OFHighScore*) compUserScore; 00134 - (bool)isComparison; 00135 - (OFUser*)comparedToUser; 00136 + (NSString*)getResourceName; 00137 00138 @end 00139 00140 00146 @protocol OFLeaderboardDelegate 00147 @optional 00148 00155 - (void)didDownloadHighScores:(NSArray*)highScores OFLeaderboard:(OFLeaderboard*)leaderboard; 00156 00162 - (void)didFailDownloadHighScoresOFLeaderboard:(OFLeaderboard*)leaderboard; 00163 00164 @end