The GuideHelper is very easy to use since all of the updating is done by the XnaGuideHelperComponent.

First thing you need to do is include the proper namespace and add 2 components to your games list of components.



What we are doing here is including the AndrewBlack.XnaGuideHelper namespace and adding 2 components...
The first is the GamerServicesComponent and comes with the XnaFramework, this is required for any project that
plans on using things like gamertags or more specifically the Xbox Guide.

After we add the GamerServicesComponent we need to add the XnaGuideHelperComponent and pass our game as the parameter.

That's the only setup required to use this. So after that the functionality is the same as the GuideHelper that is in the full XnaHelpers v2 library.

Here's an overview though.
To use the GuideHelper just call the static class GuideHelper.
There are 2 types of functions in the GuideHelper class.

What I call "Immediate" and "Callback".

There are only 2 Callback functions, ShowMessageBox and ShowStorageDeviceSelector.
Basically the difference is that for these you have to supply a method that can be called once the MessageBox or StorageDeviceSelector has gotten the data required.
The method supplied has to have an argument of a certain type.
So for ShowStorageDeviceSelector the method you supply has to have StorageDevice has a parameter.
And for ShowMessageBox the method you supply has to have an int as the parameter.

The method you supply also can only have 1 argument.
So an acceptable method for a ShowMessageBox would be...



All of the other functions can be found through Intellisense and are fairly straightforward and require no callback method. Most of them are things like
GuideHelper.ShowFriends and things like that.

A final note, the GuideHelper uses a Queue setup so you can call as many GuideHelper.Whatever as much as you want and they will be shown in the order they were added.
And there is no break in between them, so be careful about spamming the user with Guide boxes. And always remember, the user is not required to do anything in a Guide box.
They can always press the B button or mash the Guide button to skip them. So make sure you always handle the case where they enter invalid data.

This is done for you in the GuideHelper.ShowMessageBox instead of returning null it will return a -1 to tell you that they didn't choose anything and you can act appropriately.

Last edited Jul 21, 2010 at 8:58 PM by Destroyer229, version 5

Comments

No comments yet.