diff --git a/References/RecrownedAthenaeum.dll b/References/RecrownedAthenaeum.dll index 8a0d36c..76de182 100644 Binary files a/References/RecrownedAthenaeum.dll and b/References/RecrownedAthenaeum.dll differ diff --git a/References/RecrownedAthenaeum.xml b/References/RecrownedAthenaeum.xml index 2c31c84..b07e56b 100644 --- a/References/RecrownedAthenaeum.xml +++ b/References/RecrownedAthenaeum.xml @@ -637,6 +637,13 @@ RGBA data of this color. + + + Sets values for data. + + the name to be referenced by. + The color value represents. + Definition data for data transfer. @@ -652,6 +659,13 @@ The skin definition data. + + + Sets values for data. + + The name to be referenced by. + The skin data. + Generates region given . @@ -1736,11 +1750,16 @@ Manages reference to default and loading of custom skins. - + Whether or not the skin manager is set up with a and . + + + Whether or not this manager has been set up with at least a base skin. + + The list of paths for all found skins by . May be null. @@ -1778,7 +1797,7 @@ - The fallback skin in case the selected skin doesn't cover a specific definition or color. + The default skin in case the selected skin doesn't cover a specific definition or color. @@ -1800,7 +1819,7 @@ - loads a skin asynchronously. + loads a skin asynchronously to the . Graphics device to use for texture creation. Uses graphics device from by default. The data to generate from. diff --git a/RhythmBullet/Preferences/General.cs b/RhythmBullet/Preferences/General.cs index 2532b1c..742adf7 100644 --- a/RhythmBullet/Preferences/General.cs +++ b/RhythmBullet/Preferences/General.cs @@ -10,5 +10,7 @@ namespace RhythmBullet.Preferences public float MusicVolume = 1f; public float FXVolume = 1f; public string MusicDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic); + public string skinName; + public string skinDirectory; } } diff --git a/RhythmBullet/RhythmBulletGame.cs b/RhythmBullet/RhythmBulletGame.cs index 565c1b7..f616aee 100644 --- a/RhythmBullet/RhythmBulletGame.cs +++ b/RhythmBullet/RhythmBulletGame.cs @@ -4,11 +4,13 @@ using Microsoft.Xna.Framework.Input; using RecrownedAthenaeum.Camera; using RecrownedAthenaeum.ContentSystem; using RecrownedAthenaeum.ContentSystem.ContentResolvers; +using RecrownedAthenaeum.Data; using RecrownedAthenaeum.Input; using RecrownedAthenaeum.Persistence; using RecrownedAthenaeum.ScreenSystem; using RecrownedAthenaeum.SpecialTypes; using RecrownedAthenaeum.UI.Skin; +using RecrownedAthenaeum.UI.Skin.Definitions; using RhythmBullet.Audio; using RhythmBullet.Preferences; using RhythmBullet.Screens.MainMenu; @@ -40,7 +42,7 @@ namespace RhythmBullet private Texture2D currentCursorTexture; internal readonly MusicController musicController; private SkinManager skinManager = new SkinManager(); - private readonly ISkin skin; + private ISkin Skin { get { return skinManager.Skin; } } public RhythmBulletGame() { @@ -49,7 +51,6 @@ namespace RhythmBullet assets = new ContentManagerController(Content); musicController = new MusicController(); - skin = skinManager.Skin; resolutionContentResolver = new ResolutionContentResolver(); FontContentResolver fcr = new FontContentResolver(resolutionContentResolver); assets.contentPathModifier.Add(typeof(Texture2D), resolutionContentResolver); @@ -73,11 +74,16 @@ namespace RhythmBullet /// protected override void Initialize() { - Resolution resolution = preferencesManager.GetPreferences().Resolution; + General general = preferencesManager.GetPreferences(); + Resolution resolution = general.Resolution; resolutionContentResolver.Width = resolution.Width; resolutionContentResolver.Height = resolution.Height; - musicController.musicList.path = preferencesManager.GetPreferences().MusicDirectory; + musicController.musicList.path = general.MusicDirectory; musicController.musicList.StartSearch(); + if ((general.skinName ) != null) + { + skinManager.LoadSkin(skinManager.ReadSkinData(general.skinDirectory + general.skinName), general.skinDirectory + general.skinName); + } Debug.WriteLine("Initial setup complete."); base.Initialize(); } @@ -123,7 +129,7 @@ namespace RhythmBullet } else if (!initialLoadComplete && CheckReadyForInitiate()) { - Initiate(); + PostLoad(); } } else @@ -167,6 +173,27 @@ namespace RhythmBullet screenManager.PostResize(); } + private bool CheckReadyForInitiate() + { + bool ready = true; + if (!assets.Done || + !musicController.musicList.Searched) + { + ready = false; + } + + if (preferencesManager.GetPreferences().skinName != null && !skinManager.MergingSkins) + { + ready = false; + } + return ready; + } + + private void ShowFirstScreen(Screen Screen) + { + Screen.NextScreen = mainScreen; + } + private void QueueContent() { assets.Queue("cursor", false); @@ -176,16 +203,18 @@ namespace RhythmBullet assets.Queue("UI"); } - private void Initiate() + private void PostLoad() { - initialLoadComplete = true; + Debug.WriteLine("Initial setup and loading complete."); + SetUpDefaultSkin(); UpdateCursor(); mainScreen = new MainScreen(assets); + initialLoadComplete = true; } private void UpdateCursor() { - Texture2D texture = skin.CursorTexture; + Texture2D texture = skinManager.Skin.CursorTexture; int cursorSize = (int)(0.08f * graphics.PreferredBackBufferHeight); Debug.WriteLine("Cursor size length: " + cursorSize); RenderTarget2D renderTarget = new RenderTarget2D(GraphicsDevice, cursorSize, cursorSize); @@ -201,14 +230,17 @@ namespace RhythmBullet Mouse.SetCursor(MouseCursor.FromTexture2D(currentCursorTexture, currentCursorTexture.Width / 2, currentCursorTexture.Height / 2)); } - private bool CheckReadyForInitiate() + private void SetUpDefaultSkin() { - return assets.Done && musicController.musicList.Searched && skinManager.ReadyForUse; - } + Skin skin = new Skin(assets.Get("UI"), assets.Get("cursor")); + skin.AddColor("default", Color.White); - private void ShowFirstScreen(Screen Screen) - { - Screen.NextScreen = mainScreen; + TextButtonSkinDefinition textButtonSkinDefinition = new TextButtonSkinDefinition("Rounded9pButton-down", "Rounded9pButton"); + textButtonSkinDefinition.disabledRegion = "Rounded9pButton-disabled"; + skin.AddDefinition("default", textButtonSkinDefinition); + + skin.Laminate(); + skinManager.BaseSkin = skin; } } }