Sdílet prostřednictvím


How To: Detect or Simulate Trial Mode and Present a Marketplace Offer

Demonstrates how to detect and simulate trial mode for the purpose of testing the display of a Marketplace offer that will allow a player to purchase your game.

Note

It is not necessary to write special code to ensure that a Marketplace offer is available to players of Xbox LIVE Community Games. By default, trial mode games that have been released will present a Marketplace offer to the player when the gameplay time limit expires. However, you might want to write special code in your game to present a Marketplace offer, or control other areas of gameplay when a game is in trial mode.

To simulate trial mode

The XNA Framework provides a property, Guide.SimulateTrialMode, that allows developers to test the behaviors of a game under trial mode conditions. When games are in trial mode, a developer might choose to limit the capabilities of the game.

  • In this example, Guide.SimulateTrialMode is set to true for the purpose of later testing a marketplace offer that is presented if the game is in trial mode. This property is usually set in the game constructor, and must be set before the first call to Game.Update.
Guide.SimulateTrialMode = true;

To detect when a game is in trial mode

if (Guide.IsTrialMode)
{
    Guide.ShowMarketplace(signedInGamer.PlayerIndex);
}