2011-11-25 64 views
0

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

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,但广告仍然不起作用。

+2

也许这应该迁移到[gamedev.SE]。请不要过帐。如果需要,让模组移动它。 –

+0

@Drackir这里有很多关于游戏开发的帖子,如果他想要imho,每个人都可以在这里发布。 ;-) –

+1

@FelixK。哦,绝对。我的意思是,OP可能会在专门针对该主题的网站上获得更好的答案。 :-) –

回答

0

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

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

你应该叫从AdGameComponent相应的绘制和更新方法,请参阅文档:http://msdn.microsoft.com/en-us/library/hh495436(v=MSADS.20).aspx

+0

+1。 AdsGameComponent继承自DrawableGameComponent –

+0

你是wronu,我不应该调用Draw和Update方法manualy。如果我将DrawbleGameComponent添加到组件容器。 –

+1

真的很糟糕的答案。 –