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


Java SoundController类代码示例

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


SoundController类属于itdelatrisu.opsu.audio包,在下文中一共展示了SoundController类的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: 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

示例7: 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

示例8: 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

示例9: randomBeatmap

import itdelatrisu.opsu.audio.SoundController; //导入依赖的package包/类
/**
 * Focuses a random beatmap.
 * @param previous if true, pops from the random track stack instead
 */
private void randomBeatmap(boolean previous) {
	if (focusNode == null)
		return;

	SoundController.playSound(SoundEffect.MENUHIT);
	if (previous) {
		// shift key: previous random track
		SongNode prev;
		if (randomStack.isEmpty() || (prev = randomStack.pop()) == null)
			return;
		BeatmapSetNode node = prev.getNode();
		int expandedIndex = BeatmapSetList.get().getExpandedIndex();
		if (node.index == expandedIndex)
			node = node.next;  // move past base node
		setFocus(node, prev.getIndex(), true, true);
	} else {
		// random track, add previous to stack
		randomStack.push(new SongNode(BeatmapSetList.get().getBaseNode(focusNode.index), focusNode.beatmapIndex));
		setFocus(BeatmapSetList.get().getRandomNode(), 0, true, true);
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:26,代码来源:SongMenu.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: 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

示例12: 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

示例13: 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

示例14: sendSliderTickResult

import itdelatrisu.opsu.audio.SoundController; //导入依赖的package包/类
/**
 * Handles a slider tick result.
 * @param time the tick start time
 * @param result the hit result (HIT_* constants)
 * @param x the x coordinate
 * @param y the y coordinate
 * @param hitObject the hit object
 * @param repeat the current repeat number
 */
public void sendSliderTickResult(int time, int result, float x, float y, HitObject hitObject, int repeat) {
	int hitValue = 0;
	switch (result) {
	case HIT_SLIDER30:
		hitValue = 30;
		changeHealth(2f);
		SoundController.playHitSound(
				hitObject.getEdgeHitSoundType(repeat),
				hitObject.getSampleSet(repeat),
				hitObject.getAdditionSampleSet(repeat));
		break;
	case HIT_SLIDER10:
		hitValue = 10;
		changeHealth(1f);
		SoundController.playHitSound(HitSound.SLIDERTICK);
		break;
	case HIT_MISS:
		resetComboStreak();
		break;
	default:
		return;
	}

	if (hitValue > 0) {
		// calculate score and increment combo streak
		score += hitValue;
		incrementComboStreak();

		if (OPTION_SHOW_PERFECT_HIT.state) {
			hitResultList.add(new HitObjectResult(time, result, x, y, null, HitObjectType.SLIDERTICK, null, false, false));
		}
	}
	fullObjectCount++;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:44,代码来源:GameData.java

示例15: 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


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