Beispiel #1
0
 protected override void Initialize()
 {
     AdGameComponent.Initialize(this, ApplicationId);
     Components.Add(AdGameComponent.Current);
     CreateAd();
     base.Initialize();
 }
Beispiel #2
0
 /// <summary>
 /// LGame监听接口,用来监听标准XNA中Initialize的启动
 /// </summary>
 public void Initialize(Game game)
 {
     //初始化AdGameComponent组件,并将其添加到游戏中
     AdGameComponent.Initialize(game, ApplicationId);
     game.Components.Add(AdGameComponent.Current);
     //创建一个新的广告
     CreateAd(game);
 }
Beispiel #3
0
        public void InitializeAds(string applicationId, string unitId, Rectangle location)
        {
#if WINDOWS_PHONE
            AdGameComponent.Initialize(this, applicationId);
            this.Components.Add(AdGameComponent.Current);
            _ad = AdGameComponent.Current.CreateAd(unitId, location);
            _ad.ErrorOccurred += ad_ErrorOccurred;
            _ad.Visible        = false;
#endif
        }
Beispiel #4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // Initialize the AdGameComponent and add it to the game’s Component object
            AdGameComponent.Initialize(this, ApplicationId);

            AdGameComponent.Current.CountryOrRegion = "US";

            Components.Add(AdGameComponent.Current);

            // Create an actual ad for display.
            CreateAd();

            GameScreenManager.Instance.AddScreen(new BattleScreen(GraphicsDevice));
            GameScreenManager.Instance.AddScreen(new MenuScreen(GraphicsDevice));
            GameScreenManager.Instance.AddScreen(new GameOverScreen(GraphicsDevice));
            SoundPlayer.Instance.Initialize();
            GameState.Instance.Load();
            base.Initialize();
        }
Beispiel #5
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft;
            graphics.IsFullScreen          = true;
            graphics.ApplyChanges();

            viewport = GraphicsDevice.Viewport;

            int width  = viewport.Width;
            int height = viewport.Height;

            if (width > height)
            {
                int temp = width;
                width  = height;
                height = temp;
            }

            graphics.PreferredBackBufferHeight = height;
            graphics.PreferredBackBufferWidth  = width;

            graphics.SupportedOrientations = DisplayOrientation.Portrait;

            graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            viewport = GraphicsDevice.Viewport;

            currentState = new GameState(graphics, Content, viewport);
            currentState.Initialize();

            AdGameComponent.Initialize(this, appID);
            Components.Add(AdGameComponent.Current);

            // Create an actual ad for display.
            CreateAd();

            base.Initialize();
        }
Beispiel #6
0
 public static void Initialize(Game game, string applicationId)
 {
     // Initialize the AdGameComponent with your ApplicationId and add it to the game.
     AdGameComponent.Initialize(game, applicationId);
     game.Components.Add(AdGameComponent.Current);
 }