1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 01:23:24 +08:00

Merge master with conflicts resolved

This commit is contained in:
Andrei Zavatski 2020-01-30 10:39:23 +03:00
commit 1c4650c02c
27 changed files with 201 additions and 144 deletions

View File

@ -20,7 +20,9 @@ namespace osu.Game.Rulesets.Catch.UI
internal readonly CatcherArea CatcherArea; internal readonly CatcherArea CatcherArea;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) || CatcherArea.ReceivePositionalInputAt(screenSpacePos); public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
// only check the X position; handle all vertical space.
base.ReceivePositionalInputAt(new Vector2(screenSpacePos.X, ScreenSpaceDrawQuad.Centre.Y));
public CatchPlayfield(BeatmapDifficulty difficulty, Func<CatchHitObject, DrawableHitObject<CatchHitObject>> createDrawableRepresentation) public CatchPlayfield(BeatmapDifficulty difficulty, Func<CatchHitObject, DrawableHitObject<CatchHitObject>> createDrawableRepresentation)
{ {

View File

@ -30,7 +30,6 @@ namespace osu.Game.Tests.Visual.Navigation
} }
[Test] [Test]
[Ignore("will be fixed soon")]
public void TestFromMainMenuDifferentRuleset() public void TestFromMainMenuDifferentRuleset()
{ {
var firstImport = importBeatmap(1); var firstImport = importBeatmap(1);

View File

@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Online
typeof(HeaderButton), typeof(HeaderButton),
typeof(SortTabControl), typeof(SortTabControl),
typeof(ShowChildrenButton), typeof(ShowChildrenButton),
typeof(DeletedChildrenPlaceholder), typeof(DeletedCommentsCounter),
typeof(VotePill) typeof(VotePill)
}; };

View File

