コード例 #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();
        }
コード例 #2
0
ファイル: MainMenuScreen.cs プロジェクト: sergik/Cardio
        public MainMenuScreen()
        {
            //var newGameMenu = new GrowingMenuEntry("NEW GAME")
            //{
            //    Position = new Vector2(120, 40),
            //};

            //newGameMenu.Selected += (o, e) =>
            //{
            //    // Reset GameState if it was changed by previous games or by loading from file.
            //    ScreenManager.Game.Services.GetService<GameState>().Reset();
            //    LoadingScreen.Load(ScreenManager, false, new LevelMenuScreen());
            //};

            //MenuEntries.Add(newGameMenu);

            //var demoLevelMenu = new GrowingMenuEntry("CONTINUE SAVED GAME")
            //{
            //    Position = new Vector2(120, 120),
            //    IsVisible = File.Exists(SavedGame.DefaultSaveGameFile)
            //};

            //demoLevelMenu.Selected += ContinueSavedGame;
            //MenuEntries.Add(demoLevelMenu);

            //var exitMenuItem = new GrowingMenuEntry("EXIT")
            //{
            //    Position = new Vector2(120, 200),
            //};

            //exitMenuItem.Selected += (o, e) => ScreenManager.Game.Exit();
            //MenuEntries.Add(exitMenuItem);

            var newGameMenu = new GrowingMenuEntry("Press here to continue...")
            {
                Position = new Vector2(230, 230),
            };

            newGameMenu.Selected += (o, e) =>
            {
                // Reset GameState if it was changed by previous games or by loading from file.
                //ScreenManager.Game.Services.GetService<GameState>().Reset();
                var state = ScreenManager.Game.Services.GetService<GameState>();
                SavedGame.Load(SavedGame.DefaultSaveGameFile, state);
                LoadingScreen.Load(ScreenManager, false, new ComixScreen());
            };

            MenuEntries.Add(newGameMenu);
        }
コード例 #3
0
        public AlternativeMenuScreen()
        {
            //var newGameMenu = new GrowingMenuEntry("NEW GAME")
            //{
            //    Position = new Vector2(120, 40),
            //};

            //newGameMenu.Selected += (o, e) =>
            //{
            //    // Reset GameState if it was changed by previous games or by loading from file.
            //    ScreenManager.Game.Services.GetService<GameState>().Reset();
            //    LoadingScreen.Load(ScreenManager, false, new LevelMenuScreen());
            //};

            //MenuEntries.Add(newGameMenu);

            //var exitMenuItem = new GrowingMenuEntry("EXIT")
            //{
            //    Position = new Vector2(120, 200),
            //};

            //exitMenuItem.Selected += (o, e) => ScreenManager.Game.Exit();
            //MenuEntries.Add(exitMenuItem);

            var newGameMenu = new GrowingMenuEntry("Press here to continue...")
            {
                Position = new Vector2(250, 230),
                MaxScale = 1.5f,
                GrowingTime = 100
            };

            //newGameMenu.Selected += (o, e) =>
            //{
            //    // Reset GameState if it was changed by previous games or by loading from file.
            //    var state = ScreenManager.Game.Services.GetService<GameState>();
            //    SavedGame.Load(SavedGame.DefaultSaveGameFile, state);
            //    LoadingScreen.Load(ScreenManager, false, new LevelMenuScreen());
            //};

            MenuEntries.Add(newGameMenu);
        }
コード例 #4
0
ファイル: PauseMenuScreen.cs プロジェクト: sergik/Cardio
        public PauseMenuScreen()
        {
            //var level = Game.Services.GetService<GameState>().Level;

            var newGameMenu = new GrowingMenuEntry("MENU")
                                  {
                                      Position = new Vector2(300, 150),
                                  };
            newGameMenu.Selected +=
                (o, e) =>
                    {
                        LoadingScreen.Load(ScreenManager, true, new LevelMenuScreen());
                        //level.Melody.Stop();
                    };
            MenuEntries.Add(newGameMenu);

            var resumeGameMenu = new GrowingMenuEntry("RESUME GAME")
                                     {
                                         Position = new Vector2(300, 230),
                                     };
            resumeGameMenu.Selected += (o, e) => ExitScreen();
            MenuEntries.Add(resumeGameMenu);
        }
