Merge branch 'master' into consistent-terminology-format

This commit is contained in:
Dean Herbert
2018-10-10 19:19:36 +09:00
committed by GitHub
211 changed files with 2020 additions and 1293 deletions

View File

@ -17,8 +17,7 @@ using osu.Framework.Caching;
using osu.Framework.Threading;
using osu.Framework.Configuration;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Input.EventArgs;
using osu.Framework.Input.States;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Cursor;
@ -52,8 +51,8 @@ namespace osu.Game.Screens.Select
/// </summary>
public Action<BeatmapInfo> SelectionChanged;
public override bool HandleKeyboardInput => AllowSelection;
public override bool HandleMouseInput => AllowSelection;
public override bool HandleNonPositionalInput => AllowSelection;
public override bool HandlePositionalInput => AllowSelection;
/// <summary>
/// Used to avoid firing null selections before the initial beatmaps have been loaded via <see cref="BeatmapSets"/>.
@ -381,12 +380,12 @@ namespace osu.Game.Screens.Select
public void ScrollToSelected() => scrollPositionCache.Invalidate();
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
protected override bool OnKeyDown(KeyDownEvent e)
{
int direction = 0;
bool skipDifficulties = false;
switch (args.Key)
switch (e.Key)
{
case Key.Up:
direction = -1;
@ -405,7 +404,7 @@ namespace osu.Game.Screens.Select
}
if (direction == 0)
return base.OnKeyDown(state, args);
return base.OnKeyDown(e);
SelectNext(direction, skipDifficulties);
return true;

View File

@ -59,7 +59,7 @@ namespace osu.Game.Screens.Select
ruleset.ValueChanged += _ => updateDisplay();
}
protected override bool BlockPassThroughMouse => false;
protected override bool BlockPositionalInput => false;
protected override void PopIn()
{
@ -89,6 +89,8 @@ namespace osu.Game.Screens.Select
}
}
public override bool IsPresent => base.IsPresent || Info == null; // Visibility is updated in the LoadComponentAsync callback
private BufferedWedgeInfo loadingInfo;
private void updateDisplay()
@ -127,11 +129,12 @@ namespace osu.Game.Screens.Select
public OsuSpriteText VersionLabel { get; private set; }
public OsuSpriteText TitleLabel { get; private set; }
public OsuSpriteText ArtistLabel { get; private set; }
public BeatmapSetOnlineStatusPill StatusPill { get; private set; }
public FillFlowContainer MapperContainer { get; private set; }
public FillFlowContainer InfoLabelContainer { get; private set; }
private UnicodeBindableString titleBinding;
private UnicodeBindableString artistBinding;
private ILocalisedBindableString titleBinding;
private ILocalisedBindableString artistBinding;
private readonly WorkingBeatmap beatmap;
private readonly RulesetInfo ruleset;
@ -143,7 +146,7 @@ namespace osu.Game.Screens.Select
}
[BackgroundDependencyLoader]
private void load(LocalisationEngine localisation)
private void load(LocalisationManager localisation)
{
var beatmapInfo = beatmap.BeatmapInfo;
var metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
@ -152,8 +155,8 @@ namespace osu.Game.Screens.Select
CacheDrawnFrameBuffer = true;
RelativeSizeAxes = Axes.Both;
titleBinding = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title);
artistBinding = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist);
titleBinding = localisation.GetLocalisedString(new LocalisedString((metadata.TitleUnicode, metadata.Title)));
artistBinding = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist)));
Children = new Drawable[]
{
@ -190,7 +193,7 @@ namespace osu.Game.Screens.Select
},
new FillFlowContainer
{
Name = "Top-aligned metadata",
Name = "Topleft-aligned metadata",
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Direction = FillDirection.Vertical,
@ -207,6 +210,24 @@ namespace osu.Game.Screens.Select
}
},
new FillFlowContainer
{
Name = "Topright-aligned metadata",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Direction = FillDirection.Vertical,
Margin = new MarginPadding { Top = 14, Left = 10, Right = 18, Bottom = 20 },
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
StatusPill = new BeatmapSetOnlineStatusPill
{
TextSize = 11,
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
Status = beatmapInfo.Status,
}
}
},
new FillFlowContainer
{
Name = "Centre-aligned metadata",
Anchor = Anchor.CentreLeft,
@ -244,8 +265,13 @@ namespace osu.Game.Screens.Select
}
}
};
artistBinding.ValueChanged += value => setMetadata(metadata.Source);
artistBinding.TriggerChange();
titleBinding.BindValueChanged(value => setMetadata(metadata.Source));
artistBinding.BindValueChanged(value => setMetadata(metadata.Source), true);
// no difficulty means it can't have a status to show
if (beatmapInfo.Version == null)
StatusPill.Hide();
}
private void setMetadata(string source)

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.States;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
@ -155,12 +155,12 @@ namespace osu.Game.Screens.Select.Carousel
triangles.Colour = OsuColour.Gray(0.5f);
}
protected override bool OnClick(InputState state)
protected override bool OnClick(ClickEvent e)
{
if (Item.State == CarouselItemState.Selected)
startRequested?.Invoke(beatmap);
return base.OnClick(state);
return base.OnClick(e);
}
protected override void ApplyState()

