共用方式為


Inviting a Group to Join Your Game (Xbox 360)

LIVE Party gives groups of gamers more ways to connect, chat, and play together. The XNA Framework supports LIVE Party through the Guide, LocalNetworkGamer, and SignedInGamer classes. This topic shows you how to use these classes to add LIVE Party support to your game title.

Note

Currently, only Xbox 360 supports LIVE Party. Other platforms do not support LIVE Party functionality, even though the platform may support LIVE otherwise.

Showing the LIVE Party Screens

The Guide provides two screens related to LIVE Party: the Party screen and Party Sessions screen.

The Party screen serves as the main interface to LIVE Party functionality for a given player. It allows a player to do the following:

  • View all members in the current party.
  • Manage the party (if the player is the party organizer).
  • Send party invitations to other party members.

The Party Sessions screen allows a player to see all party members who are in a joinable session in the same game. It allows the player to join any of these sessions.

To show the Guide's LIVE Party screen

    // Show the party screen for the player on the first controller.
    Guide.ShowParty(PlayerIndex.One);
            

To show the Guide's LIVE Party Sessions screen

    // Show the party sessions screen for the player on the first controller.
    Guide.ShowPartySessions(PlayerIndex.One);
            

Sending a Game Invitation to Party Members

For party members not yet in the game, the player can use the LocalNetworkGamer class to send them an invitation to the current game session.

To send a game invitation to all party members not in the current game session

    // Send invitations to all members of each local network gamer's LIVE party.
    foreach(LocalNetworkGamer gamer in NetworkSession.LocalGamers)
    {
        gamer.SendPartyInvites();
    }
            

Note

When a gamer responds to a game invitation, the player who sent the invitation gets the NetworkSession.InviteAccepted event. For more information, see Inviting Players to Join Your Game

Retrieving the Number of Party Members for a Gamer

You can use the gamer's SignedInGamer class to determine the number of party members in a gamer party.

To get the number of party members for a player.

    // get the party size for the first signed-in gamer.
    if(Gamer.SignedInGamers(0).PartySize > 0)
    {
        // The player is a member of a LIVE party!
        ...
    }
            

See Also

Tasks

Inviting Players to Join Your Game

Reference

Guide.ShowParty Method
Guide.ShowPartySessions Method
SignedInGamer.PartySize Property
LocalNetworkGamer.SendPartyInvites Method