本文整理汇总了Java中itdelatrisu.opsu.ui.UI类的典型用法代码示例。如果您正苦于以下问题:Java UI类的具体用法?Java UI怎么用?Java UI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UI类属于itdelatrisu.opsu.ui包,在下文中一共展示了UI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reinit
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
private void reinit() {
// this used to be in Utils.init
// TODO find a better place for this?
setFPS(targetFPS[targetFPSIndex]);
MusicController.setMusicVolume(OPTION_MUSIC_VOLUME.val / 100f * OPTION_MASTER_VOLUME.val / 100f);
skinservice.loadSkin();
// initialize game images
for (GameImage img : GameImage.values()) {
if (img.isPreload()) {
img.setDefaultImage();
}
}
// TODO clean this up
GameMod.init(width, height);
PlaybackSpeed.init(width, height);
HitObject.init(width, height);
DownloadNode.init(width, height);
UI.init(this);
}
示例2: render
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
@Override
public void render(Graphics g) {
// get background image
GameImage bg = (gameState.getRestart() == Game.Restart.LOSE) ?
GameImage.FAIL_BACKGROUND : GameImage.PAUSE_OVERLAY;
// don't draw default background if button skinned and background unskinned
boolean buttonsSkinned =
GameImage.PAUSE_CONTINUE.hasBeatmapSkinImage() ||
GameImage.PAUSE_RETRY.hasBeatmapSkinImage() ||
GameImage.PAUSE_BACK.hasBeatmapSkinImage();
if (!buttonsSkinned || bg.hasBeatmapSkinImage())
bg.getImage().draw();
else
g.setBackground(Color.black);
// draw buttons
if (gameState.getRestart() != Game.Restart.LOSE)
continueButton.draw();
retryButton.draw();
backButton.draw();
UI.draw(g);
}
示例3: enter
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
@Override
public void enter() {
super.enter();
UI.enter();
prevPage.resetHover();
nextPage.resetHover();
clearButton.resetHover();
importButton.resetHover();
resetButton.resetHover();
rankedButton.resetHover();
serverMenu.reset();
focusResult = -1;
startResultPos.setPosition(0);
startDownloadIndexPos.setPosition(0);
pageDir = Page.RESET;
previewID = -1;
if (barNotificationOnLoad != null) {
BarNotifListener.EVENT.make().onBarNotif(barNotificationOnLoad);
barNotificationOnLoad = null;
}
}
示例4: render
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
/**
* Draws the title and buttons to the graphics context.
* @param g the graphics context
*/
public void render(Graphics g) {
// draw title
if (actualTitle != null) {
float marginX = displayContainer.width * 0.015f, marginY = displayContainer.height * 0.01f;
int lineHeight = Fonts.LARGE.getLineHeight();
for (int i = 0, size = actualTitle.size(); i < size; i++)
Fonts.LARGE.drawString(marginX, marginY + (i * lineHeight), actualTitle.get(i), Color.white);
}
// draw buttons
for (int i = 0; i < buttons.length; i++)
menuButtons[i].draw(buttons[i].getColor());
UI.draw(g);
}
示例5: render
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
@Override
public void render(Graphics g) {
Beatmap beatmap = MusicController.getBeatmap();
// background
if (!beatmap.drawBackground(displayContainer.width, displayContainer.height, 0.7f, true)) {
GameImage.PLAYFIELD.getImage().draw(0, 0);
}
// ranking screen elements
data.drawRankingElements(g, beatmap);
// buttons
replayButton.draw();
if (data.isGameplay() && !GameMod.AUTO.isActive())
retryButton.draw();
UI.getBackButton().draw(g);
UI.draw(g);
super.render(g);
}
示例6: enter
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
@Override
public void enter() {
super.enter();
UI.enter();
if (!data.isGameplay()) {
if (!MusicController.isTrackDimmed())
MusicController.toggleTrackDimmed(0.5f);
replayButton.setY(retryY);
} else {
SoundController.playSound(SoundEffect.APPLAUSE);
retryButton.resetHover();
replayButton.setY(!GameMod.AUTO.isActive() ? replayY : retryY);
}
replayButton.resetHover();
}
示例7: mouseWheelMoved
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
@Override
public void mouseWheelMoved(int delta) {
if (UI.globalMouseWheelMoved(delta, true)) {
consumeEvent();
return;
}
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
if (!active)
return;
if (!contains(mouseX, mouseY)) {
if (consumeAndClose) {
consumeEvent();
listener.close();
}
return;
}
if (!isAdjustingSlider)
scrolling.scrollOffset(-delta);
updateHoverOption(prevMouseX, prevMouseY);
consumeEvent();
}
示例8: mouseWheelMoved
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
@Override
public void mouseWheelMoved(int delta) {
if (UI.globalMouseWheelMoved(delta, true)) {
consumeEvent();
return;
}
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
if (!active)
return;
if (!contains(mouseX, mouseY)) {
if (consumeAndClose) {
consumeEvent();
listener.close(false);
}
return;
}
consumeEvent();
scrolling.scrollOffset(-delta);
}
示例9: createNewUser
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
/** Creates a new user and switches to it. */
private void createNewUser() {
SoundController.playSound(SoundEffect.MENUCLICK);
String name = newUser.getName();
int icon = newUser.getIconId();
if (!UserList.get().isValidUserName(name)) {
String error = name.isEmpty() ? "Enter a name for the user." : "You can't use that name.";
UI.getNotificationManager().sendBarNotification(error);
newUserButton.flash();
} else {
if (UserList.get().createNewUser(name, icon) == null)
UI.getNotificationManager().sendBarNotification("Something wrong happened.");
else {
// change user
UserList.get().changeUser(name);
UI.getNotificationManager().sendNotification("New user created.\nEnjoy the game! :)", Colors.GREEN);
listener.close(true);
}
}
}
示例10: render
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
@Override
public void render(GameContainer container, StateBasedGame game, Graphics g)
throws SlickException {
// get background image
GameImage bg = (gameState.getPlayState() == Game.PlayState.LOSE) ?
GameImage.FAIL_BACKGROUND : GameImage.PAUSE_OVERLAY;
// don't draw default background if button skinned and background unskinned
boolean buttonsSkinned =
GameImage.PAUSE_CONTINUE.hasBeatmapSkinImage() ||
GameImage.PAUSE_RETRY.hasBeatmapSkinImage() ||
GameImage.PAUSE_BACK.hasBeatmapSkinImage();
if (!buttonsSkinned || bg.hasBeatmapSkinImage())
bg.getImage().drawCentered(container.getWidth() / 2, container.getHeight() / 2);
else
g.setBackground(Color.black);
// draw buttons
if (gameState.getPlayState() != Game.PlayState.LOSE)
continueButton.draw();
retryButton.draw();
backButton.draw();
UI.draw(g);
}
示例11: adjustLocalMusicOffset
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
/**
* Adjusts the beatmap's local music offset.
* @param sign the sign (multiplier)
*/
private void adjustLocalMusicOffset(int sign) {
if (pauseTime > -1) {
UI.getNotificationManager().sendBarNotification("Offset can only be changed while game is not paused.");
return;
}
boolean alt = input.isKeyDown(Input.KEY_LALT) || input.isKeyDown(Input.KEY_RALT);
int diff = sign * (alt ? 1 : 5);
int newOffset = Utils.clamp(beatmap.localMusicOffset + diff, -1000, 1000);
UI.getNotificationManager().sendBarNotification(String.format("Local beatmap offset set to %dms", newOffset));
if (beatmap.localMusicOffset != newOffset) {
beatmap.localMusicOffset = newOffset;
BeatmapDB.updateLocalOffset(beatmap);
}
}
示例12: mouseWheelMoved
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
@Override
public void mouseWheelMoved(int newValue) {
// change volume
if (UI.globalMouseWheelMoved(newValue, true))
return;
// block input
if (isInputBlocked())
return;
int shift = (newValue < 0) ? 1 : -1;
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
// score buttons
if (focusScores != null && focusScores.length >= MAX_SCORE_BUTTONS && ScoreData.areaContains(mouseX, mouseY))
startScorePos.scrollOffset(ScoreData.getButtonOffset() * shift);
// song buttons
else
changeIndex(shift);
}
示例13: startGame
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
/**
* Starts the game.
*/
private void startGame() {
if (MusicController.isTrackLoading())
return;
Beatmap beatmap = MusicController.getBeatmap();
if (focusNode == null || beatmap != focusNode.getSelectedBeatmap()) {
UI.getNotificationManager().sendBarNotification("Unable to load the beatmap audio.");
return;
}
// turn on "auto" mod if holding "ctrl" key
if (input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL)) {
if (!GameMod.AUTO.isActive())
GameMod.AUTO.toggle(true);
}
SoundController.playSound(SoundEffect.MENUHIT);
MultiClip.destroyExtraClips();
Game gameState = (Game) game.getState(Opsu.STATE_GAME);
gameState.loadBeatmap(beatmap);
gameState.setPlayState(Game.PlayState.FIRST_LOAD);
gameState.setReplay(null);
game.enterState(Opsu.STATE_GAME, new EasedFadeOutTransition(), new FadeInTransition());
}
示例14: enter
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
@Override
public void enter(GameContainer container, StateBasedGame game)
throws SlickException {
UI.enter();
prevPage.resetHover();
nextPage.resetHover();
clearButton.resetHover();
importButton.resetHover();
resetButton.resetHover();
rankedButton.resetHover();
serverMenu.activate();
serverMenu.reset();
focusResult = -1;
startResultPos.setPosition(0);
startDownloadIndexPos.setPosition(0);
pageDir = Page.RESET;
previewID = -1;
if (barNotificationOnLoad != null) {
UI.getNotificationManager().sendBarNotification(barNotificationOnLoad);
barNotificationOnLoad = null;
}
}
示例15: draw
import itdelatrisu.opsu.ui.UI; //导入依赖的package包/类
/**
* Draws the title and buttons to the graphics context.
* @param container the game container
* @param game the game
* @param g the graphics context
*/
public void draw(GameContainer container, StateBasedGame game, Graphics g) {
// draw title
if (actualTitle != null) {
float marginX = container.getWidth() * 0.015f, marginY = container.getHeight() * 0.01f;
int lineHeight = Fonts.LARGE.getLineHeight();
for (int i = 0, size = actualTitle.size(); i < size; i++)
Fonts.LARGE.drawString(marginX, marginY + (i * lineHeight), actualTitle.get(i), Color.white);
}
// draw buttons
for (int i = 0; i < buttons.length; i++)
menuButtons[i].draw(buttons[i].getColor());
UI.draw(g);
}