Disable music auto-play unless tracks are installed.
This commit is contained in:
@@ -63,12 +63,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
.Select(a => a.Value)
|
.Select(a => a.Value)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
IsMusicAvailable = playlist.Any();
|
|
||||||
|
|
||||||
random = playlist.Shuffle(Game.CosmeticRandom).ToArray();
|
random = playlist.Shuffle(Game.CosmeticRandom).ToArray();
|
||||||
|
IsMusicAvailable = playlist.Any();
|
||||||
// Always start with a random song
|
|
||||||
currentSong = random.FirstOrDefault();
|
|
||||||
|
|
||||||
if (SongExists(info.StartingMusic))
|
if (SongExists(info.StartingMusic))
|
||||||
currentSong = world.Map.Rules.Music[info.StartingMusic];
|
currentSong = world.Map.Rules.Music[info.StartingMusic];
|
||||||
@@ -77,6 +73,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
currentSong = currentBackgroundSong = world.Map.Rules.Music[info.BackgroundMusic];
|
currentSong = currentBackgroundSong = world.Map.Rules.Music[info.BackgroundMusic];
|
||||||
CurrentSongIsBackground = true;
|
CurrentSongIsBackground = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Start playback with a random song, but only if the player has installed more music
|
||||||
|
var installData = Game.ModData.Manifest.Get<ContentInstaller>();
|
||||||
|
if (playlist.Length > installData.ShippedSoundtracks)
|
||||||
|
currentSong = random.FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
Play();
|
Play();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,16 +125,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var music = musicPlaylist.AvailablePlaylist();
|
var music = musicPlaylist.AvailablePlaylist();
|
||||||
currentSong = musicPlaylist.CurrentSong();
|
currentSong = musicPlaylist.CurrentSong();
|
||||||
if (currentSong == null && music.Any())
|
|
||||||
currentSong = musicPlaylist.GetNextSong();
|
|
||||||
|
|
||||||
musicList.RemoveChildren();
|
musicList.RemoveChildren();
|
||||||
foreach (var s in music)
|
foreach (var s in music)
|
||||||
{
|
{
|
||||||
var song = s;
|
var song = s;
|
||||||
if (currentSong == null)
|
|
||||||
currentSong = song;
|
|
||||||
|
|
||||||
var item = ScrollItemWidget.Setup(song.Filename, itemTemplate, () => currentSong == song, () => { currentSong = song; Play(); }, () => { });
|
var item = ScrollItemWidget.Setup(song.Filename, itemTemplate, () => currentSong == song, () => { currentSong = song; Play(); }, () => { });
|
||||||
item.Get<LabelWidget>("TITLE").GetText = () => song.Title;
|
item.Get<LabelWidget>("TITLE").GetText = () => song.Title;
|
||||||
item.Get<LabelWidget>("LENGTH").GetText = () => SongLengthLabel(song);
|
item.Get<LabelWidget>("LENGTH").GetText = () => SongLengthLabel(song);
|
||||||
|
|||||||
Reference in New Issue
Block a user