1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 17:02:55 +08:00

Merge branch 'master' into fix-import-different-ruleset

This commit is contained in:
Dan Balasescu 2020-01-30 15:08:25 +09:00 committed by GitHub
commit 09f6c57b0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 683 additions and 314 deletions

View File

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

View File

@ -4,10 +4,12 @@
using System;
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays;
using osu.Game.Overlays.Profile.Sections;
using osu.Game.Overlays.Profile.Sections.Historical;
using osu.Game.Users;
@ -27,6 +29,9 @@ namespace osu.Game.Tests.Visual.Online
typeof(DrawableProfileRow)
};
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink);
public TestSceneHistoricalSection()
{
HistoricalSection section;

View File

@ -0,0 +1,101 @@
// 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.Game.Overlays.Profile.Sections;
using osu.Game.Overlays.Profile.Sections.Ranks;
using osu.Framework.Graphics;
using osu.Game.Scoring;
using osu.Framework.Graphics.Containers;
using osuTK;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Overlays;
using osu.Framework.Allocation;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneUserProfileScores : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DrawableProfileScore),
typeof(DrawableProfileWeightedScore),
typeof(ProfileItemContainer),
};
public TestSceneUserProfileScores()
{
var score = new ScoreInfo
{
PP = 134.32,
Rank = ScoreRank.A,
Beatmap = new BeatmapInfo
{
Metadata = new BeatmapMetadata
{
Title = "Triumph & Regret",
Artist = "typeMARS"
},
Version = "[4K] Regret"
},
Date = DateTimeOffset.Now,
Mods = new Mod[]
{
new OsuModHardRock(),
new OsuModDoubleTime(),
},
Accuracy = 0.998546
};
var noPPScore = new ScoreInfo
{
Rank = ScoreRank.B,
Beatmap = new BeatmapInfo
{
Metadata = new BeatmapMetadata
{
Title = "C18H27NO3(extend)",
Artist = "Team Grimoire"
},
Version = "[4K] Cataclysmic Hypernova"
},
Date = DateTimeOffset.Now,
Accuracy = 0.55879
};
Add(new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10),
Children = new[]
{
new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(score)),
new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileScore(noPPScore)),
new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(score, 0.85))
}
});
}
private class ColourProvidedContainer : Container
{
[Cached]
private readonly OverlayColourProvider colourProvider;
public ColourProvidedContainer(OverlayColourScheme colourScheme, DrawableProfileScore score)
{
colourProvider = new OverlayColourProvider(colourScheme);
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
Add(score);
}
}
}
}

View File

@ -4,11 +4,13 @@
using System;
using System.Collections.Generic;
using NUnit.Framework;
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.Containers;
using osu.Game.Overlays;
using osu.Game.Overlays.Profile.Sections;
using osu.Game.Overlays.Profile.Sections.Ranks;
using osu.Game.Users;
@ -20,7 +22,15 @@ namespace osu.Game.Tests.Visual.Online
{
protected override bool UseOnlineAPI => true;
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(DrawableProfileScore), typeof(RanksSection) };
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DrawableProfileScore),
typeof(DrawableProfileWeightedScore),
typeof(RanksSection)
};
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
public TestSceneUserRanks()
{

View File

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

View File

@ -29,9 +29,9 @@ namespace osu.Game.Graphics
}
}
public DrawableDate(DateTimeOffset date)
public DrawableDate(DateTimeOffset date, float textSize = OsuFont.DEFAULT_FONT_SIZE)
{
Font = OsuFont.GetFont(weight: FontWeight.Regular, italics: true);
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: textSize, italics: true);
Date = date;
}

View File

@ -177,7 +177,7 @@ namespace osu.Game.Graphics.UserInterface
if (DisplayAsPercentage)
{
TooltipText = floatValue.ToString("P0");
TooltipText = floatValue.ToString("0%");
}
else
{

View File

@ -277,7 +277,7 @@ namespace osu.Game.Online.Leaderboards
protected virtual IEnumerable<LeaderboardScoreStatistic> GetStatistics(ScoreInfo model) => new[]
{
new LeaderboardScoreStatistic(FontAwesome.Solid.Link, "Max Combo", model.MaxCombo.ToString()),
new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, "Accuracy", string.Format(model.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", model.Accuracy))
new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, "Accuracy", string.Format(model.Accuracy % 1 == 0 ? @"{0:0%}" : @"{0:0.00%}", model.Accuracy))
};
protected override bool OnHover(HoverEvent e)

View File

@ -42,7 +42,7 @@ namespace osu.Game.Overlays.BeatmapSet
int playCount = beatmap?.OnlineInfo?.PlayCount ?? 0;
var rate = playCount != 0 ? (float)passCount / playCount : 0;
successPercent.Text = rate.ToString("P0");
successPercent.Text = rate.ToString("0%");
successRate.Length = rate;
percentContainer.ResizeWidthTo(successRate.Length, 250, Easing.InOutCubic);

View File

@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Comments
private int currentPage;
private FillFlowContainer content;
private DeletedChildrenPlaceholder deletedChildrenPlaceholder;
private DeletedCommentsCounter deletedCommentsCounter;
private CommentsShowMoreButton moreButton;
private TotalCommentsCounter commentCounter;
@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Comments
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
deletedChildrenPlaceholder = new DeletedChildrenPlaceholder
deletedCommentsCounter = new DeletedCommentsCounter
{
ShowDeleted = { BindTarget = ShowDeleted }
},
@ -153,7 +153,7 @@ namespace osu.Game.Overlays.Comments
private void clearComments()
{
currentPage = 1;
deletedChildrenPlaceholder.DeletedCount.Value = 0;
deletedCommentsCounter.Count.Value = 0;
moreButton.IsLoading = true;
content.Clear();
}
@ -184,7 +184,7 @@ namespace osu.Game.Overlays.Comments
{
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)
{

View File

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

View File

@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Comments
{
LinkFlowContainer username;
FillFlowContainer childCommentsContainer;
DeletedChildrenPlaceholder deletedChildrenPlaceholder;
DeletedCommentsCounter deletedCommentsCounter;
FillFlowContainer info;
LinkFlowContainer message;
GridContainer content;
@ -184,7 +184,7 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical
},
deletedChildrenPlaceholder = new DeletedChildrenPlaceholder
deletedCommentsCounter = new DeletedCommentsCounter
{
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)
username.AddUserLink(comment.User);

View File

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

View File

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

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Textures;
using osu.Game.Graphics;
using osu.Game.Overlays.Profile.Header.Components;
using osu.Game.Users;
using osuTK;
@ -28,7 +27,7 @@ namespace osu.Game.Overlays.Profile.Header
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, TextureStore textures)
private void load(OverlayColourProvider colourProvider, TextureStore textures)
{
Container<Drawable> hiddenDetailContainer;
Container<Drawable> expandedDetailContainer;
@ -38,7 +37,7 @@ namespace osu.Game.Overlays.Profile.Header
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colours.GreySeafoam
Colour = colourProvider.Background4
},
new FillFlowContainer
{
@ -119,12 +118,12 @@ namespace osu.Game.Overlays.Profile.Header
hiddenDetailGlobal = new OverlinedInfoContainer
{
Title = "Global Ranking",
LineColour = colours.Yellow
LineColour = colourProvider.Highlight1
},
hiddenDetailCountry = new OverlinedInfoContainer
{
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.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osuTK;
namespace osu.Game.Overlays.Profile.Header.Components
@ -25,10 +24,10 @@ namespace osu.Game.Overlays.Profile.Header.Components
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
IdleColour = colours.GreySeafoamLight;
HoverColour = colours.GreySeafoamLight.Darken(0.2f);
IdleColour = colourProvider.Background2;
HoverColour = colourProvider.Background2.Lighten(0.2f);
Child = icon = new SpriteIcon
{

View File

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

View File

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

View File

@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Profile.Header
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider, OsuColour colours)
{
AutoSizeAxes = Axes.Y;
@ -65,7 +65,7 @@ namespace osu.Game.Overlays.Profile.Header
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colours.GreySeafoamDarker,
Colour = colourProvider.Background5,
},
fillFlow = new FillFlowContainer
{
@ -152,12 +152,12 @@ namespace osu.Game.Overlays.Profile.Header
detailGlobalRank = new OverlinedInfoContainer(true, 110)
{
Title = "Global Ranking",
LineColour = colours.Yellow,
LineColour = colourProvider.Highlight1,
},
detailCountryRank = new OverlinedInfoContainer(false, 110)
{
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.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Overlays.Profile.Header.Components;
using osu.Game.Users;
using osuTK;
@ -23,7 +22,7 @@ namespace osu.Game.Overlays.Profile.Header
public readonly Bindable<User> User = new Bindable<User>();
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
Alpha = 0;
AutoSizeAxes = Axes.Y;
@ -34,7 +33,7 @@ namespace osu.Game.Overlays.Profile.Header
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colours.GreySeafoamDarker,
Colour = colourProvider.Background5,
},
new Container //artificial shadow
{

View File

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

View File

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

View File

@ -4,7 +4,6 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
@ -13,32 +12,25 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK;
using System.Collections.Generic;
using osu.Framework.Graphics.Cursor;
namespace osu.Game.Overlays.Profile.Sections.Historical
{
public class DrawableMostPlayedBeatmap : OsuHoverContainer
public class DrawableMostPlayedBeatmap : CompositeDrawable
{
private const int cover_width = 100;
private const int corner_radius = 6;
private const int height = 50;
private readonly BeatmapInfo beatmap;
private readonly int playCount;
private Box background;
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
public DrawableMostPlayedBeatmap(BeatmapInfo beatmap, int playCount)
{
this.beatmap = beatmap;
this.playCount = playCount;
Enabled.Value = true; //manually enabled, because we have no action
RelativeSizeAxes = Axes.X;
Height = height;
Height = 50;
Masking = true;
CornerRadius = corner_radius;
@ -47,10 +39,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
IdleColour = colours.GreySeafoam;
HoverColour = colours.GreySeafoamLight;
Children = new Drawable[]
AddRangeInternal(new Drawable[]
{
new UpdateableBeatmapSetCover
{
@ -72,46 +61,48 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
CornerRadius = corner_radius,
Children = new Drawable[]
{
background = new Box { RelativeSizeAxes = Axes.Both },
new Container
new ProfileItemContainer
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(10),
Children = new Drawable[]
Child = new Container
{
new FillFlowContainer
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(10),
Children = new Drawable[]
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
new FillFlowContainer
{
new MostPlayedBeatmapMetadataContainer(beatmap),
new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular))
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Colour = colours.GreySeafoamLighter
}.With(d =>
{
d.AddText("mapped by ");
d.AddUserLink(beatmap.Metadata.Author);
}),
}
},
new PlayCountText(playCount)
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight
},
}
},
new MostPlayedBeatmapMetadataContainer(beatmap),
new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular))
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Colour = colours.GreySeafoamLighter
}.With(d =>
{
d.AddText("mapped by ");
d.AddUserLink(beatmap.Metadata.Author);
}),
}
},
new PlayCountText(playCount)
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight
},
}
},
}
}
}
}
}
};
});
}
private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer

View File

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

View File

@ -0,0 +1,63 @@
// 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.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osuTK.Graphics;
namespace osu.Game.Overlays.Profile.Sections
{
public class ProfileItemContainer : Container
{
private const int hover_duration = 200;
protected override Container<Drawable> Content => content;
private Color4 idleColour;
private Color4 hoverColour;
private readonly Box background;
private readonly Container content;
public ProfileItemContainer()
{
RelativeSizeAxes = Axes.Both;
Masking = true;
CornerRadius = 6;
AddRangeInternal(new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
},
content = new Container
{
RelativeSizeAxes = Axes.Both,
}
});
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
background.Colour = idleColour = colourProvider.Background4;
hoverColour = colourProvider.Background3;
}
protected override bool OnHover(HoverEvent e)
{
background.FadeColour(hoverColour, hover_duration, Easing.OutQuint);
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
background.FadeColour(idleColour, hover_duration, Easing.OutQuint);
}
}
}

View File

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

View File

@ -1,47 +0,0 @@
// 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.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Scoring;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public class DrawablePerformanceScore : DrawableProfileScore
{
private readonly double? weight;
public DrawablePerformanceScore(ScoreInfo score, double? weight = null)
: base(score)
{
this.weight = weight;
}
[BackgroundDependencyLoader]
private void load(OsuColour colour)
{
double pp = Score.PP ?? 0;
RightFlowContainer.Add(new OsuSpriteText
{
Text = $"{pp:0}pp",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
});
if (weight.HasValue)
{
RightFlowContainer.Add(new OsuSpriteText
{
Text = $"weighted: {pp * weight:0}pp ({weight:P0})",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Colour = colour.GrayA,
Font = OsuFont.GetFont(size: 11, weight: FontWeight.Regular, italics: true)
});
}
}
}
}

View File

@ -1,76 +1,225 @@
// 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 System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Leaderboards;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Beatmaps;
using osu.Framework.Localisation;
using osu.Framework.Graphics.Containers;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public abstract class DrawableProfileScore : DrawableProfileRow
public class DrawableProfileScore : CompositeDrawable
{
private readonly FillFlowContainer modsContainer;
private const int performance_width = 80;
private const int content_padding = 10;
protected readonly ScoreInfo Score;
protected DrawableProfileScore(ScoreInfo score)
[Resolved]
private OsuColour colours { get; set; }
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
public DrawableProfileScore(ScoreInfo score)
{
Score = score;
RelativeSizeAxes = Axes.X;
Height = 60;
Children = new Drawable[]
Height = 40;
}
[BackgroundDependencyLoader]
private void load()
{
AddInternal(new ProfileItemContainer
{
modsContainer = new FillFlowContainer
Children = new Drawable[]
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Spacing = new Vector2(1),
Margin = new MarginPadding { Right = 160 }
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = content_padding, Right = performance_width + content_padding },
Children = new Drawable[]
{
new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(8, 0),
Children = new Drawable[]
{
new UpdateableRank(Score.Rank)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Size = new Vector2(50, 20),
},
new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 2),
Children = new Drawable[]
{
new ScoreBeatmapMetadataContainer(Score.Beatmap),
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{
new OsuSpriteText
{
Text = $"{Score.Beatmap.Version}",
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
Colour = colours.Yellow
},
new DrawableDate(Score.Date, 12)
{
Colour = colourProvider.Foreground1
}
}
}
}
}
}
},
new FillFlowContainer
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(15),
Children = new[]
{
CreateRightContent().With(c =>
{
c.Anchor = Anchor.CentreRight;
c.Origin = Anchor.CentreRight;
}),
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(2),
Children = Score.Mods.Select(mod => new ModIcon(mod)
{
Scale = new Vector2(0.35f)
}).ToList(),
}
}
}
}
},
new Container
{
RelativeSizeAxes = Axes.Y,
Width = performance_width,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Children = new[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(1, 0.5f),
Colour = Color4.Black.Opacity(0.5f),
Shear = new Vector2(-0.45f, 0),
EdgeSmoothness = new Vector2(2, 0),
},
new Box
{
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Y,
Size = new Vector2(1, -0.5f),
Position = new Vector2(0, 1),
Colour = Color4.Black.Opacity(0.5f),
Shear = new Vector2(0.45f, 0),
EdgeSmoothness = new Vector2(2, 0),
},
createDrawablePerformance().With(d =>
{
d.Anchor = Anchor.Centre;
d.Origin = Anchor.Centre;
})
}
}
}
};
});
}
[BackgroundDependencyLoader(true)]
private void load(OsuColour colour)
[NotNull]
protected virtual Drawable CreateRightContent() => CreateDrawableAccuracy();
protected OsuSpriteText CreateDrawableAccuracy() => new OsuSpriteText
{
var text = new OsuSpriteText
{
Text = $"accuracy: {Score.Accuracy:P2}",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Colour = colour.GrayA,
Font = OsuFont.GetFont(size: 11, weight: FontWeight.Regular, italics: true)
};
RightFlowContainer.Insert(1, text);
LeftFlowContainer.Add(new ProfileScoreBeatmapMetadataContainer(Score.Beatmap));
LeftFlowContainer.Add(new DrawableDate(Score.Date));
foreach (Mod mod in Score.Mods)
modsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.5f) });
}
protected override Drawable CreateLeftVisual() => new UpdateableRank(Score.Rank)
{
RelativeSizeAxes = Axes.Y,
Width = 60,
FillMode = FillMode.Fit,
Text = $"{Score.Accuracy:0.00%}",
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
Colour = colours.Yellow,
};
private class ProfileScoreBeatmapMetadataContainer : BeatmapMetadataContainer
private Drawable createDrawablePerformance()
{
public ProfileScoreBeatmapMetadataContainer(BeatmapInfo beatmap)
if (Score.PP.HasValue)
{
return new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Children = new[]
{
new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Text = $"{Score.PP:0}",
Colour = colourProvider.Highlight1
},
new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
Text = "pp",
Colour = colourProvider.Light3
}
}
};
}
return new OsuSpriteText
{
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Text = "-",
Colour = colourProvider.Highlight1
};
}
private class ScoreBeatmapMetadataContainer : BeatmapMetadataContainer
{
public ScoreBeatmapMetadataContainer(BeatmapInfo beatmap)
: base(beatmap)
{
}
@ -79,16 +228,19 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{
new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Text = new LocalisedString((
$"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ",
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")),
Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold, italics: true)
$"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} ",
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} ")),
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold, italics: true)
},
new OsuSpriteText
{
Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
Padding = new MarginPadding { Top = 3 },
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular, italics: true)
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Text = "by " + new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
Font = OsuFont.GetFont(size: 12, italics: true)
},
};
}

View File

@ -0,0 +1,55 @@
// 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Scoring;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public class DrawableProfileWeightedScore : DrawableProfileScore
{
private readonly double weight;
public DrawableProfileWeightedScore(ScoreInfo score, double weight)
: base(score)
{
this.weight = weight;
}
protected override Drawable CreateRightContent() => new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Children = new Drawable[]
{
new Container
{
AutoSizeAxes = Axes.Y,
Width = 60,
Child = CreateDrawableAccuracy()
},
new OsuSpriteText
{
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
Text = $"{Score.PP * weight:0}pp",
},
}
},
new OsuSpriteText
{
Font = OsuFont.GetFont(size: 12),
Text = $@"weighted {weight:0%}"
}
}
};
}
}

View File

@ -1,31 +0,0 @@
// 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.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Scoring;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public class DrawableTotalScore : DrawableProfileScore
{
public DrawableTotalScore(ScoreInfo score)
: base(score)
{
}
[BackgroundDependencyLoader]
private void load()
{
RightFlowContainer.Add(new OsuSpriteText
{
Text = Score.TotalScore.ToString("#,###"),
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
});
}
}
}

View File

@ -15,14 +15,12 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public class PaginatedScoreContainer : PaginatedContainer<APILegacyScoreInfo>
{
private readonly bool includeWeight;
private readonly ScoreType type;
public PaginatedScoreContainer(ScoreType type, Bindable<User> user, string header, string missing, bool includeWeight = false)
public PaginatedScoreContainer(ScoreType type, Bindable<User> user, string header, string missing)
: base(user, header, missing)
{
this.type = type;
this.includeWeight = includeWeight;
ItemsPerPage = 5;
@ -43,10 +41,10 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
switch (type)
{
default:
return new DrawablePerformanceScore(model.CreateScoreInfo(Rulesets), includeWeight ? Math.Pow(0.95, ItemsContainer.Count) : (double?)null);
return new DrawableProfileScore(model.CreateScoreInfo(Rulesets));
case ScoreType.Recent:
return new DrawableTotalScore(model.CreateScoreInfo(Rulesets));
case ScoreType.Best:
return new DrawableProfileWeightedScore(model.CreateScoreInfo(Rulesets), Math.Pow(0.95, ItemsContainer.Count));
}
}
}

View File

@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Profile.Sections
{
Children = new[]
{
new PaginatedScoreContainer(ScoreType.Best, User, "Best Performance", "No performance records. :(", true),
new PaginatedScoreContainer(ScoreType.Best, User, "Best Performance", "No performance records. :("),
new PaginatedScoreContainer(ScoreType.Firsts, User, "First Place Ranks", "No awesome performance records yet. :("),
};
}

View File

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

View File

@ -20,6 +20,9 @@ namespace osu.Game.Rulesets.Mods
/// </summary>
private const double final_rate_progress = 0.75f;
[SettingSource("Initial rate", "The starting speed of the track")]
public abstract BindableNumber<double> InitialRate { get; }
[SettingSource("Final rate", "The final speed to ramp to")]
public abstract BindableNumber<double> FinalRate { get; }
@ -69,6 +72,6 @@ namespace osu.Game.Rulesets.Mods
/// </summary>
/// <param name="amount">The amount of adjustment to apply (from 0..1).</param>
private void applyAdjustment(double amount) =>
SpeedChange.Value = 1 + (FinalRate.Value - 1) * Math.Clamp(amount, 0, 1);
SpeedChange.Value = InitialRate.Value + (FinalRate.Value - InitialRate.Value) * Math.Clamp(amount, 0, 1);
}
}

View File

@ -17,6 +17,16 @@ namespace osu.Game.Rulesets.Mods
public override IconUsage? Icon => FontAwesome.Solid.ChevronCircleDown;
public override double ScoreMultiplier => 1.0;
[SettingSource("Initial rate", "The starting speed of the track")]
public override BindableNumber<double> InitialRate { get; } = new BindableDouble
{
MinValue = 1,
MaxValue = 2,
Default = 1,
Value = 1,
Precision = 0.01,
};
[SettingSource("Final rate", "The speed increase to ramp towards")]
public override BindableNumber<double> FinalRate { get; } = new BindableDouble
{

View File

@ -17,6 +17,16 @@ namespace osu.Game.Rulesets.Mods
public override IconUsage? Icon => FontAwesome.Solid.ChevronCircleUp;
public override double ScoreMultiplier => 1.0;
[SettingSource("Initial rate", "The starting speed of the track")]
public override BindableNumber<double> InitialRate { get; } = new BindableDouble
{
MinValue = 0.5,
MaxValue = 1,
Default = 1,
Value = 1,
Precision = 0.01,
};
[SettingSource("Final rate", "The speed increase to ramp towards")]
public override BindableNumber<double> FinalRate { get; } = new BindableDouble
{

View File

@ -28,7 +28,7 @@ namespace osu.Game.Screens.Multi.Match.Components
protected override IEnumerable<LeaderboardScoreStatistic> GetStatistics(ScoreInfo model) => new[]
{
new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, "Accuracy", string.Format(model.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", model.Accuracy)),
new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, "Accuracy", string.Format(model.Accuracy % 1 == 0 ? @"{0:0%}" : @"{0:0.00%}", model.Accuracy)),
new LeaderboardScoreStatistic(FontAwesome.Solid.Sync, "Total Attempts", score.TotalAttempts.ToString()),
new LeaderboardScoreStatistic(FontAwesome.Solid.Check, "Completed Beatmaps", score.CompletedBeatmaps.ToString()),
};

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;
public ModDisplay()
@ -50,7 +50,7 @@ namespace osu.Game.Screens.Play.HUD
Children = new Drawable[]
{
iconsContainer = new ReverseChildIDFillFlowContainer<ModIcon>
IconsContainer = new ReverseChildIDFillFlowContainer<ModIcon>
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
@ -69,11 +69,11 @@ namespace osu.Game.Screens.Play.HUD
Current.ValueChanged += mods =>
{
iconsContainer.Clear();
IconsContainer.Clear();
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)
@ -92,7 +92,7 @@ namespace osu.Game.Screens.Play.HUD
base.LoadComplete();
appearTransform();
iconsContainer.FadeInFromZero(fade_duration, Easing.OutQuint);
IconsContainer.FadeInFromZero(fade_duration, Easing.OutQuint);
}
private void appearTransform()
@ -104,17 +104,17 @@ namespace osu.Game.Screens.Play.HUD
expand();
using (iconsContainer.BeginDelayedSequence(1200))
using (IconsContainer.BeginDelayedSequence(1200))
contract();
}
private void expand()
{
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)
{

View File

@ -56,6 +56,7 @@ namespace osu.Game.Screens.Select
}
}
protected FillFlowContainer ButtonContentContainer;
protected readonly Container TextContainer;
protected readonly SpriteText SpriteText;
private readonly Box box;
@ -80,15 +81,36 @@ namespace osu.Game.Screens.Select
EdgeSmoothness = new Vector2(2, 0),
RelativeSizeAxes = Axes.X,
},
TextContainer = new Container
new Container
{
Size = new Vector2(100 - SHEAR_WIDTH, 50),
Shear = -SHEAR,
Child = SpriteText = new OsuSpriteText
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
ButtonContentContainer = new FillFlowContainer
{
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 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)
{
Hovered?.Invoke();

View File

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

View File

@ -24,8 +24,11 @@ namespace osu.Game.Screens.Select
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
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]

View File

@ -32,7 +32,7 @@ namespace osu.Game.Screens.Select
BeatmapInfo beatmap = beatmapManager.QueryBeatmap(b => b.ID == score.BeatmapInfoID);
Debug.Assert(beatmap != null);
string accuracy = string.Format(score.Accuracy == 1 ? "{0:P0}" : "{0:P2}", score.Accuracy);
string accuracy = string.Format(score.Accuracy == 1 ? "{0:0%}" : "{0:0.00%}", score.Accuracy);
BodyText = $"{score.User} ({accuracy}, {score.Rank})";
Icon = FontAwesome.Regular.TrashAlt;

View File

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

View File

@ -35,6 +35,7 @@ using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Game.Overlays.Notifications;
using osu.Game.Scoring;
namespace osu.Game.Screens.Select
@ -66,6 +67,14 @@ namespace osu.Game.Screens.Select
/// </summary>
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 BeatmapCarousel Carousel { get; private set; }
@ -295,6 +304,12 @@ namespace osu.Game.Screens.Select
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);
this.Push(new Editor());
}