@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual.Online
}; };
[Cached] [Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink);
public TestSceneHistoricalSection() public TestSceneHistoricalSection()
{ {

View File

@ -16,7 +16,8 @@ namespace osu.Game.Tests.Visual.UserInterface
{ {
public override IReadOnlyList<Type> RequiredTypes => new[] public override IReadOnlyList<Type> RequiredTypes => new[]
{ {
typeof(FooterButtonMods) typeof(FooterButtonMods),
typeof(FooterButton)
}; };
private readonly TestFooterButtonMods footerButtonMods; private readonly TestFooterButtonMods footerButtonMods;

View File

@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Comments
private int currentPage; private int currentPage;
private FillFlowContainer content; private FillFlowContainer content;
private DeletedChildrenPlaceholder deletedChildrenPlaceholder; private DeletedCommentsCounter deletedCommentsCounter;
private CommentsShowMoreButton moreButton; private CommentsShowMoreButton moreButton;
private TotalCommentsCounter commentCounter; private TotalCommentsCounter commentCounter;
@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Comments
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
deletedChildrenPlaceholder = new DeletedChildrenPlaceholder deletedCommentsCounter = new DeletedCommentsCounter
{ {
ShowDeleted = { BindTarget = ShowDeleted } ShowDeleted = { BindTarget = ShowDeleted }
}, },
@ -153,7 +153,7 @@ namespace osu.Game.Overlays.Comments
private void clearComments() private void clearComments()
{ {
currentPage = 1; currentPage = 1;
deletedChildrenPlaceholder.DeletedCount.Value = 0; deletedCommentsCounter.Count.Value = 0;
moreButton.IsLoading = true; moreButton.IsLoading = true;
content.Clear(); content.Clear();
} }
@ -184,7 +184,7 @@ namespace osu.Game.Overlays.Comments
{ {
content.Add(loaded); content.Add(loaded);
deletedChildrenPlaceholder.DeletedCount.Value += response.Comments.Count(c => c.IsDeleted && c.IsTopLevel); deletedCommentsCounter.Count.Value += response.Comments.Count(c => c.IsDeleted && c.IsTopLevel);
if (response.HasMore) if (response.HasMore)
{ {

View File

@ -12,51 +12,56 @@ using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Comments namespace osu.Game.Overlays.Comments
{ {
public class DeletedChildrenPlaceholder : FillFlowContainer public class DeletedCommentsCounter : CompositeDrawable
{ {
public readonly BindableBool ShowDeleted = new BindableBool(); public readonly BindableBool ShowDeleted = new BindableBool();
public readonly BindableInt DeletedCount = new BindableInt();
public readonly BindableInt Count = new BindableInt();
private readonly SpriteText countText; private readonly SpriteText countText;
public DeletedChildrenPlaceholder() public DeletedCommentsCounter()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Direction = FillDirection.Horizontal;
Spacing = new Vector2(3, 0);
Margin = new MarginPadding { Vertical = 10, Left = 80 }; Margin = new MarginPadding { Vertical = 10, Left = 80 };
Children = new Drawable[]
InternalChild = new FillFlowContainer
{ {
new SpriteIcon AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(3, 0),
Children = new Drawable[]
{ {
Icon = FontAwesome.Solid.Trash, new SpriteIcon
Size = new Vector2(14), {
}, Icon = FontAwesome.Solid.Trash,
countText = new OsuSpriteText Size = new Vector2(14),
{ },
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true), countText = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
}
} }
}; };
} }
protected override void LoadComplete() protected override void LoadComplete()
{ {
DeletedCount.BindValueChanged(_ => updateDisplay(), true);
ShowDeleted.BindValueChanged(_ => updateDisplay(), true);
base.LoadComplete(); base.LoadComplete();
Count.BindValueChanged(_ => updateDisplay(), true);
ShowDeleted.BindValueChanged(_ => updateDisplay(), true);
} }
private void updateDisplay() private void updateDisplay()
{ {
if (DeletedCount.Value != 0) if (!ShowDeleted.Value && Count.Value != 0)
{ {
countText.Text = @"deleted comment".ToQuantity(DeletedCount.Value); countText.Text = @"deleted comment".ToQuantity(Count.Value);
this.FadeTo(ShowDeleted.Value ? 0 : 1); Show();
} }
else else
{
Hide(); Hide();
}
} }
} }
} }

View File

@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Comments
{ {
LinkFlowContainer username; LinkFlowContainer username;
FillFlowContainer childCommentsContainer; FillFlowContainer childCommentsContainer;
DeletedChildrenPlaceholder deletedChildrenPlaceholder; DeletedCommentsCounter deletedCommentsCounter;
FillFlowContainer info; FillFlowContainer info;
LinkFlowContainer message; LinkFlowContainer message;
GridContainer content; GridContainer content;
@ -184,7 +184,7 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical Direction = FillDirection.Vertical
}, },
deletedChildrenPlaceholder = new DeletedChildrenPlaceholder deletedCommentsCounter = new DeletedCommentsCounter
{ {
ShowDeleted = { BindTarget = ShowDeleted } ShowDeleted = { BindTarget = ShowDeleted }
} }
@ -193,7 +193,7 @@ namespace osu.Game.Overlays.Comments
} }
}; };
deletedChildrenPlaceholder.DeletedCount.Value = comment.DeletedChildrenCount; deletedCommentsCounter.Count.Value = comment.DeletedChildrenCount;
if (comment.UserId.HasValue) if (comment.UserId.HasValue)
username.AddUserLink(comment.User); username.AddUserLink(comment.User);

View File

@ -18,11 +18,11 @@ namespace osu.Game.Overlays
protected IAPIProvider API { get; private set; } protected IAPIProvider API { get; private set; }
[Cached] [Cached]
private readonly OverlayColourProvider colourProvider; protected readonly OverlayColourProvider ColourProvider;
protected FullscreenOverlay(OverlayColourScheme colourScheme) protected FullscreenOverlay(OverlayColourScheme colourScheme)
{ {
colourProvider = new OverlayColourProvider(colourScheme); ColourProvider = new OverlayColourProvider(colourScheme);
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
RelativePositionAxes = Axes.Both; RelativePositionAxes = Axes.Both;
@ -43,10 +43,10 @@ namespace osu.Game.Overlays
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Waves.FirstWaveColour = colourProvider.Light4; Waves.FirstWaveColour = ColourProvider.Light4;
Waves.SecondWaveColour = colourProvider.Light3; Waves.SecondWaveColour = ColourProvider.Light3;
Waves.ThirdWaveColour = colourProvider.Dark4; Waves.ThirdWaveColour = ColourProvider.Dark4;
Waves.FourthWaveColour = colourProvider.Dark3; Waves.FourthWaveColour = ColourProvider.Dark3;
} }
public override void Show() public override void Show()

