Merge remote-tracking branch 'upstream/master' into m2307-master

# Conflicts:
#	osu.Game/Screens/Select/SongSelect.cs
This commit is contained in:
Dean Herbert
2019-03-01 10:08:35 +09:00
1448 changed files with 14543 additions and 8468 deletions

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 osuTK;
using osu.Framework.Graphics;
@ -13,9 +13,9 @@ using osu.Framework.MathUtils;
using System.Diagnostics;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Caching;
using osu.Framework.Threading;
using osu.Framework.Configuration;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
@ -37,7 +37,7 @@ namespace osu.Game.Screens.Select
/// </summary>
public BeatmapInfo SelectedBeatmap => selectedBeatmap?.Beatmap;
private CarouselBeatmap selectedBeatmap => selectedBeatmapSet?.Beatmaps.FirstOrDefault(s => s.State == CarouselItemState.Selected);
private CarouselBeatmap selectedBeatmap => selectedBeatmapSet?.Beatmaps.FirstOrDefault(s => s.State.Value == CarouselItemState.Selected);
/// <summary>
/// The currently selected beatmap set.
@ -101,7 +101,6 @@ namespace osu.Game.Screens.Select
private readonly Container<DrawableCarouselItem> scrollableContent;
public Bindable<bool> RightClickScrollingEnabled = new Bindable<bool>();
public Bindable<RandomSelectAlgorithm> RandomAlgorithm = new Bindable<RandomSelectAlgorithm>();
@ -131,7 +130,7 @@ namespace osu.Game.Screens.Select
config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm);
config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled);
RightClickScrollingEnabled.ValueChanged += v => RightMouseScrollbar = v;
RightClickScrollingEnabled.ValueChanged += enabled => RightMouseScrollbar = enabled.NewValue;
RightClickScrollingEnabled.TriggerChange();
}
@ -197,7 +196,7 @@ namespace osu.Game.Screens.Select
foreach (CarouselBeatmapSet set in beatmapSets)
{
if (!bypassFilters && set.Filtered)
if (!bypassFilters && set.Filtered.Value)
continue;
var item = set.Beatmaps.FirstOrDefault(p => p.Beatmap.Equals(beatmap));
@ -206,9 +205,9 @@ namespace osu.Game.Screens.Select
// The beatmap that needs to be selected doesn't exist in this set
continue;
if (!bypassFilters && item.Filtered)
if (!bypassFilters && item.Filtered.Value)
// The beatmap exists in this set but is filtered, so look for the first unfiltered map in the set
item = set.Beatmaps.FirstOrDefault(b => !b.Filtered);
item = set.Beatmaps.FirstOrDefault(b => !b.Filtered.Value);
if (item != null)
{
@ -227,7 +226,7 @@ namespace osu.Game.Screens.Select
/// <param name="skipDifficulties">Whether to skip individual difficulties and only increment over full groups.</param>
public void SelectNext(int direction = 1, bool skipDifficulties = true)
{
var visibleItems = Items.Where(s => !s.Item.Filtered).ToList();
var visibleItems = Items.Where(s => !s.Item.Filtered.Value).ToList();
if (!visibleItems.Any())
return;
@ -249,19 +248,20 @@ namespace osu.Game.Screens.Select
{
var item = visibleItems[currentIndex].Item;
if (item.Filtered || item.State == CarouselItemState.Selected) continue;
if (item.Filtered.Value || item.State.Value == CarouselItemState.Selected) continue;
switch (item)
{
case CarouselBeatmap beatmap:
if (skipDifficulties) continue;
select(beatmap);
return;
case CarouselBeatmapSet set:
if (skipDifficulties)
select(set);
else
select(direction > 0 ? set.Beatmaps.First(b => !b.Filtered) : set.Beatmaps.Last(b => !b.Filtered));
select(direction > 0 ? set.Beatmaps.First(b => !b.Filtered.Value) : set.Beatmaps.Last(b => !b.Filtered.Value));
return;
}
}
@ -273,7 +273,7 @@ namespace osu.Game.Screens.Select
/// <returns>True if a selection could be made, else False.</returns>
public bool SelectNextRandom()
{
var visibleSets = beatmapSets.Where(s => !s.Filtered).ToList();
var visibleSets = beatmapSets.Where(s => !s.Filtered.Value).ToList();
if (!visibleSets.Any())
return false;
@ -289,7 +289,7 @@ namespace osu.Game.Screens.Select
CarouselBeatmapSet set;
if (RandomAlgorithm == RandomSelectAlgorithm.RandomPermutation)
if (RandomAlgorithm.Value == RandomSelectAlgorithm.RandomPermutation)
{
var notYetVisitedSets = visibleSets.Except(previouslyVisitedRandomSets).ToList();
if (!notYetVisitedSets.Any())
@ -304,7 +304,7 @@ namespace osu.Game.Screens.Select
else
set = visibleSets.ElementAt(RNG.Next(visibleSets.Count));
var visibleBeatmaps = set.Beatmaps.Where(s => !s.Filtered).ToList();
var visibleBeatmaps = set.Beatmaps.Where(s => !s.Filtered.Value).ToList();
select(visibleBeatmaps[RNG.Next(visibleBeatmaps.Count)]);
return true;
}
@ -315,9 +315,9 @@ namespace osu.Game.Screens.Select
{
var beatmap = randomSelectedBeatmaps.Pop();
if (!beatmap.Filtered)
if (!beatmap.Filtered.Value)
{
if (RandomAlgorithm == RandomSelectAlgorithm.RandomPermutation)
if (RandomAlgorithm.Value == RandomSelectAlgorithm.RandomPermutation)
previouslyVisitedRandomSets.Remove(selectedBeatmapSet);
select(beatmap);
break;
@ -328,6 +328,7 @@ namespace osu.Game.Screens.Select
private void select(CarouselItem item)
{
if (item == null) return;
item.State.Value = CarouselItemState.Selected;
}
@ -510,9 +511,9 @@ namespace osu.Game.Screens.Select
foreach (var c in set.Beatmaps)
{
c.State.ValueChanged += v =>
c.State.ValueChanged += state =>
{
if (v == CarouselItemState.Selected)
if (state.NewValue == CarouselItemState.Selected)
{
selectedBeatmapSet = set;
SelectionChanged?.Invoke(c.Beatmap);
@ -550,7 +551,7 @@ namespace osu.Game.Screens.Select
case DrawableCarouselBeatmapSet set:
lastSet = set;
set.MoveToX(set.Item.State == CarouselItemState.Selected ? -100 : 0, 500, Easing.OutExpo);
set.MoveToX(set.Item.State.Value == CarouselItemState.Selected ? -100 : 0, 500, Easing.OutExpo);
set.MoveToY(currentY, 750, Easing.OutExpo);
break;
case DrawableCarouselBeatmap beatmap:
@ -560,7 +561,7 @@ namespace osu.Game.Screens.Select
void performMove(float y, float? startY = null)
{
if (startY != null) beatmap.MoveTo(new Vector2(0, startY.Value));
beatmap.MoveToX(beatmap.Item.State == CarouselItemState.Selected ? -50 : 0, 500, Easing.OutExpo);
beatmap.MoveToX(beatmap.Item.State.Value == CarouselItemState.Selected ? -50 : 0, 500, Easing.OutExpo);
beatmap.MoveToY(y, 750, Easing.OutExpo);
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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.Game.Beatmaps;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using osu.Framework.Graphics;
@ -20,12 +20,10 @@ namespace osu.Game.Screens.Select
public readonly BeatmapLeaderboard Leaderboard;
private WorkingBeatmap beatmap;
public WorkingBeatmap Beatmap
{
get
{
return beatmap;
}
get => beatmap;
set
{
beatmap = value;

View File

@ -1,10 +1,10 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -27,7 +27,7 @@ namespace osu.Game.Screens.Select
private void invokeOnFilter()
{
OnFilter?.Invoke(tabs.Current, modsCheckbox.Current);
OnFilter?.Invoke(tabs.Current.Value, modsCheckbox.Current.Value);
}
[BackgroundDependencyLoader]
@ -69,8 +69,8 @@ namespace osu.Game.Screens.Select
},
};
tabs.Current.ValueChanged += item => invokeOnFilter();
modsCheckbox.Current.ValueChanged += item => invokeOnFilter();
tabs.Current.ValueChanged += _ => invokeOnFilter();
modsCheckbox.Current.ValueChanged += _ => invokeOnFilter();
}
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 osuTK;
using osuTK.Graphics;
@ -16,6 +16,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Extensions.Color4Extensions;
using osu.Game.Screens.Select.Details;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
namespace osu.Game.Screens.Select
@ -40,12 +41,14 @@ namespace osu.Game.Screens.Select
private ScheduledDelegate pendingBeatmapSwitch;
private BeatmapInfo beatmap;
public BeatmapInfo Beatmap
{
get { return beatmap; }
get => beatmap;
set
{
if (value == beatmap) return;
beatmap = value;
pendingBeatmapSwitch?.Cancel();
@ -115,6 +118,7 @@ namespace osu.Game.Screens.Select
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
LayoutDuration = transition_duration,
LayoutEasing = Easing.OutQuad,
Spacing = new Vector2(spacing * 2),
Margin = new MarginPadding { Top = spacing * 2 },
Children = new[]
@ -137,8 +141,7 @@ namespace osu.Game.Screens.Select
new OsuSpriteText
{
Text = "Points of Failure",
Font = @"Exo2.0-Bold",
TextSize = 14,
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14),
},
failRetryGraph = new FailRetryGraph
{
@ -323,8 +326,7 @@ namespace osu.Game.Screens.Select
Child = new OsuSpriteText
{
Text = title,
Font = @"Exo2.0-Bold",
TextSize = 14,
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14),
},
},
},
@ -337,17 +339,19 @@ namespace osu.Game.Screens.Select
{
if (string.IsNullOrEmpty(value))
{
textContainer.FadeOut(transition_duration);
this.FadeOut(transition_duration);
return;
}
this.FadeIn(transition_duration);
setTextAsync(value);
}
}
private void setTextAsync(string text)
{
LoadComponentAsync(new OsuTextFlowContainer(s => s.TextSize = 14)
LoadComponentAsync(new OsuTextFlowContainer(s => s.Font = s.Font.With(size: 14))
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using System.Collections.Generic;
@ -8,7 +8,7 @@ using JetBrains.Annotations;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
@ -203,9 +203,8 @@ namespace osu.Game.Screens.Select
{
VersionLabel = new OsuSpriteText
{
Font = @"Exo2.0-MediumItalic",
Text = beatmapInfo.Version,
TextSize = 24,
Font = OsuFont.GetFont(size: 24, italics: true),
},
}
},
@ -240,13 +239,11 @@ namespace osu.Game.Screens.Select
{
TitleLabel = new OsuSpriteText
{
Font = @"Exo2.0-MediumItalic",
TextSize = 28,
Font = OsuFont.GetFont(size: 28, italics: true),
},
ArtistLabel = new OsuSpriteText
{
Font = @"Exo2.0-MediumItalic",
TextSize = 17,
Font = OsuFont.GetFont(size: 17, italics: true),
},
MapperContainer = new FillFlowContainer
{
@ -266,8 +263,8 @@ namespace osu.Game.Screens.Select
}
};
titleBinding.BindValueChanged(value => setMetadata(metadata.Source));
artistBinding.BindValueChanged(value => setMetadata(metadata.Source), true);
titleBinding.BindValueChanged(_ => setMetadata(metadata.Source));
artistBinding.BindValueChanged(_ => setMetadata(metadata.Source), true);
// no difficulty means it can't have a status to show
if (beatmapInfo.Version == null)
@ -345,16 +342,13 @@ namespace osu.Game.Screens.Select
{
new OsuSpriteText
{
Font = @"Exo2.0-Medium",
Text = "mapped by ",
TextSize = 15,
Font = OsuFont.GetFont(size: 15),
},
new OsuSpriteText
{
Font = @"Exo2.0-Bold",
// ReSharper disable once PossibleNullReferenceException (resharper broken?)
Text = metadata.Author.Username,
TextSize = 15,
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 15),
}
};
}
@ -402,10 +396,9 @@ namespace osu.Game.Screens.Select
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Colour = new Color4(255, 221, 85, 255),
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17),
Margin = new MarginPadding { Left = 30 },
Text = statistic.Content,
TextSize = 17,
}
};
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using System.Linq;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using System.Collections.Generic;
@ -50,7 +50,7 @@ namespace osu.Game.Screens.Select.Carousel
public override void Filter(FilterCriteria criteria)
{
base.Filter(criteria);
Filtered.Value = InternalChildren.All(i => i.Filtered);
Filtered.Value = InternalChildren.All(i => i.Filtered.Value);
}
public override string ToString() => BeatmapSet.ToString();

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System.Collections.Generic;
@ -49,7 +49,7 @@ namespace osu.Game.Screens.Select.Carousel
public virtual void AddChild(CarouselItem i)
{
i.State.ValueChanged += v => ChildItemStateChanged(i, v);
i.State.ValueChanged += state => ChildItemStateChanged(i, state.NewValue);
i.ChildID = ++currentChildID;
InternalChildren.Add(i);
}
@ -58,9 +58,9 @@ namespace osu.Game.Screens.Select.Carousel
{
if (items != null) InternalChildren = items;
State.ValueChanged += v =>
State.ValueChanged += state =>
{
switch (v)
switch (state.NewValue)
{
case CarouselItemState.Collapsed:
case CarouselItemState.NotSelected:
@ -69,7 +69,7 @@ namespace osu.Game.Screens.Select.Carousel
case CarouselItemState.Selected:
InternalChildren.ForEach(c =>
{
if (c.State == CarouselItemState.Collapsed) c.State.Value = CarouselItemState.NotSelected;
if (c.State.Value == CarouselItemState.Collapsed) c.State.Value = CarouselItemState.NotSelected;
});
break;
}
@ -96,6 +96,7 @@ namespace osu.Game.Screens.Select.Carousel
foreach (var b in InternalChildren)
{
if (item == b) continue;
b.State.Value = CarouselItemState.NotSelected;
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using System.Linq;
@ -13,9 +13,9 @@ namespace osu.Game.Screens.Select.Carousel
{
public CarouselGroupEagerSelect()
{
State.ValueChanged += v =>
State.ValueChanged += state =>
{
if (v == CarouselItemState.Selected)
if (state.NewValue == CarouselItemState.Selected)
attemptSelection();
};
}
@ -81,10 +81,10 @@ namespace osu.Game.Screens.Select.Carousel
if (filteringChildren) return;
// we only perform eager selection if we are a currently selected group.
if (State != CarouselItemState.Selected) return;
if (State.Value != CarouselItemState.Selected) return;
// we only perform eager selection if none of our children are in a selected state already.
if (Children.Any(i => i.State == CarouselItemState.Selected)) return;
if (Children.Any(i => i.State.Value == CarouselItemState.Selected)) return;
PerformSelection();
}
@ -92,8 +92,8 @@ namespace osu.Game.Screens.Select.Carousel
protected virtual void PerformSelection()
{
CarouselItem nextToSelect =
Children.Skip(lastSelectedIndex).FirstOrDefault(i => !i.Filtered) ??
Children.Reverse().Skip(InternalChildren.Count - lastSelectedIndex).FirstOrDefault(i => !i.Filtered);
Children.Skip(lastSelectedIndex).FirstOrDefault(i => !i.Filtered.Value) ??
Children.Reverse().Skip(InternalChildren.Count - lastSelectedIndex).FirstOrDefault(i => !i.Filtered.Value);
if (nextToSelect != null)
nextToSelect.State.Value = CarouselItemState.Selected;

View File

@ -1,9 +1,9 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using System.Collections.Generic;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
namespace osu.Game.Screens.Select.Carousel
{
@ -16,7 +16,7 @@ namespace osu.Game.Screens.Select.Carousel
/// <summary>
/// This item is not in a hidden state.
/// </summary>
public bool Visible => State.Value != CarouselItemState.Collapsed && !Filtered;
public bool Visible => State.Value != CarouselItemState.Collapsed && !Filtered.Value;
public virtual List<DrawableCarouselItem> Drawables
{
@ -37,9 +37,9 @@ namespace osu.Game.Screens.Select.Carousel
{
DrawableRepresentation = new Lazy<DrawableCarouselItem>(CreateDrawableRepresentation);
Filtered.ValueChanged += v =>
Filtered.ValueChanged += filtered =>
{
if (v && State == CarouselItemState.Selected)
if (filtered.NewValue && State.Value == CarouselItemState.Selected)
State.Value = CarouselItemState.NotSelected;
};
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using osu.Framework.Allocation;
@ -38,7 +38,8 @@ namespace osu.Game.Screens.Select.Carousel
private BeatmapSetOverlay beatmapOverlay;
public DrawableCarouselBeatmap(CarouselBeatmap panel) : base(panel)
public DrawableCarouselBeatmap(CarouselBeatmap panel)
: base(panel)
{
beatmap = panel.Beatmap;
Height *= 0.60f;
@ -100,25 +101,21 @@ namespace osu.Game.Screens.Select.Carousel
{
new OsuSpriteText
{
Font = @"Exo2.0-Medium",
Text = beatmap.Version,
TextSize = 20,
Font = OsuFont.GetFont(size: 20),
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft
},
new OsuSpriteText
{
Font = @"Exo2.0-Medium",
Text = "mapped by",
TextSize = 16,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft
},
new OsuSpriteText
{
Font = @"Exo2.0-MediumItalic",
Text = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author.Username}",
TextSize = 16,
Font = OsuFont.GetFont(italics: true),
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft
},
@ -157,7 +154,7 @@ namespace osu.Game.Screens.Select.Carousel
protected override bool OnClick(ClickEvent e)
{
if (Item.State == CarouselItemState.Selected)
if (Item.State.Value == CarouselItemState.Selected)
startRequested?.Invoke(beatmap);
return base.OnClick(e);

View File

@ -1,11 +1,11 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
@ -15,6 +15,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
@ -48,11 +49,11 @@ namespace osu.Game.Screens.Select.Carousel
Children = new Drawable[]
{
new DelayedLoadUnloadWrapper(() =>
new PanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault()))
{
RelativeSizeAxes = Axes.Both,
OnLoadComplete = d => d.FadeInFromZero(1000, Easing.OutQuint),
}, 300, 5000
new PanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault()))
{
RelativeSizeAxes = Axes.Both,
OnLoadComplete = d => d.FadeInFromZero(1000, Easing.OutQuint),
}, 300, 5000
),
new FillFlowContainer
{
@ -63,16 +64,14 @@ namespace osu.Game.Screens.Select.Carousel
{
new OsuSpriteText
{
Font = @"Exo2.0-BoldItalic",
Text = new LocalisedString((beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title)),
TextSize = 22,
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 22, italics: true),
Shadow = true,
},
new OsuSpriteText
{
Font = @"Exo2.0-SemiBoldItalic",
Text = new LocalisedString((beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist)),
TextSize = 17,
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 17, italics: true),
Shadow = true,
},
new FillFlowContainer
@ -109,7 +108,7 @@ namespace osu.Game.Screens.Select.Carousel
{
List<MenuItem> items = new List<MenuItem>();
if (Item.State == CarouselItemState.NotSelected)
if (Item.State.Value == CarouselItemState.NotSelected)
items.Add(new OsuMenuItem("Expand", MenuItemType.Highlighted, () => Item.State.Value = CarouselItemState.Selected));
if (beatmapSet.OnlineBeatmapSetID != null)
@ -189,7 +188,7 @@ namespace osu.Game.Screens.Select.Carousel
: base(item.Beatmap)
{
filtered.BindTo(item.Filtered);
filtered.ValueChanged += v => Schedule(() => this.FadeTo(v ? 0.1f : 1, 100));
filtered.ValueChanged += isFiltered => Schedule(() => this.FadeTo(isFiltered.NewValue ? 0.1f : 1, 100));
filtered.TriggerChange();
}
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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.Audio;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 osuTK;
using osuTK.Graphics;
@ -20,12 +20,14 @@ namespace osu.Game.Screens.Select.Details
private readonly StatisticRow firstValue, hpDrain, accuracy, approachRate, starDifficulty;
private BeatmapInfo beatmap;
public BeatmapInfo Beatmap
{
get { return beatmap; }
get => beatmap;
set
{
if (value == beatmap) return;
beatmap = value;
//mania specific
@ -83,14 +85,15 @@ namespace osu.Game.Screens.Select.Details
public string Title
{
get { return name.Text; }
set { name.Text = value; }
get => name.Text;
set => name.Text = value;
}
private float difficultyValue;
public float Value
{
get { return difficultyValue; }
get => difficultyValue;
set
{
difficultyValue = value;
@ -101,8 +104,8 @@ namespace osu.Game.Screens.Select.Details
public Color4 AccentColour
{
get { return bar.AccentColour; }
set { bar.AccentColour = value; }
get => bar.AccentColour;
set => bar.AccentColour = value;
}
public StatisticRow(float maxValue = 10, bool forceDecimalPlaces = false)
@ -120,7 +123,7 @@ namespace osu.Game.Screens.Select.Details
AutoSizeAxes = Axes.Y,
Child = name = new OsuSpriteText
{
TextSize = 13,
Font = OsuFont.GetFont(size: 13)
},
},
bar = new Bar
@ -142,7 +145,7 @@ namespace osu.Game.Screens.Select.Details
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
TextSize = 13,
Font = OsuFont.GetFont(size: 13)
},
},
};

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 osuTK;
using osu.Framework.Allocation;
@ -17,12 +17,14 @@ namespace osu.Game.Screens.Select.Details
private readonly BarGraph retryGraph, failGraph;
private BeatmapMetrics metrics;
public BeatmapMetrics Metrics
{
get { return metrics; }
get => metrics;
set
{
if (value == metrics) return;
metrics = value;
var retries = Metrics?.Retries ?? new int[0];

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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;
@ -24,10 +24,11 @@ namespace osu.Game.Screens.Select.Details
public BeatmapMetrics Metrics
{
get { return metrics; }
get => metrics;
set
{
if (value == metrics) return;
metrics = value;
const int rating_range = 10;
@ -70,7 +71,7 @@ namespace osu.Game.Screens.Select.Details
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "User Rating",
TextSize = 13,
Font = OsuFont.GetFont(size: 13)
},
ratingsBar = new Bar
{
@ -87,14 +88,14 @@ namespace osu.Game.Screens.Select.Details
negativeRatings = new OsuSpriteText
{
Text = "0",
TextSize = 13,
Font = OsuFont.GetFont(size: 13)
},
positiveRatings = new OsuSpriteText
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Text = @"0",
TextSize = 13,
Font = OsuFont.GetFont(size: 13)
},
},
},
@ -103,7 +104,7 @@ namespace osu.Game.Screens.Select.Details
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "Rating Spread",
TextSize = 13,
Font = OsuFont.GetFont(size: 13),
Margin = new MarginPadding { Top = 10, Bottom = 5 },
},
},

View File

@ -1,5 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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.Screens;
namespace osu.Game.Screens.Select
{
@ -9,7 +11,7 @@ namespace osu.Game.Screens.Select
protected override bool OnStart()
{
Exit();
this.Exit();
return true;
}
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System.ComponentModel;
@ -9,32 +9,46 @@ namespace osu.Game.Screens.Select.Filter
{
[Description("All")]
All,
[Description("Artist")]
Artist,
[Description("Author")]
Author,
[Description("BPM")]
BPM,
[Description("Collections")]
Collections,
[Description("Date Added")]
DateAdded,
[Description("Difficulty")]
Difficulty,
[Description("Favourites")]
Favourites,
[Description("Length")]
Length,
[Description("My Maps")]
MyMaps,
[Description("No Grouping")]
NoGrouping,
[Description("Rank Achieved")]
RankAchieved,
[Description("Ranked Status")]
RankedStatus,
[Description("Recently Played")]
RecentlyPlayed,
[Description("Title")]
Title
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System.ComponentModel;
@ -9,18 +9,25 @@ namespace osu.Game.Screens.Select.Filter
{
[Description("Artist")]
Artist,
[Description("Author")]
Author,
[Description("BPM")]
BPM,
[Description("Date Added")]
DateAdded,
[Description("Difficulty")]
Difficulty,
[Description("Length")]
Length,
[Description("Rank Achieved")]
RankAchieved,
[Description("Title")]
Title
}

View File

@ -1,11 +1,11 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
@ -32,7 +32,7 @@ namespace osu.Game.Screens.Select
public SortMode Sort
{
get { return sort; }
get => sort;
set
{
if (sort != value)
@ -47,7 +47,7 @@ namespace osu.Game.Screens.Select
public GroupMode Group
{
get { return group; }
get => group;
set
{
if (group != value)
@ -63,7 +63,7 @@ namespace osu.Game.Screens.Select
Group = group,
Sort = sort,
SearchText = searchTextBox.Text,
AllowConvertedBeatmaps = showConverted,
AllowConvertedBeatmaps = showConverted.Value,
Ruleset = ruleset.Value
};
@ -146,12 +146,12 @@ namespace osu.Game.Screens.Select
}
};
searchTextBox.Current.ValueChanged += t => FilterChanged?.Invoke(CreateCriteria());
searchTextBox.Current.ValueChanged += _ => FilterChanged?.Invoke(CreateCriteria());
groupTabs.PinItem(GroupMode.All);
groupTabs.PinItem(GroupMode.RecentlyPlayed);
groupTabs.Current.ValueChanged += val => Group = val;
sortTabs.Current.ValueChanged += val => Sort = val;
groupTabs.Current.ValueChanged += group => Group = group.NewValue;
sortTabs.Current.ValueChanged += sort => Sort = sort.NewValue;
}
public void Deactivate()
@ -178,7 +178,7 @@ namespace osu.Game.Screens.Select
sortTabs.AccentColour = colours.GreenLight;
showConverted = config.GetBindable<bool>(OsuSetting.ShowConvertedBeatmaps);
showConverted.ValueChanged += val => updateCriteria();
showConverted.ValueChanged += _ => updateCriteria();
ruleset.BindTo(parentRuleset);
ruleset.BindValueChanged(_ => updateCriteria(), true);

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using System.Linq;
@ -22,7 +22,7 @@ namespace osu.Game.Screens.Select
public string SearchText
{
get { return searchText; }
get => searchText;
set
{
searchText = value;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using System.Collections.Generic;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using osuTK;
@ -20,7 +20,7 @@ namespace osu.Game.Screens.Select
public string Text
{
get { return spriteText?.Text; }
get => spriteText?.Text;
set
{
if (spriteText != null)
@ -29,9 +29,10 @@ namespace osu.Game.Screens.Select
}
private Color4 deselectedColour;
public Color4 DeselectedColour
{
get { return deselectedColour; }
get => deselectedColour;
set
{
deselectedColour = value;
@ -41,9 +42,10 @@ namespace osu.Game.Screens.Select
}
private Color4 selectedColour;
public Color4 SelectedColour
{
get { return selectedColour; }
get => selectedColour;
set
{
selectedColour = value;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using osu.Game.Graphics;

View File

@ -1,11 +1,11 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select.Leaderboards
public BeatmapInfo Beatmap
{
get { return beatmap; }
get => beatmap;
set
{
if (beatmap == value)

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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.
namespace osu.Game.Screens.Select.Leaderboards
{

View File

@ -1,9 +1,16 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using System.Collections.Generic;
using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Online.Multiplayer;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Multi;
namespace osu.Game.Screens.Select
@ -15,6 +22,20 @@ namespace osu.Game.Screens.Select
public string ShortTitle => "song selection";
public override string Title => ShortTitle.Humanize();
[Resolved(typeof(Room))]
protected Bindable<PlaylistItem> CurrentItem { get; private set; }
[Resolved]
private Bindable<IEnumerable<Mod>> selectedMods { get; set; }
[Resolved]
private BeatmapManager beatmaps { get; set; }
public MatchSongSelect()
{
Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING };
}
protected override bool OnStart()
{
var item = new PlaylistItem
@ -28,10 +49,33 @@ namespace osu.Game.Screens.Select
Selected?.Invoke(item);
if (IsCurrentScreen)
Exit();
if (this.IsCurrentScreen())
this.Exit();
return true;
}
public override bool OnExiting(IScreen next)
{
if (base.OnExiting(next))
return true;
Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value?.Beatmap);
Beatmap.Value.Mods.Value = selectedMods.Value = CurrentItem.Value?.RequiredMods;
Ruleset.Value = CurrentItem.Value?.Ruleset;
Beatmap.Disabled = true;
Ruleset.Disabled = true;
return false;
}
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
Beatmap.Disabled = false;
Ruleset.Disabled = false;
}
}
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@ -28,26 +28,26 @@ namespace osu.Game.Screens.Select.Options
public Color4 ButtonColour
{
get { return background.Colour; }
set { background.Colour = value; }
get => background.Colour;
set => background.Colour = value;
}
public FontAwesome Icon
{
get { return iconText.Icon; }
set { iconText.Icon = value; }
get => iconText.Icon;
set => iconText.Icon = value;
}
public string FirstLineText
{
get { return firstLine.Text; }
set { firstLine.Text = value; }
get => firstLine.Text;
set => firstLine.Text = value;
}
public string SecondLineText
{
get { return secondLine.Text; }
set { secondLine.Text = value; }
get => secondLine.Text;
set => secondLine.Text = value;
}
public Key? HotKey;
@ -150,14 +150,14 @@ namespace osu.Game.Screens.Select.Options
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Text = @"",
},
secondLine = new OsuSpriteText
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Text = @"",
},
},

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System;
using osu.Framework.Extensions.Color4Extensions;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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 System.Linq;
using osu.Framework.Allocation;
@ -15,6 +15,8 @@ namespace osu.Game.Screens.Select
private bool removeAutoModOnResume;
private OsuScreen player;
public override bool AllowExternalScreenChange => true;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
@ -25,7 +27,7 @@ namespace osu.Game.Screens.Select
}, Key.Number3);
}
protected override void OnResuming(Screen last)
public override void OnResuming(IScreen last)
{
player = null;
@ -58,13 +60,12 @@ namespace osu.Game.Screens.Select
}
Beatmap.Value.Track.Looping = false;
Beatmap.Disabled = true;
SampleConfirm?.Play();
LoadComponentAsync(player = new PlayerLoader(() => new Player()), l =>
{
if (IsCurrentScreen) Push(player);
if (this.IsCurrentScreen()) this.Push(player);
});
return true;

View File

@ -1,11 +1,11 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
@ -27,6 +27,7 @@ using osu.Game.Screens.Play;
using osu.Game.Screens.Select.Options;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
using osuTK.Input;
using System;
using System.Collections.Generic;
@ -44,8 +45,6 @@ namespace osu.Game.Screens.Select
protected virtual bool ShowFooter => true;
public override bool AllowExternalScreenChange => true;
/// <summary>
/// Can be null if <see cref="ShowFooter"/> is false.
/// </summary>
@ -77,7 +76,7 @@ namespace osu.Game.Screens.Select
protected readonly BeatmapDetailArea BeatmapDetails;
protected new readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
[Cached]
[Cached(Type = typeof(IBindable<IEnumerable<Mod>>))]
@ -88,7 +87,7 @@ namespace osu.Game.Screens.Select
const float carousel_width = 640;
const float filter_height = 100;
AddRange(new Drawable[]
AddRangeInternal(new Drawable[]
{
new ParallaxContainer
{
@ -156,8 +155,8 @@ namespace osu.Game.Screens.Select
Background = { Width = 2 },
Exit = () =>
{
if (IsCurrentScreen)
Exit();
if (this.IsCurrentScreen())
this.Exit();
},
},
}
@ -182,7 +181,7 @@ namespace osu.Game.Screens.Select
if (ShowFooter)
{
Add(FooterPanels = new Container
AddInternal(FooterPanels = new Container
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
@ -193,7 +192,7 @@ namespace osu.Game.Screens.Select
Bottom = Footer.HEIGHT,
},
});
Add(Footer = new Footer
AddInternal(Footer = new Footer
{
OnBack = ExitFromBack,
});
@ -210,7 +209,7 @@ namespace osu.Game.Screens.Select
});
}
BeatmapDetails.Leaderboard.ScoreSelected += s => Push(new SoloResults(s));
BeatmapDetails.Leaderboard.ScoreSelected += s => this.Push(new SoloResults(s));
}
[BackgroundDependencyLoader(true)]
@ -267,8 +266,8 @@ namespace osu.Game.Screens.Select
{
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs(this);
dependencies.CacheAs(Ruleset);
dependencies.CacheAs<IBindable<RulesetInfo>>(Ruleset);
dependencies.CacheAs(decoupledRuleset);
dependencies.CacheAs<IBindable<RulesetInfo>>(decoupledRuleset);
return dependencies;
}
@ -281,13 +280,13 @@ namespace osu.Game.Screens.Select
return;
}
Exit();
this.Exit();
}
public void Edit(BeatmapInfo beatmap = null)
{
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce);
Push(new Editor());
this.Push(new Editor());
}
/// <summary>
@ -297,14 +296,14 @@ namespace osu.Game.Screens.Select
/// <param name="performStartAction">Whether to trigger <see cref="OnStart"/>.</param>
public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true)
{
// avoid attempting to continue before a selection has been obtained.
// this could happen via a user interaction while the carousel is still in a loading state.
if (Carousel.SelectedBeatmap == null) return;
// if we have a pending filter operation, we want to run it now.
// it could change selection (ie. if the ruleset has been changed).
Carousel.FlushPendingFilterOperations();
// avoid attempting to continue before a selection has been obtained.
// this could happen via a user interaction while the carousel is still in a loading state.
if (Carousel.SelectedBeatmap == null) return;
if (beatmap != null)
Carousel.SelectBeatmap(beatmap);
@ -327,16 +326,16 @@ namespace osu.Game.Screens.Select
private ScheduledDelegate selectionChangedDebounce;
private void workingBeatmapChanged(WorkingBeatmap beatmap)
private void workingBeatmapChanged(ValueChangedEvent<WorkingBeatmap> e)
{
if (beatmap is DummyWorkingBeatmap) return;
if (e.NewValue is DummyWorkingBeatmap) return;
if (IsCurrentScreen && !Carousel.SelectBeatmap(beatmap?.BeatmapInfo, false))
if (this.IsCurrentScreen() && !Carousel.SelectBeatmap(e.NewValue?.BeatmapInfo, false))
// If selecting new beatmap without bypassing filters failed, there's possibly a ruleset mismatch
if (beatmap?.BeatmapInfo?.Ruleset != null && beatmap.BeatmapInfo.Ruleset != Ruleset.Value)
if (e.NewValue?.BeatmapInfo?.Ruleset != null && e.NewValue.BeatmapInfo.Ruleset != decoupledRuleset.Value)
{
base.Ruleset.Value = beatmap.BeatmapInfo.Ruleset;
Carousel.SelectBeatmap(beatmap.BeatmapInfo);
Ruleset.Value = e.NewValue.BeatmapInfo.Ruleset;
Carousel.SelectBeatmap(e.NewValue.BeatmapInfo);
}
}
@ -376,12 +375,12 @@ namespace osu.Game.Screens.Select
bool preview = false;
if (ruleset?.Equals(Ruleset.Value) == false)
if (ruleset?.Equals(decoupledRuleset.Value) == false)
{
Logger.Log($"ruleset changed from \"{Ruleset.Value}\" to \"{ruleset}\"");
Logger.Log($"ruleset changed from \"{decoupledRuleset.Value}\" to \"{ruleset}\"");
Beatmap.Value.Mods.Value = Enumerable.Empty<Mod>();
Ruleset.Value = ruleset;
decoupledRuleset.Value = ruleset;
// force a filter before attempting to change the beatmap.
// we may still be in the wrong ruleset as there is a debounce delay on ruleset changes.
@ -411,7 +410,7 @@ namespace osu.Game.Screens.Select
}
}
if (IsCurrentScreen) ensurePlayingSelected(preview);
if (this.IsCurrentScreen()) ensurePlayingSelected(preview);
UpdateBeatmap(Beatmap.Value);
}
@ -431,11 +430,11 @@ namespace osu.Game.Screens.Select
Carousel.SelectNextRandom();
}
protected override void OnEntering(Screen last)
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
Content.FadeInFromZero(250);
this.FadeInFromZero(250);
FilterControl.Activate();
}
@ -445,7 +444,6 @@ namespace osu.Game.Screens.Select
{
base.LogoArriving(logo, resuming);
logo.RelativePositionAxes = Axes.Both;
Vector2 position = new Vector2(0.95f, 0.96f);
if (logo.Alpha > 0.8f)
@ -476,7 +474,7 @@ namespace osu.Game.Screens.Select
logo.FadeOut(logo_transition / 2, Easing.Out);
}
protected override void OnResuming(Screen last)
public override void OnResuming(IScreen last)
{
BeatmapDetails.Leaderboard.RefreshScores();
@ -490,38 +488,33 @@ namespace osu.Game.Screens.Select
base.OnResuming(last);
Content.FadeIn(250);
this.FadeIn(250);
Content.ScaleTo(1, 250, Easing.OutSine);
this.ScaleTo(1, 250, Easing.OutSine);
FilterControl.Activate();
}
protected override void OnSuspending(Screen next)
public override void OnSuspending(IScreen next)
{
ModSelect.Hide();
Content.ScaleTo(1.1f, 250, Easing.InSine);
this.ScaleTo(1.1f, 250, Easing.InSine);
Content.FadeOut(250);
this.FadeOut(250);
FilterControl.Deactivate();
base.OnSuspending(next);
}
protected override bool OnExiting(Screen next)
public override bool OnExiting(IScreen next)
{
if (ModSelect.State == Visibility.Visible)
{
ModSelect.Hide();
if (base.OnExiting(next))
return true;
}
FinaliseSelection(performStartAction: false);
beatmapInfoWedge.State = Visibility.Hidden;
Content.FadeOut(100);
this.FadeOut(100);
FilterControl.Deactivate();
@ -531,14 +524,14 @@ namespace osu.Game.Screens.Select
SelectedMods.UnbindAll();
Beatmap.Value.Mods.Value = new Mod[] { };
return base.OnExiting(next);
return false;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
Ruleset.UnbindAll();
decoupledRuleset.UnbindAll();
if (beatmaps != null)
{
@ -564,7 +557,7 @@ namespace osu.Game.Screens.Select
{
backgroundModeBeatmap.Beatmap = beatmap;
backgroundModeBeatmap.BlurTo(background_blur, 750, Easing.OutQuint);
backgroundModeBeatmap.FadeTo(1, 250);
backgroundModeBeatmap.FadeColour(Color4.White, 250);
}
beatmapInfoWedge.Beatmap = beatmap;
@ -599,9 +592,11 @@ namespace osu.Game.Screens.Select
if (rulesetNoDebounce == null)
{
// manual binding to parent ruleset to allow for delayed load in the incoming direction.
rulesetNoDebounce = Ruleset.Value = base.Ruleset.Value;
base.Ruleset.ValueChanged += updateSelectedRuleset;
Ruleset.ValueChanged += r => base.Ruleset.Value = r;
rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value;
Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue);
decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue;
decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r;
Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true);
Beatmap.BindValueChanged(workingBeatmapChanged);
@ -622,6 +617,7 @@ namespace osu.Game.Screens.Select
private void delete(BeatmapSetInfo beatmap)
{
if (beatmap == null || beatmap.ID <= 0) return;
dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap));
}
@ -636,7 +632,7 @@ namespace osu.Game.Screens.Select
public override bool OnPressed(GlobalAction action)
{
if (!IsCurrentScreen) return false;
if (!this.IsCurrentScreen()) return false;
switch (action)
{

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// 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.Extensions.Color4Extensions;
using osu.Framework.Graphics;