Conditionally add some UI elements only on desktop

Prevents crashes from trying to access features that are not applicable to mobile.
This commit is contained in:
Shane Woolcock
2019-02-28 13:09:38 +09:00
parent 94a389319d
commit ce17e37c74
4 changed files with 51 additions and 31 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Platform;
@ -15,19 +16,20 @@ namespace osu.Game.Overlays.Settings.Sections.General
[BackgroundDependencyLoader]
private void load(Storage storage, OsuConfigManager config)
{
Children = new Drawable[]
Add(new SettingsEnumDropdown<ReleaseStream>
{
new SettingsEnumDropdown<ReleaseStream>
{
LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
},
new SettingsButton
LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
});
if (RuntimeInfo.IsDesktop)
{
Add(new SettingsButton
{
Text = "Open osu! folder",
Action = storage.OpenInNativeExplorer,
}
};
});
}
}
}
}