當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。