remove old main menu buttons

This commit is contained in:
yugecin 2018-07-07 18:29:29 +02:00
parent 3463bfd9df
commit 3baefd2c0b
No known key found for this signature in database
GPG Key ID: 2C5AC035A7068E44

View File

@ -111,9 +111,6 @@ public class MainMenu extends BaseOpsuState {
/** Now playing position vlaue. */ /** Now playing position vlaue. */
private final AnimatedValue nowPlayingPosition; private final AnimatedValue nowPlayingPosition;
/** Main "Play" and "Exit" buttons. */
private MenuButton playButton, exitButton;
/** Music control buttons. */ /** Music control buttons. */
private MenuButton musicPlay, musicPause, musicStop, musicNext, musicPrev; private MenuButton musicPlay, musicPause, musicStop, musicNext, musicPrev;
private MenuButton[] musicButtons = new MenuButton[5]; private MenuButton[] musicButtons = new MenuButton[5];
@ -185,28 +182,13 @@ public class MainMenu extends BaseOpsuState {
// initialize menu buttons // initialize menu buttons
Image logoImg = GameImage.MENU_LOGO.getImage(); Image logoImg = GameImage.MENU_LOGO.getImage();
Image playImg = GameImage.MENU_PLAY.getImage();
Image exitImg = GameImage.MENU_EXIT.getImage();
float exitOffset = (playImg.getWidth() - exitImg.getWidth()) / 3f;
logo = new MenuButton(logoImg, displayContainer.width / 2f, displayContainer.height / 2f); logo = new MenuButton(logoImg, displayContainer.width / 2f, displayContainer.height / 2f);
playButton = new MenuButton(playImg,
displayContainer.width * 0.75f, (displayContainer.height / 2) - (logoImg.getHeight() / 5f)
);
exitButton = new MenuButton(exitImg,
displayContainer.width * 0.75f - exitOffset, (displayContainer.height / 2) + (exitImg.getHeight() / 2f)
);
final int logoAnimationDuration = 350; final int logoAnimationDuration = 350;
logo.setHoverAnimationDuration(logoAnimationDuration); logo.setHoverAnimationDuration(logoAnimationDuration);
playButton.setHoverAnimationDuration(logoAnimationDuration);
exitButton.setHoverAnimationDuration(logoAnimationDuration);
final AnimationEquation logoAnimationEquation = AnimationEquation.IN_OUT_EXPO; final AnimationEquation logoAnimationEquation = AnimationEquation.IN_OUT_EXPO;
logo.setHoverAnimationEquation(logoAnimationEquation); logo.setHoverAnimationEquation(logoAnimationEquation);
playButton.setHoverAnimationEquation(logoAnimationEquation);
exitButton.setHoverAnimationEquation(logoAnimationEquation);
final float logoHoverScale = 1.096f; final float logoHoverScale = 1.096f;
logo.setHoverExpand(logoHoverScale); logo.setHoverExpand(logoHoverScale);
playButton.setHoverExpand(logoHoverScale);
exitButton.setHoverExpand(logoHoverScale);
// initialize music buttons // initialize music buttons
final int musicSize = (int) (this.textLineHeight * 0.8f); final int musicSize = (int) (this.textLineHeight * 0.8f);
@ -519,8 +501,6 @@ public class MainMenu extends BaseOpsuState {
int mouseX = displayContainer.mouseX; int mouseX = displayContainer.mouseX;
int mouseY = displayContainer.mouseY; int mouseY = displayContainer.mouseY;
logo.hoverUpdate(delta, mouseX, mouseY, 0.25f); logo.hoverUpdate(delta, mouseX, mouseY, 0.25f);
playButton.hoverUpdate(delta, mouseX, mouseY, 0.25f);
exitButton.hoverUpdate(delta, mouseX, mouseY, 0.25f);
if (repoButton != null) { if (repoButton != null) {
repoButton.hoverUpdate(delta, mouseX, mouseY); repoButton.hoverUpdate(delta, mouseX, mouseY);
danceRepoButton.hoverUpdate(delta, mouseX, mouseY); danceRepoButton.hoverUpdate(delta, mouseX, mouseY);
@ -555,7 +535,6 @@ public class MainMenu extends BaseOpsuState {
// buttons // buttons
int centerX = displayContainer.width / 2; int centerX = displayContainer.width / 2;
float currentLogoButtonAlpha;
switch (logoState) { switch (logoState) {
case DEFAULT: case DEFAULT:
break; break;
@ -571,11 +550,7 @@ public class MainMenu extends BaseOpsuState {
} }
break; break;
case OPEN: case OPEN:
if (logoButtonAlpha.update(delta)) { // fade in buttons logoButtonAlpha.update(delta);
currentLogoButtonAlpha = logoButtonAlpha.getValue();
playButton.getImage().setAlpha(currentLogoButtonAlpha);
exitButton.getImage().setAlpha(currentLogoButtonAlpha);
}
if (this.lastMouseX != mouseX || this.lastMouseY != mouseY) { if (this.lastMouseX != mouseX || this.lastMouseY != mouseY) {
this.logoTimer = 0; this.logoTimer = 0;
this.lastMouseX = mouseX; this.lastMouseX = mouseX;
@ -588,11 +563,7 @@ public class MainMenu extends BaseOpsuState {
} }
break; break;
case CLOSING: case CLOSING:
if (logoButtonAlpha.update(-delta)) { // fade out buttons logoButtonAlpha.update(-delta);
currentLogoButtonAlpha = logoButtonAlpha.getValue();
playButton.getImage().setAlpha(currentLogoButtonAlpha);
exitButton.getImage().setAlpha(currentLogoButtonAlpha);
}
if (logoPosition.update(-delta)) { if (logoPosition.update(-delta)) {
logo.setX(centerX - logoPosition.getValue()); logo.setX(centerX - logoPosition.getValue());
this.buttonAnimation.update(-delta); this.buttonAnimation.update(-delta);
@ -676,10 +647,6 @@ public class MainMenu extends BaseOpsuState {
int mouseY = displayContainer.mouseY; int mouseY = displayContainer.mouseY;
if (!logo.contains(mouseX, mouseY, 0.25f)) if (!logo.contains(mouseX, mouseY, 0.25f))
logo.resetHover(); logo.resetHover();
if (!playButton.contains(mouseX, mouseY, 0.25f))
playButton.resetHover();
if (!exitButton.contains(mouseX, mouseY, 0.25f))
exitButton.resetHover();
for (MenuButton b : this.musicButtons) { for (MenuButton b : this.musicButtons) {
if (!b.contains(mouseX, mouseY)) { if (!b.contains(mouseX, mouseY)) {
b.resetHover(); b.resetHover();
@ -830,7 +797,7 @@ public class MainMenu extends BaseOpsuState {
SoundController.playSound(SoundEffect.MENUHIT); SoundController.playSound(SoundEffect.MENUHIT);
enterSongMenu(); enterSongMenu();
return true; return true;
} else if (exitButton.contains(x, y, 0.25f)) { } else if (this.buttonPositions[2].contains(x, y, 0.25f)) {
displayContainer.exitRequested = true; displayContainer.exitRequested = true;
return true; return true;
} }
@ -940,8 +907,6 @@ public class MainMenu extends BaseOpsuState {
buttonAnimation.change(300, 0f, 1f, OUT_QUAD); buttonAnimation.change(300, 0f, 1f, OUT_QUAD);
logoPosition.change(300, 0, logoPositionOffsetX, OUT_CUBIC); logoPosition.change(300, 0, logoPositionOffsetX, OUT_CUBIC);
logoState = LogoState.OPENING; logoState = LogoState.OPENING;
playButton.getImage().setAlpha(0f);
exitButton.getImage().setAlpha(0f);
} }
private void closeLogo() { private void closeLogo() {