mainmenu: close the logo after 6s mouse inactivity instead of 10s total
This commit is contained in:
parent
9d6ac19868
commit
a2634ac093
|
@ -68,7 +68,7 @@ import static yugecin.opsudance.options.Options.*;
|
||||||
public class MainMenu extends BaseOpsuState {
|
public class MainMenu extends BaseOpsuState {
|
||||||
|
|
||||||
/** Idle time, in milliseconds, before returning the logo to its original position. */
|
/** Idle time, in milliseconds, before returning the logo to its original position. */
|
||||||
private static final short LOGO_IDLE_DELAY = 10000;
|
private static final short LOGO_IDLE_DELAY = 6000;
|
||||||
|
|
||||||
/** Max alpha level of the menu background. */
|
/** Max alpha level of the menu background. */
|
||||||
private static final float BG_MAX_ALPHA = 0.9f;
|
private static final float BG_MAX_ALPHA = 0.9f;
|
||||||
|
@ -91,6 +91,9 @@ public class MainMenu extends BaseOpsuState {
|
||||||
private AnimatedValue logoPosition;
|
private AnimatedValue logoPosition;
|
||||||
private float logoPositionOffsetX;
|
private float logoPositionOffsetX;
|
||||||
|
|
||||||
|
private int lastMouseX;
|
||||||
|
private int lastMouseY;
|
||||||
|
|
||||||
/** Logo button alpha levels. */
|
/** Logo button alpha levels. */
|
||||||
private AnimatedValue logoButtonAlpha;
|
private AnimatedValue logoButtonAlpha;
|
||||||
|
|
||||||
|
@ -504,10 +507,16 @@ public class MainMenu extends BaseOpsuState {
|
||||||
currentLogoButtonAlpha = logoButtonAlpha.getValue();
|
currentLogoButtonAlpha = logoButtonAlpha.getValue();
|
||||||
playButton.getImage().setAlpha(currentLogoButtonAlpha);
|
playButton.getImage().setAlpha(currentLogoButtonAlpha);
|
||||||
exitButton.getImage().setAlpha(currentLogoButtonAlpha);
|
exitButton.getImage().setAlpha(currentLogoButtonAlpha);
|
||||||
} else if (logoTimer >= LOGO_IDLE_DELAY) { // timer over: shift back to center
|
}
|
||||||
this.closeLogo();
|
if (this.lastMouseX != mouseX || this.lastMouseY != mouseY) {
|
||||||
|
this.logoTimer = 0;
|
||||||
|
this.lastMouseX = mouseX;
|
||||||
|
this.lastMouseY = mouseY;
|
||||||
} else {
|
} else {
|
||||||
logoTimer += delta;
|
this.logoTimer += delta;
|
||||||
|
if (this.logoTimer >= LOGO_IDLE_DELAY) {
|
||||||
|
this.closeLogo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CLOSING:
|
case CLOSING:
|
||||||
|
@ -552,7 +561,6 @@ public class MainMenu extends BaseOpsuState {
|
||||||
logoPosition.setTime(0);
|
logoPosition.setTime(0);
|
||||||
logoButtonAlpha.setTime(0);
|
logoButtonAlpha.setTime(0);
|
||||||
nowPlayingPosition.setTime(0);
|
nowPlayingPosition.setTime(0);
|
||||||
logoTimer = 0;
|
|
||||||
logoState = LogoState.DEFAULT;
|
logoState = LogoState.DEFAULT;
|
||||||
|
|
||||||
UI.enter();
|
UI.enter();
|
||||||
|
@ -831,7 +839,6 @@ public class MainMenu extends BaseOpsuState {
|
||||||
private void openLogo() {
|
private void openLogo() {
|
||||||
logoPosition.change(300, 0, logoPositionOffsetX, OUT_CUBIC);
|
logoPosition.change(300, 0, logoPositionOffsetX, OUT_CUBIC);
|
||||||
logoState = LogoState.OPENING;
|
logoState = LogoState.OPENING;
|
||||||
logoTimer = 0;
|
|
||||||
playButton.getImage().setAlpha(0f);
|
playButton.getImage().setAlpha(0f);
|
||||||
exitButton.getImage().setAlpha(0f);
|
exitButton.getImage().setAlpha(0f);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user