Don’t switch mods from inside button click handlers.

Fixes screen flickering and desyncs when returning to the mod chooser.
This commit is contained in:
Paul Chote
2015-06-17 21:55:48 +01:00
parent f72a14faea
commit 75210b692e
5 changed files with 22 additions and 12 deletions

View File

@@ -87,10 +87,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
installButton.IsDisabled = () => world == null || world.Type != WorldType.Shellmap;
var args = new string[] { "Install.Music=true" };
installButton.OnClick = () =>
{
Game.ModData.LoadScreen.Display(); // HACK: prevent a flicker when transitioning to the installation dialog
Game.InitializeMod(Game.Settings.Game.Mod, new Arguments(args));
};
Game.RunAfterTick(() =>
Game.InitializeMod(Game.Settings.Game.Mod, new Arguments(args)));
var installData = Game.ModData.Manifest.Get<ContentInstaller>();
installButton.IsVisible = () => modRules.InstalledMusic.ToArray().Length <= installData.ShippedSoundtracks;