コード例 #5
0
ファイル: LevelMenuScreen.cs プロジェクト: sergik/Cardio
        public override void LoadContent()
        {
            _levelSelectionMenu = new GrowingMenuEntry("LEVEL");
            MenuEntries.Add(_levelSelectionMenu);

            _shopMenu = new GrowingMenuEntry("SHOP");
            MenuEntries.Add(_shopMenu);

            _exitMenu = new GrowingMenuEntry("EXIT");
            MenuEntries.Add(_exitMenu);

            LevelSelection = new LevelSelectionScreen(ScreenManager.Game, this);
            Shop = new ShopScreen(ScreenManager.Game);
            Shop.SelectedCategory = ShopSelectedCategory;

            _levelSelectionMenu.Position = new Vector2(120, 16);
            _levelSelectionMenu.Selected += (s, e) => _activeTab = Tabs.LevelSelection;

            _shopMenu.Position = new Vector2(240, 18);
            _shopMenu.Selected += (s, e) => _activeTab = Tabs.Shop;

            _exitMenu.Position = new Vector2(360, 18);
            _exitMenu.Selected += (s, e) => ScreenManager.Game.Exit();

            LevelSelection.Initialize();
            Shop.Initialize();

            SoundManager.MenuMelody.Play();

            if(SelectedTab.HasValue)
            {
                _activeTab = SelectedTab.Value;
            }

            base.LoadContent();
        }
コード例 #6
0
        private void InitializeButtons()
        {
            //_fromClipboard = new GrowingMenuEntry("PASTE FROM CLIPBOARD") { Position = new Vector2(550, 290) };
            //_fromClipboard.Selected += (o, e) =>
            //                           {
            //                               _pinTextBox.Text = Clipboard.GetText();
            //                           };
            //MenuEntries.Add(_fromClipboard);

            var submitPin = new GrowingMenuEntry("SUBMIT PIN AND POST TWEET") { Position = new Vector2(180, 420) };
            submitPin.Selected += (o, e) =>
                                      {
                                          if (!string.IsNullOrEmpty(_pinTextBox.Text))
                                          {
                                              if (_twitter.IsInitialized &&
                                                  _twitter.AuthenticateWith(_pinTextBox.Text) &&
                                                  _twitter.SendTweet(TextToSendAsTweet))
                                              {
                                                  Tweeted = true;
                                                  TweenSent.Fire(this, () => EventArgs.Empty);
                                              }
                                          }
                                      };
            MenuEntries.Add(submitPin);

            var back = new GrowingMenuEntry("BACK") { Position = new Vector2(40, ScreenManager.Game.GraphicsDevice.Viewport.Height - 40) };
            back.Selected += (o, e) => ExitScreen();
            MenuEntries.Add(back);
        }
コード例 #7
0
ファイル: LevelThumbnail.cs プロジェクト: sergik/Cardio
 public LevelThumbnail()
 {
     _menuEntry = new GrowingMenuEntry("");
     TextOffset = new Vector2(0, 5);
 }
