update the music player widget when the music changes
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
|
using OpenRA.Mods.Common.Widgets;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
@@ -96,6 +97,18 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
installButton.IsVisible = () => modRules.InstalledMusic.ToArray().Length <= installData.ShippedSoundtracks;
|
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(); };
|
panel.Get<ButtonWidget>("BACK_BUTTON").OnClick = () => { Game.Settings.Save(); Ui.CloseWindow(); onExit(); };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Container@MUSIC_PANEL:
|
|||||||
Width: 360
|
Width: 360
|
||||||
Height: 435
|
Height: 435
|
||||||
Children:
|
Children:
|
||||||
|
LogicTicker@SONG_WATCHER:
|
||||||
Label@TITLE:
|
Label@TITLE:
|
||||||
Width: 360
|
Width: 360
|
||||||
Y: 0-25
|
Y: 0-25
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Background@MUSIC_PANEL:
|
|||||||
Width: 360
|
Width: 360
|
||||||
Height: 450
|
Height: 450
|
||||||
Children:
|
Children:
|
||||||
|
LogicTicker@SONG_WATCHER:
|
||||||
ScrollPanel@MUSIC_LIST:
|
ScrollPanel@MUSIC_LIST:
|
||||||
X: 15
|
X: 15
|
||||||
Y: 45
|
Y: 45
|
||||||
|
|||||||
Reference in New Issue
Block a user