View File

@ -38,11 +38,8 @@ namespace osu.Game.Screens.Select.Carousel
}
[BackgroundDependencyLoader(true)]
private void load(LocalisationEngine localisation, BeatmapManager manager, BeatmapSetOverlay beatmapOverlay, DialogOverlay overlay)
private void load(BeatmapManager manager, BeatmapSetOverlay beatmapOverlay, DialogOverlay overlay)
{
if (localisation == null)
throw new ArgumentNullException(nameof(localisation));
restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore);
dialogOverlay = overlay;
if (beatmapOverlay != null)
@ -67,22 +64,39 @@ namespace osu.Game.Screens.Select.Carousel
new OsuSpriteText
{
Font = @"Exo2.0-BoldItalic",
Current = localisation.GetUnicodePreference(beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title),
Text = new LocalisedString((beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title)),
TextSize = 22,
Shadow = true,
},
new OsuSpriteText
{
Font = @"Exo2.0-SemiBoldItalic",
Current = localisation.GetUnicodePreference(beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist),
Text = new LocalisedString((beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist)),
TextSize = 17,
Shadow = true,
},
new FillFlowContainer<FilterableDifficultyIcon>
new FillFlowContainer
{
Margin = new MarginPadding { Top = 5 },
Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
Children = ((CarouselBeatmapSet)Item).Beatmaps.Select(b => new FilterableDifficultyIcon(b)).ToList()
Margin = new MarginPadding { Top = 5 },
Children = new Drawable[]
{
new BeatmapSetOnlineStatusPill
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Margin = new MarginPadding { Right = 5 },
TextSize = 11,
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
Status = beatmapSet.Status
},
new FillFlowContainer<FilterableDifficultyIcon>
{
AutoSizeAxes = Axes.Both,
Children = ((CarouselBeatmapSet)Item).Beatmaps.Select(b => new FilterableDifficultyIcon(b)).ToList()
},
}
}
}
}

View File

