当前位置: 首页>>代码示例>>Java>>正文


Java UI.globalKeyPressed方法代码示例

本文整理汇总了Java中itdelatrisu.opsu.ui.UI.globalKeyPressed方法的典型用法代码示例。如果您正苦于以下问题:Java UI.globalKeyPressed方法的具体用法?Java UI.globalKeyPressed怎么用?Java UI.globalKeyPressed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在itdelatrisu.opsu.ui.UI的用法示例。


在下文中一共展示了UI.globalKeyPressed方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: keyPressed

import itdelatrisu.opsu.ui.UI; //导入方法依赖的package包/类
@Override
public void keyPressed(int key, char c) {
	if (UI.globalKeyPressed(key))
		return;

	switch (key) {
	case Input.KEY_ESCAPE:
		if (menuState != null)
			menuState.leave(container, game);
		break;
	default:
		if (menuState != null)
			menuState.keyPress(container, game, key, c);
		break;
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:17,代码来源:ButtonMenu.java

示例2: keyPressed

import itdelatrisu.opsu.ui.UI; //导入方法依赖的package包/类
@Override
public void keyPressed(int key, char c) {
	if (!active)
		return;

	consumeEvent();

	// esc: close overlay or clear text
	if (key == Input.KEY_ESCAPE) {
		if (state == State.CREATE_USER && !textField.getText().isEmpty()) {
			textField.setText("");
			newUser.setName("");
		} else
			listener.close(false);
		return;
	}

	if (UI.globalKeyPressed(key))
		return;

	// key entry
	if (state == State.CREATE_USER) {
		// enter: create user
		if (key == Input.KEY_ENTER) {
			createNewUser();
			return;
		}

		textField.setFocus(true);
		textField.keyPressed(key, c);
		textField.setFocus(false);
		newUser.setName(textField.getText());
		if (c > 255 && Character.isLetterOrDigit(c)) {
			Fonts.loadGlyphs(Fonts.LARGE, c);
			Fonts.loadGlyphs(Fonts.MEDIUM, c);
		}
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:39,代码来源:UserSelectOverlay.java

示例3: keyPressed

import itdelatrisu.opsu.ui.UI; //导入方法依赖的package包/类
@Override
public void keyPressed(int key, char c) {
	if (UI.globalKeyPressed(key))
		return;

	switch (key) {
	case Input.KEY_ESCAPE:
		returnToSongMenu();
		break;
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:12,代码来源:GameRanking.java

示例4: keyPressed

import itdelatrisu.opsu.ui.UI; //导入方法依赖的package包/类
@Override
public void keyPressed(int key, char c) {
	if (!active)
		return;

	consumeEvent();

	// key entry state
	if (keyEntryRight) {
		Options.setGameKeyRight(key);
		keyEntryRight = false;
		return;
	} else if (keyEntryLeft) {
		Options.setGameKeyLeft(key);
		keyEntryLeft = false;
		return;
	}

	// esc: close open list option, otherwise close overlay
	if (key == Input.KEY_ESCAPE) {
		if (lastSearchText.length() > 0)
			resetSearch();
		else
			listener.close();
		return;
	}

	if (UI.globalKeyPressed(key))
		return;

	searchField.setFocus(true);
	searchField.keyPressed(key, c);
	searchField.setFocus(false);
	if (!searchField.getText().equals(lastSearchText)) {
		String newSearchText = searchField.getText().toLowerCase();
		if (!hasSearchResults(newSearchText)) {
			searchField.setText(lastSearchText);
			invalidSearchAnimation.setTime(0);
			Random rand = new Random();
			invalidSearchImgRotation = 10 + rand.nextInt(10);
			invalidSearchTextRotation = 10 + rand.nextInt(10);
			if (rand.nextBoolean())
				invalidSearchImgRotation = -invalidSearchImgRotation;
			if (rand.nextBoolean())
				invalidSearchTextRotation = -invalidSearchTextRotation;
		} else {
			lastSearchText = newSearchText;
			updateSearch();
		}
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:52,代码来源:OptionsOverlay.java

示例5: keyPressed

import itdelatrisu.opsu.ui.UI; //导入方法依赖的package包/类
@Override
public void keyPressed(int key, char c) {
	if (UI.globalKeyPressed(key))
		return;

	// game keys
	if (!Keyboard.isRepeatEvent()) {
		if (key == Options.getGameKeyLeft())
			mousePressed(Input.MOUSE_LEFT_BUTTON, input.getMouseX(), input.getMouseY());
		else if (key == Options.getGameKeyRight())
			mousePressed(Input.MOUSE_RIGHT_BUTTON, input.getMouseX(), input.getMouseY());
	}

	switch (key) {
	case Input.KEY_ESCAPE:
		// 'esc' will normally unpause, but will return to song menu if health is zero
		if (gameState.getPlayState() == Game.PlayState.LOSE) {
			SoundController.playSound(SoundEffect.MENUBACK);
			((SongMenu) game.getState(Opsu.STATE_SONGMENU)).resetGameDataOnLoad();
			MusicController.playAt(MusicController.getBeatmap().previewTime, true);
			if (UI.getCursor().isBeatmapSkinned())
				UI.getCursor().reset();
			game.enterState(Opsu.STATE_SONGMENU, new EasedFadeOutTransition(), new FadeInTransition());
		} else {
			SoundController.playSound(SoundEffect.MENUBACK);
			gameState.setPlayState(Game.PlayState.NORMAL);
			game.enterState(Opsu.STATE_GAME);
		}
		break;
	case Input.KEY_R:
		// restart
		if (input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL)) {
			gameState.setPlayState(Game.PlayState.RETRY);
			game.enterState(Opsu.STATE_GAME);
		}
		break;
	case Input.KEY_EQUALS:
	case Input.KEY_ADD:
	case Input.KEY_MINUS:
	case Input.KEY_SUBTRACT:
		UI.getNotificationManager().sendBarNotification("Offset can only be changed while game is not paused.");
		break;
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:45,代码来源:GamePauseMenu.java

示例6: keyPressed

import itdelatrisu.opsu.ui.UI; //导入方法依赖的package包/类
@Override
public void keyPressed(int key, char c) {
	// block input during beatmap importing
	if (importThread != null && !(key == Input.KEY_ESCAPE || key == Input.KEY_F12))
		return;

	if (UI.globalKeyPressed(key))
		return;

	switch (key) {
	case Input.KEY_ESCAPE:
		if (importThread != null) {
			// beatmap importing: stop parsing beatmaps by sending interrupt to BeatmapParser
			importThread.interrupt();
		} else if (!search.getText().isEmpty()) {
			// clear search text
			search.setText("");
			pageDir = Page.RESET;
			resetSearchTimer();
		} else {
			// return to main menu
			SoundController.playSound(SoundEffect.MENUBACK);
			((MainMenu) game.getState(Opsu.STATE_MAINMENU)).reset();
			game.enterState(Opsu.STATE_MAINMENU, new EasedFadeOutTransition(), new FadeInTransition());
		}
		break;
	case Input.KEY_ENTER:
		if (!search.getText().isEmpty()) {
			pageDir = Page.RESET;
			resetSearchTimer();
		}
		break;
	case Input.KEY_F5:
		SoundController.playSound(SoundEffect.MENUCLICK);
		lastQuery = null;
		pageDir = Page.CURRENT;
		if (searchQuery != null)
			searchQuery.interrupt();
		resetSearchTimer();
		break;
	default:
		// wait for user to finish typing
		if (Character.isLetterOrDigit(c) || key == Input.KEY_BACK || key == Input.KEY_SPACE) {
			// load glyphs
			if (c > 255)
				Fonts.loadGlyphs(searchFont, c);

			// reset search timer
			searchTimer = 0;
			pageDir = Page.RESET;
		}
		break;
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:55,代码来源:DownloadsMenu.java

示例7: keyPressed

import itdelatrisu.opsu.ui.UI; //导入方法依赖的package包/类
@Override
public void keyPressed(int key, char c) {
	if (UI.globalKeyPressed(key))
		return;

	switch (key) {
	case Input.KEY_ESCAPE:
	case Input.KEY_Q:
		((ButtonMenu) game.getState(Opsu.STATE_BUTTONMENU)).setMenuState(MenuState.EXIT);
		game.enterState(Opsu.STATE_BUTTONMENU);
		break;
	case Input.KEY_P:
		SoundController.playSound(SoundEffect.MENUHIT);
		if (logoState == LogoState.DEFAULT || logoState == LogoState.CLOSING)
			openLogoMenu();
		else
			enterSongMenu();
		break;
	case Input.KEY_D:
		SoundController.playSound(SoundEffect.MENUHIT);
		game.enterState(Opsu.STATE_DOWNLOADSMENU, new EasedFadeOutTransition(), new FadeInTransition());
		break;
	case Input.KEY_O:
		SoundController.playSound(SoundEffect.MENUHIT);
		if ((logoState == LogoState.DEFAULT || logoState == LogoState.CLOSING) &&
		    !(input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL)))
			openLogoMenu();
		else {
			showOptionsOverlay = true;
			optionsOverlayProgress.setTime(0);
			optionsOverlay.activate();
			input.consumeEvent();  // don't let options overlay consume this keypress
		}
		break;
	case Input.KEY_F:
		Options.toggleFPSCounter();
		break;
	case Input.KEY_Z:
		previousTrack();
		UI.getNotificationManager().sendBarNotification("<< Prev");
		break;
	case Input.KEY_X:
		if (MusicController.isPlaying()) {
			lastMeasureProgress = 0f;
			MusicController.setPosition(0);
		} else if (!MusicController.isTrackLoading())
			MusicController.resume();
		UI.getNotificationManager().sendBarNotification("Play");
		break;
	case Input.KEY_C:
		if (MusicController.isPlaying()) {
			MusicController.pause();
			UI.getNotificationManager().sendBarNotification("Pause");
		} else if (!MusicController.isTrackLoading()) {
			MusicController.resume();
			UI.getNotificationManager().sendBarNotification("Unpause");
		}
		break;
	case Input.KEY_V:
		nextTrack(true);
		UI.getNotificationManager().sendBarNotification(">> Next");
		break;
	case Input.KEY_R:
		nextTrack(true);
		break;
	case Input.KEY_UP:
		UI.changeVolume(1);
		break;
	case Input.KEY_DOWN:
		UI.changeVolume(-1);
		break;
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:74,代码来源:MainMenu.java


注:本文中的itdelatrisu.opsu.ui.UI.globalKeyPressed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。