0

XNA WP7 アプリケーションで広告コントロールを使用しようとしています。うまく表示されますが、クリックできません。次のコードを試してください。

public class Game1 : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;

    private DrawableAd bannerAd;
    private bool shouldDraw;
    private const string guid = "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // my id is hidden
    private const string idapp = "00000";

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
        TargetElapsedTime = TimeSpan.FromTicks(333333);
        InactiveSleepTime = TimeSpan.FromSeconds(1);
    }

    protected override void Initialize()
    {
        AdGameComponent.Initialize(this, guid);
        CreateAd();

        Components.Add(AdGameComponent.Current);
        AdGameComponent.Current.Enabled = true;
        AdGameComponent.Current.Visible = false;

        base.Initialize();
    }

    private void CreateAd()
    {
        // Create a banner ad for the game.
        int width = 480;
        int height = 80;
        int x = (GraphicsDevice.Viewport.Bounds.Width - width) / 2; // centered on the display
        int y = 390;

        bannerAd = AdGameComponent.Current.CreateAd(idapp, new Rectangle(x, y, width, height), true);
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
    }

    protected override void UnloadContent()
    {
    }

    protected override void Update(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

        TouchCollection touchPoints = TouchPanel.GetState();
        if (touchPoints.Count > 0)
        {
            TouchLocation t = touchPoints[0];
            if (t.State == TouchLocationState.Pressed)
            {
                shouldDraw = true;
            }
        }


        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        if (shouldDraw)
        {
            shouldDraw = false;
            AdGameComponent.Current.Visible = true;
        }

        base.Draw(gameTime);
    }
}

このコードの何が問題になっていますか?

助けてくれてありがとう。

よろしくお願いします

NB : コンポーネントが可視状態で開始される場合、サンプルは機能しますが、アプリケーションの開始時ではなく配置したいので、それは私が望むものではありません

4

1 に答える 1

0

SDKにバグがあります最新バージョンを使用すれば問題ありません

http://community.microsoftadvertising.com/en/developer/pubcenter/f/32/t/72786.aspxを参照してください

于 2012-05-11T12:35:52.110 に答える