/// <summary> /// Ctor - /// </summary> /// <param name="store"></param> /// <param name="mode"></param> internal SkinKeys(SkinStore store, GameMode mode) { Store = store; Mode = mode; switch (Mode) { case GameMode.Keys4: ShortName = "4k"; SetDefault4KConfig(); break; case GameMode.Keys7: ShortName = "7k"; SetDefault7KConfig(); break; default: throw new InvalidEnumArgumentException($"SkinKeys can only be instantiated with: {GameMode.Keys4} or {GameMode.Keys7}. Got {Mode}"); } // Set the generic config variables, and THEN try to read from // skin.ini. SetGenericConfig(); ReadConfig(); LoadTextures(); }
/// <summary> /// Ctor - /// </summary> /// <param name="store"></param> /// <param name="mode"></param> internal SkinKeys(SkinStore store, GameMode mode) { Store = store; Mode = mode; // Set the generic config variables, and THEN try to read from // skin.ini. ReadConfig(true); ReadConfig(false); LoadTextures(); }
/// <summary> /// Loads a spritesheet /// </summary> /// <param name="folder"></param> /// <param name="element"></param> /// <param name="shared">If the resource is shared between key modes.</param> /// <param name="rows"></param> /// <param name="columns"></param> /// <param name="extension"></param> /// <returns></returns> private List <Texture2D> LoadSpritesheet(SkinKeysFolder folder, string element, bool shared, int rows, int columns, string extension = ".png") { string resource; if (shared) { resource = $"Quaver.Resources/Textures/Skins/Shared/{folder.ToString()}/{element}"; } else { resource = $"Quaver.Resources/Textures/Skins/{ConfigManager.DefaultSkin.Value.ToString()}/{folder.ToString()}" + $"/{Mode.ToString()}/{GetResourcePath(element)}"; } var folderName = shared ? folder.ToString() : $"/{ShortName}/{folder.ToString()}/"; return(SkinStore.LoadSpritesheet(folderName, element, resource, rows, columns, extension)); }
/// <summary> /// Loads an individual skin element. /// </summary> /// <param name="folder"></param> /// <param name="element"></param> /// <param name="shared">If the resource is shared between key modes.</param> /// <param name="extension"></param> /// <returns></returns> private Texture2D LoadTexture(SkinKeysFolder folder, string element, bool shared, string extension = ".png") { string resource; if (shared) { resource = $"Quaver.Resources/Textures/Skins/Shared/{folder.ToString()}/{element}.png"; } else { resource = $"Quaver.Resources/Textures/Skins/{ConfigManager.DefaultSkin.Value.ToString()}/{folder.ToString()}" + $"/{Mode.ToString()}/{GetResourcePath(element)}.png"; } var folderName = shared ? folder.ToString() : $"/{ShortName}/{folder.ToString()}"; return(SkinStore.LoadSingleTexture($"{SkinStore.Dir}/{folderName}/{element}", resource)); }
/// <summary> /// Loads the currently selected skin /// </summary> public static void Load() => Skin = new SkinStore();