This project is read-only.
The namespace Andrewl.XnaHelpers.GamerServices contains classes to make accessing gamer cards easier. note this is only included in the xbox 360 build.

The first class is the static GamerHandler
This class will allow you to set a function that accepts a SignedInEventArgs or SignedOutEventArgs respectivly.
The methods you set will be called whenever a gamer is signed in or signed out on the local Xbox.

So say I have a function that handles when a new user is signed in called HandleSignIn
public void HandleSignIn(SignedInEventArgs e)
     //code to handle the sign in
and I want that to be called whenever someone signs in to the xbox
So... to do this you would do....
GamerHandler.signedInAction = HandleSignIn;
You would do the same thing if you were setting to signed out the only difference is that you have to changed the SignedInEventArgs to SignedOutEventArgs and set it to the GamerHandler.signedOutAction variable.

Gamertag Helper

This is still in testing so don't trust it too much.

Basically what you would do to use this is say you have a Player class. Create an instance of GamertagHelper in it and send the PlayerIndex of the player, and optionally you can pass a function to call when the gamertag has been fetched successfully.

So once you create the instance and set the values, in your update loop you call GamerTagHelper.Update() and pass a boolean value weather you want it to call Gamer.GetProfile() once the gamer has been fetched. Normally its okay to do that, but it will hang your game while its getting the data, so if you plan to adapt this code to work on NetworkGamers then that is a big no no. Your game will pause as it trys to get the data, and it may not even be there yet, so its best to use the AsyncGetProfile instead.

Once you have gotten the gamer, you can get the profile by calling GetProfile and potentially hang the game, or you can call AsyncGetProfile which will asynchronously get the gamer profile.
When you use asyncGetProfile you can pass a function to it that will be called when the profile is finished being fetched.

Basically once you get the gamer and get the profile you have access to all the accessors included. I won't list them all since intellisense shows them to you but some that may be useful to you are...

IsFriend(Gamer gamer)

Last edited Jul 27, 2010 at 9:48 PM by Destroyer229, version 2


No comments yet.