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


Java SoundController.playSound方法代码示例

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


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

示例1: hitResult

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的package包/类
/**
 * Calculates and sends the spinner hit result.
 * @return the hit result (GameData.HIT_* constants)
 */
private int hitResult() {
	// TODO: verify ratios
	int result;
	float ratio = rotations / rotationsNeeded;
	if (ratio >= 1.0f || GameMod.AUTO.isActive() || GameMod.AUTOPILOT.isActive() || GameMod.SPUN_OUT.isActive()) {
		result = GameData.HIT_300;
		SoundController.playSound(SoundEffect.SPINNEROSU);
	} else if (ratio >= 0.9f)
		result = GameData.HIT_100;
	else if (ratio >= 0.75f)
		result = GameData.HIT_50;
	else
		result = GameData.HIT_MISS;

	data.sendHitResult(hitObject.getEndTime(), result, width / 2, height / 2,
			Color.transparent, true, hitObject, HitObjectType.SPINNER, true, 0, null, false);
	return result;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:23,代码来源:Spinner.java

示例2: rotate

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的package包/类
/**
	 * Rotates the spinner by an angle.
	 * @param angle the angle to rotate (in radians)
	 */
	private void rotate(float angle) {
		drawRotation += angle / TWO_PI;
		angle = Math.abs(angle);
		float newRotations = rotations + (angle / TWO_PI);

		// added one whole rotation...
		if (Math.floor(newRotations) > rotations) {
			//TODO seems to give 1100 points per spin but also an extra 100 for some spinners
			if (newRotations > rotationsNeeded) {  // extra rotations
				data.changeScore(1000);
				SoundController.playSound(SoundEffect.SPINNERBONUS);
			}
			data.changeScore(100);
			SoundController.playSound(SoundEffect.SPINNERSPIN);
		}

		// extra 100 for some spinners (mostly wrong)
//		if (Math.floor(newRotations + 0.5f) > rotations + 0.5f) {
//			if (newRotations + 0.5f > rotationsNeeded)  // extra rotations
//				data.changeScore(100);
//		}

		rotations = newRotations;
	}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:29,代码来源:Spinner.java

示例3: skipIntro

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的package包/类
/**
 * Skips the beginning of a track.
 * @return {@code true} if skipped, {@code false} otherwise
 */
private synchronized boolean skipIntro() {
	int firstObjectTime = beatmap.objects[0].getTime();
	int trackPosition = MusicController.getPosition();
	if (objectIndex == 0 && (trackPosition < firstObjectTime - SKIP_OFFSET) || isLeadIn()) {
		if (isLeadIn()) {
			leadInTime = 0;
			epiImgTime = 0;
			MusicController.resume();
		}
		MusicController.setPosition(Math.max(0, firstObjectTime - SKIP_OFFSET));
		MusicController.setPitch(GameMod.getSpeedMultiplier() * playbackSpeed.getModifier());
		replaySkipTime = (isReplay) ? -1 : trackPosition;
		if (isReplay) {
			replayX = (int) skipButton.getX();
			replayY = (int) skipButton.getY();
		}
		SoundController.playSound(SoundEffect.MENUHIT);
		return true;
	}
	return false;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:26,代码来源:Game.java

示例4: startGame

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的package包/类
/**
 * Starts the game.
 */
private void startGame() {
	if (MusicController.isTrackLoading())
		return;

	Beatmap beatmap = MusicController.getBeatmap();
	if (focusNode == null || beatmap != focusNode.getSelectedBeatmap()) {
		BarNotifListener.EVENT.make().onBarNotif("Unable to load the beatmap audio.");
		return;
	}

	// turn on "auto" mod if holding "ctrl" key
	if (input.isControlDown() && !GameMod.AUTO.isActive()) {
		GameMod.AUTO.toggle(true);
	}

	SoundController.playSound(SoundEffect.MENUHIT);
	MultiClip.destroyExtraClips();
	gameState.loadBeatmap(beatmap);
	gameState.setRestart(Game.Restart.NEW);
	gameState.setReplay(null);
	displayContainer.switchState(gameState);
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:26,代码来源:SongMenu.java

示例5: enter

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的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

示例6: enter

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的package包/类
@Override
public void enter(GameContainer container, StateBasedGame game)
		throws SlickException {
	UI.enter();
	Display.setTitle(game.getTitle());
	if (!data.isGameplay()) {
		if (!MusicController.isTrackDimmed())
			MusicController.toggleTrackDimmed(0.5f);
		replayButton.setY(retryY);
		animationProgress.setTime(animationProgress.getDuration());
	} else {
		SoundController.playSound(SoundEffect.APPLAUSE);
		retryButton.resetHover();
		if (GameMod.AUTO.isActive()) {
			replayButton.setY(retryY);
			animationProgress.setTime(animationProgress.getDuration());
		} else {
			replayButton.setY(replayY);
			animationProgress.setTime(0);
		}
	}
	replayButton.resetHover();
	loadReplay();
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:25,代码来源:GameRanking.java

示例7: sendSpinnerSpinResult

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的package包/类
/**
 * Handles a spinner spin result.
 * @param result the hit result (HIT_* constants)
 */
public void sendSpinnerSpinResult(int result) {
	int hitValue = 0;
	switch (result) {
	case HIT_SPINNERSPIN:
		hitValue = 100;
		SoundController.playSound(SoundEffect.SPINNERSPIN);
		break;
	case HIT_SPINNERBONUS:
		hitValue = 1100;
		SoundController.playSound(SoundEffect.SPINNERBONUS);
		break;
	default:
		return;
	}

	score += hitValue;
	health.changeHealthForHit(result);
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:23,代码来源:GameData.java

示例8: createNewUser

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的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

示例9: skipIntro

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的package包/类
/**
 * Skips the beginning of a track.
 * @return {@code true} if skipped, {@code false} otherwise
 */
private synchronized boolean skipIntro() {
	int firstObjectTime = beatmap.objects[0].getTime();
	int trackPosition = MusicController.getPosition(true);
	if (objectIndex == 0 && trackPosition < firstObjectTime - SKIP_OFFSET) {
		if (isLeadIn()) {
			leadInTime = 0;
			MusicController.resume();
		}
		MusicController.setPosition(firstObjectTime - SKIP_OFFSET);
		MusicController.setPitch(getCurrentPitch());
		replaySkipTime = (isReplay) ? -1 : trackPosition;
		if (isReplay) {
			replayX = (int) skipButton.getX();
			replayY = (int) skipButton.getY();
		}
		SoundController.playSound(SoundEffect.MENUHIT);
		return true;
	}
	return false;
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:25,代码来源:Game.java

示例10: startGame

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的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

示例11: hide

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的package包/类
@Override
public void hide() {
	searchField.setFocused(false);
	acceptInput = false;
	SoundController.playSound(SoundEffect.MENUBACK);
	hideAnimationTime = animationtime;
	hideAnimationStartProgress = (float) animationtime / SHOWANIMATIONTIME;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:9,代码来源:OptionsOverlay.java

示例12: resetComboStreak

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的package包/类
/**
 * Resets the combo streak to zero.
 */
private void resetComboStreak() {
	if (combo >= 20 && !(GameMod.RELAX.isActive() || GameMod.AUTOPILOT.isActive()))
		SoundController.playSound(SoundEffect.COMBOBREAK);
	combo = 0;
	if (GameMod.SUDDEN_DEATH.isActive())
		health = 0f;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:11,代码来源:GameData.java

示例13: keyPressed

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的package包/类
@Override
public boolean keyPressed(int key, char c) {
	if (super.keyPressed(key, c)) {
		return true;
	}

	// game keys
	if (!Keyboard.isRepeatEvent()) {
		if (key == OPTION_KEY_LEFT.intval) {
			mousePressed(Input.MOUSE_LEFT_BUTTON, displayContainer.mouseX, displayContainer.mouseY);
		} else if (key == OPTION_KEY_RIGHT.intval) {
			mousePressed(Input.MOUSE_RIGHT_BUTTON, displayContainer.mouseX, displayContainer.mouseY);
		}
	}

	if (key == KEY_ESCAPE) {
		// 'esc' will normally unpause, but will return to song menu if health is zero
		if (gameState.getRestart() == Game.Restart.LOSE) {
			SoundController.playSound(SoundEffect.MENUBACK);
			songMenuState.resetGameDataOnLoad();
			MusicController.playAt(MusicController.getBeatmap().previewTime, true);
			displayContainer.switchState(songMenuState);
		} else {
			SoundController.playSound(SoundEffect.MENUBACK);
			gameState.setRestart(Game.Restart.FALSE);
			displayContainer.switchState(gameState);
		}
		return true;
	}

	if (key == KEY_R && input.isControlDown()) {
		gameState.setRestart(Game.Restart.MANUAL);
		displayContainer.switchState(gameState);
		return true;
	}

	return false;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:39,代码来源:GamePauseMenu.java

示例14: mousePressed

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的package包/类
@Override
public boolean mousePressed(int button, int x, int y) {
	if (super.mousePressed(button, x, y)) {
		return true;
	}

	if (button == Input.MOUSE_MIDDLE_BUTTON) {
		return true;
	}

	boolean loseState = (gameState.getRestart() == Game.Restart.LOSE);
	if (continueButton.contains(x, y) && !loseState) {
		SoundController.playSound(SoundEffect.MENUBACK);
		gameState.setRestart(Game.Restart.FALSE);
		displayContainer.switchState(gameState);
	} else if (retryButton.contains(x, y)) {
		SoundController.playSound(SoundEffect.MENUHIT);
		gameState.setRestart(Game.Restart.MANUAL);
		displayContainer.switchState(gameState);
	} else if (backButton.contains(x, y)) {
		SoundController.playSound(SoundEffect.MENUBACK);
		songMenuState.resetGameDataOnLoad();
		if (loseState)
			MusicController.playAt(MusicController.getBeatmap().previewTime, true);
		else
			MusicController.resume();
		if (displayContainer.cursor.isBeatmapSkinned()) {
			displayContainer.resetCursor();
		}
		MusicController.setPitch(1.0f);
		displayContainer.switchState(songMenuState);
	}

	return true;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:36,代码来源:GamePauseMenu.java

示例15: mousePressed

import itdelatrisu.opsu.audio.SoundController; //导入方法依赖的package包/类
@Override
public void mousePressed(int cx, int cy) {
	super.mousePressed(cx, cy);
	for (GameMod mod : GameMod.values()) {
		if (mod.contains(cx, cy)) {
			boolean prevState = mod.isActive();
			mod.toggle(true);
			if (mod.isActive() != prevState)
				SoundController.playSound(SoundEffect.MENUCLICK);
			return;
		}
	}
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:14,代码来源:ButtonMenu.java


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