convert songmenu
This commit is contained in:
parent
4541b507f2
commit
7004c9ef4d
|
@ -88,7 +88,7 @@ public class Opsu extends StateBasedGame {
|
||||||
//addState(new Splash(STATE_SPLASH));
|
//addState(new Splash(STATE_SPLASH));
|
||||||
//addState(new MainMenu(STATE_MAINMENU));
|
//addState(new MainMenu(STATE_MAINMENU));
|
||||||
addState(new ButtonMenu(STATE_BUTTONMENU));
|
addState(new ButtonMenu(STATE_BUTTONMENU));
|
||||||
addState(new SongMenu(STATE_SONGMENU));
|
//addState(new SongMenu(STATE_SONGMENU));
|
||||||
addState(new Game(STATE_GAME));
|
addState(new Game(STATE_GAME));
|
||||||
addState(new GamePauseMenu(STATE_GAMEPAUSEMENU));
|
addState(new GamePauseMenu(STATE_GAMEPAUSEMENU));
|
||||||
addState(new GameRanking(STATE_GAMERANKING));
|
addState(new GameRanking(STATE_GAMERANKING));
|
||||||
|
|
|
@ -52,6 +52,7 @@ import org.newdawn.slick.state.transition.FadeInTransition;
|
||||||
import yugecin.opsudance.core.DisplayContainer;
|
import yugecin.opsudance.core.DisplayContainer;
|
||||||
import yugecin.opsudance.core.inject.InstanceContainer;
|
import yugecin.opsudance.core.inject.InstanceContainer;
|
||||||
import yugecin.opsudance.core.state.BaseOpsuState;
|
import yugecin.opsudance.core.state.BaseOpsuState;
|
||||||
|
import yugecin.opsudance.core.state.OpsuState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Main Menu" state.
|
* "Main Menu" state.
|
||||||
|
@ -754,13 +755,11 @@ public class MainMenu extends BaseOpsuState {
|
||||||
* Enters the song menu, or the downloads menu if no beatmaps are loaded.
|
* Enters the song menu, or the downloads menu if no beatmaps are loaded.
|
||||||
*/
|
*/
|
||||||
private void enterSongMenu() {
|
private void enterSongMenu() {
|
||||||
int state = Opsu.STATE_SONGMENU;
|
Class<? extends OpsuState> state = SongMenu.class;
|
||||||
if (BeatmapSetList.get().getMapSetCount() == 0) {
|
if (BeatmapSetList.get().getMapSetCount() == 0) {
|
||||||
// TODO
|
instanceContainer.provide(DownloadsMenu.class).notifyOnLoad("Download some beatmaps to get started!");
|
||||||
//((DownloadsMenu) game.getState(Opsu.STATE_DOWNLOADSMENU)).notifyOnLoad("Download some beatmaps to get started!");
|
// TODO d state = DownloadsMenu.class;
|
||||||
//state = Opsu.STATE_DOWNLOADSMENU;
|
|
||||||
}
|
}
|
||||||
// TODO
|
displayContainer.switchState(state);
|
||||||
//game.enterState(state, new EasedFadeOutTransition(), new FadeInTransition());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,11 +72,15 @@ import org.newdawn.slick.Input;
|
||||||
import org.newdawn.slick.SlickException;
|
import org.newdawn.slick.SlickException;
|
||||||
import org.newdawn.slick.SpriteSheet;
|
import org.newdawn.slick.SpriteSheet;
|
||||||
import org.newdawn.slick.gui.TextField;
|
import org.newdawn.slick.gui.TextField;
|
||||||
import org.newdawn.slick.state.BasicGameState;
|
|
||||||
import org.newdawn.slick.state.StateBasedGame;
|
import org.newdawn.slick.state.StateBasedGame;
|
||||||
import org.newdawn.slick.state.transition.EasedFadeOutTransition;
|
import org.newdawn.slick.state.transition.EasedFadeOutTransition;
|
||||||
import org.newdawn.slick.state.transition.EmptyTransition;
|
import org.newdawn.slick.state.transition.EmptyTransition;
|
||||||
import org.newdawn.slick.state.transition.FadeInTransition;
|
import org.newdawn.slick.state.transition.FadeInTransition;
|
||||||
|
import yugecin.opsudance.core.DisplayContainer;
|
||||||
|
import yugecin.opsudance.core.events.EventListener;
|
||||||
|
import yugecin.opsudance.core.inject.InstanceContainer;
|
||||||
|
import yugecin.opsudance.core.state.BaseOpsuState;
|
||||||
|
import yugecin.opsudance.events.ResolutionChangedEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Song Selection" state.
|
* "Song Selection" state.
|
||||||
|
@ -84,7 +88,10 @@ import org.newdawn.slick.state.transition.FadeInTransition;
|
||||||
* Players are able to select a beatmap to play, view previous scores, choose game mods,
|
* Players are able to select a beatmap to play, view previous scores, choose game mods,
|
||||||
* manage beatmaps, or change game options from this state.
|
* manage beatmaps, or change game options from this state.
|
||||||
*/
|
*/
|
||||||
public class SongMenu extends BasicGameState {
|
public class SongMenu extends BaseOpsuState {
|
||||||
|
|
||||||
|
private final InstanceContainer instanceContainer;
|
||||||
|
|
||||||
/** The max number of song buttons to be shown on each screen. */
|
/** The max number of song buttons to be shown on each screen. */
|
||||||
public static final int MAX_SONG_BUTTONS = 6;
|
public static final int MAX_SONG_BUTTONS = 6;
|
||||||
|
|
||||||
|
@ -169,7 +176,8 @@ public class SongMenu extends BasicGameState {
|
||||||
private MenuButton selectModsButton, selectRandomButton, selectMapOptionsButton, selectOptionsButton;
|
private MenuButton selectModsButton, selectRandomButton, selectMapOptionsButton, selectOptionsButton;
|
||||||
|
|
||||||
/** The search textfield. */
|
/** The search textfield. */
|
||||||
private TextField search;
|
//private TextField search;
|
||||||
|
// TODO d recreate textfield
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delay timer, in milliseconds, before running another search.
|
* Delay timer, in milliseconds, before running another search.
|
||||||
|
@ -321,47 +329,39 @@ public class SongMenu extends BasicGameState {
|
||||||
private boolean isScrollingToFocusNode = false;
|
private boolean isScrollingToFocusNode = false;
|
||||||
|
|
||||||
/** Sort order dropdown menu. */
|
/** Sort order dropdown menu. */
|
||||||
private DropdownMenu<BeatmapSortOrder> sortMenu;
|
// TODO: d remake dropdownmenu
|
||||||
|
//private DropdownMenu<BeatmapSortOrder> sortMenu;
|
||||||
|
|
||||||
// game-related variables
|
public SongMenu(final DisplayContainer displayContainer, InstanceContainer instanceContainer) {
|
||||||
private GameContainer container;
|
super(displayContainer);
|
||||||
private StateBasedGame game;
|
this.instanceContainer = instanceContainer;
|
||||||
private Input input;
|
|
||||||
private final int state;
|
|
||||||
|
|
||||||
public SongMenu(int state) {
|
|
||||||
this.state = state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(GameContainer container, StateBasedGame game)
|
public void revalidate() {
|
||||||
throws SlickException {
|
super.revalidate();
|
||||||
this.container = container;
|
|
||||||
this.game = game;
|
|
||||||
this.input = container.getInput();
|
|
||||||
|
|
||||||
int width = container.getWidth();
|
|
||||||
int height = container.getHeight();
|
|
||||||
|
|
||||||
// header/footer coordinates
|
// header/footer coordinates
|
||||||
headerY = height * 0.0075f + GameImage.MENU_MUSICNOTE.getImage().getHeight() +
|
headerY = displayContainer.height * 0.0075f + GameImage.MENU_MUSICNOTE.getImage().getHeight() +
|
||||||
Fonts.BOLD.getLineHeight() + Fonts.DEFAULT.getLineHeight() +
|
Fonts.BOLD.getLineHeight() + Fonts.DEFAULT.getLineHeight() +
|
||||||
Fonts.SMALL.getLineHeight();
|
Fonts.SMALL.getLineHeight();
|
||||||
footerY = height - GameImage.SELECTION_MODS.getImage().getHeight();
|
footerY = displayContainer.height - GameImage.SELECTION_MODS.getImage().getHeight();
|
||||||
|
|
||||||
// footer logo coordinates
|
// footer logo coordinates
|
||||||
float footerHeight = height - footerY;
|
float footerHeight = displayContainer.height - footerY;
|
||||||
footerLogoSize = footerHeight * 3.25f;
|
footerLogoSize = footerHeight * 3.25f;
|
||||||
Image logo = GameImage.MENU_LOGO.getImage();
|
Image logo = GameImage.MENU_LOGO.getImage();
|
||||||
logo = logo.getScaledCopy(footerLogoSize / logo.getWidth());
|
logo = logo.getScaledCopy(footerLogoSize / logo.getWidth());
|
||||||
footerLogoButton = new MenuButton(logo, width - footerHeight * 0.8f, height - footerHeight * 0.65f);
|
footerLogoButton = new MenuButton(logo, displayContainer.width - footerHeight * 0.8f, displayContainer.height - footerHeight * 0.65f);
|
||||||
footerLogoButton.setHoverAnimationDuration(1);
|
footerLogoButton.setHoverAnimationDuration(1);
|
||||||
footerLogoButton.setHoverExpand(1.2f);
|
footerLogoButton.setHoverExpand(1.2f);
|
||||||
|
|
||||||
// initialize sorts
|
// initialize sorts
|
||||||
int sortWidth = (int) (width * 0.12f);
|
// TODO d reenable dropdown
|
||||||
|
/*
|
||||||
|
int sortWidth = (int) (displayContainer.width * 0.12f);
|
||||||
sortMenu = new DropdownMenu<BeatmapSortOrder>(container, BeatmapSortOrder.values(),
|
sortMenu = new DropdownMenu<BeatmapSortOrder>(container, BeatmapSortOrder.values(),
|
||||||
width * 0.87f, headerY - GameImage.MENU_TAB.getImage().getHeight() * 2.25f, sortWidth) {
|
displayContainer.width * 0.87f, headerY - GameImage.MENU_TAB.getImage().getHeight() * 2.25f, sortWidth) {
|
||||||
@Override
|
@Override
|
||||||
public void itemSelected(int index, BeatmapSortOrder item) {
|
public void itemSelected(int index, BeatmapSortOrder item) {
|
||||||
BeatmapSortOrder.set(item);
|
BeatmapSortOrder.set(item);
|
||||||
|
@ -386,36 +386,40 @@ public class SongMenu extends BasicGameState {
|
||||||
sortMenu.setBackgroundColor(Colors.BLACK_BG_HOVER);
|
sortMenu.setBackgroundColor(Colors.BLACK_BG_HOVER);
|
||||||
sortMenu.setBorderColor(Colors.BLUE_DIVIDER);
|
sortMenu.setBorderColor(Colors.BLUE_DIVIDER);
|
||||||
sortMenu.setChevronRightColor(Color.white);
|
sortMenu.setChevronRightColor(Color.white);
|
||||||
|
*/
|
||||||
|
|
||||||
// initialize group tabs
|
// initialize group tabs
|
||||||
for (BeatmapGroup group : BeatmapGroup.values())
|
for (BeatmapGroup group : BeatmapGroup.values())
|
||||||
group.init(width, headerY - DIVIDER_LINE_WIDTH / 2);
|
group.init(displayContainer.width, headerY - DIVIDER_LINE_WIDTH / 2);
|
||||||
|
|
||||||
// initialize score data buttons
|
// initialize score data buttons
|
||||||
ScoreData.init(width, headerY + height * 0.01f);
|
ScoreData.init(displayContainer.width, headerY + displayContainer.height * 0.01f);
|
||||||
|
|
||||||
// song button background & graphics context
|
// song button background & graphics context
|
||||||
Image menuBackground = GameImage.MENU_BUTTON_BG.getImage();
|
Image menuBackground = GameImage.MENU_BUTTON_BG.getImage();
|
||||||
|
|
||||||
// song button coordinates
|
// song button coordinates
|
||||||
buttonX = width * 0.6f;
|
buttonX = displayContainer.width * 0.6f;
|
||||||
//buttonY = headerY;
|
//buttonY = headerY;
|
||||||
buttonWidth = menuBackground.getWidth();
|
buttonWidth = menuBackground.getWidth();
|
||||||
buttonHeight = menuBackground.getHeight();
|
buttonHeight = menuBackground.getHeight();
|
||||||
buttonOffset = (footerY - headerY - DIVIDER_LINE_WIDTH) / MAX_SONG_BUTTONS;
|
buttonOffset = (footerY - headerY - DIVIDER_LINE_WIDTH) / MAX_SONG_BUTTONS;
|
||||||
|
|
||||||
// search
|
// search
|
||||||
int textFieldX = (int) (width * 0.7125f + Fonts.BOLD.getWidth("Search: "));
|
// TODO d reenable search box
|
||||||
|
/*
|
||||||
|
int textFieldX = (int) (displayContainer.width * 0.7125f + Fonts.BOLD.getWidth("Search: "));
|
||||||
int textFieldY = (int) (headerY + Fonts.BOLD.getLineHeight() / 2);
|
int textFieldY = (int) (headerY + Fonts.BOLD.getLineHeight() / 2);
|
||||||
search = new TextField(
|
search = new TextField(
|
||||||
container, Fonts.BOLD, textFieldX, textFieldY,
|
container, Fonts.BOLD, textFieldX, textFieldY,
|
||||||
(int) (width * 0.99f) - textFieldX, Fonts.BOLD.getLineHeight()
|
(int) (displayContainer.width * 0.99f) - textFieldX, Fonts.BOLD.getLineHeight()
|
||||||
);
|
);
|
||||||
search.setBackgroundColor(Color.transparent);
|
search.setBackgroundColor(Color.transparent);
|
||||||
search.setBorderColor(Color.transparent);
|
search.setBorderColor(Color.transparent);
|
||||||
search.setTextColor(Color.white);
|
search.setTextColor(Color.white);
|
||||||
search.setConsumeEvents(false);
|
search.setConsumeEvents(false);
|
||||||
search.setMaxLength(60);
|
search.setMaxLength(60);
|
||||||
|
*/
|
||||||
|
|
||||||
// selection buttons
|
// selection buttons
|
||||||
Image selectionMods = GameImage.SELECTION_MODS.getImage();
|
Image selectionMods = GameImage.SELECTION_MODS.getImage();
|
||||||
|
@ -427,8 +431,8 @@ public class SongMenu extends BasicGameState {
|
||||||
if (selectButtonsWidth < 20) {
|
if (selectButtonsWidth < 20) {
|
||||||
selectButtonsWidth = 100;
|
selectButtonsWidth = 100;
|
||||||
}
|
}
|
||||||
float selectX = width * 0.183f + selectButtonsWidth / 2f;
|
float selectX = displayContainer.width * 0.183f + selectButtonsWidth / 2f;
|
||||||
float selectY = height - selectButtonsHeight / 2f;
|
float selectY = displayContainer.height - selectButtonsHeight / 2f;
|
||||||
float selectOffset = selectButtonsWidth * 1.05f;
|
float selectOffset = selectButtonsWidth * 1.05f;
|
||||||
selectModsButton = new MenuButton(GameImage.SELECTION_MODS_OVERLAY.getImage(),
|
selectModsButton = new MenuButton(GameImage.SELECTION_MODS_OVERLAY.getImage(),
|
||||||
selectX, selectY);
|
selectX, selectY);
|
||||||
|
@ -449,33 +453,37 @@ public class SongMenu extends BasicGameState {
|
||||||
loader = new Animation(spr, 50);
|
loader = new Animation(spr, 50);
|
||||||
|
|
||||||
// beatmap watch service listener
|
// beatmap watch service listener
|
||||||
final StateBasedGame game_ = game;
|
|
||||||
BeatmapWatchService.addListener(new BeatmapWatchServiceListener() {
|
BeatmapWatchService.addListener(new BeatmapWatchServiceListener() {
|
||||||
@Override
|
@Override
|
||||||
public void eventReceived(Kind<?> kind, Path child) {
|
public void eventReceived(Kind<?> kind, Path child) {
|
||||||
if (!songFolderChanged && kind != StandardWatchEventKinds.ENTRY_MODIFY) {
|
if (!songFolderChanged && kind != StandardWatchEventKinds.ENTRY_MODIFY) {
|
||||||
songFolderChanged = true;
|
songFolderChanged = true;
|
||||||
if (game_.getCurrentStateID() == Opsu.STATE_SONGMENU)
|
if (displayContainer.isInState(SongMenu.class)) {
|
||||||
UI.sendBarNotification("Changes in Songs folder detected. Hit F5 to refresh.");
|
UI.sendBarNotification("Changes in Songs folder detected. Hit F5 to refresh.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// star stream
|
// star stream
|
||||||
starStream = new StarStream(width, (height - GameImage.STAR.getImage().getHeight()) / 2, -width, 0, MAX_STREAM_STARS);
|
starStream = new StarStream(displayContainer.width, (displayContainer.height - GameImage.STAR.getImage().getHeight()) / 2, -displayContainer.width, 0, MAX_STREAM_STARS);
|
||||||
starStream.setPositionSpread(height / 20f);
|
starStream.setPositionSpread(displayContainer.height / 20f);
|
||||||
starStream.setDirectionSpread(10f);
|
starStream.setDirectionSpread(10f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(GameContainer container, StateBasedGame game, Graphics g)
|
public void render(Graphics g) {
|
||||||
throws SlickException {
|
super.render(g);
|
||||||
|
|
||||||
g.setBackground(Color.black);
|
g.setBackground(Color.black);
|
||||||
|
|
||||||
int width = container.getWidth();
|
int width = displayContainer.width;
|
||||||
int height = container.getHeight();
|
int height = displayContainer.height;
|
||||||
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
|
int mouseX = displayContainer.mouseX;
|
||||||
boolean inDropdownMenu = sortMenu.contains(mouseX, mouseY);
|
int mouseY = displayContainer.mouseY;
|
||||||
|
|
||||||
|
// TODO d
|
||||||
|
//boolean inDropdownMenu = sortMenu.contains(mouseX, mouseY);
|
||||||
|
|
||||||
// background
|
// background
|
||||||
if (focusNode != null) {
|
if (focusNode != null) {
|
||||||
|
@ -547,8 +555,11 @@ public class SongMenu extends BasicGameState {
|
||||||
g.clearClip();
|
g.clearClip();
|
||||||
|
|
||||||
// scroll bar
|
// scroll bar
|
||||||
|
// TODO d
|
||||||
|
/*
|
||||||
if (focusScores.length > MAX_SCORE_BUTTONS && ScoreData.areaContains(mouseX, mouseY) && !inDropdownMenu)
|
if (focusScores.length > MAX_SCORE_BUTTONS && ScoreData.areaContains(mouseX, mouseY) && !inDropdownMenu)
|
||||||
ScoreData.drawScrollbar(g, startScorePos.getPosition(), focusScores.length * ScoreData.getButtonOffset());
|
ScoreData.drawScrollbar(g, startScorePos.getPosition(), focusScores.length * ScoreData.getButtonOffset());
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// top/bottom bars
|
// top/bottom bars
|
||||||
|
@ -565,6 +576,8 @@ public class SongMenu extends BasicGameState {
|
||||||
Float position = MusicController.getBeatProgress();
|
Float position = MusicController.getBeatProgress();
|
||||||
if (position == null) // default to 60bpm
|
if (position == null) // default to 60bpm
|
||||||
position = System.currentTimeMillis() % 1000 / 1000f;
|
position = System.currentTimeMillis() % 1000 / 1000f;
|
||||||
|
// TODO d
|
||||||
|
/*
|
||||||
if (footerLogoButton.contains(mouseX, mouseY, 0.25f) && !inDropdownMenu) {
|
if (footerLogoButton.contains(mouseX, mouseY, 0.25f) && !inDropdownMenu) {
|
||||||
// hovering over logo: stop pulsing
|
// hovering over logo: stop pulsing
|
||||||
footerLogoButton.draw();
|
footerLogoButton.draw();
|
||||||
|
@ -578,6 +591,7 @@ public class SongMenu extends BasicGameState {
|
||||||
ghostLogo.drawCentered(footerLogoButton.getX(), footerLogoButton.getY(), Colors.GHOST_LOGO);
|
ghostLogo.drawCentered(footerLogoButton.getX(), footerLogoButton.getY(), Colors.GHOST_LOGO);
|
||||||
Colors.GHOST_LOGO.a = oldGhostAlpha;
|
Colors.GHOST_LOGO.a = oldGhostAlpha;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// header
|
// header
|
||||||
if (focusNode != null) {
|
if (focusNode != null) {
|
||||||
|
@ -658,6 +672,8 @@ public class SongMenu extends BasicGameState {
|
||||||
// group tabs
|
// group tabs
|
||||||
BeatmapGroup currentGroup = BeatmapGroup.current();
|
BeatmapGroup currentGroup = BeatmapGroup.current();
|
||||||
BeatmapGroup hoverGroup = null;
|
BeatmapGroup hoverGroup = null;
|
||||||
|
// TODO d
|
||||||
|
/*
|
||||||
if (!inDropdownMenu) {
|
if (!inDropdownMenu) {
|
||||||
for (BeatmapGroup group : BeatmapGroup.values()) {
|
for (BeatmapGroup group : BeatmapGroup.values()) {
|
||||||
if (group.contains(mouseX, mouseY)) {
|
if (group.contains(mouseX, mouseY)) {
|
||||||
|
@ -666,6 +682,7 @@ public class SongMenu extends BasicGameState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
for (BeatmapGroup group : BeatmapGroup.VALUES_REVERSED) {
|
for (BeatmapGroup group : BeatmapGroup.VALUES_REVERSED) {
|
||||||
if (group != currentGroup)
|
if (group != currentGroup)
|
||||||
group.draw(false, group == hoverGroup);
|
group.draw(false, group == hoverGroup);
|
||||||
|
@ -673,6 +690,8 @@ public class SongMenu extends BasicGameState {
|
||||||
currentGroup.draw(true, false);
|
currentGroup.draw(true, false);
|
||||||
|
|
||||||
// search
|
// search
|
||||||
|
// TODO d
|
||||||
|
/*
|
||||||
boolean searchEmpty = search.getText().isEmpty();
|
boolean searchEmpty = search.getText().isEmpty();
|
||||||
int searchX = search.getX(), searchY = search.getY();
|
int searchX = search.getX(), searchY = search.getY();
|
||||||
float searchBaseX = width * 0.7f;
|
float searchBaseX = width * 0.7f;
|
||||||
|
@ -707,6 +726,7 @@ public class SongMenu extends BasicGameState {
|
||||||
|
|
||||||
// sorting options
|
// sorting options
|
||||||
sortMenu.render(container, g);
|
sortMenu.render(container, g);
|
||||||
|
*/
|
||||||
|
|
||||||
// reloading beatmaps
|
// reloading beatmaps
|
||||||
if (reloadThread != null) {
|
if (reloadThread != null) {
|
||||||
|
@ -725,8 +745,10 @@ public class SongMenu extends BasicGameState {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(GameContainer container, StateBasedGame game, int delta)
|
public void preRenderUpdate() {
|
||||||
throws SlickException {
|
super.preRenderUpdate();
|
||||||
|
|
||||||
|
int delta = displayContainer.delta;
|
||||||
UI.update(delta);
|
UI.update(delta);
|
||||||
if (reloadThread == null)
|
if (reloadThread == null)
|
||||||
MusicController.loopTrackIfEnded(true);
|
MusicController.loopTrackIfEnded(true);
|
||||||
|
@ -742,8 +764,9 @@ public class SongMenu extends BasicGameState {
|
||||||
MusicController.playThemeSong();
|
MusicController.playThemeSong();
|
||||||
reloadThread = null;
|
reloadThread = null;
|
||||||
}
|
}
|
||||||
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
|
int mouseX = displayContainer.mouseX;
|
||||||
boolean inDropdownMenu = sortMenu.contains(mouseX, mouseY);
|
int mouseY = displayContainer.mouseY;
|
||||||
|
boolean inDropdownMenu = false; // TODO d sortMenu.contains(mouseX, mouseY);
|
||||||
UI.getBackButton().hoverUpdate(delta, mouseX, mouseY);
|
UI.getBackButton().hoverUpdate(delta, mouseX, mouseY);
|
||||||
selectModsButton.hoverUpdate(delta, mouseX, mouseY);
|
selectModsButton.hoverUpdate(delta, mouseX, mouseY);
|
||||||
selectRandomButton.hoverUpdate(delta, mouseX, mouseY);
|
selectRandomButton.hoverUpdate(delta, mouseX, mouseY);
|
||||||
|
@ -759,8 +782,8 @@ public class SongMenu extends BasicGameState {
|
||||||
if (focusNode != null) {
|
if (focusNode != null) {
|
||||||
MenuState state = focusNode.getBeatmapSet().isFavorite() ?
|
MenuState state = focusNode.getBeatmapSet().isFavorite() ?
|
||||||
MenuState.BEATMAP_FAVORITE : MenuState.BEATMAP;
|
MenuState.BEATMAP_FAVORITE : MenuState.BEATMAP;
|
||||||
((ButtonMenu) game.getState(Opsu.STATE_BUTTONMENU)).setMenuState(state, focusNode);
|
instanceContainer.provide(ButtonMenu.class).setMenuState(state, focusNode);
|
||||||
game.enterState(Opsu.STATE_BUTTONMENU);
|
// TODO d displayContainer.switchState(ButtonMenu.class);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -782,6 +805,8 @@ public class SongMenu extends BasicGameState {
|
||||||
starStream.update(delta);
|
starStream.update(delta);
|
||||||
|
|
||||||
// search
|
// search
|
||||||
|
// TODO d
|
||||||
|
/*
|
||||||
search.setFocus(true);
|
search.setFocus(true);
|
||||||
searchTimer += delta;
|
searchTimer += delta;
|
||||||
if (searchTimer >= SEARCH_DELAY && reloadThread == null && beatmapMenuTimer == -1) {
|
if (searchTimer >= SEARCH_DELAY && reloadThread == null && beatmapMenuTimer == -1) {
|
||||||
|
@ -827,6 +852,7 @@ public class SongMenu extends BasicGameState {
|
||||||
if (searchTransitionTimer > SEARCH_TRANSITION_TIME)
|
if (searchTransitionTimer > SEARCH_TRANSITION_TIME)
|
||||||
searchTransitionTimer = SEARCH_TRANSITION_TIME;
|
searchTransitionTimer = SEARCH_TRANSITION_TIME;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// scores
|
// scores
|
||||||
if (focusScores != null) {
|
if (focusScores != null) {
|
||||||
|
@ -862,9 +888,11 @@ public class SongMenu extends BasicGameState {
|
||||||
}
|
}
|
||||||
|
|
||||||
// tooltips
|
// tooltips
|
||||||
|
// TODO d
|
||||||
|
/*
|
||||||
if (sortMenu.baseContains(mouseX, mouseY))
|
if (sortMenu.baseContains(mouseX, mouseY))
|
||||||
UI.updateTooltip(delta, "Sort by...", false);
|
UI.updateTooltip(delta, "Sort by...", false);
|
||||||
else if (focusScores != null && ScoreData.areaContains(mouseX, mouseY)) {
|
else */if (focusScores != null && ScoreData.areaContains(mouseX, mouseY)) {
|
||||||
int startScore = (int) (startScorePos.getPosition() / ScoreData.getButtonOffset());
|
int startScore = (int) (startScorePos.getPosition() / ScoreData.getButtonOffset());
|
||||||
int offset = (int) (-startScorePos.getPosition() + startScore * ScoreData.getButtonOffset());
|
int offset = (int) (-startScorePos.getPosition() + startScore * ScoreData.getButtonOffset());
|
||||||
int scoreButtons = Math.min(focusScores.length - startScore, MAX_SCORE_BUTTONS);
|
int scoreButtons = Math.min(focusScores.length - startScore, MAX_SCORE_BUTTONS);
|
||||||
|
@ -880,66 +908,58 @@ public class SongMenu extends BasicGameState {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getID() { return state; }
|
public boolean mousePressed(int button, int x, int y) {
|
||||||
|
if (button == Input.MOUSE_MIDDLE_BUTTON) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
if (isScrollingToFocusNode) {
|
||||||
public void mousePressed(int button, int x, int y) {
|
return true;
|
||||||
// check mouse button
|
}
|
||||||
if (button == Input.MOUSE_MIDDLE_BUTTON)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (isScrollingToFocusNode)
|
|
||||||
return;
|
|
||||||
|
|
||||||
songScrolling.pressed();
|
songScrolling.pressed();
|
||||||
startScorePos.pressed();
|
startScorePos.pressed();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(int button, int x, int y) {
|
public boolean mouseReleased(int button, int x, int y) {
|
||||||
// check mouse button
|
if (button == Input.MOUSE_MIDDLE_BUTTON) {
|
||||||
if (button == Input.MOUSE_MIDDLE_BUTTON)
|
return false;
|
||||||
return;
|
}
|
||||||
|
|
||||||
if (isScrollingToFocusNode)
|
if (isScrollingToFocusNode) {
|
||||||
return;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
songScrolling.released();
|
songScrolling.released();
|
||||||
startScorePos.released();
|
startScorePos.released();
|
||||||
|
|
||||||
|
if (isInputBlocked()) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mouseClicked(int button, int x, int y, int clickCount) {
|
|
||||||
// check mouse button
|
|
||||||
if (button == Input.MOUSE_MIDDLE_BUTTON)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// block input
|
|
||||||
if (isInputBlocked())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// back
|
|
||||||
if (UI.getBackButton().contains(x, y)) {
|
if (UI.getBackButton().contains(x, y)) {
|
||||||
SoundController.playSound(SoundEffect.MENUBACK);
|
SoundController.playSound(SoundEffect.MENUBACK);
|
||||||
((MainMenu) game.getState(Opsu.STATE_MAINMENU)).reset();
|
instanceContainer.provide(MainMenu.class).reset(); // TODO d why is this needed
|
||||||
game.enterState(Opsu.STATE_MAINMENU, new EasedFadeOutTransition(), new FadeInTransition());
|
displayContainer.switchState(MainMenu.class);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// selection buttons
|
// selection buttons
|
||||||
if (selectModsButton.contains(x, y)) {
|
if (selectModsButton.contains(x, y)) {
|
||||||
this.keyPressed(Input.KEY_F1, '\0');
|
this.keyPressed(Input.KEY_F1, '\0');
|
||||||
return;
|
return true;
|
||||||
} else if (selectRandomButton.contains(x, y)) {
|
} else if (selectRandomButton.contains(x, y)) {
|
||||||
this.keyPressed(Input.KEY_F2, '\0');
|
this.keyPressed(Input.KEY_F2, '\0');
|
||||||
return;
|
return true;
|
||||||
} else if (selectMapOptionsButton.contains(x, y)) {
|
} else if (selectMapOptionsButton.contains(x, y)) {
|
||||||
this.keyPressed(Input.KEY_F3, '\0');
|
this.keyPressed(Input.KEY_F3, '\0');
|
||||||
return;
|
return true;
|
||||||
} else if (selectOptionsButton.contains(x, y)) {
|
} else if (selectOptionsButton.contains(x, y)) {
|
||||||
SoundController.playSound(SoundEffect.MENUHIT);
|
SoundController.playSound(SoundEffect.MENUHIT);
|
||||||
game.enterState(Opsu.STATE_OPTIONSMENU, new EmptyTransition(), new FadeInTransition());
|
// TODO d displayContainer.switchState(OptionsMenu.class);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// group tabs
|
// group tabs
|
||||||
|
@ -954,7 +974,7 @@ public class SongMenu extends BasicGameState {
|
||||||
songInfo = null;
|
songInfo = null;
|
||||||
scoreMap = null;
|
scoreMap = null;
|
||||||
focusScores = null;
|
focusScores = null;
|
||||||
search.setText("");
|
// TODO d search.setText("");
|
||||||
searchTimer = SEARCH_DELAY;
|
searchTimer = SEARCH_DELAY;
|
||||||
searchTransitionTimer = SEARCH_TRANSITION_TIME;
|
searchTransitionTimer = SEARCH_TRANSITION_TIME;
|
||||||
searchResultString = null;
|
searchResultString = null;
|
||||||
|
@ -965,17 +985,18 @@ public class SongMenu extends BasicGameState {
|
||||||
if (BeatmapSetList.get().size() < 1 && group.getEmptyMessage() != null)
|
if (BeatmapSetList.get().size() < 1 && group.getEmptyMessage() != null)
|
||||||
UI.sendBarNotification(group.getEmptyMessage());
|
UI.sendBarNotification(group.getEmptyMessage());
|
||||||
}
|
}
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (focusNode == null)
|
if (focusNode == null) {
|
||||||
return;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// logo: start game
|
// logo: start game
|
||||||
if (footerLogoButton.contains(x, y, 0.25f)) {
|
if (footerLogoButton.contains(x, y, 0.25f)) {
|
||||||
startGame();
|
startGame();
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// song buttons
|
// song buttons
|
||||||
|
@ -1014,7 +1035,7 @@ public class SongMenu extends BasicGameState {
|
||||||
if (button == Input.MOUSE_RIGHT_BUTTON)
|
if (button == Input.MOUSE_RIGHT_BUTTON)
|
||||||
beatmapMenuTimer = (node.index == expandedIndex) ? BEATMAP_MENU_DELAY * 4 / 5 : 0;
|
beatmapMenuTimer = (node.index == expandedIndex) ? BEATMAP_MENU_DELAY * 4 / 5 : 0;
|
||||||
|
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// score buttons
|
// score buttons
|
||||||
|
@ -1027,28 +1048,33 @@ public class SongMenu extends BasicGameState {
|
||||||
SoundController.playSound(SoundEffect.MENUHIT);
|
SoundController.playSound(SoundEffect.MENUHIT);
|
||||||
if (button != Input.MOUSE_RIGHT_BUTTON) {
|
if (button != Input.MOUSE_RIGHT_BUTTON) {
|
||||||
// view score
|
// view score
|
||||||
GameData data = new GameData(focusScores[rank], container.getWidth(), container.getHeight());
|
instanceContainer.provide(GameRanking.class).setGameData(new GameData(focusScores[rank], displayContainer.width, displayContainer.height));
|
||||||
((GameRanking) game.getState(Opsu.STATE_GAMERANKING)).setGameData(data);
|
// TODO d displayContainer.switchState(GameRanking.class);
|
||||||
game.enterState(Opsu.STATE_GAMERANKING, new EasedFadeOutTransition(), new FadeInTransition());
|
|
||||||
} else {
|
} else {
|
||||||
// score management
|
// score management
|
||||||
((ButtonMenu) game.getState(Opsu.STATE_BUTTONMENU)).setMenuState(MenuState.SCORE, focusScores[rank]);
|
instanceContainer.provide(ButtonMenu.class).setMenuState(MenuState.SCORE, focusScores[rank]);
|
||||||
game.enterState(Opsu.STATE_BUTTONMENU);
|
// TODO d displayContainer.switchState(ButtonMenu.class);
|
||||||
}
|
}
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(int key, char c) {
|
public boolean keyPressed(int key, char c) {
|
||||||
// block input
|
// block input
|
||||||
if ((reloadThread != null && !(key == Input.KEY_ESCAPE || key == Input.KEY_F12)) || beatmapMenuTimer > -1 || isScrollingToFocusNode)
|
if ((reloadThread != null && !(key == Input.KEY_ESCAPE || key == Input.KEY_F12)) || beatmapMenuTimer > -1 || isScrollingToFocusNode) {
|
||||||
return;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Input input = displayContainer.input;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case Input.KEY_ESCAPE:
|
case Input.KEY_ESCAPE:
|
||||||
|
// TODO d
|
||||||
|
/*
|
||||||
if (reloadThread != null) {
|
if (reloadThread != null) {
|
||||||
// beatmap reloading: stop parsing beatmaps by sending interrupt to BeatmapParser
|
// beatmap reloading: stop parsing beatmaps by sending interrupt to BeatmapParser
|
||||||
reloadThread.interrupt();
|
reloadThread.interrupt();
|
||||||
|
@ -1064,12 +1090,13 @@ public class SongMenu extends BasicGameState {
|
||||||
((MainMenu) game.getState(Opsu.STATE_MAINMENU)).reset();
|
((MainMenu) game.getState(Opsu.STATE_MAINMENU)).reset();
|
||||||
game.enterState(Opsu.STATE_MAINMENU, new EasedFadeOutTransition(), new FadeInTransition());
|
game.enterState(Opsu.STATE_MAINMENU, new EasedFadeOutTransition(), new FadeInTransition());
|
||||||
}
|
}
|
||||||
break;
|
*/
|
||||||
|
return true;
|
||||||
case Input.KEY_F1:
|
case Input.KEY_F1:
|
||||||
SoundController.playSound(SoundEffect.MENUHIT);
|
SoundController.playSound(SoundEffect.MENUHIT);
|
||||||
((ButtonMenu) game.getState(Opsu.STATE_BUTTONMENU)).setMenuState(MenuState.MODS);
|
instanceContainer.provide(ButtonMenu.class).setMenuState(MenuState.MODS);
|
||||||
game.enterState(Opsu.STATE_BUTTONMENU);
|
// TODO d displayContainer.switchState(ButtonMenu.class);
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_F2:
|
case Input.KEY_F2:
|
||||||
if (focusNode == null)
|
if (focusNode == null)
|
||||||
break;
|
break;
|
||||||
|
@ -1089,25 +1116,25 @@ public class SongMenu extends BasicGameState {
|
||||||
randomStack.push(new SongNode(BeatmapSetList.get().getBaseNode(focusNode.index), focusNode.beatmapIndex));
|
randomStack.push(new SongNode(BeatmapSetList.get().getBaseNode(focusNode.index), focusNode.beatmapIndex));
|
||||||
setFocus(BeatmapSetList.get().getRandomNode(), -1, true, true);
|
setFocus(BeatmapSetList.get().getRandomNode(), -1, true, true);
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_F3:
|
case Input.KEY_F3:
|
||||||
if (focusNode == null)
|
if (focusNode == null)
|
||||||
break;
|
break;
|
||||||
SoundController.playSound(SoundEffect.MENUHIT);
|
SoundController.playSound(SoundEffect.MENUHIT);
|
||||||
MenuState state = focusNode.getBeatmapSet().isFavorite() ?
|
MenuState state = focusNode.getBeatmapSet().isFavorite() ?
|
||||||
MenuState.BEATMAP_FAVORITE : MenuState.BEATMAP;
|
MenuState.BEATMAP_FAVORITE : MenuState.BEATMAP;
|
||||||
((ButtonMenu) game.getState(Opsu.STATE_BUTTONMENU)).setMenuState(state, focusNode);
|
instanceContainer.provide(ButtonMenu.class).setMenuState(state, focusNode);
|
||||||
game.enterState(Opsu.STATE_BUTTONMENU);
|
// TODO d displayContainer.switchState(ButtonMenu.class);
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_F5:
|
case Input.KEY_F5:
|
||||||
SoundController.playSound(SoundEffect.MENUHIT);
|
SoundController.playSound(SoundEffect.MENUHIT);
|
||||||
if (songFolderChanged)
|
if (songFolderChanged)
|
||||||
reloadBeatmaps(false);
|
reloadBeatmaps(false);
|
||||||
else {
|
else {
|
||||||
((ButtonMenu) game.getState(Opsu.STATE_BUTTONMENU)).setMenuState(MenuState.RELOAD);
|
instanceContainer.provide(ButtonMenu.class).setMenuState(MenuState.RELOAD);
|
||||||
game.enterState(Opsu.STATE_BUTTONMENU);
|
// TODO d displayContainer.switchState(ButtonMenu.class);
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_DELETE:
|
case Input.KEY_DELETE:
|
||||||
if (focusNode == null)
|
if (focusNode == null)
|
||||||
break;
|
break;
|
||||||
|
@ -1115,31 +1142,31 @@ public class SongMenu extends BasicGameState {
|
||||||
SoundController.playSound(SoundEffect.MENUHIT);
|
SoundController.playSound(SoundEffect.MENUHIT);
|
||||||
MenuState ms = (focusNode.beatmapIndex == -1 || focusNode.getBeatmapSet().size() == 1) ?
|
MenuState ms = (focusNode.beatmapIndex == -1 || focusNode.getBeatmapSet().size() == 1) ?
|
||||||
MenuState.BEATMAP_DELETE_CONFIRM : MenuState.BEATMAP_DELETE_SELECT;
|
MenuState.BEATMAP_DELETE_CONFIRM : MenuState.BEATMAP_DELETE_SELECT;
|
||||||
((ButtonMenu) game.getState(Opsu.STATE_BUTTONMENU)).setMenuState(ms, focusNode);
|
instanceContainer.provide(ButtonMenu.class).setMenuState(ms, focusNode);
|
||||||
game.enterState(Opsu.STATE_BUTTONMENU);
|
// TODO d displayContainer.switchState(ButtonMenu.class);
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_F7:
|
case Input.KEY_F7:
|
||||||
// TODO d
|
// TODO d
|
||||||
//Options.setNextFPS(container);
|
//Options.setNextFPS(container);
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_F10:
|
case Input.KEY_F10:
|
||||||
Options.toggleMouseDisabled();
|
Options.toggleMouseDisabled();
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_F12:
|
case Input.KEY_F12:
|
||||||
Utils.takeScreenShot();
|
Utils.takeScreenShot();
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_ENTER:
|
case Input.KEY_ENTER:
|
||||||
if (focusNode == null)
|
if (focusNode == null)
|
||||||
break;
|
break;
|
||||||
startGame();
|
startGame();
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_DOWN:
|
case Input.KEY_DOWN:
|
||||||
changeIndex(1);
|
changeIndex(1);
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_UP:
|
case Input.KEY_UP:
|
||||||
changeIndex(-1);
|
changeIndex(-1);
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_RIGHT:
|
case Input.KEY_RIGHT:
|
||||||
if (focusNode == null)
|
if (focusNode == null)
|
||||||
break;
|
break;
|
||||||
|
@ -1155,7 +1182,7 @@ public class SongMenu extends BasicGameState {
|
||||||
hoverIndex = oldHoverIndex;
|
hoverIndex = oldHoverIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_LEFT:
|
case Input.KEY_LEFT:
|
||||||
if (focusNode == null)
|
if (focusNode == null)
|
||||||
break;
|
break;
|
||||||
|
@ -1171,24 +1198,26 @@ public class SongMenu extends BasicGameState {
|
||||||
hoverIndex = oldHoverIndex;
|
hoverIndex = oldHoverIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_NEXT:
|
case Input.KEY_NEXT:
|
||||||
changeIndex(MAX_SONG_BUTTONS);
|
changeIndex(MAX_SONG_BUTTONS);
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_PRIOR:
|
case Input.KEY_PRIOR:
|
||||||
changeIndex(-MAX_SONG_BUTTONS);
|
changeIndex(-MAX_SONG_BUTTONS);
|
||||||
break;
|
return true;
|
||||||
case Input.KEY_O:
|
case Input.KEY_O:
|
||||||
if (input.isKeyDown(Input.KEY_LCONTROL) || input.isKeyDown(Input.KEY_RCONTROL)) {
|
if (input.isKeyDown(Input.KEY_LCONTROL) || input.isKeyDown(Input.KEY_RCONTROL)) {
|
||||||
game.enterState(Opsu.STATE_OPTIONSMENU, new EmptyTransition(), new FadeInTransition());
|
// TODO d displayContainer.switchState(OptionsMenu.class);
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
default:
|
default:
|
||||||
// wait for user to finish typing
|
// wait for user to finish typing
|
||||||
// TODO: accept all characters (current conditions are from TextField class)
|
// TODO: accept all characters (current conditions are from TextField class)
|
||||||
if ((c > 31 && c < 127) || key == Input.KEY_BACK) {
|
if ((c > 31 && c < 127) || key == Input.KEY_BACK) {
|
||||||
searchTimer = 0;
|
searchTimer = 0;
|
||||||
int textLength = search.getText().length();
|
// TODO d
|
||||||
|
//int textLength = search.getText().length();
|
||||||
|
int textLength = 0;
|
||||||
if (lastSearchTextLength != textLength) {
|
if (lastSearchTextLength != textLength) {
|
||||||
if (key == Input.KEY_BACK) {
|
if (key == Input.KEY_BACK) {
|
||||||
if (textLength == 0)
|
if (textLength == 0)
|
||||||
|
@ -1198,10 +1227,13 @@ public class SongMenu extends BasicGameState {
|
||||||
lastSearchTextLength = textLength;
|
lastSearchTextLength = textLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO d
|
||||||
|
/*
|
||||||
@Override
|
@Override
|
||||||
public void mouseDragged(int oldx, int oldy, int newx, int newy) {
|
public void mouseDragged(int oldx, int oldy, int newx, int newy) {
|
||||||
// block input
|
// block input
|
||||||
|
@ -1229,18 +1261,20 @@ public class SongMenu extends BasicGameState {
|
||||||
else
|
else
|
||||||
songScrolling.dragged(-diff * multiplier);
|
songScrolling.dragged(-diff * multiplier);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseWheelMoved(int newValue) {
|
public boolean mouseWheelMoved(int newValue) {
|
||||||
// change volume
|
Input input = displayContainer.input;
|
||||||
|
|
||||||
if (input.isKeyDown(Input.KEY_LALT) || input.isKeyDown(Input.KEY_RALT)) {
|
if (input.isKeyDown(Input.KEY_LALT) || input.isKeyDown(Input.KEY_RALT)) {
|
||||||
UI.changeVolume((newValue < 0) ? -1 : 1);
|
UI.changeVolume((newValue < 0) ? -1 : 1);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// block input
|
if (isInputBlocked()) {
|
||||||
if (isInputBlocked())
|
return true;
|
||||||
return;
|
}
|
||||||
|
|
||||||
int shift = (newValue < 0) ? 1 : -1;
|
int shift = (newValue < 0) ? 1 : -1;
|
||||||
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
|
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
|
||||||
|
@ -1252,13 +1286,14 @@ public class SongMenu extends BasicGameState {
|
||||||
// song buttons
|
// song buttons
|
||||||
else
|
else
|
||||||
changeIndex(shift);
|
changeIndex(shift);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter(GameContainer container, StateBasedGame game)
|
public void enter() {
|
||||||
throws SlickException {
|
super.enter();
|
||||||
|
|
||||||
UI.enter();
|
UI.enter();
|
||||||
Display.setTitle(game.getTitle());
|
|
||||||
selectModsButton.resetHover();
|
selectModsButton.resetHover();
|
||||||
selectRandomButton.resetHover();
|
selectRandomButton.resetHover();
|
||||||
selectMapOptionsButton.resetHover();
|
selectMapOptionsButton.resetHover();
|
||||||
|
@ -1276,8 +1311,9 @@ public class SongMenu extends BasicGameState {
|
||||||
songChangeTimer.setTime(songChangeTimer.getDuration());
|
songChangeTimer.setTime(songChangeTimer.getDuration());
|
||||||
musicIconBounceTimer.setTime(musicIconBounceTimer.getDuration());
|
musicIconBounceTimer.setTime(musicIconBounceTimer.getDuration());
|
||||||
starStream.clear();
|
starStream.clear();
|
||||||
sortMenu.activate();
|
// TODO d
|
||||||
sortMenu.reset();
|
//sortMenu.activate();
|
||||||
|
//sortMenu.reset();
|
||||||
|
|
||||||
// reset song stack
|
// reset song stack
|
||||||
randomStack = new Stack<SongNode>();
|
randomStack = new Stack<SongNode>();
|
||||||
|
@ -1308,7 +1344,7 @@ public class SongMenu extends BasicGameState {
|
||||||
|
|
||||||
// reset game data
|
// reset game data
|
||||||
if (resetGame) {
|
if (resetGame) {
|
||||||
((Game) game.getState(Opsu.STATE_GAME)).resetGameData();
|
instanceContainer.provide(Game.class).resetGameData();
|
||||||
|
|
||||||
// destroy extra Clips
|
// destroy extra Clips
|
||||||
MultiClip.destroyExtraClips();
|
MultiClip.destroyExtraClips();
|
||||||
|
@ -1441,10 +1477,13 @@ public class SongMenu extends BasicGameState {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void leave(GameContainer container, StateBasedGame game)
|
public void leave() {
|
||||||
throws SlickException {
|
super.leave();
|
||||||
|
// TODO d
|
||||||
|
/*
|
||||||
search.setFocus(false);
|
search.setFocus(false);
|
||||||
sortMenu.deactivate();
|
sortMenu.deactivate();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1569,9 +1608,9 @@ public class SongMenu extends BasicGameState {
|
||||||
|
|
||||||
// change the focus node
|
// change the focus node
|
||||||
if (changeStartNode || (startNode.index == 0 && startNode.beatmapIndex == -1 && startNode.prev == null)) {
|
if (changeStartNode || (startNode.index == 0 && startNode.beatmapIndex == -1 && startNode.prev == null)) {
|
||||||
if (startNode == null || game.getCurrentStateID() != Opsu.STATE_SONGMENU)
|
if (startNode == null || displayContainer.isInState(SongMenu.class)) {
|
||||||
songScrolling.setPosition((node.index - 1) * buttonOffset);
|
songScrolling.setPosition((node.index - 1) * buttonOffset);
|
||||||
else {
|
} else {
|
||||||
isScrollingToFocusNode = true;
|
isScrollingToFocusNode = true;
|
||||||
songScrolling.setSpeedMultiplier(2f);
|
songScrolling.setSpeedMultiplier(2f);
|
||||||
songScrolling.released();
|
songScrolling.released();
|
||||||
|
@ -1704,7 +1743,8 @@ public class SongMenu extends BasicGameState {
|
||||||
songInfo = null;
|
songInfo = null;
|
||||||
hoverOffset.setTime(0);
|
hoverOffset.setTime(0);
|
||||||
hoverIndex = null;
|
hoverIndex = null;
|
||||||
search.setText("");
|
// TODO d
|
||||||
|
//search.setText("");
|
||||||
searchTimer = SEARCH_DELAY;
|
searchTimer = SEARCH_DELAY;
|
||||||
searchTransitionTimer = SEARCH_TRANSITION_TIME;
|
searchTransitionTimer = SEARCH_TRANSITION_TIME;
|
||||||
searchResultString = null;
|
searchResultString = null;
|
||||||
|
@ -1785,17 +1825,17 @@ public class SongMenu extends BasicGameState {
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn on "auto" mod if holding "ctrl" key
|
// turn on "auto" mod if holding "ctrl" key
|
||||||
if (input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL)) {
|
if (displayContainer.input.isKeyDown(Input.KEY_RCONTROL) || displayContainer.input.isKeyDown(Input.KEY_LCONTROL)) {
|
||||||
if (!GameMod.AUTO.isActive())
|
if (!GameMod.AUTO.isActive())
|
||||||
GameMod.AUTO.toggle(true);
|
GameMod.AUTO.toggle(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundController.playSound(SoundEffect.MENUHIT);
|
SoundController.playSound(SoundEffect.MENUHIT);
|
||||||
MultiClip.destroyExtraClips();
|
MultiClip.destroyExtraClips();
|
||||||
Game gameState = (Game) game.getState(Opsu.STATE_GAME);
|
Game gameState = instanceContainer.provide(Game.class);
|
||||||
gameState.loadBeatmap(beatmap);
|
gameState.loadBeatmap(beatmap);
|
||||||
gameState.setRestart(Game.Restart.NEW);
|
gameState.setRestart(Game.Restart.NEW);
|
||||||
gameState.setReplay(null);
|
gameState.setReplay(null);
|
||||||
game.enterState(Opsu.STATE_GAME, new EasedFadeOutTransition(), new FadeInTransition());
|
// TODO d displayContainer.switchState(Game.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.newdawn.slick.Graphics;
|
||||||
import org.newdawn.slick.Input;
|
import org.newdawn.slick.Input;
|
||||||
import org.newdawn.slick.KeyListener;
|
import org.newdawn.slick.KeyListener;
|
||||||
import org.newdawn.slick.MouseListener;
|
import org.newdawn.slick.MouseListener;
|
||||||
import org.newdawn.slick.openal.SoundStore;
|
|
||||||
import org.newdawn.slick.opengl.InternalTextureLoader;
|
import org.newdawn.slick.opengl.InternalTextureLoader;
|
||||||
import org.newdawn.slick.opengl.renderer.Renderer;
|
import org.newdawn.slick.opengl.renderer.Renderer;
|
||||||
import org.newdawn.slick.opengl.renderer.SGL;
|
import org.newdawn.slick.opengl.renderer.SGL;
|
||||||
|
@ -76,7 +75,7 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
|
||||||
public final DisplayMode nativeDisplayMode;
|
public final DisplayMode nativeDisplayMode;
|
||||||
|
|
||||||
private Graphics graphics;
|
private Graphics graphics;
|
||||||
private Input input;
|
public Input input;
|
||||||
|
|
||||||
public int width;
|
public int width;
|
||||||
public int height;
|
public int height;
|
||||||
|
@ -300,6 +299,10 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
|
||||||
state.writeErrorDump(dump);
|
state.writeErrorDump(dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInState(Class<? extends OpsuState> state) {
|
||||||
|
return state.isInstance(state);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isTransitioning() {
|
public boolean isTransitioning() {
|
||||||
return state instanceof TransitionState;
|
return state instanceof TransitionState;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package yugecin.opsudance.core.inject;
|
package yugecin.opsudance.core.inject;
|
||||||
|
|
||||||
import itdelatrisu.opsu.states.MainMenu;
|
import itdelatrisu.opsu.states.MainMenu;
|
||||||
|
import itdelatrisu.opsu.states.SongMenu;
|
||||||
import itdelatrisu.opsu.states.Splash;
|
import itdelatrisu.opsu.states.Splash;
|
||||||
import yugecin.opsudance.PreStartupInitializer;
|
import yugecin.opsudance.PreStartupInitializer;
|
||||||
import yugecin.opsudance.core.DisplayContainer;
|
import yugecin.opsudance.core.DisplayContainer;
|
||||||
|
@ -55,6 +56,7 @@ public class OpsuDanceInjector extends Injector {
|
||||||
|
|
||||||
bind(Splash.class).asEagerSingleton();
|
bind(Splash.class).asEagerSingleton();
|
||||||
bind(MainMenu.class).asEagerSingleton();
|
bind(MainMenu.class).asEagerSingleton();
|
||||||
|
bind(SongMenu.class).asEagerSingleton();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user