本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
}
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
}