View File

@ -33,16 +33,16 @@ namespace osu.Game.Overlays.Profile.Header
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OverlayColourProvider colourProvider)
{ {
iconColour = colours.GreySeafoamLighter; iconColour = colourProvider.Foreground1;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colours.GreySeafoamDark, Colour = colourProvider.Background4
}, },
new FillFlowContainer new FillFlowContainer
{ {

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Graphics;
using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Overlays.Profile.Header.Components;
using osu.Game.Users; using osu.Game.Users;
using osuTK; using osuTK;
@ -28,7 +27,7 @@ namespace osu.Game.Overlays.Profile.Header
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, TextureStore textures) private void load(OverlayColourProvider colourProvider, TextureStore textures)
{ {
Container<Drawable> hiddenDetailContainer; Container<Drawable> hiddenDetailContainer;
Container<Drawable> expandedDetailContainer; Container<Drawable> expandedDetailContainer;
@ -38,7 +37,7 @@ namespace osu.Game.Overlays.Profile.Header
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colours.GreySeafoam Colour = colourProvider.Background4
}, },
new FillFlowContainer new FillFlowContainer
{ {
@ -119,12 +118,12 @@ namespace osu.Game.Overlays.Profile.Header
hiddenDetailGlobal = new OverlinedInfoContainer hiddenDetailGlobal = new OverlinedInfoContainer
{ {
Title = "Global Ranking", Title = "Global Ranking",
LineColour = colours.Yellow LineColour = colourProvider.Highlight1
}, },
hiddenDetailCountry = new OverlinedInfoContainer hiddenDetailCountry = new OverlinedInfoContainer
{ {
Title = "Country Ranking", Title = "Country Ranking",
LineColour = colours.Yellow LineColour = colourProvider.Highlight1
}, },
} }
} }

View File

@ -6,7 +6,6 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osuTK; using osuTK;
namespace osu.Game.Overlays.Profile.Header.Components namespace osu.Game.Overlays.Profile.Header.Components
@ -25,10 +24,10 @@ namespace osu.Game.Overlays.Profile.Header.Components
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OverlayColourProvider colourProvider)
{ {
IdleColour = colours.GreySeafoamLight; IdleColour = colourProvider.Background2;
HoverColour = colours.GreySeafoamLight.Darken(0.2f); HoverColour = colourProvider.Background2.Lighten(0.2f);
Child = icon = new SpriteIcon Child = icon = new SpriteIcon
{ {

View File

@ -43,7 +43,8 @@ namespace osu.Game.Overlays.Profile.Header.Components
line = new Circle line = new Circle
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 4, Height = 2,
Margin = new MarginPadding { Bottom = 2 }
}, },
title = new OsuSpriteText title = new OsuSpriteText
{ {

View File

@ -6,7 +6,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Game.Graphics;
using osu.Game.Users; using osu.Game.Users;
namespace osu.Game.Overlays.Profile.Header.Components namespace osu.Game.Overlays.Profile.Header.Components
@ -27,12 +26,12 @@ namespace osu.Game.Overlays.Profile.Header.Components
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OverlayColourProvider colourProvider)
{ {
InternalChild = info = new OverlinedInfoContainer InternalChild = info = new OverlinedInfoContainer
{ {
Title = "Total Play Time", Title = "Total Play Time",
LineColour = colours.Yellow, LineColour = colourProvider.Highlight1,
}; };
User.BindValueChanged(updateTime, true); User.BindValueChanged(updateTime, true);

View File

@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Profile.Header
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OverlayColourProvider colourProvider, OsuColour colours)
{ {
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
@ -65,7 +65,7 @@ namespace osu.Game.Overlays.Profile.Header
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colours.GreySeafoamDarker, Colour = colourProvider.Background5,
}, },
fillFlow = new FillFlowContainer fillFlow = new FillFlowContainer
{ {
@ -152,12 +152,12 @@ namespace osu.Game.Overlays.Profile.Header
detailGlobalRank = new OverlinedInfoContainer(true, 110) detailGlobalRank = new OverlinedInfoContainer(true, 110)
{ {
Title = "Global Ranking", Title = "Global Ranking",
LineColour = colours.Yellow, LineColour = colourProvider.Highlight1,
}, },
detailCountryRank = new OverlinedInfoContainer(false, 110) detailCountryRank = new OverlinedInfoContainer(false, 110)
{ {
Title = "Country Ranking", Title = "Country Ranking",
LineColour = colours.Yellow, LineColour = colourProvider.Highlight1,
}, },
} }
} }

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Overlays.Profile.Header.Components;
using osu.Game.Users; using osu.Game.Users;
using osuTK; using osuTK;
@ -23,7 +22,7 @@ namespace osu.Game.Overlays.Profile.Header
public readonly Bindable<User> User = new Bindable<User>(); public readonly Bindable<User> User = new Bindable<User>();
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OverlayColourProvider colourProvider)
{ {
Alpha = 0; Alpha = 0;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
@ -34,7 +33,7 @@ namespace osu.Game.Overlays.Profile.Header
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colours.GreySeafoamDarker, Colour = colourProvider.Background5,
}, },
new Container //artificial shadow new Container //artificial shadow
{ {

View File

@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Profile.Header
private FillFlowContainer userStats; private FillFlowContainer userStats;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OverlayColourProvider colourProvider)
{ {
Height = 150; Height = 150;
@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Profile.Header
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colours.GreySeafoamDark, Colour = colourProvider.Background5,
}, },
new FillFlowContainer new FillFlowContainer
{ {
@ -117,7 +117,7 @@ namespace osu.Game.Overlays.Profile.Header
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 1.5f, Height = 1.5f,
Margin = new MarginPadding { Top = 10 }, Margin = new MarginPadding { Top = 10 },
Colour = colours.GreySeafoamLighter, Colour = colourProvider.Light1,
}, },
new FillFlowContainer new FillFlowContainer
{ {
@ -137,7 +137,7 @@ namespace osu.Game.Overlays.Profile.Header
Margin = new MarginPadding { Left = 10 }, Margin = new MarginPadding { Left = 10 },
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Colour = colours.GreySeafoamLighter, Colour = colourProvider.Light1,
} }
} }
}, },

