Esempio n. 1
0
        public override void LoadContent()
        {
            _infoText = Information[_random.Next(Information.Count)];

            var viewport = ScreenManager.Game.GraphicsDevice.Viewport;
            _infoPosition = new Vector2(viewport.Width / 2f, viewport.Height / 2f);

            _proceedButton = new GrowingMenuEntry("PLAY")
            {Position = new Vector2(viewport.Width - 150, viewport.Height - 60)};
            _proceedButton.Initialize(ScreenManager.Game);

            _tweetButton = new GrowingMenuEntry("POST TO TWITTER")
                               {
                                   Position = new Vector2(viewport.Width - 550, viewport.Height - 60),
                                   MaxScale = 1.1f
                               };
            _tweetButton.Initialize(ScreenManager.Game);

            var twitter = ScreenManager.Game.Services.GetService<ITwitter>();
            _tweetButton.Selected += (o, e) =>
                                         {
                                             if (!twitter.IsInitialized)
                                             {
                                                 return;
                                             }
                                             if (twitter.AuthenticationRequired)
                                             {
                                                 GoToTwitterScreen();
                                             }
                                             else
                                             {
                                                 _tweeted = twitter.SendTweet(_infoText);
                                             }
                                         };

            _reenterPin = new GrowingMenuEntry("REENTER PIN AND POST TO TWITTER")
            {
                Position = new Vector2(50, viewport.Height - 60),
                MaxScale = 1.1F
            };
            _reenterPin.Initialize(ScreenManager.Game);
            _reenterPin.Selected += (o, e) =>
                                        {
                                            if (twitter.IsInitialized)
                                            {
                                                GoToTwitterScreen();
                                            }
                                        };

            base.LoadContent();
        }
Esempio n. 2
0
        public virtual void Initialize(Game game)
        {
            Game = game;
            SpriteBatch = game.Services.GetService<SpriteBatch>();

            LoadComponent();
            Component.Initialize(Game, SpriteBatch, null);

            BuyButton = new GrowingMenuEntry("buy");
            BuyButton.Position = Position + new Vector2(1050, 40);
            BuyButton.Initialize(game);

            LoadContent();
        }