update the music player widget when the music changes

This commit is contained in:
Matthias Mailänder
2014-12-22 21:32:07 +01:00
parent c3e3a47746
commit 895f02d7cb
3 changed files with 15 additions and 0 deletions

View File

@@ -11,6 +11,7 @@
using System;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Mods.Common.Widgets;
using OpenRA.Traits;
using OpenRA.Widgets;
@@ -96,6 +97,18 @@ namespace OpenRA.Mods.RA.Widgets.Logic
installButton.IsVisible = () => modRules.InstalledMusic.ToArray().Length <= installData.ShippedSoundtracks;
}
var songWatcher = widget.GetOrNull<LogicTickerWidget>("SONG_WATCHER");
if (songWatcher != null)
{
songWatcher.OnTick = () =>
{
if (Sound.CurrentMusic == null || currentSong == Sound.CurrentMusic)
return;
currentSong = Sound.CurrentMusic;
};
}
panel.Get<ButtonWidget>("BACK_BUTTON").OnClick = () => { Game.Settings.Save(); Ui.CloseWindow(); onExit(); };
}