1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 04:12:57 +08:00

Merge branch 'master' into fix-carousel-filter-application

This commit is contained in:
Dean Herbert 2020-07-13 17:05:45 +09:00
commit ef3ab7a858
9 changed files with 93 additions and 24 deletions

View File

@ -0,0 +1,25 @@
// 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.Game.Overlays;
using osu.Game.Overlays.Rankings;
namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneRankingsSortTabControl : OsuTestScene
{
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
public TestSceneRankingsSortTabControl()
{
Child = new RankingsSortTabControl
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
};
}
}
}

View File

@ -35,6 +35,7 @@ namespace osu.Game.Input.Bindings
new KeyBinding(new[] { InputKey.Control, InputKey.T }, GlobalAction.ToggleToolbar), new KeyBinding(new[] { InputKey.Control, InputKey.T }, GlobalAction.ToggleToolbar),
new KeyBinding(new[] { InputKey.Control, InputKey.O }, GlobalAction.ToggleSettings), new KeyBinding(new[] { InputKey.Control, InputKey.O }, GlobalAction.ToggleSettings),
new KeyBinding(new[] { InputKey.Control, InputKey.D }, GlobalAction.ToggleDirect), new KeyBinding(new[] { InputKey.Control, InputKey.D }, GlobalAction.ToggleDirect),
new KeyBinding(new[] { InputKey.Control, InputKey.N }, GlobalAction.ToggleNotifications),
new KeyBinding(InputKey.Escape, GlobalAction.Back), new KeyBinding(InputKey.Escape, GlobalAction.Back),
new KeyBinding(InputKey.ExtraMouseButton1, GlobalAction.Back), new KeyBinding(InputKey.ExtraMouseButton1, GlobalAction.Back),
@ -157,5 +158,8 @@ namespace osu.Game.Input.Bindings
[Description("Home")] [Description("Home")]
Home, Home,
[Description("Toggle notifications")]
ToggleNotifications
} }
} }

View File

@ -170,36 +170,37 @@ namespace osu.Game.Online.Leaderboards
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new GridContainer new OsuContextMenuContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
RowDimensions = new[] Masking = true,
Child = new GridContainer
{ {
new Dimension(), RelativeSizeAxes = Axes.Both,
new Dimension(GridSizeMode.AutoSize), RowDimensions = new[]
},
Content = new[]
{
new Drawable[]
{ {
new OsuContextMenuContainer new Dimension(),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new Drawable[]
{ {
RelativeSizeAxes = Axes.Both, scrollContainer = new OsuScrollContainer
Child = scrollContainer = new OsuScrollContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
ScrollbarVisible = false, ScrollbarVisible = false,
} }
},
new Drawable[]
{
content = new Container
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
},
} }
}, },
new Drawable[]
{
content = new Container
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
},
}
}, },
}, },
loading = new LoadingSpinner(), loading = new LoadingSpinner(),

View File

@ -58,6 +58,9 @@ namespace osu.Game.Online.Leaderboards
[Resolved(CanBeNull = true)] [Resolved(CanBeNull = true)]
private DialogOverlay dialogOverlay { get; set; } private DialogOverlay dialogOverlay { get; set; }
[Resolved(CanBeNull = true)]
private SongSelect songSelect { get; set; }
public LeaderboardScore(ScoreInfo score, int? rank, bool allowHighlight = true) public LeaderboardScore(ScoreInfo score, int? rank, bool allowHighlight = true)
{ {
this.score = score; this.score = score;
@ -373,6 +376,9 @@ namespace osu.Game.Online.Leaderboards
{ {
List<MenuItem> items = new List<MenuItem>(); List<MenuItem> items = new List<MenuItem>();
if (score.Mods.Length > 0 && modsContainer.Any(s => s.IsHovered) && songSelect != null)
items.Add(new OsuMenuItem("Use these mods", MenuItemType.Highlighted, () => songSelect.Mods.Value = score.Mods));
if (score.ID != 0) if (score.ID != 0)
items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new LocalScoreDeleteDialog(score)))); items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new LocalScoreDeleteDialog(score))));

View File

@ -890,6 +890,10 @@ namespace osu.Game
beatmapListing.ToggleVisibility(); beatmapListing.ToggleVisibility();
return true; return true;
case GlobalAction.ToggleNotifications:
notifications.ToggleVisibility();
return true;
case GlobalAction.ToggleGameplayMouseButtons: case GlobalAction.ToggleGameplayMouseButtons:
LocalConfig.Set(OsuSetting.MouseDisableButtons, !LocalConfig.Get<bool>(OsuSetting.MouseDisableButtons)); LocalConfig.Set(OsuSetting.MouseDisableButtons, !LocalConfig.Get<bool>(OsuSetting.MouseDisableButtons));
return true; return true;

View File

@ -86,7 +86,7 @@ namespace osu.Game.Overlays.Comments
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 12), Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
Text = @"Show deleted" Text = @"Show deleted"
} }
}, },

View File

@ -30,6 +30,14 @@ namespace osu.Game.Overlays
set => current.Current = value; set => current.Current = value;
} }
public string Title
{
get => text.Text;
set => text.Text = value;
}
private readonly OsuSpriteText text;
public OverlaySortTabControl() public OverlaySortTabControl()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
@ -40,11 +48,11 @@ namespace osu.Game.Overlays
Spacing = new Vector2(10, 0), Spacing = new Vector2(10, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText text = new OsuSpriteText
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 12), Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
Text = @"Sort by" Text = @"Sort by"
}, },
CreateControl().With(c => CreateControl().With(c =>
@ -133,7 +141,7 @@ namespace osu.Game.Overlays
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 12), Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
Text = (value as Enum)?.GetDescription() ?? value.ToString() Text = (value as Enum)?.GetDescription() ?? value.ToString()
} }
} }
@ -163,7 +171,7 @@ namespace osu.Game.Overlays
ContentColour = Active.Value && !IsHovered ? colourProvider.Light1 : Color4.White; ContentColour = Active.Value && !IsHovered ? colourProvider.Light1 : Color4.White;
text.Font = text.Font.With(weight: Active.Value ? FontWeight.Bold : FontWeight.Medium); text.Font = text.Font.With(weight: Active.Value ? FontWeight.Bold : FontWeight.SemiBold);
} }
} }
} }

View File

@ -0,0 +1,19 @@
// 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.Overlays.Rankings
{
public class RankingsSortTabControl : OverlaySortTabControl<RankingsSortCriteria>
{
public RankingsSortTabControl()
{
Title = "Show";
}
}
public enum RankingsSortCriteria
{
All,
Friends
}
}

View File

@ -219,6 +219,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
Alpha = 0; Alpha = 0;
} }
protected override bool ShouldBeConsideredForInput(Drawable child) => state == SelectionState.Selected;
private class RoomName : OsuSpriteText private class RoomName : OsuSpriteText
{ {
[Resolved(typeof(Room), nameof(Online.Multiplayer.Room.Name))] [Resolved(typeof(Room), nameof(Online.Multiplayer.Room.Name))]