Пример #1
0
 protected override void Initialize()
 {
     AdGameComponent.Initialize(this, ApplicationId);
     Components.Add(AdGameComponent.Current);
     CreateAd();
     base.Initialize();
 }
Пример #2
0
 /// <summary>
 /// LGame监听接口,用来监听标准XNA中Initialize的启动
 /// </summary>
 public void Initialize(Game game)
 {
     //初始化AdGameComponent组件,并将其添加到游戏中
     AdGameComponent.Initialize(game, ApplicationId);
     game.Components.Add(AdGameComponent.Current);
     //创建一个新的广告
     CreateAd(game);
 }
 public void Initialize(Game game, string applicationId)
 {
     if (!AdGameComponent.Initialized)
     {
         AdGameComponent.Initialize(game, applicationId);
         _adComponent = AdGameComponent.Current;
         _adComponent.Visible = false;
         _adComponent.Enabled = true;
     }
 }
Пример #4
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
        }
Пример #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()
        {
            // 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();
        }
Пример #6
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();
        }
Пример #7
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);
 }
Пример #8
0
        public Main()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            // Create an adGameComponent for this game
            AdGameComponent.Initialize(this, "bb378d06-64e7-4214-97a7-a895b66d073f");
            adGameComponent = AdGameComponent.Current;
            Components.Add(adGameComponent);

            this.graphics.PreferredBackBufferWidth = 800;
            this.graphics.PreferredBackBufferHeight = 480;
            this.graphics.IsFullScreen = true;

            // Frame rate is 30 fps by default for Windows Phone.
            TargetElapsedTime = TimeSpan.FromTicks(333333);

            if (Microsoft.Xna.Framework.Media.MediaPlayer.State == MediaState.Playing)
            {
                Guide.BeginShowMessageBox("Zune music is playing", "Choose music choise",
                        new List<string> { "Game", "Zune" }, 0, MessageBoxIcon.Error,
                        asyncResult =>
                        {
                            int? returned = Guide.EndShowMessageBox(asyncResult);
                            if (returned == 0)
                            {
                                Microsoft.Xna.Framework.Media.MediaPlayer.Stop();
                                zuneOn = false;
                                MediaPlayer.Play(music);
                            }
                            else
                            {
                                zuneOn = true;
                            }
                        }, null);

            }

            TouchPanel.EnabledGestures = GestureType.FreeDrag | GestureType.Tap;
        }
Пример #9
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = 480;
            graphics.PreferredBackBufferHeight = 800;
            graphics.IsFullScreen = true;

            Content.RootDirectory = "Content";

            // Frame rate is 30 fps by default for Windows Phone.
            TargetElapsedTime = TimeSpan.FromTicks(333333);

            // Extend battery life under lock.
            InactiveSleepTime = TimeSpan.FromSeconds(1);

            PhoneApplicationService.Current.Launching += new EventHandler<LaunchingEventArgs>(Game_Launching);
            PhoneApplicationService.Current.Closing += new EventHandler<ClosingEventArgs>(Game_Closing);
            PhoneApplicationService.Current.Deactivated += new EventHandler<DeactivatedEventArgs>(Game_Deactivated);
            PhoneApplicationService.Current.Activated += new EventHandler<ActivatedEventArgs>(Game_Activated);

            TouchPanel.EnabledGestures = GestureType.Tap;

            #if DEBUG
            AdGameComponent.Initialize(this, "test_client");
            #else
            AdGameComponent.Initialize(this, "644f3cef-dfcc-47c3-a726-b9d7a1b40e53");
            #endif
            adGameComponent = AdGameComponent.Current;
            Components.Add(adGameComponent);
        }