How to use method "getplayerscore".

19 views
Skip to first unread message

Michael Bujnovský

unread,
Sep 24, 2012, 4:13:13 PM9/24/12
to moga...@googlegroups.com
I am beginner in programming and I dont know how to write this method right.
Especially I dont know, how to implement this parameter "System.Action<Mogade.Response<Mogade.Score>>".
Can you please write me example?

for exam - I need to get score of player "player1" in day scope...  ...to int _Score

Thanks, Michael


GlowPuff

unread,
Sep 24, 2012, 7:47:11 PM9/24/12
to moga...@googlegroups.com
Let's say you want to get a score.

string boardID = "123456"; //this is your board ID that you get from
your mogade dashboard
int page = 1;//first page of scores
int numberOfScores = 10;//grab 10 scores
mogade.GetLeaderboard( boardID , page, numberOfScores ,
LeaderboardScope.Daily, DailyLeaderboardReceived );
Note that "mogade" is an instance of IMogadeClient.

"DailyLeaderboardReceived" is the Action you're asking about. It's just
a method that takes a Response of type Mogade.LeaderboardScores as a
parameter. It's defined elsewhere in your code, like this:
private void DailyLeaderboardReceived(
Response<Mogade.LeaderboardScores> response )
{
if ( !response.Success )
return;//operation failed
else
{
int theScore = response.Data.Scores[ 0 ].Points;//normally you
will want to iterate through all the Data.Scores (it is a List<Score>
collection). My example is just picking off the first score (index of 0).
}
}

All of the other mogade "GetLeaderboard" methods
(GetLeaderboardWithPlayerStats, for example) work the same way.

Hope this helps.

Michael Bujnovský

unread,
Sep 25, 2012, 10:13:11 AM9/25/12
to moga...@googlegroups.com
thank you, 
 
this was, what I wanted
Reply all
Reply to author
Forward
0 new messages