@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States;
using osu.Framework.Input.Events;
using osu.Framework.MathUtils;
using osu.Game.Graphics;
using OpenTK;
@ -72,18 +72,18 @@ namespace osu.Game.Screens.Select.Carousel
hoverLayer.Colour = colours.Blue.Opacity(0.1f);
}
protected override bool OnHover(InputState state)
protected override bool OnHover(HoverEvent e)
{
sampleHover?.Play();
hoverLayer.FadeIn(100, Easing.OutQuint);
return base.OnHover(state);
return base.OnHover(e);
}
protected override void OnHoverLost(InputState state)
protected override void OnHoverLost(HoverLostEvent e)
{
hoverLayer.FadeOut(1000, Easing.OutQuint);
base.OnHoverLost(state);
base.OnHoverLost(e);
}
public void SetMultiplicativeAlpha(float alpha) => borderContainer.Alpha = alpha;
@ -145,7 +145,7 @@ namespace osu.Game.Screens.Select.Carousel
};
}
protected override bool OnClick(InputState state)
protected override bool OnClick(ClickEvent e)
{
Item.State.Value = CarouselItemState.Selected;
return true;

View File

@ -14,8 +14,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Select.Filter;
using Container = osu.Framework.Graphics.Containers.Container;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.EventArgs;
using osu.Framework.Input.States;
using osu.Framework.Input.Events;
using osu.Game.Configuration;
using osu.Game.Rulesets;
@ -72,8 +71,8 @@ namespace osu.Game.Screens.Select
private readonly SearchTextBox searchTextBox;
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) =>
base.ReceiveMouseInputAt(screenSpacePos) || groupTabs.ReceiveMouseInputAt(screenSpacePos) || sortTabs.ReceiveMouseInputAt(screenSpacePos);
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
base.ReceivePositionalInputAt(screenSpacePos) || groupTabs.ReceivePositionalInputAt(screenSpacePos) || sortTabs.ReceivePositionalInputAt(screenSpacePos);
public FilterControl()
{
@ -187,10 +186,10 @@ namespace osu.Game.Screens.Select
private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria());
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
protected override bool OnMouseDown(MouseDownEvent e) => true;
protected override bool OnMouseMove(InputState state) => true;
protected override bool OnMouseMove(MouseMoveEvent e) => true;
protected override bool OnClick(InputState state) => true;
protected override bool OnClick(ClickEvent e) => true;
}
}

View File

@ -11,8 +11,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.EventArgs;
using osu.Framework.Input.States;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Select
@ -139,8 +138,8 @@ namespace osu.Game.Screens.Select
updateModeLight();
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
protected override bool OnMouseDown(MouseDownEvent e) => true;
protected override bool OnClick(InputState state) => true;
protected override bool OnClick(ClickEvent e) => true;
}
}

View File

@ -8,8 +8,7 @@ using OpenTK.Input;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.EventArgs;
using osu.Framework.Input.States;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.Containers;
@ -56,7 +55,7 @@ namespace osu.Game.Screens.Select
private readonly Box box;
private readonly Box light;
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos);
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos);
public FooterButton()
{
@ -89,7 +88,7 @@ namespace osu.Game.Screens.Select
public Action HoverLost;
public Key? Hotkey;
protected override bool OnHover(InputState state)
protected override bool OnHover(HoverEvent e)
{
Hovered?.Invoke();
light.ScaleTo(new Vector2(1, 2), Footer.TRANSITION_LENGTH, Easing.OutQuint);
@ -97,42 +96,42 @@ namespace osu.Game.Screens.Select
return true;
}
protected override void OnHoverLost(InputState state)
protected override void OnHoverLost(HoverLostEvent e)
{
HoverLost?.Invoke();
light.ScaleTo(new Vector2(1, 1), Footer.TRANSITION_LENGTH, Easing.OutQuint);
light.FadeColour(DeselectedColour, Footer.TRANSITION_LENGTH, Easing.OutQuint);
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
protected override bool OnMouseDown(MouseDownEvent e)
{
box.FadeTo(0.3f, Footer.TRANSITION_LENGTH * 2, Easing.OutQuint);
return base.OnMouseDown(state, args);
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
protected override bool OnMouseUp(MouseUpEvent e)
{
box.FadeOut(Footer.TRANSITION_LENGTH, Easing.OutQuint);
return base.OnMouseUp(state, args);
return base.OnMouseUp(e);
}
protected override bool OnClick(InputState state)
protected override bool OnClick(ClickEvent e)
{
box.ClearTransforms();
box.Alpha = 1;
box.FadeOut(Footer.TRANSITION_LENGTH * 3, Easing.OutQuint);
return base.OnClick(state);
return base.OnClick(e);
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
protected override bool OnKeyDown(KeyDownEvent e)
{
if (!args.Repeat && args.Key == Hotkey)
if (!e.Repeat && e.Key == Hotkey)
{
OnClick(state);
Click();
return true;
}
return base.OnKeyDown(state, args);
return base.OnKeyDown(e);
}
}
}

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
@ -251,16 +251,16 @@ namespace osu.Game.Screens.Select.Leaderboards
}
}
protected override bool OnHover(InputState state)
protected override bool OnHover(HoverEvent e)
{
background.FadeTo(0.5f, 300, Easing.OutQuint);
return base.OnHover(state);
return base.OnHover(e);
}
protected override void OnHoverLost(InputState state)
protected override void OnHoverLost(HoverLostEvent e)
{
background.FadeTo(background_alpha, 200, Easing.OutQuint);
base.OnHoverLost(state);
base.OnHoverLost(e);
}
private class GlowingSpriteText : Container

