NetworkSessionType networkSessionType;
public XboxLiveScreen(NetworkSessionType networkSessionType)
{
this.networkSessionType = networkSessionType;
if (this.networkSessionType == NetworkSessionType.PlayerMatch)
{
if (this.networkSessionType == NetworkSessionType.SystemLink)
{
MenuEntries.Add("Back");
}if (this.networkSessionType == NetworkSessionType.PlayerMatch)
{
MenuEntries.Add("Create XBox LIVE Session");
MenuEntries.Add("Join XBox LIVE Session");
}MenuEntries.Add("Join XBox LIVE Session");
if (this.networkSessionType == NetworkSessionType.SystemLink)
{
MenuEntries.Add("Create System Link Session");
MenuEntries.Add("Join System Link Session");
}MenuEntries.Add("Join System Link Session");
MenuEntries.Add("Back");
Now we will need to go back to the LiveOptionMenuScreen and modify the line:
ScreenManager.AddScreen(new XboxLiveScreen());to pass in the session type, you will also need to add Microsoft.Xna.Framework.Net to the using statements :
ScreenManager.AddScreen(new XboxLiveScreen(NetworkSessionType.PlayerMatch));And under case 2: lets add the following line:
ScreenManager.AddScreen(new XboxLiveScreen(NetworkSessionType.SystemLink));You will also need to the LobbyScreen.cs file and modify this line and move it to above where we checking if the networkSession is null:
ScreenManager.AddScreen(new XboxLiveScreen();To the following (here we passing in the current network session type so that it goes back to the correct menu):
ScreenManager.AddScreen(new XboxLiveScreen(networkSession.SessionType));Ok, so if we had to run the following and tried to login to System Link (without signing into LIVE first) we would get this error:
"A signed in gamer profile is required to perform this operation. A Live profile may also be required. There are no profiles currently signed in, or the profile is not signed in to Live."
Basically what this means is that you need to first login with a normal gamer profile or a Silver LIVE gamer profile, so lets do a check to see if we have at least got a normal gamer profile loaded before trying to move into the next screen:
[LiveOptionsMenuScreen.cs]
case 2:
// System Link
if (Gamer.SignedInGamers.Count < 1)
{
else
{
break;
if (Gamer.SignedInGamers.Count < 1)
{
if (!Guide.IsVisible)
{
}{
Guide.ShowSignIn(1, true);
}else
{
ScreenManager.AddScreen(new XboxLiveScreen(NetworkSessionType.SystemLink));
}break;
So now we support Creating a Session for both LIVE and System Link network types.
Next we will implement the Searching of a System Link session similar to how we just did the above.
1 comment:
Awesome work on this networking tutorial series! I am currently holding a competition for xna related articles and thing that you would make a great candidate to enter. Check it out on my site: Ziggyware XNA News and Tutorials
Thanks,
Ziggy
Post a Comment