Centralise creation of UpdateManagers

This commit is contained in:
Dean Herbert 2020-03-05 13:34:04 +09:00
parent e78c238ecd
commit 6477a7b73e
4 changed files with 17 additions and 20 deletions

View File

@ -30,11 +30,6 @@ public override Version AssemblyVersion
} }
} }
protected override void LoadComplete() protected override UpdateManager CreateUpdateManager() => new SimpleUpdateManager();
{
base.LoadComplete();
Add(new SimpleUpdateManager());
}
} }
} }

View File

@ -47,20 +47,25 @@ public override Storage GetStorageForStableInstall()
return null; return null;
} }
protected override UpdateManager CreateUpdateManager()
{
switch (RuntimeInfo.OS)
{
case RuntimeInfo.Platform.Windows:
return new SquirrelUpdateManager();
default:
return new SimpleUpdateManager();
}
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
if (!noVersionOverlay) if (!noVersionOverlay)
{
LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, Add); LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, Add);
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
Add(new SquirrelUpdateManager());
else
Add(new SimpleUpdateManager());
}
LoadComponentAsync(new DiscordRichPresence(), Add); LoadComponentAsync(new DiscordRichPresence(), Add);
} }

View File

@ -43,6 +43,7 @@
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Screens.Select; using osu.Game.Screens.Select;
using osu.Game.Updater;
using osu.Game.Utils; using osu.Game.Utils;
using LogLevel = osu.Framework.Logging.LogLevel; using LogLevel = osu.Framework.Logging.LogLevel;
@ -390,6 +391,8 @@ public void PresentScore(ScoreInfo score)
protected virtual Loader CreateLoader() => new Loader(); protected virtual Loader CreateLoader() => new Loader();
protected virtual UpdateManager CreateUpdateManager() => new UpdateManager();
protected override Container CreateScalingContainer() => new ScalingContainer(ScalingMode.Everything); protected override Container CreateScalingContainer() => new ScalingContainer(ScalingMode.Everything);
#region Beatmap progression #region Beatmap progression
@ -528,6 +531,7 @@ protected override void LoadComplete()
AddRange(new Drawable[] AddRange(new Drawable[]
{ {
CreateUpdateManager(),
new VolumeControlReceptor new VolumeControlReceptor
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -11,12 +11,5 @@ namespace osu.iOS
public class OsuGameIOS : OsuGame public class OsuGameIOS : OsuGame
{ {
public override Version AssemblyVersion => new Version(NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString()); public override Version AssemblyVersion => new Version(NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString());
protected override void LoadComplete()
{
base.LoadComplete();
Add(new UpdateManager());
}
} }
} }