當前位置: 首頁>>代碼示例>>Java>>正文


Java UI類代碼示例

本文整理匯總了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);
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:23,代碼來源:DisplayContainer.java

示例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);
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:25,代碼來源:GamePauseMenu.java

示例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;
	}
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:23,代碼來源:DownloadsMenu.java

示例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);
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:20,代碼來源:ButtonMenu.java

示例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);
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:23,代碼來源:GameRanking.java

示例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();
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:17,代碼來源:GameRanking.java

示例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();
}
 
開發者ID:itdelatrisu,項目名稱:opsu,代碼行數:25,代碼來源:OptionsOverlay.java

示例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);
}
 
開發者ID:itdelatrisu,項目名稱:opsu,代碼行數:24,代碼來源:UserSelectOverlay.java

示例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);
		}
	}
}
 
開發者ID:itdelatrisu,項目名稱:opsu,代碼行數:21,代碼來源:UserSelectOverlay.java

示例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);
}
 
開發者ID:itdelatrisu,項目名稱:opsu,代碼行數:26,代碼來源:GamePauseMenu.java

示例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);
	}
}
 
開發者ID:itdelatrisu,項目名稱:opsu,代碼行數:20,代碼來源:Game.java

示例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);
}
 
開發者ID:itdelatrisu,項目名稱:opsu,代碼行數:22,代碼來源:SongMenu.java

示例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());
}
 
開發者ID:itdelatrisu,項目名稱:opsu,代碼行數:28,代碼來源:SongMenu.java

示例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;
	}
}
 
開發者ID:itdelatrisu,項目名稱:opsu,代碼行數:23,代碼來源:DownloadsMenu.java

示例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);
}
 
開發者ID:itdelatrisu,項目名稱:opsu,代碼行數:22,代碼來源:ButtonMenu.java


注:本文中的itdelatrisu.opsu.ui.UI類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。