View File

@ -95,10 +95,10 @@ namespace osu.Game.Overlays.Profile
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OverlayColourProvider colourProvider)
{ {
background.Colour = colours.GreySeafoamDarker; background.Colour = colourProvider.Background5;
underscore.Colour = colours.Seafoam; underscore.Colour = colourProvider.Highlight1;
} }
private class SectionTriangles : Container private class SectionTriangles : Container
@ -128,11 +128,11 @@ namespace osu.Game.Overlays.Profile
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OverlayColourProvider colourProvider)
{ {
triangles.ColourLight = colours.GreySeafoamDark; triangles.ColourLight = colourProvider.Background4;
triangles.ColourDark = colours.GreySeafoamDarker.Darken(0.2f); triangles.ColourDark = colourProvider.Background5.Darken(0.2f);
foreground.Colour = ColourInfo.GradientVertical(colours.GreySeafoamDarker, colours.GreySeafoamDarker.Opacity(0)); foreground.Colour = ColourInfo.GradientVertical(colourProvider.Background5, colourProvider.Background5.Opacity(0));
} }
} }
} }

View File

@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
{ {
Masking = true, Masking = true,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 5, Height = 2,
Child = lineBackground = new Box Child = lineBackground = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -128,10 +128,10 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OverlayColourProvider colourProvider)
{ {
lineBackground.Colour = colours.Yellow; lineBackground.Colour = colourProvider.Highlight1;
DescriptionText.Colour = colours.GreySeafoamLighter; DescriptionText.Colour = colourProvider.Foreground1;
} }
} }
} }

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Profile.Sections namespace osu.Game.Overlays.Profile.Sections
@ -10,11 +9,11 @@ namespace osu.Game.Overlays.Profile.Sections
public class ProfileShowMoreButton : ShowMoreButton public class ProfileShowMoreButton : ShowMoreButton
{ {
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colors) private void load(OverlayColourProvider colourProvider)
{ {
IdleColour = colors.GreySeafoamDark; IdleColour = colourProvider.Background2;
HoverColour = colors.GreySeafoam; HoverColour = colourProvider.Background1;
ChevronIconColour = colors.Yellow; ChevronIconColour = colourProvider.Foreground1;
} }
} }
} }

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Profile; using osu.Game.Overlays.Profile;
@ -30,7 +29,7 @@ namespace osu.Game.Overlays
public const float CONTENT_X_MARGIN = 70; public const float CONTENT_X_MARGIN = 70;
public UserProfileOverlay() public UserProfileOverlay()
: base(OverlayColourScheme.Green) : base(OverlayColourScheme.Pink)
{ {
} }
@ -74,7 +73,7 @@ namespace osu.Game.Overlays
Add(new Box Add(new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.1f) Colour = ColourProvider.Background6
}); });
Add(sectionsContainer = new ProfileSectionsContainer Add(sectionsContainer = new ProfileSectionsContainer
@ -83,7 +82,8 @@ namespace osu.Game.Overlays
FixedHeader = tabs, FixedHeader = tabs,
HeaderBackground = new Box HeaderBackground = new Box
{ {
Colour = OsuColour.Gray(34), // this is only visible as the ProfileTabControl background
Colour = ColourProvider.Background5,
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
}, },
}); });
@ -165,9 +165,9 @@ namespace osu.Game.Overlays
}; };
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OverlayColourProvider colourProvider)
{ {
AccentColour = colours.Seafoam; AccentColour = colourProvider.Highlight1;
} }
private class ProfileTabItem : OverlayTabItem private class ProfileTabItem : OverlayTabItem

View File

@ -41,7 +41,7 @@ namespace osu.Game.Screens.Play.HUD
} }
} }
private readonly FillFlowContainer<ModIcon> iconsContainer; protected readonly FillFlowContainer<ModIcon> IconsContainer;
private readonly OsuSpriteText unrankedText; private readonly OsuSpriteText unrankedText;
public ModDisplay() public ModDisplay()
@ -50,7 +50,7 @@ namespace osu.Game.Screens.Play.HUD
Children = new Drawable[] Children = new Drawable[]
{ {
iconsContainer = new ReverseChildIDFillFlowContainer<ModIcon> IconsContainer = new ReverseChildIDFillFlowContainer<ModIcon>
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
@ -69,11 +69,11 @@ namespace osu.Game.Screens.Play.HUD
Current.ValueChanged += mods => Current.ValueChanged += mods =>
{ {
iconsContainer.Clear(); IconsContainer.Clear();
foreach (Mod mod in mods.NewValue) foreach (Mod mod in mods.NewValue)
{ {
iconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) }); IconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) });
} }
if (IsLoaded) if (IsLoaded)
@ -92,7 +92,7 @@ namespace osu.Game.Screens.Play.HUD
base.LoadComplete(); base.LoadComplete();
appearTransform(); appearTransform();
iconsContainer.FadeInFromZero(fade_duration, Easing.OutQuint); IconsContainer.FadeInFromZero(fade_duration, Easing.OutQuint);
} }
private void appearTransform() private void appearTransform()
@ -104,17 +104,17 @@ namespace osu.Game.Screens.Play.HUD
expand(); expand();
using (iconsContainer.BeginDelayedSequence(1200)) using (IconsContainer.BeginDelayedSequence(1200))
contract(); contract();
} }
private void expand() private void expand()
{ {
if (AllowExpand) if (AllowExpand)
iconsContainer.TransformSpacingTo(new Vector2(5, 0), 500, Easing.OutQuint); IconsContainer.TransformSpacingTo(new Vector2(5, 0), 500, Easing.OutQuint);
} }
private void contract() => iconsContainer.TransformSpacingTo(new Vector2(-25, 0), 500, Easing.OutQuint); private void contract() => IconsContainer.TransformSpacingTo(new Vector2(-25, 0), 500, Easing.OutQuint);
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {

View File

@ -56,6 +56,7 @@ namespace osu.Game.Screens.Select
} }
} }
protected FillFlowContainer ButtonContentContainer;
protected readonly Container TextContainer; protected readonly Container TextContainer;
protected readonly SpriteText SpriteText; protected readonly SpriteText SpriteText;
private readonly Box box; private readonly Box box;
@ -80,15 +81,36 @@ namespace osu.Game.Screens.Select
EdgeSmoothness = new Vector2(2, 0), EdgeSmoothness = new Vector2(2, 0),
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
}, },
TextContainer = new Container new Container
{ {
Size = new Vector2(100 - SHEAR_WIDTH, 50), AutoSizeAxes = Axes.Both,
Shear = -SHEAR, Children = new Drawable[]
Child = SpriteText = new OsuSpriteText
{ {
Anchor = Anchor.Centre, ButtonContentContainer = new FillFlowContainer
Origin = Anchor.Centre, {
} Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Direction = FillDirection.Horizontal,
Shear = -SHEAR,
AutoSizeAxes = Axes.X,
Height = 50,
Spacing = new Vector2(15, 0),
Children = new Drawable[]
{
TextContainer = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Child = SpriteText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
},
},
},
},
}, },
}; };
} }
@ -97,6 +119,19 @@ namespace osu.Game.Screens.Select
public Action HoverLost; public Action HoverLost;
public Key? Hotkey; public Key? Hotkey;
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();
float horizontalMargin = (100 - TextContainer.Width) / 2;
ButtonContentContainer.Padding = new MarginPadding
{
Left = horizontalMargin,
// right side margin offset to compensate for shear
Right = horizontalMargin - SHEAR_WIDTH / 2
};
}
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
Hovered?.Invoke(); Hovered?.Invoke();

