Fixed a bug where sounds weren't reloaded when changing skins.

When restarting the program through the options menu, all sounds now get reloaded if the skin was changed.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-06-03 06:23:23 -04:00
parent f3825eba5e
commit 90c8c9e705
4 changed files with 67 additions and 12 deletions

View File

@@ -911,15 +911,12 @@ public class Options {
* If the directory is invalid, the default skin will be loaded.
*/
public static void loadSkin() {
File root = getSkinRootDir();
File skinDir = new File(root, skinName);
if (!skinDir.isDirectory()) { // invalid skin name
File skinDir = getSkinDir();
if (skinDir == null) // invalid skin name
skinName = Skin.DEFAULT_SKIN_NAME;
skinDir = null;
}
// create available skins list
File[] dirs = SkinLoader.getSkinDirectories(root);
File[] dirs = SkinLoader.getSkinDirectories(getSkinRootDir());
skinDirs = new String[dirs.length + 1];
skinDirs[0] = Skin.DEFAULT_SKIN_NAME;
for (int i = 0; i < dirs.length; i++)
@@ -953,6 +950,21 @@ public class Options {
*/
public static Skin getSkin() { return skin; }
/**
* Returns the current skin directory.
* <p>
* NOTE: This directory will differ from that of the currently loaded skin
* if {@link #loadSkin()} has not been called after a directory change.
* Use {@link Skin#getDirectory()} to get the directory of the currently
* loaded skin.
* @return the skin directory, or null for the default skin
*/
public static File getSkinDir() {
File root = getSkinRootDir();
File dir = new File(root, skinName);
return (dir.isDirectory()) ? dir : null;
}
/**
* Returns a dummy Beatmap containing the theme song.
* @return the theme song beatmap