Example #1
0
        private void StartTitle()
        {
            var title = sceneFactory.CreateTitleScene();

            scenes.Add(title);

            title.BeginGame += player =>
            {
                var game = sceneFactory.CreateGamePlayScene();
                game.Run(player);

                scenes.Remove(title);
                scenes.Add(game);

                game.SceneEnd += (_, __) => StartTitle();
            };
        }
Example #2
0
        private void Mouse_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (hideTitle)
            {
                hideTitle          = false;
                timeSinceMouseMove = 0;

                return;
            }
            if (mousex > 100 - 20 && mousex < 500 && mousey > 100 && mousey < 130)
            {
                GameState gameState = gameStateFactory.CreateGameState();
                gameState.world = beginningWorld;
                gameState.level = beginningLevel;

                BeginGame?.Invoke(gameState);
            }

            if (mousex > 100 - 20 && mousex < 500 && mousey > 160 && mousey < 190)
            {
                SceneStack.Remove(this);
            }
            if (mousex > 100 - 20 && mousex < 500 && mousey > 250 && mousey < 280)
            {
                config.BackgroundScroll = !config.BackgroundScroll;
                game.bgspeed            = config.BackgroundScroll ? 50.0f : 0.0f;
            }
            if (mousex > 100 - 20 && mousex < 500 && mousey > 280 && mousey < 320)
            {
                config.PlayMusic = !config.PlayMusic;

                if (config.PlayMusic)
                {
                    StartTitleMusic();
                }
                else
                {
                    MediaPlayer.Stop();
                }
            }
        }