View File

@ -3,7 +3,6 @@
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.HUD;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using System.Collections.Generic; using System.Collections.Generic;
@ -34,31 +33,18 @@ namespace osu.Game.Screens.Select
public FooterButtonMods() public FooterButtonMods()
{ {
Add(new FillFlowContainer ButtonContentContainer.Add(modDisplay = new FooterModDisplay
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft, Origin = Anchor.Centre,
Direction = FillDirection.Horizontal, DisplayUnrankedText = false,
Shear = -SHEAR, Scale = new Vector2(0.8f)
Children = new Drawable[] });
{ ButtonContentContainer.Add(MultiplierText = new OsuSpriteText
modDisplay = new FooterModDisplay {
{ Anchor = Anchor.Centre,
Anchor = Anchor.Centre, Origin = Anchor.Centre,
Origin = Anchor.Centre, Font = OsuFont.GetFont(weight: FontWeight.Bold),
DisplayUnrankedText = false,
Scale = new Vector2(0.8f)
},
MultiplierText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Margin = new MarginPadding { Right = 10 }
}
},
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Left = 70 }
}); });
} }
@ -92,6 +78,11 @@ namespace osu.Game.Screens.Select
MultiplierText.FadeColour(lowMultiplierColour, 200); MultiplierText.FadeColour(lowMultiplierColour, 200);
else else
MultiplierText.FadeColour(Color4.White, 200); MultiplierText.FadeColour(Color4.White, 200);
if (Current.Value?.Count > 0)
modDisplay.FadeIn();
else
modDisplay.FadeOut();
} }
private class FooterModDisplay : ModDisplay private class FooterModDisplay : ModDisplay
@ -101,6 +92,7 @@ namespace osu.Game.Screens.Select
public FooterModDisplay() public FooterModDisplay()
{ {
AllowExpand = false; AllowExpand = false;
IconsContainer.Margin = new MarginPadding();
} }
} }
} }

View File

@ -24,8 +24,11 @@ namespace osu.Game.Screens.Select
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Text = @"rewind", Text = @"rewind",
Alpha = 0 Alpha = 0,
}); });
// force both text sprites to always be present to avoid width flickering while they're being swapped out
SpriteText.AlwaysPresent = secondaryText.AlwaysPresent = true;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -24,6 +24,8 @@ namespace osu.Game.Screens.Select
[Resolved(typeof(Room))] [Resolved(typeof(Room))]
protected Bindable<PlaylistItem> CurrentItem { get; private set; } protected Bindable<PlaylistItem> CurrentItem { get; private set; }
public override bool AllowEditing => false;
[Resolved] [Resolved]
private BeatmapManager beatmaps { get; set; } private BeatmapManager beatmaps { get; set; }

View File

