import itdelatrisu.opsu.ui.UI; //导入方法依赖的package包/类
@Override
public void enter(GameContainer container, StateBasedGame game)
throws SlickException {
UI.enter();
if (!enterNotification) {
if (Updater.get().getStatus() == Updater.Status.UPDATE_AVAILABLE) {
UI.getNotificationManager().sendNotification("A new update is available!", Colors.GREEN);
enterNotification = true;
} else if (Updater.get().justUpdated()) {
String updateMessage = OpsuConstants.PROJECT_NAME + " is now up to date!";
final String version = Updater.get().getCurrentVersion();
if (version != null && Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
updateMessage += "\nClick to see what changed!";
UI.getNotificationManager().sendNotification(updateMessage, Colors.GREEN, new NotificationListener() {
@Override
public void click() {
try {
Desktop.getDesktop().browse(OpsuConstants.getChangelogURI(version));
} catch (IOException e) {
UI.getNotificationManager().sendBarNotification("The web page could not be opened.");
}
}
});
} else
UI.getNotificationManager().sendNotification(updateMessage);
enterNotification = true;
}
}
// reset measure info
lastMeasureProgress = 0f;
starFountain.clear();
// reset button hover states if mouse is not currently hovering over the button
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
if (!logo.contains(mouseX, mouseY, 0.25f))
logo.resetHover();
if (!playButton.contains(mouseX, mouseY, 0.25f))
playButton.resetHover();
if (!exitButton.contains(mouseX, mouseY, 0.25f))
exitButton.resetHover();
if (!musicPlay.contains(mouseX, mouseY))
musicPlay.resetHover();
if (!musicPause.contains(mouseX, mouseY))
musicPause.resetHover();
if (!musicNext.contains(mouseX, mouseY))
musicNext.resetHover();
if (!musicPrevious.contains(mouseX, mouseY))
musicPrevious.resetHover();
if (repoButton != null && !repoButton.contains(mouseX, mouseY))
repoButton.resetHover();
updateButton.resetHover();
restartButton.resetHover();
if (!downloadsButton.contains(mouseX, mouseY))
downloadsButton.resetHover();
if (!userButton.contains(mouseX, mouseY))
userButton.resetHover();
// reset overlays
optionsOverlay.deactivate();
optionsOverlay.reset();
showOptionsOverlay = false;
optionsOverlayProgress.setTime(optionsOverlayProgress.getDuration());
userOverlay.deactivate();
showUserOverlay = false;
userOverlayProgress.setTime(userOverlayProgress.getDuration());
}