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 00019 @class OFRequestHandle; 00020 @class OFLeaderboard; 00021 @protocol OFDistributedScoreEnumeratorDelegate; 00022 00044 @interface OFDistributedScoreEnumerator : NSObject<OFCallbackable> 00045 { 00046 NSInteger pageSize; 00047 NSInteger currentPage; 00048 NSInteger scoreDelta; 00049 NSInteger startScore; 00050 NSInteger lastPage; 00051 NSMutableDictionary* scores; 00052 NSString* leaderboardId; 00053 OFRequestHandle* activeRequest; 00054 } 00055 00062 + (void)setDelegate:(id<OFDistributedScoreEnumeratorDelegate>)delegate; 00063 00091 + (OFDistributedScoreEnumerator*)scoreEnumeratorForLeaderboard:(OFLeaderboard*)leaderboard 00092 pageSize:(NSInteger)pageSize 00093 scoreDelta:(NSInteger)scoreDelta 00094 startScore:(NSInteger)startScore 00095 delegate:(id<OFDistributedScoreEnumeratorDelegate>)delegate; 00096 00109 - (BOOL)nextPage; 00110 00123 - (BOOL)previousPage; 00124 00131 - (void)jumpToPage:(NSInteger)page; 00132 00136 @property (nonatomic, readonly) NSInteger pageSize; 00137 00143 @property (nonatomic, readonly) NSInteger currentPage; 00144 00148 @property (nonatomic, readonly) NSInteger scoreDelta; 00149 00153 @property (nonatomic, readonly) NSInteger startScore; 00154 00158 @property (nonatomic, readonly) BOOL hasScores; 00159 00164 @property (nonatomic, readonly) NSArray* scores; 00165 00166 @end 00167 00168 @protocol OFDistributedScoreEnumeratorDelegate 00169 @optional 00176 - (void)didReceiveScoresOFDistributedScoreEnumerator:(OFDistributedScoreEnumerator*)scoreEnumerator; 00177 00183 - (void)didFailReceiveScoresOFDistributedScoreEnumerator:(OFDistributedScoreEnumerator*)scoreEnumerator; 00184 00190 - (void)didReachLastPageOFDistributedScoreEnumerator:(OFDistributedScoreEnumerator*)scoreEnumerator; 00191 00192 @end