mirror of
https://github.com/ppy/osu
synced 2025-01-24 14:53:18 +00:00
Merge branch 'master' into carousel-wedge-level
This commit is contained in:
commit
47f35c423b
@ -74,15 +74,18 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
private readonly AudioManager audioManager;
|
||||
|
||||
private readonly GameHost host;
|
||||
|
||||
private readonly List<DownloadBeatmapSetRequest> currentDownloads = new List<DownloadBeatmapSetRequest>();
|
||||
|
||||
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, APIAccess api, AudioManager audioManager, IIpcHost importHost = null,
|
||||
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, APIAccess api, AudioManager audioManager, GameHost host = null,
|
||||
WorkingBeatmap defaultBeatmap = null)
|
||||
: base(storage, contextFactory, new BeatmapStore(contextFactory), importHost)
|
||||
: base(storage, contextFactory, new BeatmapStore(contextFactory), host)
|
||||
{
|
||||
this.rulesets = rulesets;
|
||||
this.api = api;
|
||||
this.audioManager = audioManager;
|
||||
this.host = host;
|
||||
|
||||
DefaultBeatmap = defaultBeatmap;
|
||||
|
||||
@ -254,7 +257,7 @@ namespace osu.Game.Beatmaps
|
||||
if (beatmapInfo.Metadata == null)
|
||||
beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
|
||||
|
||||
WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(Files.Store, beatmapInfo, audioManager);
|
||||
WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(Files.Store, new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store)), beatmapInfo, audioManager);
|
||||
|
||||
previous?.TransferTo(working);
|
||||
|
||||
|
@ -22,10 +22,11 @@ namespace osu.Game.Beatmaps
|
||||
private readonly IResourceStore<byte[]> store;
|
||||
private readonly AudioManager audioManager;
|
||||
|
||||
public BeatmapManagerWorkingBeatmap(IResourceStore<byte[]> store, BeatmapInfo beatmapInfo, AudioManager audioManager)
|
||||
public BeatmapManagerWorkingBeatmap(IResourceStore<byte[]> store, TextureStore textureStore, BeatmapInfo beatmapInfo, AudioManager audioManager)
|
||||
: base(beatmapInfo)
|
||||
{
|
||||
this.store = store;
|
||||
this.textureStore = textureStore;
|
||||
this.audioManager = audioManager;
|
||||
}
|
||||
|
||||
@ -44,7 +45,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
private string getPathForFile(string filename) => BeatmapSetInfo.Files.First(f => string.Equals(f.Filename, filename, StringComparison.InvariantCultureIgnoreCase)).FileInfo.StoragePath;
|
||||
|
||||
private LargeTextureStore textureStore;
|
||||
private TextureStore textureStore;
|
||||
|
||||
protected override bool BackgroundStillValid(Texture b) => false; // bypass lazy logic. we want to return a new background each time for refcounting purposes.
|
||||
|
||||
@ -55,7 +56,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
try
|
||||
{
|
||||
return (textureStore ?? (textureStore = new LargeTextureStore(new TextureLoaderStore(store)))).Get(getPathForFile(Metadata.BackgroundFile));
|
||||
return textureStore.Get(getPathForFile(Metadata.BackgroundFile));
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -3,7 +3,9 @@
|
||||
|
||||
using osuTK.Graphics;
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osuTK.Input;
|
||||
|
||||
@ -21,9 +23,16 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
private bool focus;
|
||||
|
||||
private bool allowImmediateFocus => host?.OnScreenKeyboardOverlapsGameWindow != true;
|
||||
|
||||
public void TakeFocus()
|
||||
{
|
||||
if (allowImmediateFocus) GetContainingInputManager().ChangeFocus(this);
|
||||
}
|
||||
|
||||
public bool HoldFocus
|
||||
{
|
||||
get { return focus; }
|
||||
get => allowImmediateFocus && focus;
|
||||
set
|
||||
{
|
||||
focus = value;
|
||||
@ -32,6 +41,14 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
private GameHost host;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host)
|
||||
{
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
// We may not be focused yet, but we need to handle keyboard input to be able to request focus
|
||||
public override bool HandleNonPositionalInput => HoldFocus || base.HandleNonPositionalInput;
|
||||
|
||||
|
@ -111,8 +111,8 @@ namespace osu.Game
|
||||
|
||||
dependencies.Cache(contextFactory = new DatabaseContextFactory(Host.Storage));
|
||||
|
||||
var largeStore = new LargeTextureStore(new TextureLoaderStore(new NamespacedResourceStore<byte[]>(Resources, @"Textures")));
|
||||
largeStore.AddStore(new TextureLoaderStore(new OnlineStore()));
|
||||
var largeStore = new LargeTextureStore(Host.CreateTextureLoaderStore(new NamespacedResourceStore<byte[]>(Resources, @"Textures")));
|
||||
largeStore.AddStore(Host.CreateTextureLoaderStore(new OnlineStore()));
|
||||
dependencies.Cache(largeStore);
|
||||
|
||||
dependencies.CacheAs(this);
|
||||
|
@ -164,7 +164,7 @@ namespace osu.Game.Overlays.Chat.Selection
|
||||
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
GetContainingInputManager().ChangeFocus(search);
|
||||
search.TakeFocus();
|
||||
base.OnFocus(e);
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@ namespace osu.Game.Overlays
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
//this is necessary as textbox is masked away and therefore can't get focus :(
|
||||
GetContainingInputManager().ChangeFocus(textbox);
|
||||
textbox.TakeFocus();
|
||||
base.OnFocus(e);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
@ -53,10 +52,9 @@ namespace osu.Game.Overlays.Music
|
||||
|
||||
public class FilterTextBox : SearchTextBox
|
||||
{
|
||||
private Color4 backgroundColour;
|
||||
protected override Color4 BackgroundUnfocused => OsuColour.Gray(0.06f);
|
||||
protected override Color4 BackgroundFocused => OsuColour.Gray(0.12f);
|
||||
|
||||
protected override Color4 BackgroundUnfocused => backgroundColour;
|
||||
protected override Color4 BackgroundFocused => backgroundColour;
|
||||
protected override bool AllowCommit => true;
|
||||
|
||||
public FilterTextBox()
|
||||
@ -64,12 +62,6 @@ namespace osu.Game.Overlays.Music
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
backgroundColour = colours.Gray2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ namespace osu.Game.Overlays.Music
|
||||
protected override void PopIn()
|
||||
{
|
||||
filter.Search.HoldFocus = true;
|
||||
Schedule(() => GetContainingInputManager().ChangeFocus(filter.Search));
|
||||
Schedule(() => filter.Search.TakeFocus());
|
||||
|
||||
this.ResizeTo(new Vector2(1, playlist_height), transition_duration, Easing.OutQuint);
|
||||
this.FadeIn(transition_duration, Easing.OutQuint);
|
||||
|
@ -127,17 +127,10 @@ namespace osu.Game.Overlays.SearchableList
|
||||
|
||||
private class FilterSearchTextBox : SearchTextBox
|
||||
{
|
||||
protected override Color4 BackgroundUnfocused => backgroundColour;
|
||||
protected override Color4 BackgroundFocused => backgroundColour;
|
||||
protected override Color4 BackgroundUnfocused => OsuColour.Gray(0.06f);
|
||||
protected override Color4 BackgroundFocused => OsuColour.Gray(0.12f);
|
||||
|
||||
protected override bool AllowCommit => true;
|
||||
|
||||
private Color4 backgroundColour;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
backgroundColour = colours.Gray2.Opacity(0.9f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace osu.Game.Overlays.SearchableList
|
||||
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
GetContainingInputManager().ChangeFocus(Filter.Search);
|
||||
Filter.Search.TakeFocus();
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
|
@ -179,7 +179,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
GetContainingInputManager().ChangeFocus(searchTextBox);
|
||||
searchTextBox.TakeFocus();
|
||||
base.OnFocus(e);
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ namespace osu.Game.Screens.Multi.Lounge
|
||||
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
GetContainingInputManager().ChangeFocus(Filter.Search);
|
||||
Filter.Search.TakeFocus();
|
||||
}
|
||||
|
||||
protected override void OnEntering(Screen last)
|
||||
|
Loading…
Reference in New Issue
Block a user