Пример #1
0
        private void Start()
        {
            MWDataReader = new MorrowindDataReader(dataPath);
            MWEngine     = new MorrowindEngine(MWDataReader, UIManager);

            if (playMusic)
            {
                // Start the music.
                musicPlayer = new MusicPlayer();

                foreach (var songFilePath in Directory.GetFiles(dataPath + "/Music/Explore"))
                {
                    if (!songFilePath.Contains("Morrowind Title"))
                    {
                        musicPlayer.AddSong(songFilePath);
                    }
                }

                musicPlayer.Play();
            }

            // Spawn the player.
            //MWEngine.SpawnPlayerInside(playerPrefab, new Vector2i(4537908, 1061158912), new Vector3(0.8f, -0.45f, -1.4f));

            MWEngine.SpawnPlayerOutside(playerPrefab, new Vector2i(-2, -9), new Vector3(-137.94f, 2.30f, -1037.6f));
        }
Пример #2
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth  = 1024; // set screen dimensions 4:3 as per Bark's sketch
            graphics.PreferredBackBufferHeight = 768;
            graphics.ApplyChanges();

            Content.RootDirectory = "Content";
            IsMouseVisible        = true;

            musicPlayer = new MusicPlayer();
            musicPlayer.Initialize();

            string currentDir = Directory.GetCurrentDirectory();

            musicPlayer.AddSong(currentDir + "\\Kickin.mp3");
            musicPlayer.LoadSong(0, true);
            musicPlayer.Play();

            // User needs to register all the Screens that have been created!
            ScreenGameComponent screenGameComponent = new ScreenGameComponent(this);

            screenGameComponent.Register <Screen>(new MainMenuScreen(this.Services));
            screenGameComponent.Register <Screen>(new GameplayScreen(this.Services));
            Components.Add(screenGameComponent);
        }
Пример #3
0
        void Start()
        {
            var dataPath = FileManager.GetFilePath(".", _gameId);

            _asset  = new TesAssetPack(dataPath, null);
            _data   = new TesDataPack(dataPath, null, _gameId);
            _engine = new TesEngine(AssetManager.GetAssetManager(EngineId.Tes), _asset, _data, UIManager);
            if (_playMusic)
            {
                // Start the music.
                _musicPlayer = new MusicPlayer();
                if (_gameId == GameId.Morrowind)
                {
                    foreach (var songFilePath in Directory.GetFiles(dataPath + "/Music/Explore"))
                    {
                        if (!songFilePath.Contains("Morrowind Title"))
                        {
                            _musicPlayer.AddSong(songFilePath);
                        }
                    }
                }
                _musicPlayer.Play();
            }

            // Spawn the player.
            _engine.SpawnPlayer(PlayerPrefab, new Vector3(-137.94f, 2.30f, -1037.6f)); // new Vector3Int(-2, -9, 0),
        }
Пример #4
0
        public async Task Load(CommandContext ctx, [Description("Playlist name")] string playlistName)
        {
            var playlist = await _context.Playlists.Include(p => p.Songs).ThenInclude(s => s.Song)
                           .SingleOrDefaultAsync(p => p.Name == playlistName && p.ServerId == ctx.Guild.Id);

            if (playlist == null)
            {
                await ctx.RespondAsync($"Playlist {Formatter.Bold(playlistName)} does not exist.");

                return;
            }

            var songs = playlist.Songs.Select(s => s.Song).ToList();

            MusicPlayer = new MusicPlayer(ctx, _context)
            {
                Playlist = playlist
            };

            foreach (var song in songs)
            {
                await MusicPlayer.AddSong(song);
            }
            await MusicPlayer.Play();
        }
Пример #5
0
        public void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(_game.GraphicsDevice);
            _infoPanel   = new InfoPanel(ContentRepository, _screen);

            _music.AddSong("the_lift", ContentRepository.LoadSong("Music/the_lift"));
            _music.AddSoundEffect("explode", ContentRepository.LoadSoundEffect("Sounds/explode"));
            _music.AddSoundEffect("star", ContentRepository.LoadSoundEffect("Sounds/floop"));

            _tile   = ContentRepository.LoadTexture("Textures/tile");
            _effect = ContentRepository.LoadEffect("Effects/Tunnel"
#if ANDROID
                                                   + ".android"
#endif
                                                   );

            _tunnel         = new Tunnel(32, _effect, _tile);
            _player         = new Player(ContentRepository, _game, _camera, _tunnel);
            _player.Visible = false;

            _elemManager = new ElementManager(ContentRepository, _sceneInterface, _game, _camera, _tunnel, _player, _music);
            angleUpdate  = 0;

            _font[0]      = ContentRepository.LoadFont("Fonts/Ubuntu12");
            _font[1]      = ContentRepository.LoadFont("Fonts/Ubuntu24");
            _font[2]      = ContentRepository.LoadFont("Fonts/Ubuntu36");
            _font[3]      = ContentRepository.LoadFont("Fonts/Ubuntu48");
            _font[4]      = ContentRepository.LoadFont("Fonts/Ubuntu64");
            _fontIcons[0] = ContentRepository.LoadFont("Fonts/Awesome12");
            _fontIcons[1] = ContentRepository.LoadFont("Fonts/Awesome24");
            _fontIcons[2] = ContentRepository.LoadFont("Fonts/Awesome36");
            _fontIcons[3] = ContentRepository.LoadFont("Fonts/Awesome48");
            _fontIcons[4] = ContentRepository.LoadFont("Fonts/Awesome64");
        }
Пример #6
0
 public void InitializeMusicPlayer()
 {
     mPlayer = new MusicPlayer(isMusicEnabled);
     mPlayer.AddSong("MusicTrack_1_Sun_Spots");                  // 0 Start Screen
     mPlayer.AddSong("MusicTrack_2_Start_Your_Engines");         // 1 Start Race
     mPlayer.AddSong("MusicTrack_3_EasyTopUnderscore");          // 2 End Race / Congratulations
     mPlayer.AddSong("MusicTrack_4_Hungry_For_Disaster");        // 3 Start Race
     mPlayer.AddSong("MusicTrack_5_Road_Star");                  // 4 Final Congratulations
     mPlayer.AddSong("MusicTrack_6_Run");                        // 5 Start Race
 }
Пример #7
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth  = 1024; // set screen dimensions 4:3 as per Bark's sketch
            graphics.PreferredBackBufferHeight = 768;
            graphics.ApplyChanges();

            Content.RootDirectory = "Content";
            IsMouseVisible        = true;

            MusicPlayer.Initialize();
            string currentDir = Directory.GetCurrentDirectory();

            MusicPlayer.AddSong(currentDir + "\\Content\\117BPMKickin_new.mp3");
            MusicPlayer.BPM = 117;

            screenManager           = Components.Add <ScreenManager>();
            screenManager.DrawOrder = 99;
            GameSettings.Read();

            MusicPlayer.MasterVolume = GameSettings.MasterVolume / 100f;
            MusicPlayer.MusicVolume  = (GameSettings.MusicVolume / 100f) * (MusicPlayer.MasterVolume);
            MusicPlayer.SFXVolume    = (GameSettings.EffectsVolume / 100f) * (MusicPlayer.MasterVolume);
        }