View File

@ -11,8 +11,6 @@ namespace osu.Game.Screens.Select.Leaderboards
{
protected const float TEXT_SIZE = 22;
public override bool HandleMouseInput => true;
protected Placeholder()
: base(cp => cp.TextSize = TEXT_SIZE)
{

View File

@ -3,8 +3,7 @@
using System;
using osu.Framework.Graphics;
using osu.Framework.Input.EventArgs;
using osu.Framework.Input.States;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using OpenTK;
@ -49,16 +48,16 @@ namespace osu.Game.Screens.Select.Leaderboards
};
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
protected override bool OnMouseDown(MouseDownEvent e)
{
icon.ScaleTo(0.8f, 4000, Easing.OutQuint);
return base.OnMouseDown(state, args);
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
protected override bool OnMouseUp(MouseUpEvent e)
{
icon.ScaleTo(1, 1000, Easing.OutElastic);
return base.OnMouseUp(state, args);
return base.OnMouseUp(e);
}
}
}

View File

@ -5,8 +5,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.EventArgs;
using osu.Framework.Input.States;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using OpenTK;
@ -53,39 +52,39 @@ namespace osu.Game.Screens.Select.Options
public Key? HotKey;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
protected override bool OnMouseDown(MouseDownEvent e)
{
flash.FadeTo(0.1f, 1000, Easing.OutQuint);
return base.OnMouseDown(state, args);
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
protected override bool OnMouseUp(MouseUpEvent e)
{
flash.FadeTo(0, 1000, Easing.OutQuint);
return base.OnMouseUp(state, args);
return base.OnMouseUp(e);
}
protected override bool OnClick(InputState state)
protected override bool OnClick(ClickEvent e)
{
flash.ClearTransforms();
flash.Alpha = 0.9f;
flash.FadeOut(800, Easing.OutExpo);
return base.OnClick(state);
return base.OnClick(e);
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
protected override bool OnKeyDown(KeyDownEvent e)
{
if (!args.Repeat && args.Key == HotKey)
if (!e.Repeat && e.Key == HotKey)
{
OnClick(state);
Click();
return true;
}
return false;
}
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos);
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos);
public BeatmapOptionsButton()
{

View File

@ -13,8 +13,7 @@ using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Logging;
using osu.Framework.Input.EventArgs;
using osu.Framework.Input.States;
using osu.Framework.Input.Events;
using osu.Framework.Screens;
using osu.Framework.Threading;
using osu.Game.Beatmaps;
@ -536,7 +535,7 @@ namespace osu.Game.Screens.Select
private void delete(BeatmapSetInfo beatmap)
{
if (beatmap == null) return;
if (beatmap == null || beatmap.ID <= 0) return;
dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap));
}
@ -554,14 +553,14 @@ namespace osu.Game.Screens.Select
return base.OnPressed(action);
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
protected override bool OnKeyDown(KeyDownEvent e)
{
if (args.Repeat) return false;
if (e.Repeat) return false;
switch (args.Key)
switch (e.Key)
{
case Key.Delete:
if (state.Keyboard.ShiftPressed)
if (e.ShiftPressed)
{
if (!Beatmap.IsDefault)
delete(Beatmap.Value.BeatmapSetInfo);
@ -571,7 +570,7 @@ namespace osu.Game.Screens.Select
break;
}
return base.OnKeyDown(state, args);
return base.OnKeyDown(e);
}
private class ResetScrollContainer : Container
@ -583,10 +582,10 @@ namespace osu.Game.Screens.Select
this.onHoverAction = onHoverAction;
}
protected override bool OnHover(InputState state)
protected override bool OnHover(HoverEvent e)
{
onHoverAction?.Invoke();
return base.OnHover(state);
return base.OnHover(e);
}
}
}