v1.2.0: fixed music resuming during silent moments

This commit is contained in:
Evan Debenham 2022-03-20 17:10:52 -04:00
parent d61ac8dc99
commit 61cd95e1f2
6 changed files with 13 additions and 13 deletions

View File

@ -183,8 +183,9 @@ public enum Music {
}
}
public synchronized void mute() {
public synchronized void end() {
lastPlayed = null;
trackList = null;
stop();
}
@ -228,7 +229,7 @@ public enum Music {
if (!isPlaying() && value) {
if (trackList != null){
playTracks(trackList, trackChances, shuffle);
} else {
} else if (lastPlayed != null) {
play(lastPlayed, looping);
}
}

View File

@ -77,7 +77,7 @@ public class CavesBossLevel extends Level {
Music.INSTANCE.play(Assets.Music.CAVES_BOSS, true);
//if wall isn't broken
} else if (map[14 + 13*width()] == Terrain.SIGN){
Music.INSTANCE.stop();
Music.INSTANCE.end();
} else {
Music.INSTANCE.playTracks(
new String[]{Assets.Music.CAVES_1, Assets.Music.CAVES_2, Assets.Music.CAVES_2},
@ -316,7 +316,7 @@ public class CavesBossLevel extends Level {
Game.runOnRenderThread(new Callback() {
@Override
public void call() {
Music.INSTANCE.stop();
Music.INSTANCE.end();
}
});

View File

@ -89,7 +89,7 @@ public class CityBossLevel extends Level {
Music.INSTANCE.play(Assets.Music.CITY_BOSS, true);
//if top door isn't unlocked
} else if (map[topDoor] == Terrain.LOCKED_DOOR){
Music.INSTANCE.stop();
Music.INSTANCE.end();
} else {
Music.INSTANCE.playTracks(
new String[]{Assets.Music.CITY_1, Assets.Music.CITY_2, Assets.Music.CITY_2},
@ -335,7 +335,7 @@ public class CityBossLevel extends Level {
Game.runOnRenderThread(new Callback() {
@Override
public void call() {
Music.INSTANCE.stop();
Music.INSTANCE.end();
}
});
}

View File

@ -69,7 +69,7 @@ public class HallsBossLevel extends Level {
Music.INSTANCE.play(Assets.Music.HALLS_BOSS, true);
//if exit isn't unlocked
} else if (map[exit] != Terrain.EXIT){
Music.INSTANCE.stop();
Music.INSTANCE.end();
} else {
Music.INSTANCE.playTracks(
new String[]{Assets.Music.HALLS_1, Assets.Music.HALLS_2, Assets.Music.HALLS_2},
@ -252,7 +252,7 @@ public class HallsBossLevel extends Level {
Game.runOnRenderThread(new Callback() {
@Override
public void call() {
Music.INSTANCE.stop();
Music.INSTANCE.end();
}
});
}

View File

@ -89,7 +89,7 @@ public class PrisonBossLevel extends Level {
@Override
public void playLevelMusic() {
if (state == State.START){
Music.INSTANCE.stop();
Music.INSTANCE.end();
} else if (state == State.WON) {
Music.INSTANCE.playTracks(
new String[]{Assets.Music.PRISON_1, Assets.Music.PRISON_2, Assets.Music.PRISON_2},
@ -512,7 +512,7 @@ public class PrisonBossLevel extends Level {
Game.runOnRenderThread(new Callback() {
@Override
public void call() {
Music.INSTANCE.stop();
Music.INSTANCE.end();
}
});
break;

View File

@ -40,7 +40,6 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.sewerboss.SewerBoss
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.sewerboss.SewerBossExitRoom;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.BossHealthBar;
import com.watabou.noosa.Game;
import com.watabou.noosa.Group;
import com.watabou.noosa.audio.Music;
@ -75,7 +74,7 @@ public class SewerBossLevel extends SewerLevel {
}
if (gooAlive){
Music.INSTANCE.stop();
Music.INSTANCE.end();
} else {
Music.INSTANCE.playTracks(
new String[]{Assets.Music.SEWERS_1, Assets.Music.SEWERS_2, Assets.Music.SEWERS_2},
@ -201,7 +200,7 @@ public class SewerBossLevel extends SewerLevel {
Game.runOnRenderThread(new Callback() {
@Override
public void call() {
Music.INSTANCE.stop();
Music.INSTANCE.end();
}
});
}