@ -35,6 +35,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Game.Overlays.Notifications;
using osu.Game.Scoring; using osu.Game.Scoring;
namespace osu.Game.Screens.Select namespace osu.Game.Screens.Select
@ -66,6 +67,14 @@ namespace osu.Game.Screens.Select
/// </summary> /// </summary>
protected Container FooterPanels { get; private set; } protected Container FooterPanels { get; private set; }
/// <summary>
/// Whether entering editor mode should be allowed.
/// </summary>
public virtual bool AllowEditing => true;
[Resolved(canBeNull: true)]
private NotificationOverlay notificationOverlay { get; set; }
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value); protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
protected BeatmapCarousel Carousel { get; private set; } protected BeatmapCarousel Carousel { get; private set; }
@ -277,7 +286,7 @@ namespace osu.Game.Screens.Select
// if not the current screen, we want to get carousel in a good presentation state before displaying (resume or enter). // if not the current screen, we want to get carousel in a good presentation state before displaying (resume or enter).
bool shouldDebounce = this.IsCurrentScreen(); bool shouldDebounce = this.IsCurrentScreen();
Schedule(() => Carousel.Filter(criteria, shouldDebounce)); Carousel.Filter(criteria, shouldDebounce);
} }
private DependencyContainer dependencies; private DependencyContainer dependencies;
@ -295,6 +304,12 @@ namespace osu.Game.Screens.Select
public void Edit(BeatmapInfo beatmap = null) public void Edit(BeatmapInfo beatmap = null)
{ {
if (!AllowEditing)
{
notificationOverlay?.Post(new SimpleNotification { Text = "Editing is not available from the current mode." });
return;
}
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce); Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce);
this.Push(new Editor()); this.Push(new Editor());
} }
@ -310,8 +325,10 @@ namespace osu.Game.Screens.Select
if (!Carousel.BeatmapSetsLoaded) if (!Carousel.BeatmapSetsLoaded)
return; return;
// if we have a pending filter operation, we want to run it now. transferRulesetValue();
// it could change selection (ie. if the ruleset has been changed).
// while transferRulesetValue will flush, it only does so if the ruleset changes.
// the user could have changed a filter, and we want to ensure we are 100% up-to-date and consistent here.
Carousel.FlushPendingFilterOperations(); Carousel.FlushPendingFilterOperations();
// avoid attempting to continue before a selection has been obtained. // avoid attempting to continue before a selection has been obtained.
@ -397,20 +414,10 @@ namespace osu.Game.Screens.Select
{ {
Logger.Log($"updating selection with beatmap:{beatmap?.ID.ToString() ?? "null"} ruleset:{ruleset?.ID.ToString() ?? "null"}"); Logger.Log($"updating selection with beatmap:{beatmap?.ID.ToString() ?? "null"} ruleset:{ruleset?.ID.ToString() ?? "null"}");
if (ruleset?.Equals(decoupledRuleset.Value) == false) if (transferRulesetValue())
{ {
Logger.Log($"ruleset changed from \"{decoupledRuleset.Value}\" to \"{ruleset}\""); // if the ruleset changed, the rest of the selection update will happen via updateSelectedRuleset.
Mods.Value = Array.Empty<Mod>(); Mods.Value = Array.Empty<Mod>();
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.
Carousel.Filter(null, false);
// Filtering only completes after the carousel runs Update.
// If we also have a pending beatmap change we should delay it one frame.
selectionChangedDebounce = Schedule(run);
return; return;
} }
@ -634,6 +641,7 @@ namespace osu.Game.Screens.Select
// manual binding to parent ruleset to allow for delayed load in the incoming direction. // manual binding to parent ruleset to allow for delayed load in the incoming direction.
transferRulesetValue(); transferRulesetValue();
Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue); Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue);
decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue; decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue;
@ -645,9 +653,23 @@ namespace osu.Game.Screens.Select
boundLocalBindables = true; boundLocalBindables = true;
} }
private void transferRulesetValue() /// <summary>
/// Transfer the game-wide ruleset to the local decoupled ruleset.
/// Will immediately run filter operations if required.
/// </summary>
/// <returns>Whether a transfer occurred.</returns>
private bool transferRulesetValue()
{ {
if (decoupledRuleset.Value?.Equals(Ruleset.Value) == true)
return false;
Logger.Log($"decoupled ruleset transferred (\"{decoupledRuleset.Value}\" -> \"{Ruleset.Value}\"");
rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value; rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value;
// 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();
return true;
} }
private void delete(BeatmapSetInfo beatmap) private void delete(BeatmapSetInfo beatmap)