mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Merge branch 'master' into ensure-import-sanity
This commit is contained in:
commit
05358fa458
@ -45,24 +45,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
protected override Drawable CreateDrawable(BeatmapInfo model)
|
||||
{
|
||||
Drawable drawable;
|
||||
|
||||
var localBeatmap = beatmaps.GetWorkingBeatmap(model);
|
||||
|
||||
if (model?.BeatmapSet?.OnlineInfo != null)
|
||||
{
|
||||
drawable = new BeatmapSetCover(model.BeatmapSet, beatmapSetCoverType);
|
||||
}
|
||||
else if (localBeatmap.BeatmapInfo.ID != 0)
|
||||
{
|
||||
// Fall back to local background if one exists
|
||||
drawable = new BeatmapBackgroundSprite(localBeatmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the default background if somehow an online set does not exist and we don't have a local copy.
|
||||
drawable = new BeatmapBackgroundSprite(beatmaps.DefaultBeatmap);
|
||||
}
|
||||
Drawable drawable = getDrawableForModel(model);
|
||||
|
||||
drawable.RelativeSizeAxes = Axes.Both;
|
||||
drawable.Anchor = Anchor.Centre;
|
||||
@ -72,5 +55,16 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
return drawable;
|
||||
}
|
||||
|
||||
private Drawable getDrawableForModel(BeatmapInfo model)
|
||||
{
|
||||
// prefer online cover where available.
|
||||
if (model?.BeatmapSet?.OnlineInfo != null)
|
||||
return new BeatmapSetCover(model.BeatmapSet, beatmapSetCoverType);
|
||||
|
||||
return model?.ID > 0
|
||||
? new BeatmapBackgroundSprite(beatmaps.GetWorkingBeatmap(model))
|
||||
: new BeatmapBackgroundSprite(beatmaps.DefaultBeatmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -320,6 +320,8 @@ namespace osu.Game.Overlays
|
||||
this.MoveToY(Height, transition_length, Easing.InSine);
|
||||
this.FadeOut(transition_length, Easing.InSine);
|
||||
|
||||
channelSelectionOverlay.State = Visibility.Hidden;
|
||||
|
||||
textbox.HoldFocus = false;
|
||||
base.PopOut();
|
||||
}
|
||||
|
@ -134,9 +134,9 @@ namespace osu.Game.Overlays
|
||||
Filter.Tabs.Current.Value = DirectSortCriteria.Ranked;
|
||||
}
|
||||
};
|
||||
((FilterControl)Filter).Ruleset.ValueChanged += _ => Scheduler.AddOnce(updateSearch);
|
||||
((FilterControl)Filter).Ruleset.ValueChanged += _ => queueUpdateSearch();
|
||||
Filter.DisplayStyleControl.DisplayStyle.ValueChanged += style => recreatePanels(style.NewValue);
|
||||
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch);
|
||||
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => queueUpdateSearch();
|
||||
|
||||
Header.Tabs.Current.ValueChanged += tab =>
|
||||
{
|
||||
@ -144,24 +144,11 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
currentQuery.Value = string.Empty;
|
||||
Filter.Tabs.Current.Value = (DirectSortCriteria)Header.Tabs.Current.Value;
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
queueUpdateSearch();
|
||||
}
|
||||
};
|
||||
|
||||
currentQuery.ValueChanged += text =>
|
||||
{
|
||||
queryChangedDebounce?.Cancel();
|
||||
|
||||
if (string.IsNullOrEmpty(text.NewValue))
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
else
|
||||
{
|
||||
BeatmapSets = null;
|
||||
ResultAmounts = null;
|
||||
|
||||
queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500);
|
||||
}
|
||||
};
|
||||
currentQuery.ValueChanged += text => queueUpdateSearch(!string.IsNullOrEmpty(text.NewValue));
|
||||
|
||||
currentQuery.BindTo(Filter.Search.Current);
|
||||
|
||||
@ -170,7 +157,7 @@ namespace osu.Game.Overlays
|
||||
if (Header.Tabs.Current.Value != DirectTab.Search && tab.NewValue != (DirectSortCriteria)Header.Tabs.Current.Value)
|
||||
Header.Tabs.Current.Value = DirectTab.Search;
|
||||
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
queueUpdateSearch();
|
||||
};
|
||||
|
||||
updateResultCounts();
|
||||
@ -242,37 +229,42 @@ namespace osu.Game.Overlays
|
||||
|
||||
// Queries are allowed to be run only on the first pop-in
|
||||
if (getSetsRequest == null)
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
queueUpdateSearch();
|
||||
}
|
||||
|
||||
private SearchBeatmapSetsRequest getSetsRequest;
|
||||
|
||||
private readonly Bindable<string> currentQuery = new Bindable<string>();
|
||||
private readonly Bindable<string> currentQuery = new Bindable<string>(string.Empty);
|
||||
|
||||
private ScheduledDelegate queryChangedDebounce;
|
||||
private PreviewTrackManager previewTrackManager;
|
||||
|
||||
private void queueUpdateSearch(bool queryTextChanged = false)
|
||||
{
|
||||
BeatmapSets = null;
|
||||
ResultAmounts = null;
|
||||
|
||||
getSetsRequest?.Cancel();
|
||||
|
||||
queryChangedDebounce?.Cancel();
|
||||
queryChangedDebounce = Scheduler.AddDelayed(updateSearch, queryTextChanged ? 500 : 100);
|
||||
}
|
||||
|
||||
private void updateSearch()
|
||||
{
|
||||
queryChangedDebounce?.Cancel();
|
||||
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
if (State == Visibility.Hidden)
|
||||
return;
|
||||
|
||||
BeatmapSets = null;
|
||||
ResultAmounts = null;
|
||||
|
||||
getSetsRequest?.Cancel();
|
||||
|
||||
if (api == null)
|
||||
return;
|
||||
|
||||
previewTrackManager.StopAnyPlaying(this);
|
||||
|
||||
getSetsRequest = new SearchBeatmapSetsRequest(currentQuery.Value ?? string.Empty,
|
||||
getSetsRequest = new SearchBeatmapSetsRequest(
|
||||
currentQuery.Value,
|
||||
((FilterControl)Filter).Ruleset.Value,
|
||||
Filter.DisplayStyleControl.Dropdown.Current.Value,
|
||||
Filter.Tabs.Current.Value); //todo: sort direction (?)
|
||||
|
@ -92,30 +92,6 @@ namespace osu.Game.Screens.Play.HUD
|
||||
public Action HoverGained;
|
||||
public Action HoverLost;
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.Back:
|
||||
BeginConfirm();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.Back:
|
||||
AbortConfirm();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
@ -178,7 +154,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
// avoid starting a new confirm call until we finish animating.
|
||||
pendingAnimation = true;
|
||||
|
||||
Progress.Value = 0;
|
||||
AbortConfirm();
|
||||
|
||||
overlayCircle.ScaleTo(0, 100)
|
||||
.Then().FadeOut().ScaleTo(1).FadeIn(500)
|
||||
@ -207,6 +183,31 @@ namespace osu.Game.Screens.Play.HUD
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.Back:
|
||||
if (!pendingAnimation)
|
||||
BeginConfirm();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.Back:
|
||||
AbortConfirm();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
if (!pendingAnimation && e.CurrentState.Mouse.Buttons.Count() == 1)
|
||||
|
Loading…
Reference in New Issue
Block a user