Renamed "SongSort" to "BeatmapSortOrder"; moved into "opsu.beatmaps".
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
2c47e9a1b9
commit
3f081f1a8a
|
@ -19,7 +19,6 @@
|
||||||
package itdelatrisu.opsu.beatmap;
|
package itdelatrisu.opsu.beatmap;
|
||||||
|
|
||||||
import itdelatrisu.opsu.ErrorHandler;
|
import itdelatrisu.opsu.ErrorHandler;
|
||||||
import itdelatrisu.opsu.SongSort;
|
|
||||||
import itdelatrisu.opsu.Utils;
|
import itdelatrisu.opsu.Utils;
|
||||||
import itdelatrisu.opsu.audio.MusicController;
|
import itdelatrisu.opsu.audio.MusicController;
|
||||||
import itdelatrisu.opsu.db.BeatmapDB;
|
import itdelatrisu.opsu.db.BeatmapDB;
|
||||||
|
@ -378,7 +377,7 @@ public class BeatmapSetList {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// sort the list
|
// sort the list
|
||||||
Collections.sort(nodes, SongSort.getSort().getComparator());
|
Collections.sort(nodes, BeatmapSortOrder.getSort().getComparator());
|
||||||
expandedIndex = -1;
|
expandedIndex = -1;
|
||||||
expandedStartNode = expandedEndNode = null;
|
expandedStartNode = expandedEndNode = null;
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
* along with opsu!. If not, see <http://www.gnu.org/licenses/>.
|
* along with opsu!. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package itdelatrisu.opsu;
|
package itdelatrisu.opsu.beatmap;
|
||||||
|
|
||||||
import itdelatrisu.opsu.beatmap.Beatmap;
|
import itdelatrisu.opsu.GameImage;
|
||||||
import itdelatrisu.opsu.beatmap.BeatmapSetNode;
|
|
||||||
import itdelatrisu.opsu.ui.MenuButton;
|
import itdelatrisu.opsu.ui.MenuButton;
|
||||||
import itdelatrisu.opsu.ui.UI;
|
import itdelatrisu.opsu.ui.UI;
|
||||||
|
|
||||||
|
@ -30,9 +29,9 @@ import java.util.Comparator;
|
||||||
import org.newdawn.slick.Image;
|
import org.newdawn.slick.Image;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BeatmapSetNode sorts.
|
* Beatmap sorting orders.
|
||||||
*/
|
*/
|
||||||
public enum SongSort {
|
public enum BeatmapSortOrder {
|
||||||
TITLE (0, "Title", new TitleOrder()),
|
TITLE (0, "Title", new TitleOrder()),
|
||||||
ARTIST (1, "Artist", new ArtistOrder()),
|
ARTIST (1, "Artist", new ArtistOrder()),
|
||||||
CREATOR (2, "Creator", new CreatorOrder()),
|
CREATOR (2, "Creator", new CreatorOrder()),
|
||||||
|
@ -54,27 +53,27 @@ public enum SongSort {
|
||||||
/** Total number of sorts. */
|
/** Total number of sorts. */
|
||||||
private static final int SIZE = values().length;
|
private static final int SIZE = values().length;
|
||||||
|
|
||||||
/** Array of SongSort objects in reverse order. */
|
/** Array of BeatmapSortOrder objects in reverse order. */
|
||||||
public static final SongSort[] VALUES_REVERSED;
|
public static final BeatmapSortOrder[] VALUES_REVERSED;
|
||||||
static {
|
static {
|
||||||
VALUES_REVERSED = values();
|
VALUES_REVERSED = values();
|
||||||
Collections.reverse(Arrays.asList(VALUES_REVERSED));
|
Collections.reverse(Arrays.asList(VALUES_REVERSED));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Current sort. */
|
/** Current sort. */
|
||||||
private static SongSort currentSort = TITLE;
|
private static BeatmapSortOrder currentSort = TITLE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current sort.
|
* Returns the current sort.
|
||||||
* @return the current sort
|
* @return the current sort
|
||||||
*/
|
*/
|
||||||
public static SongSort getSort() { return currentSort; }
|
public static BeatmapSortOrder getSort() { return currentSort; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a new sort.
|
* Sets a new sort.
|
||||||
* @param sort the 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.
|
* Compares two BeatmapSetNode objects by title.
|
||||||
|
@ -144,7 +143,7 @@ public enum SongSort {
|
||||||
* @param name the sort name
|
* @param name the sort name
|
||||||
* @param comparator the comparator for the sort
|
* @param comparator the comparator for the sort
|
||||||
*/
|
*/
|
||||||
SongSort(int id, String name, Comparator<BeatmapSetNode> comparator) {
|
BeatmapSortOrder(int id, String name, Comparator<BeatmapSetNode> comparator) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.comparator = comparator;
|
this.comparator = comparator;
|
|
@ -27,7 +27,6 @@ import itdelatrisu.opsu.Options;
|
||||||
import itdelatrisu.opsu.OsuParser;
|
import itdelatrisu.opsu.OsuParser;
|
||||||
import itdelatrisu.opsu.OszUnpacker;
|
import itdelatrisu.opsu.OszUnpacker;
|
||||||
import itdelatrisu.opsu.ScoreData;
|
import itdelatrisu.opsu.ScoreData;
|
||||||
import itdelatrisu.opsu.SongSort;
|
|
||||||
import itdelatrisu.opsu.Utils;
|
import itdelatrisu.opsu.Utils;
|
||||||
import itdelatrisu.opsu.audio.MultiClip;
|
import itdelatrisu.opsu.audio.MultiClip;
|
||||||
import itdelatrisu.opsu.audio.MusicController;
|
import itdelatrisu.opsu.audio.MusicController;
|
||||||
|
@ -36,6 +35,7 @@ import itdelatrisu.opsu.audio.SoundEffect;
|
||||||
import itdelatrisu.opsu.beatmap.Beatmap;
|
import itdelatrisu.opsu.beatmap.Beatmap;
|
||||||
import itdelatrisu.opsu.beatmap.BeatmapSetList;
|
import itdelatrisu.opsu.beatmap.BeatmapSetList;
|
||||||
import itdelatrisu.opsu.beatmap.BeatmapSetNode;
|
import itdelatrisu.opsu.beatmap.BeatmapSetNode;
|
||||||
|
import itdelatrisu.opsu.beatmap.BeatmapSortOrder;
|
||||||
import itdelatrisu.opsu.db.BeatmapDB;
|
import itdelatrisu.opsu.db.BeatmapDB;
|
||||||
import itdelatrisu.opsu.db.ScoreDB;
|
import itdelatrisu.opsu.db.ScoreDB;
|
||||||
import itdelatrisu.opsu.states.ButtonMenu.MenuState;
|
import itdelatrisu.opsu.states.ButtonMenu.MenuState;
|
||||||
|
@ -228,7 +228,7 @@ public class SongMenu extends BasicGameState {
|
||||||
footerY = height - GameImage.SELECTION_MODS.getImage().getHeight();
|
footerY = height - GameImage.SELECTION_MODS.getImage().getHeight();
|
||||||
|
|
||||||
// initialize sorts
|
// initialize sorts
|
||||||
for (SongSort sort : SongSort.values())
|
for (BeatmapSortOrder sort : BeatmapSortOrder.values())
|
||||||
sort.init(width, headerY - SongMenu.DIVIDER_LINE_WIDTH / 2);
|
sort.init(width, headerY - SongMenu.DIVIDER_LINE_WIDTH / 2);
|
||||||
|
|
||||||
// initialize score data buttons
|
// initialize score data buttons
|
||||||
|
@ -388,15 +388,15 @@ public class SongMenu extends BasicGameState {
|
||||||
selectOptionsButton.draw();
|
selectOptionsButton.draw();
|
||||||
|
|
||||||
// sorting tabs
|
// sorting tabs
|
||||||
SongSort currentSort = SongSort.getSort();
|
BeatmapSortOrder currentSort = BeatmapSortOrder.getSort();
|
||||||
SongSort hoverSort = null;
|
BeatmapSortOrder hoverSort = null;
|
||||||
for (SongSort sort : SongSort.values()) {
|
for (BeatmapSortOrder sort : BeatmapSortOrder.values()) {
|
||||||
if (sort.contains(mouseX, mouseY)) {
|
if (sort.contains(mouseX, mouseY)) {
|
||||||
hoverSort = sort;
|
hoverSort = sort;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (SongSort sort : SongSort.VALUES_REVERSED) {
|
for (BeatmapSortOrder sort : BeatmapSortOrder.VALUES_REVERSED) {
|
||||||
if (sort != currentSort)
|
if (sort != currentSort)
|
||||||
sort.draw(false, sort == hoverSort);
|
sort.draw(false, sort == hoverSort);
|
||||||
}
|
}
|
||||||
|
@ -636,10 +636,10 @@ public class SongMenu extends BasicGameState {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// sorting buttons
|
// sorting buttons
|
||||||
for (SongSort sort : SongSort.values()) {
|
for (BeatmapSortOrder sort : BeatmapSortOrder.values()) {
|
||||||
if (sort.contains(x, y)) {
|
if (sort.contains(x, y)) {
|
||||||
if (sort != SongSort.getSort()) {
|
if (sort != BeatmapSortOrder.getSort()) {
|
||||||
SongSort.setSort(sort);
|
BeatmapSortOrder.setSort(sort);
|
||||||
SoundController.playSound(SoundEffect.MENUCLICK);
|
SoundController.playSound(SoundEffect.MENUCLICK);
|
||||||
BeatmapSetNode oldFocusBase = BeatmapSetList.get().getBaseNode(focusNode.index);
|
BeatmapSetNode oldFocusBase = BeatmapSetList.get().getBaseNode(focusNode.index);
|
||||||
int oldFocusFileIndex = focusNode.beatmapIndex;
|
int oldFocusFileIndex = focusNode.beatmapIndex;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user