Вопрос

I need to create three leaderboards which will show only users who obtained most coins on this day, on this week, on this month.

Is it possible to achieve with Game Center? If yes, than how?

Thx.

Это было полезно?

Решение

A leaderboard cannot be reset daily. However, you may query for results during the last day / week / etc. This is explained here:

https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/GameKit_Guide/Achievements/Achievements.html#//apple_ref/doc/uid/TP40008304-CH7-SW30

You may show data filtered by possible properties, such as timeScope:

You set properties on the GKLeaderboard object to filter which scores are returned to your game, then tell the object to load the scores. Table 4-5 Properties that affect the leaderboard data query

Property - Effect

playerScope - You can choose whether to restrict the search to the local player’s friends or to find scores from any player. Optionally, you can also initialize a leaderboard object to search for scores for a specific group of players that you supply.

timeScope - You can choose to filter based on when the score was earned.

...

By re-reading your question, I think timeScope will do the trick for you!

Другие советы

Only daily, weekly, and all time leaderboards are available via GKLeaderBoardTimeScope

Might worth mentioning that when displaying leaderboards the laziest way with GKGameCenterViewController it is possible to set up leaderboardTimeScope for the initial view, see Apple's example.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top