0
\$\begingroup\$

I'm trying to build a project for Xbox, and when I try to Package as an XNA Creator's Club Game I receive the following errors:

The best overloaded method match for 'Pong.MessageBoxScreen.MessageBoxScreen(Microsoft.Xna.Framework.Game, string)' has some invalid arguments.

Argument 1: cannot convert from 'string' to 'Microsoft.Xna.Framework.Game'

Argument 2: cannot convert from 'bool' to 'string'

        /// <summary>
    /// Event handler for when the Unlock Game menu entry is selected.
    /// </summary>
    void UnlockMenuEntrySelected(object sender, PlayerIndexEventArgs e)
    {
 #if XBOX
        try
        {
            Guide.ShowMarketplace(e.PlayerIndex);
        }
        catch (GamerPrivilegeException gamerPrivilegeException)
        {
            const string message = "Please use Xbox Live account.";

            MessageBoxScreen promptForPurchase = new MessageBoxScreen(message, false);
            ScreenManager.AddScreen(promptForPurchase, e.PlayerIndex);
        }
 #else
        const string message = "Unlock Full Game (Xbox Only)";
        MessageBoxScreen unlockMessageBox = new MessageBoxScreen(Game, message,      false);
        ScreenManager.AddScreen(unlockMessageBox, e.PlayerIndex);

 #endif
    }

Everything within the #if XBOX area is grayed out, I suppose because it is surrounded by that tag.

What do you think is suddenly causing these issues, and how can I correct it?

\$\endgroup\$
3
  • \$\begingroup\$ I see code, but no error messages. \$\endgroup\$
    – 3Dave
    Commented Aug 18, 2012 at 20:40
  • \$\begingroup\$ What error? Please edit post. \$\endgroup\$ Commented Aug 18, 2012 at 20:41
  • \$\begingroup\$ Sorry, I accidentally hit "post" while I was in the middle of writing the post :p. I've since added it \$\endgroup\$ Commented Aug 18, 2012 at 20:42

1 Answer 1

4
\$\begingroup\$

Based on the exception, it appears this line is at fault:

MessageBoxScreen promptForPurchase = new MessageBoxScreen(message, false);

You'll see that the error message tells you exactly what is wrong. You are passing arguments that are invalid for that constructor. You need to pass a Microsoft.Xna.Framework.Game object as the first argument and a String as the second argument.

\$\endgroup\$
1
  • \$\begingroup\$ That was exactly it. I don't remember ever changing this constructor, but when I went back and compared it to the GSM sample, it appears that I must have at some point. Thank you! \$\endgroup\$ Commented Aug 20, 2012 at 10:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .