1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 16:47:24 +08:00

Merge pull request #7724 from EVAST9919/beatmap-overlay-recolour

Update BeatmapSetOverlay to match web design
This commit is contained in:
Dan Balasescu 2020-02-04 21:18:20 +09:00 committed by GitHub
commit d627d2f74e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 69 additions and 87 deletions

View File

@ -3,11 +3,13 @@
using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Utils;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
using osu.Game.Overlays.BeatmapSet.Scores;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Scoring;
@ -27,6 +29,9 @@ namespace osu.Game.Tests.Visual.Online
typeof(ScoreTableRowBackground),
};
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
public TestSceneScoresContainer()
{
TestScoresContainer scoresContainer;

View File

@ -24,6 +24,7 @@ namespace osu.Game.Overlays.BeatmapSet
private const float spacing = 20;
private readonly Box successRateBackground;
private readonly Box background;
private readonly SuccessRate successRate;
public readonly Bindable<BeatmapSetInfo> BeatmapSet = new Bindable<BeatmapSetInfo>();
@ -50,10 +51,9 @@ namespace osu.Game.Overlays.BeatmapSet
Children = new Drawable[]
{
new Box
background = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
RelativeSizeAxes = Axes.Both
},
new Container
{
@ -126,14 +126,14 @@ namespace osu.Game.Overlays.BeatmapSet
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
successRateBackground.Colour = colours.GrayE;
successRateBackground.Colour = colourProvider.Background4;
background.Colour = colourProvider.Background5;
}
private class MetadataSection : FillFlowContainer
{
private readonly OsuSpriteText header;
private readonly TextFlowContainer textFlow;
public string Text
@ -148,7 +148,7 @@ namespace osu.Game.Overlays.BeatmapSet
this.FadeIn(transition_duration);
textFlow.Clear();
textFlow.AddText(value, s => s.Font = s.Font.With(size: 14));
textFlow.AddText(value, s => s.Font = s.Font.With(size: 12));
}
}
@ -160,11 +160,10 @@ namespace osu.Game.Overlays.BeatmapSet
InternalChildren = new Drawable[]
{
header = new OsuSpriteText
new OsuSpriteText
{
Text = title,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold),
Shadow = false,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Black),
Margin = new MarginPadding { Top = 20 },
},
textFlow = new OsuTextFlowContainer
@ -174,12 +173,6 @@ namespace osu.Game.Overlays.BeatmapSet
},
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
header.Colour = textFlow.Colour = colours.Gray5;
}
}
}
}

View File

@ -7,8 +7,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Scoring;
using osuTK;
using osuTK.Graphics;
@ -17,11 +15,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{
public class DrawableTopScore : CompositeDrawable
{
private const float fade_duration = 100;
private Color4 backgroundIdleColour;
private Color4 backgroundHoveredColour;
private readonly Box background;
public DrawableTopScore(ScoreInfo score, int position = 1)
@ -30,7 +23,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
AutoSizeAxes = Axes.Y;
Masking = true;
CornerRadius = 10;
CornerRadius = 5;
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow,
@ -84,24 +77,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
backgroundIdleColour = colours.Gray3;
backgroundHoveredColour = colours.Gray4;
background.Colour = backgroundIdleColour;
}
protected override bool OnHover(HoverEvent e)
{
background.FadeColour(backgroundHoveredColour, fade_duration, Easing.OutQuint);
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
background.FadeColour(backgroundIdleColour, fade_duration, Easing.OutQuint);
base.OnHoverLost(e);
background.Colour = colourProvider.Background4;
}
private class AutoSizingGrid : GridContainer

View File

@ -23,7 +23,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{
private const float horizontal_inset = 20;
private const float row_height = 25;
private const int text_size = 14;
private const int text_size = 12;
private readonly FillFlowContainer backgroundFlow;
@ -190,7 +190,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
public HeaderText(string text)
{
Text = text.ToUpper();
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Black);
Font = OsuFont.GetFont(size: 10, weight: FontWeight.Bold);
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
Colour = colourProvider.Foreground1;
}
}
}

View File

@ -48,18 +48,18 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, IAPIProvider api)
private void load(OsuColour colours, OverlayColourProvider colourProvider, IAPIProvider api)
{
var isOwnScore = api.LocalUser.Value.Id == score.UserID;
if (isOwnScore)
background.Colour = colours.GreenDarker;
else if (index % 2 == 0)
background.Colour = colours.Gray3;
background.Colour = colourProvider.Background4;
else
background.Alpha = 0;
hoveredBackground.Colour = isOwnScore ? colours.GreenDark : colours.Gray4;
hoveredBackground.Colour = isOwnScore ? colours.GreenDark : colourProvider.Background3;
}
protected override bool OnHover(HoverEvent e)

View File

@ -5,7 +5,6 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osuTK;
using System.Linq;
@ -179,9 +178,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
background.Colour = colours.Gray2;
background.Colour = colourProvider.Background5;
user.BindTo(api.LocalUser);
}

View File

@ -24,8 +24,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{
private const float margin = 10;
private readonly FontUsage smallFont = OsuFont.GetFont(size: 20);
private readonly FontUsage largeFont = OsuFont.GetFont(size: 25);
private readonly FontUsage smallFont = OsuFont.GetFont(size: 16);
private readonly FontUsage largeFont = OsuFont.GetFont(size: 22);
private readonly TextColumn totalScoreColumn;
private readonly TextColumn accuracyColumn;
@ -109,6 +109,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private class InfoColumn : CompositeDrawable
{
private readonly Box separator;
private readonly OsuSpriteText text;
public InfoColumn(string title, Drawable content)
{
@ -121,15 +122,15 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Spacing = new Vector2(0, 2),
Children = new[]
{
new OsuSpriteText
text = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Black),
Font = OsuFont.GetFont(size: 10, weight: FontWeight.Black),
Text = title.ToUpper()
},
separator = new Box
{
RelativeSizeAxes = Axes.X,
Height = 2
Height = 1
},
content
}
@ -137,9 +138,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
separator.Colour = colours.Gray5;
separator.Colour = text.Colour = colourProvider.Foreground1;
}
}
@ -189,15 +190,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
set
{
modsContainer.Clear();
foreach (Mod mod in value)
modsContainer.Children = value.Select(mod => new ModIcon(mod)
{
modsContainer.Add(new ModIcon(mod)
{
AutoSizeAxes = Axes.Both,
Scale = new Vector2(0.3f),
});
}
AutoSizeAxes = Axes.Both,
Scale = new Vector2(0.25f),
}).ToList();
}
}
}

View File

@ -1,7 +1,6 @@
// 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.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -51,13 +50,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 24, weight: FontWeight.Bold, italics: true)
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold)
},
rank = new UpdateableRank(ScoreRank.D)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(40),
Size = new Vector2(28),
FillMode = FillMode.Fit,
},
}
@ -66,7 +65,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(80),
Size = new Vector2(70),
Masking = true,
CornerRadius = 5,
EdgeEffect = new EdgeEffectParameters
@ -87,7 +86,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Spacing = new Vector2(0, 3),
Children = new Drawable[]
{
usernameText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold, italics: true))
usernameText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true))
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
@ -97,13 +96,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold)
Font = OsuFont.GetFont(size: 10, weight: FontWeight.Bold)
},
flag = new UpdateableFlag
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Size = new Vector2(20, 13),
Size = new Vector2(19, 13),
ShowPlaceholderOnNull = false,
},
}
@ -112,12 +111,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
rankText.Colour = colours.Yellow;
}
public int ScorePosition
{
set => rankText.Text = $"#{value}";

View File

@ -17,7 +17,7 @@ namespace osu.Game.Overlays.BeatmapSet
protected readonly FailRetryGraph Graph;
private readonly FillFlowContainer header;
private readonly OsuSpriteText successRateLabel, successPercent, graphLabel;
private readonly OsuSpriteText successPercent;
private readonly Bar successRate;
private readonly Container percentContainer;
@ -60,7 +60,7 @@ namespace osu.Game.Overlays.BeatmapSet
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
successRateLabel = new OsuSpriteText
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
@ -85,7 +85,7 @@ namespace osu.Game.Overlays.BeatmapSet
Font = OsuFont.GetFont(size: 13),
},
},
graphLabel = new OsuSpriteText
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
@ -107,7 +107,6 @@ namespace osu.Game.Overlays.BeatmapSet
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
successRateLabel.Colour = successPercent.Colour = graphLabel.Colour = colours.Gray5;
successRate.AccentColour = colours.Green;
successRate.BackgroundColour = colours.GrayD;

View File

@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.BeatmapSet;
@ -33,6 +32,8 @@ namespace osu.Game.Overlays
// receive input outside our bounds so we can trigger a close event on ourselves.
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
private readonly Box background;
public BeatmapSetOverlay()
: base(OverlayColourScheme.Blue)
{
@ -41,10 +42,9 @@ namespace osu.Game.Overlays
Children = new Drawable[]
{
new Box
background = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.2f)
RelativeSizeAxes = Axes.Both
},
scroll = new OsuScrollContainer
{
@ -55,10 +55,20 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 20),
Children = new Drawable[]
{
Header = new Header(),
info = new Info(),
new ReverseChildIDFillFlowContainer<Drawable>
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
Header = new Header(),
info = new Info()
}
},
new ScoresContainer
{
Beatmap = { BindTarget = Header.Picker.Beatmap }
@ -83,6 +93,8 @@ namespace osu.Game.Overlays
private void load(RulesetStore rulesets)
{
this.rulesets = rulesets;
background.Colour = ColourProvider.Background6;
}
protected override void PopOutComplete()