Windows Phone library:

this is how you can save your game result

GameServicesCaller caller = new GameServicesCaller("http://localhost:2442", "catcheggs", "E47552CF-AF1F-4cb6-BA2E-3F7289F98233");
caller.SaveGameResult(new GameResultDto()
   {
    DeviceId = IdsProvider.GetDeviceId(),
    Score = 123,
    PlayerName = "Maciej Grabek"
   }, delegate {
       this.Dispatcher.BeginInvoke(() => { MessageBox.Show("Done"); });
   });

and here is how you can get game scores:

GameServicesCaller caller = new GameServicesCaller("http://localhost:2442", "catcheggs", "E47552CF-AF1F-4cb6-BA2E-3F7289F98233");
caller.GetGameResults((IEnumerable<GameResultLightDto> items) =>
   {
    this.Dispatcher.BeginInvoke(() => { MessageBox.Show(items.Count().ToString()); });
   },
   delegate(Exception exception) { /* do something with error */ });

to create GameServicesCaller you need to provide url, game Id (required to save game score because of security scenario I've assumed) and normalized game name to get information from services.

To call services directly (ex. from fiddler) you have two options:

GET /api/gameResults/gameNormalizedName

POST /api/gameResults
Sample request body:
{
 "GameHash" : "E47552CF-AF1F-4cb6-BA2E-3F7289F98233",
 "Score" : "202",
 "PlayerName": "Maciej Grabek",
 "DeviceId" : "2"

Simple as that!

 How to deploy game services

Last edited Apr 18, 2012 at 6:46 PM by maciejgrabek, version 7

Comments

No comments yet.