コード例 #8
0
ファイル: LevelShop.cs プロジェクト: sergik/Cardio
        private void CreateTabs()
        {
            var inventory = Game.Services.GetService<InventoryService>();
            var guns = new GrowingMenuEntry("GUNS");
            guns.Position = new Vector2(Position.X - 20, Position.Y + 60);
            EventHandler<EventArgs> gunsSelected = (s, e) =>
            {
                ItemsSetToDisplay.Clear();
                foreach (var gun in Guns)
                {
                    ItemsSetToDisplay.Add(gun);
                }
                InitializeItemsPositions();
                SetAvailibility(ItemsSetToDisplay, inventory.Gun);
            };
            guns.Selected += gunsSelected;
            Tabs.Add(guns);
            gunsSelected(null, null);

            var shields = new GrowingMenuEntry("SHIELDS");
            shields.Position = new Vector2(Position.X - 20, Position.Y + 100);
            shields.Selected += (s, e) =>
                                    {
                                        ItemsSetToDisplay.Clear();
                                        foreach (var shield in Shields)
                                        {
                                            ItemsSetToDisplay.Add(shield);
                                        }
                                        InitializeItemsPositions();
                                        SetAvailibility(ItemsSetToDisplay, inventory.Shield);
                                    };
            Tabs.Add(shields);

            var bodies = new GrowingMenuEntry("BODIES");
            bodies.Position = new Vector2(Position.X - 20, Position.Y + 140);
            bodies.Selected += (s, e) =>
                                    {
                                        ItemsSetToDisplay.Clear();
                                        foreach (var body in Bodies)
                                        {
                                            ItemsSetToDisplay.Add(body);
                                        }
                                        InitializeItemsPositions();
                                        SetAvailibility(ItemsSetToDisplay, inventory.Body);
                                    };
            Tabs.Add(bodies);

            var medcits = new GrowingMenuEntry("MEDCITS");
            medcits.Position = new Vector2(Position.X - 20, Position.Y + 220);
            medcits.Selected += (s, e) =>
                                    {
                                        ItemsSetToDisplay.Clear();
                                        foreach (var medcit in Medcits)
                                        {
                                            ItemsSetToDisplay.Add(medcit);
                                        }
                                        InitializeItemsPositions();
                                        SetAvailibility(ItemsSetToDisplay, inventory.Medcit);
                                    };
            Tabs.Add(medcits);

            var tablets = new GrowingMenuEntry("TABLETS");
            tablets.Position = new Vector2(Position.X - 20, Position.Y + 260);
            tablets.Selected += (s, e) =>
            {
                ItemsSetToDisplay.Clear();
                foreach (var tablet in Tablets)
                {
                    ItemsSetToDisplay.Add(tablet);
                }
                InitializeItemsPositions();
                SetAvailibility(ItemsSetToDisplay, inventory.Tablet);
            };
            Tabs.Add(tablets);

            var spikes = new GrowingMenuEntry("SPIKES");
            spikes.Position = new Vector2(Position.X - 20, Position.Y + 300);
            spikes.Selected += (s, e) =>
                                   {
                                       ItemsSetToDisplay.Clear();
                                       foreach (var spike in Spikes)
                                       {
                                           ItemsSetToDisplay.Add(spike);
                                       }
                                       InitializeItemsPositions();
                                       SetAvailibility(ItemsSetToDisplay, inventory.Spike);
                                   };
            Tabs.Add(spikes);

            var plazma = new GrowingMenuEntry("PLAZMA");
            plazma.Position = new Vector2(Position.X - 20, Position.Y + 180);
            plazma.Selected += (s, e) =>
            {
                ItemsSetToDisplay.Clear();
                foreach (var pazma in FrontWeapons)
                {
                    ItemsSetToDisplay.Add(pazma);
                }
                InitializeItemsPositions();
                SetAvailibility(ItemsSetToDisplay, inventory.FrontWeapon);
            };
            Tabs.Add(plazma);

            _selectedTab = Tabs[0];
        }
コード例 #9
0
ファイル: LevelShop.cs プロジェクト: sergik/Cardio
        public void Initialize(Game game)
        {
            Game = game;
            _spriteBatch = game.Services.GetService<SpriteBatch>();

            foreach (var gun in Guns)
            {
                gun.Initialize(game);
            }
            foreach (var shield in Shields)
            {
                shield.Initialize(game);
            }
            foreach (var body in Bodies)
            {
                body.Initialize(game);
            }

            foreach (var frontWeapon in FrontWeapons)
            {
                frontWeapon.Initialize(game);
            }

            CreateTabs();

            foreach (var tab in Tabs)
            {
                tab.Initialize(game);
            }

            if (SelectedTabIndex.HasValue)
            {
                Tabs[SelectedTabIndex.Value].OnSelectEntry();
                _selectedTab = Tabs[SelectedTabIndex.Value];
            }

            LoadContent();
        }
コード例 #10
0
ファイル: LevelShop.cs プロジェクト: sergik/Cardio
        public void HandleInput()
        {
            if (InputManager.IsMouseButtonTriggered(x => x.LeftButton))
             {
                 var tab = Tabs.FirstOrDefault(
                     t => t.EntryArea.Contains(InputManager.CurrentMouseState.X, InputManager.CurrentMouseState.Y));
                 if (tab != null)
                 {
                     tab.OnSelectEntry();
                     _selectedTab = tab;
                 }
             }

            for (int index = 0; index < ItemsSetToDisplay.Count; index++)
            {
                var item = ItemsSetToDisplay[index];
                item.HandleInput();
            }
        }