【问题标题】:XNA AdGameComponent does not drawXNA AdGameComponent 不绘制
【发布时间】:2012-01-06 12:48:47
【问题描述】:

我有以下代码。 但是 AddGameComponent 不绘制。

   protected override void Initialize()
    {
        // TODO: Add your initialization logic here
        base.Initialize();
        var li = new LicenseInformation();
        IsTrial = li.IsTrial();
        if (IsTrial)
        {
            AdGameComponent.Initialize(this, AppID);
            Components.Add(AdGameComponent.Current);
            CreateAd();
        }
    }


   private void CreateAd()
    {
        bannerAd = AdGameComponent.Current.CreateAd(AdUnitID, new Rectangle(x, y, width, height), true);
        AdGameComponent.Current.Enabled = true;
    }

我尝试将 DrawOrder 设置为 1000,但广告仍然不起作用。

【问题讨论】:

  • 也许这应该迁移到Game Development。请不要跨帖。如果需要,让模组移动它。
  • @Drackir 这里有很多关于游戏开发的帖子,大家可以随意发帖,恕我直言。 ;-)
  • @FelixK。哦,绝对的。我只是说 OP 可能会在专门针对该主题的网站上获得更好的答案。 :-)

标签: c# windows-phone-7 xna components ads


【解决方案1】:

您应该从 AdGameComponent 中调用相应的 Draw 和 Update 方法,请参阅文档:http://msdn.microsoft.com/en-us/library/hh495436(v=MSADS.20).aspx

【讨论】:

  • 你错了,我不应该手动调用 Draw 和 Update 方法。如果我将 DrawbleGameComponent 添加到 Components 容器中。
【解决方案2】:

答案:广告需要地理位置数据。

this.gcw = new GeoCoordinateWatcher(); 
this.gcw.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(gcw_PositionChanged); 
this.gcw.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(gcw_StatusChanged); 
this.gcw.Start(); 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-11
    • 1970-01-01
    • 1970-01-01
    • 2011-10-09
    • 2011-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多