diff --git a/RhythmBullet/RhythmBulletGame.cs b/RhythmBullet/RhythmBulletGame.cs index 28c2368..96ea8bd 100644 --- a/RhythmBullet/RhythmBulletGame.cs +++ b/RhythmBullet/RhythmBulletGame.cs @@ -38,7 +38,8 @@ namespace RecrownedAthenaeum private MainScreen mainScreen; private Texture2D currentCursorTexture; internal readonly MusicController musicController; - private Skin skin; + private SkinManager skinManager = new SkinManager(); + private readonly ISkin skin; public RhythmBulletGame() { @@ -47,12 +48,13 @@ namespace RecrownedAthenaeum assets = new ContentManagerController(Content); musicController = new MusicController(); - + skin = skinManager.Skin; resolutionContentResolver = new ResolutionContentResolver(); FontContentResolver fcr = new FontContentResolver(resolutionContentResolver); assets.contentPathModifier.Add(typeof(Texture2D), resolutionContentResolver); assets.contentPathModifier.Add(typeof(SpriteFont), fcr); - preferencesManager = new PreferencesManager(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/RhythmBullet", + preferencesManager = new PreferencesManager( + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/RhythmBullet", new General(), new Controls()); preferencesManager.Load(); @@ -123,12 +125,10 @@ namespace RecrownedAthenaeum else if (!initialLoadComplete) { Debug.WriteLine("Initial load complete."); - initialLoadComplete = true; - SetUpCursor(); - mainScreen = new MainScreen(assets); + Initiate(); } - screenManager.UpdateCurrentScreen(gameTime, assets.Done && musicController.musicList.Searched); + screenManager.UpdateCurrentScreen(gameTime, CheckReadyForInitiate()); InputUtilities.Update(); Camera.Update(); @@ -156,7 +156,7 @@ namespace RecrownedAthenaeum assets.UnloadAll(); QueueContent(); screenManager.Resize(new LoadingScreen(this, Content.Load("loading_ring"), 0.4f, true)); - SetUpCursor(); + UpdateCursor(); } private void PostResize() @@ -174,9 +174,16 @@ namespace RecrownedAthenaeum assets.Queue("UI"); } - private void SetUpCursor() + private void Initiate() { - Texture2D texture = assets.Get("cursor"); + initialLoadComplete = true; + UpdateCursor(); + mainScreen = new MainScreen(assets); + } + + private void UpdateCursor() + { + Texture2D texture = skin.CursorTexture; int cursorSize = (int)(0.08f * graphics.PreferredBackBufferHeight); Debug.WriteLine("Cursor size length: " + cursorSize); RenderTarget2D renderTarget = new RenderTarget2D(GraphicsDevice, cursorSize, cursorSize); @@ -192,6 +199,11 @@ namespace RecrownedAthenaeum Mouse.SetCursor(MouseCursor.FromTexture2D(currentCursorTexture, currentCursorTexture.Width / 2, currentCursorTexture.Height / 2)); } + private bool CheckReadyForInitiate() + { + return assets.Done && musicController.musicList.Searched && skinManager.ReadyForUse; + } + private void ShowFirstScreen(Screen Screen) { Screen.NextScreen = mainScreen;