当前位置: 首页>>代码示例>>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;未经允许,请勿转载。