diff --git a/RhythmBullet/RhythmBulletGame.cs b/RhythmBullet/RhythmBulletGame.cs index 07dfa38..56a5484 100644 --- a/RhythmBullet/RhythmBulletGame.cs +++ b/RhythmBullet/RhythmBulletGame.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; +using RhythmBullet.Zer01HD.Audio; using RhythmBullet.Zer01HD.ContentResolvers; using RhythmBullet.Zer01HD.Preferences; using RhythmBullet.Zer01HD.Screens.MainMenu; @@ -27,7 +28,7 @@ namespace RhythmBullet GraphicsDeviceManager graphics; SpriteBatch spriteBatch; - public readonly ContentManagerController Assets; + public readonly ContentManagerController assets; readonly ResolutionContentResolver resolutionContentResolver; public PreferencesManager preferencesManager; private ScreenManager screenManager; @@ -36,17 +37,20 @@ namespace RhythmBullet private bool initialLoadComplete; private MainScreen mainScreen; private Texture2D currentCursorTexture; + internal readonly MusicController musicController; public RhythmBulletGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; - Assets = new ContentManagerController(Content); + assets = new ContentManagerController(Content); + + musicController = new MusicController(); resolutionContentResolver = new ResolutionContentResolver(); FontContentResolver fcr = new FontContentResolver(resolutionContentResolver); - Assets.contentPathModifier.Add(typeof(Texture2D), resolutionContentResolver); - Assets.contentPathModifier.Add(typeof(SpriteFont), fcr); + assets.contentPathModifier.Add(typeof(Texture2D), resolutionContentResolver); + assets.contentPathModifier.Add(typeof(SpriteFont), fcr); preferencesManager = new PreferencesManager(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/RhythmBullet", new General(), new Controls()); @@ -67,6 +71,8 @@ namespace RhythmBullet Resolution resolution = preferencesManager.GetPreferences().Resolution; resolutionContentResolver.Width = resolution.Width; resolutionContentResolver.Height = resolution.Height; + musicController.musicList.path = preferencesManager.GetPreferences().MusicDirectory; + musicController.musicList.StartSearch(); Debug.WriteLine("Initial setup complete."); base.Initialize(); } @@ -92,7 +98,7 @@ namespace RhythmBullet /// protected override void UnloadContent() { - Assets.UnloadAll(); + assets.UnloadAll(); screenManager.Dispose(); currentCursorTexture.Dispose(); } @@ -104,9 +110,9 @@ namespace RhythmBullet /// Provides a snapshot of timing values. protected override void Update(GameTime gameTime) { - if (!Assets.Done) + if (!assets.Done) { - Assets.Update(); + assets.Update(); } else if (resizing) { @@ -118,10 +124,10 @@ namespace RhythmBullet Debug.WriteLine("Initial load complete."); initialLoadComplete = true; SetUpCursor(); - mainScreen = new MainScreen(Assets); + mainScreen = new MainScreen(assets); } - screenManager.UpdateCurrentScreen(gameTime, Assets.Done); + screenManager.UpdateCurrentScreen(gameTime, assets.Done && musicController.musicList.Searched); InputUtilities.Update(); Camera.Update(); @@ -146,7 +152,7 @@ namespace RhythmBullet graphics.PreferredBackBufferWidth = width; graphics.PreferredBackBufferHeight = height; resizing = true; - Assets.UnloadAll(); + assets.UnloadAll(); QueueContent(); screenManager.Resize(new LoadingScreen(this, Content.Load("loading_ring"), 0.4f)); SetUpCursor(); @@ -160,15 +166,15 @@ namespace RhythmBullet private void QueueContent() { - Assets.Queue("cursor", false); - Assets.Queue("title"); - Assets.Queue("default_cover", false); - Assets.Queue("backgrounds/mainBG"); + assets.Queue("cursor", false); + assets.Queue("title"); + assets.Queue("default_cover", false); + assets.Queue("backgrounds/mainBG"); } private void SetUpCursor() { - Texture2D texture = Assets.Get("cursor"); + Texture2D texture = assets.Get("cursor"); int cursorSize = (int)(0.08f * graphics.PreferredBackBufferHeight); Debug.WriteLine("Cursor size length: " + cursorSize); RenderTarget2D renderTarget = new RenderTarget2D(GraphicsDevice, cursorSize, cursorSize);