0
XNA WP7アプリケーションで広告コントロールを使用する傾向があります。うまく表示されますが、クリックできません。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:コンポーネントが可視状態で起動した場合のサンプルが働いているが、それは私が、私は自分のアプリケーションの開始時ではない、それを入れたいので
を参照してください大丈夫です、あなたは「それをクリックすることができませんでし」何を意味するのですか? –
広告はブラウザを開けません、それは助けられました – Tim
例外はありますか?あなたはrefでMicrosoft.Phone.dllを持っていますか? WMAppManifest.xmlにCapability Name = "ID_CAP_WEBBROWSERCOMPONENT"がありますか? –