Merge remote-tracking branch 'upstream/master' into HoutarouOreki-changelog-overlay

This commit is contained in:
Dean Herbert
2019-05-15 14:24:45 +09:00
10 changed files with 79 additions and 45 deletions

View File

@ -31,11 +31,9 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Input;
using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets;
using osu.Game.Screens.Play;
using osu.Game.Input.Bindings;
using osu.Game.Online.Chat;
using osu.Game.Rulesets.Mods;
using osu.Game.Skinning;
using osuTK.Graphics;
using osu.Game.Overlays.Volume;
@ -89,7 +87,6 @@ namespace osu.Game
private Intro introScreen;
private Bindable<int> configRuleset;
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
private Bindable<int> configSkin;
@ -99,12 +96,9 @@ namespace osu.Game
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
private readonly List<OverlayContainer> visibleBlockingOverlays = new List<OverlayContainer>();
private readonly List<OverlayContainer> toolbarElements = new List<OverlayContainer>();
// todo: move this to SongSelect once Screen has the ability to unsuspend.
[Cached]
[Cached(typeof(IBindable<IReadOnlyList<Mod>>))]
private readonly Bindable<IReadOnlyList<Mod>> mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
private readonly List<OverlayContainer> visibleBlockingOverlays = new List<OverlayContainer>();
public OsuGame(string[] args = null)
{
@ -134,12 +128,17 @@ namespace osu.Game
/// <summary>
/// Close all game-wide overlays.
/// </summary>
/// <param name="toolbar">Whether the toolbar should also be hidden.</param>
public void CloseAllOverlays(bool toolbar = true)
/// <param name="hideToolbarElements">Whether the toolbar (and accompanying controls) should also be hidden.</param>
public void CloseAllOverlays(bool hideToolbarElements = true)
{
foreach (var overlay in overlays)
overlay.State = Visibility.Hidden;
if (toolbar) Toolbar.State = Visibility.Hidden;
if (hideToolbarElements)
{
foreach (var overlay in toolbarElements)
overlay.State = Visibility.Hidden;
}
}
private DependencyContainer dependencies;
@ -169,15 +168,12 @@ namespace osu.Game
dependencies.Cache(RavenLogger);
dependencies.CacheAs(ruleset);
dependencies.CacheAs<IBindable<RulesetInfo>>(ruleset);
dependencies.Cache(osuLogo = new OsuLogo { Alpha = 0 });
// bind config int to database RulesetInfo
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First();
ruleset.ValueChanged += r => configRuleset.Value = r.NewValue.ID ?? 0;
Ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First();
Ruleset.ValueChanged += r => configRuleset.Value = r.NewValue.ID ?? 0;
// bind config int to database SkinInfo
configSkin = LocalConfig.GetBindable<int>(OsuSetting.Skin);
@ -248,9 +244,9 @@ namespace osu.Game
}
// Use first beatmap available for current ruleset, else switch ruleset.
var first = databasedSet.Beatmaps.Find(b => b.Ruleset == ruleset.Value) ?? databasedSet.Beatmaps.First();
var first = databasedSet.Beatmaps.Find(b => b.Ruleset == Ruleset.Value) ?? databasedSet.Beatmaps.First();
ruleset.Value = first.Ruleset;
Ruleset.Value = first.Ruleset;
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(first);
}, $"load {beatmap}", bypassScreenAllowChecks: true, targetScreen: typeof(PlaySongSelect));
}
@ -280,9 +276,9 @@ namespace osu.Game
performFromMainMenu(() =>
{
ruleset.Value = databasedScoreInfo.Ruleset;
Ruleset.Value = databasedScoreInfo.Ruleset;
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
mods.Value = databasedScoreInfo.Mods;
Mods.Value = databasedScoreInfo.Mods;
menuScreen.Push(new PlayerLoader(() => new ReplayPlayer(databasedScore)));
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
@ -415,7 +411,11 @@ namespace osu.Game
CloseAllOverlays(false);
menuScreen?.MakeCurrent();
},
}, topMostOverlayContent.Add);
}, d =>
{
topMostOverlayContent.Add(d);
toolbarElements.Add(d);
});
loadComponentSingleFile(volume = new VolumeOverlay(), leftFloatingOverlayContent.Add);
loadComponentSingleFile(new OnScreenDisplay(), Add, true);
@ -451,7 +451,11 @@ namespace osu.Game
GetToolbarHeight = () => ToolbarOffset,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
}, rightFloatingOverlayContent.Add, true);
}, d =>
{
rightFloatingOverlayContent.Add(d);
toolbarElements.Add(d);
}, true);
loadComponentSingleFile(new AccountCreationOverlay(), topMostOverlayContent.Add, true);
loadComponentSingleFile(new DialogOverlay(), topMostOverlayContent.Add, true);