本文整理汇总了Java中com.badlogic.gdx.audio.Music.stop方法的典型用法代码示例。如果您正苦于以下问题:Java Music.stop方法的具体用法?Java Music.stop怎么用?Java Music.stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.audio.Music
的用法示例。
在下文中一共展示了Music.stop方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playNext
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public void playNext(){
System.out.println("next sound");
Music old = currentMusic;
if(nextMusic == null){
nextMusic = currentMusic;
}
if(nextMusic == currentMusic)
return;
currentMusic=nextMusic;
currentMusic.setVolume(vol);
currentMusic.play();
currentMusic.setVolume(vol);
old.stop();
old = null;
}
示例2: stopMusicBeautifully
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public void stopMusicBeautifully(String name, Stage stage) {
final Music music = musics.get(name);
if (music == null) {
Logger.error("there is no music for " + name);
return;
}
final float initialVolume = music.getVolume();
Action action = new TemporalAction(2f, Interpolation.linear) {
@Override protected void update(float percent) {
music.setVolume(initialVolume - percent * initialVolume);
}
@Override protected void end() {
music.stop();
playingMusics.remove(music);
disabledMusics.remove(music);
}
};
stage.addAction(action);
replaceAction(music, action);
}
示例3: RandomMusicPlaylist
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public RandomMusicPlaylist(float volume, AssetsHandler assetsHndlr){
_assetsHndlr = assetsHndlr;
_musics = new ArrayList<Music>();
_volume = volume;
for(String name : _GAME_MUSIC_NAMES)
_musics.add((Music)_assetsHndlr.get(name));
_musicListener = new OnCompletionListener() {
@Override
public void onCompletion(Music music) {
if(music.isPlaying())
music.stop();
PlayRandomMusic();
}
};
}
示例4: stop
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public void stop() {
if (backgroundMusic) {
Music musicAsset = RapidAsset.INSTANCE.getMusic(music.getResourcePath());
musicAsset.stop();
} else {
Sound soundAsset = RapidAsset.INSTANCE.getSound(sound.getResourcePath());
if (loop) {
soundAsset.stop();
} else {
soundAsset.play();
}
}
}
示例5: onDisable
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
@Override
public void onDisable() {
if (backgroundMusic) {
Music musicAsset = RapidAsset.INSTANCE.getMusic(music.getResourcePath());
musicAsset.stop();
return;
}
Sound soundAsset = RapidAsset.INSTANCE.getSound(sound.getResourcePath());
for (long id : soundIds) {
soundAsset.stop(id);
}
}
示例6: stopMusic
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public void stopMusic(String name) {
Music music = musics.get(name);
if (music == null) {
Logger.error("there is no music for " + name);
return;
}
music.stop();
playingMusics.remove(music);
disabledMusics.remove(music);
}
示例7: update
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public void update(Application APP, Player player, Music gameMusic, float delta)
{
for (int i = 0; i < currentEnemies.size; i++)
{
bulletLoop:
for (int j = 0; j < currentBullets.size; j++)
{
// IF ENEMY COLLIDES WITH BULLET
if (Intersector.overlapConvexPolygons(currentEnemies.get(i).getBounds(), currentBullets.get(j).getBounds()))
{
// DAMAGE THE ENEMY
currentEnemies.get(i).renderHit = true;
currentEnemies.get(i).playSquishSound();
currentEnemies.get(i).setHitTexture();
currentEnemies.get(i).reduceHealth(Bullet.getWeapon().getDamage());
// KNOCKBACK ENEMY
currentEnemies.get(i).knockback(Bullet.getWeapon().getKnockbackPower());
currentEnemies.get(i).applyVelocityToPosition(delta);
// REMOVE THE HIT BULLET
currentBullets.get(j).isUsed = false;
currentBullets.get(j).isOutOfScreen = false;
currentBullets.removeIndex(j);
break bulletLoop;
}
}
// IF ENEMY COLLIDES WITH PLAYER
if (Intersector.overlapConvexPolygons(currentEnemies.get(i).getBounds(), player.getBounds()))
{
Input.touchDown = false;
APP.setScreen(deadScreen);
gameMusic.stop();
}
}
}
示例8: stopMusic
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
@Override
public final void stopMusic( int soundId ) {
Music sound = music.get( soundId );
if ( sound == null || !sound.isPlaying() ) {
return;
}
sound.stop();
}
示例9: disposeOf
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
private void disposeOf(Music mus) {
if(mus == null)
return;;
if(mus.isPlaying())
mus.stop();
mus.dispose();
}
示例10: stop
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
@Override
public void stop(int fadeOutMillis) {
// TODO Implement fade out time
Music music = musicRef.get();
if (music != null) {
music.stop();
paused = false;
}
}
示例11: stopMusic
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public void stopMusic() {
if (currentMusic.isEmpty()) {
return;
}
Music music = assetManager.get(musicPath + currentMusic, Music.class);
if (music.isPlaying()) {
music.stop();
}
}
示例12: stopSongs
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
/**
* Stops all songs.
*/
public void stopSongs() {
for (Music music: songs.values()) {
music.stop();
}
}
示例13: onNotify
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
@Override
public void onNotify(AudioCommand command, AudioTypeEvent event) {
switch(command){
case MUSIC_LOAD:
Assets.loadMusicAsset(event.getValue());
break;
case MUSIC_PLAY_ONCE:
playMusic(false, event.getValue());
break;
case MUSIC_PLAY_LOOP:
playMusic(true, event.getValue());
break;
case MUSIC_STOP:
Music music = _queuedMusic.get(event.getValue());
if( music != null ){
music.stop();
}
break;
case MUSIC_STOP_ALL:
for( Music musicStop: _queuedMusic.values() ){
musicStop.stop();
}
break;
case SOUND_LOAD:
Assets.loadSoundAsset(event.getValue());
break;
case SOUND_PLAY_LOOP:
playSound(true, event.getValue());
break;
case SOUND_PLAY_ONCE:
playSound(false, event.getValue());
break;
case SOUND_STOP:
Sound sound = _queuedSounds.get(event.getValue());
if( sound != null ){
sound.stop();
}
break;
default:
break;
}
}
示例14: stopIntroMusic
import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public void stopIntroMusic() {
Music music = assetManager.get("sounds/intro.ogg", Music.class);
music.stop();
}