diff --git a/src/itdelatrisu/opsu/beatmap/BeatmapSetList.java b/src/itdelatrisu/opsu/beatmap/BeatmapSetList.java index 5045dbf5..7c5aab81 100644 --- a/src/itdelatrisu/opsu/beatmap/BeatmapSetList.java +++ b/src/itdelatrisu/opsu/beatmap/BeatmapSetList.java @@ -19,7 +19,6 @@ package itdelatrisu.opsu.beatmap; import itdelatrisu.opsu.ErrorHandler; -import itdelatrisu.opsu.SongSort; import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.audio.MusicController; import itdelatrisu.opsu.db.BeatmapDB; @@ -378,7 +377,7 @@ public class BeatmapSetList { return; // sort the list - Collections.sort(nodes, SongSort.getSort().getComparator()); + Collections.sort(nodes, BeatmapSortOrder.getSort().getComparator()); expandedIndex = -1; expandedStartNode = expandedEndNode = null; diff --git a/src/itdelatrisu/opsu/SongSort.java b/src/itdelatrisu/opsu/beatmap/BeatmapSortOrder.java similarity index 90% rename from src/itdelatrisu/opsu/SongSort.java rename to src/itdelatrisu/opsu/beatmap/BeatmapSortOrder.java index 50fbf81d..a9c3c545 100644 --- a/src/itdelatrisu/opsu/SongSort.java +++ b/src/itdelatrisu/opsu/beatmap/BeatmapSortOrder.java @@ -16,10 +16,9 @@ * along with opsu!. If not, see . */ -package itdelatrisu.opsu; +package itdelatrisu.opsu.beatmap; -import itdelatrisu.opsu.beatmap.Beatmap; -import itdelatrisu.opsu.beatmap.BeatmapSetNode; +import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.ui.MenuButton; import itdelatrisu.opsu.ui.UI; @@ -30,9 +29,9 @@ import java.util.Comparator; import org.newdawn.slick.Image; /** - * BeatmapSetNode sorts. + * Beatmap sorting orders. */ -public enum SongSort { +public enum BeatmapSortOrder { TITLE (0, "Title", new TitleOrder()), ARTIST (1, "Artist", new ArtistOrder()), CREATOR (2, "Creator", new CreatorOrder()), @@ -54,27 +53,27 @@ public enum SongSort { /** Total number of sorts. */ private static final int SIZE = values().length; - /** Array of SongSort objects in reverse order. */ - public static final SongSort[] VALUES_REVERSED; + /** Array of BeatmapSortOrder objects in reverse order. */ + public static final BeatmapSortOrder[] VALUES_REVERSED; static { VALUES_REVERSED = values(); Collections.reverse(Arrays.asList(VALUES_REVERSED)); } /** Current sort. */ - private static SongSort currentSort = TITLE; + private static BeatmapSortOrder currentSort = TITLE; /** * Returns the current sort. * @return the current sort */ - public static SongSort getSort() { return currentSort; } + public static BeatmapSortOrder getSort() { return currentSort; } /** * Sets a new sort. * @param sort the new sort */ - public static void setSort(SongSort sort) { SongSort.currentSort = sort; } + public static void setSort(BeatmapSortOrder sort) { BeatmapSortOrder.currentSort = sort; } /** * Compares two BeatmapSetNode objects by title. @@ -144,7 +143,7 @@ public enum SongSort { * @param name the sort name * @param comparator the comparator for the sort */ - SongSort(int id, String name, Comparator comparator) { + BeatmapSortOrder(int id, String name, Comparator comparator) { this.id = id; this.name = name; this.comparator = comparator; diff --git a/src/itdelatrisu/opsu/states/SongMenu.java b/src/itdelatrisu/opsu/states/SongMenu.java index fb3dc464..0bd8dc0d 100644 --- a/src/itdelatrisu/opsu/states/SongMenu.java +++ b/src/itdelatrisu/opsu/states/SongMenu.java @@ -27,7 +27,6 @@ import itdelatrisu.opsu.Options; import itdelatrisu.opsu.OsuParser; import itdelatrisu.opsu.OszUnpacker; import itdelatrisu.opsu.ScoreData; -import itdelatrisu.opsu.SongSort; import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.audio.MultiClip; import itdelatrisu.opsu.audio.MusicController; @@ -36,6 +35,7 @@ import itdelatrisu.opsu.audio.SoundEffect; import itdelatrisu.opsu.beatmap.Beatmap; import itdelatrisu.opsu.beatmap.BeatmapSetList; import itdelatrisu.opsu.beatmap.BeatmapSetNode; +import itdelatrisu.opsu.beatmap.BeatmapSortOrder; import itdelatrisu.opsu.db.BeatmapDB; import itdelatrisu.opsu.db.ScoreDB; import itdelatrisu.opsu.states.ButtonMenu.MenuState; @@ -228,7 +228,7 @@ public class SongMenu extends BasicGameState { footerY = height - GameImage.SELECTION_MODS.getImage().getHeight(); // initialize sorts - for (SongSort sort : SongSort.values()) + for (BeatmapSortOrder sort : BeatmapSortOrder.values()) sort.init(width, headerY - SongMenu.DIVIDER_LINE_WIDTH / 2); // initialize score data buttons @@ -388,15 +388,15 @@ public class SongMenu extends BasicGameState { selectOptionsButton.draw(); // sorting tabs - SongSort currentSort = SongSort.getSort(); - SongSort hoverSort = null; - for (SongSort sort : SongSort.values()) { + BeatmapSortOrder currentSort = BeatmapSortOrder.getSort(); + BeatmapSortOrder hoverSort = null; + for (BeatmapSortOrder sort : BeatmapSortOrder.values()) { if (sort.contains(mouseX, mouseY)) { hoverSort = sort; break; } } - for (SongSort sort : SongSort.VALUES_REVERSED) { + for (BeatmapSortOrder sort : BeatmapSortOrder.VALUES_REVERSED) { if (sort != currentSort) sort.draw(false, sort == hoverSort); } @@ -636,10 +636,10 @@ public class SongMenu extends BasicGameState { return; // sorting buttons - for (SongSort sort : SongSort.values()) { + for (BeatmapSortOrder sort : BeatmapSortOrder.values()) { if (sort.contains(x, y)) { - if (sort != SongSort.getSort()) { - SongSort.setSort(sort); + if (sort != BeatmapSortOrder.getSort()) { + BeatmapSortOrder.setSort(sort); SoundController.playSound(SoundEffect.MENUCLICK); BeatmapSetNode oldFocusBase = BeatmapSetList.get().getBaseNode(focusNode.index); int oldFocusFileIndex = focusNode.beatmapIndex;