1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Merge branch 'master' into results-middle-content

This commit is contained in:
Dean Herbert 2020-03-17 21:37:23 +09:00
commit b27bb4aeae
13 changed files with 228 additions and 26 deletions

View File

@ -52,6 +52,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.314.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.317.0" />
</ItemGroup>
</Project>

View File

@ -417,7 +417,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[Test]
public async Task TestImportWithDuplicateHashes()
{
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportNestedStructure)))
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportWithDuplicateHashes)))
{
try
{

View File

@ -0,0 +1,35 @@
// 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.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Screens.Ranking.Expanded;
using osu.Game.Users;
using osuTK;
namespace osu.Game.Tests.Visual.Ranking
{
public class TestSceneExpandedPanelTopContent : OsuTestScene
{
public TestSceneExpandedPanelTopContent()
{
Child = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(500, 200),
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4Extensions.FromHex("#444"),
},
new ExpandedPanelTopContent(new User { Id = 2, Username = "peppy" }),
}
};
}
}
}

View File

@ -0,0 +1,40 @@
// 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.Framework.Graphics;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Tests.Components
{
public class TestSceneRoundDisplay : TournamentTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DrawableTournamentHeaderText),
typeof(DrawableTournamentHeaderLogo),
};
public TestSceneRoundDisplay()
{
Children = new Drawable[]
{
new RoundDisplay(new TournamentMatch
{
Round =
{
Value = new TournamentRound
{
Name = { Value = "Test Round" }
}
}
})
{
Margin = new MarginPadding(20)
}
};
}
}
}

View File

@ -11,9 +11,13 @@ namespace osu.Game.Tournament.Components
{
public class DrawableTournamentHeaderText : CompositeDrawable
{
public DrawableTournamentHeaderText()
public DrawableTournamentHeaderText(bool center = true)
{
InternalChild = new TextSprite();
InternalChild = new TextSprite
{
Anchor = center ? Anchor.Centre : Anchor.TopLeft,
Origin = center ? Anchor.Centre : Anchor.TopLeft,
};
Height = 22;
RelativeSizeAxes = Axes.X;
@ -27,9 +31,6 @@ namespace osu.Game.Tournament.Components
RelativeSizeAxes = Axes.Both;
FillMode = FillMode.Fit;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Texture = textures.Get("header-text");
}
}

View File

@ -12,19 +12,27 @@ namespace osu.Game.Tournament.Components
{
public RoundDisplay(TournamentMatch match)
{
AutoSizeAxes = Axes.Both;
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
InternalChildren = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new DrawableTournamentHeaderText(),
new DrawableTournamentHeaderText(false)
{
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
},
new TournamentSpriteText
{
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Text = match.Round.Value?.Name.Value ?? "Unknown Round",
Font = OsuFont.Torus.With(size: 26, weight: FontWeight.SemiBold)
},

View File

@ -35,7 +35,9 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
private void load(LadderInfo ladder)
{
currentMatch.BindTo(ladder.CurrentMatch);
currentMatch.BindValueChanged(matchChanged, true);
currentMatch.BindValueChanged(matchChanged);
updateMatch();
}
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
@ -43,10 +45,19 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
currentTeamScore.UnbindBindings();
currentTeam.UnbindBindings();
if (match.NewValue != null)
Scheduler.AddOnce(updateMatch);
}
private void updateMatch()
{
var match = currentMatch.Value;
if (match != null)
{
currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1Score : match.NewValue.Team2Score);
currentTeam.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1 : match.NewValue.Team2);
match.StartMatch();
currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.Team1Score : match.Team2Score);
currentTeam.BindTo(teamColour == TeamColour.Red ? match.Team1 : match.Team2);
}
// team may change to same team, which means score is not in a good state.

View File

@ -401,14 +401,18 @@ namespace osu.Game.Screens.Play
protected virtual ScoreInfo CreateScore()
{
var score = DrawableRuleset.ReplayScore?.ScoreInfo ?? new ScoreInfo
var score = new ScoreInfo
{
Beatmap = Beatmap.Value.BeatmapInfo,
Ruleset = rulesetInfo,
Mods = Mods.Value.ToArray(),
User = api.LocalUser.Value,
};
if (DrawableRuleset.ReplayScore != null)
score.User = DrawableRuleset.ReplayScore.ScoreInfo?.User ?? new GuestUser();
else
score.User = api.LocalUser.Value;
ScoreProcessor.PopulateScore(score);
return score;

View File

@ -222,7 +222,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
if (badge.Accuracy > score.Accuracy)
continue;
using (BeginDelayedSequence(inverseEasing(ACCURACY_TRANSFORM_EASING, badge.Accuracy / targetAccuracy) * ACCURACY_TRANSFORM_DURATION, true))
using (BeginDelayedSequence(inverseEasing(ACCURACY_TRANSFORM_EASING, Math.Min(1 - virtual_ss_percentage, badge.Accuracy) / targetAccuracy) * ACCURACY_TRANSFORM_DURATION, true))
badge.Appear();
}

View File

@ -4,11 +4,13 @@
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.Sprites;
using osu.Game.Online.Leaderboards;
using osu.Game.Scoring;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Ranking.Expanded.Accuracy
{
@ -19,7 +21,9 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
{
private readonly ScoreRank rank;
private Drawable flash;
private BufferedContainer flash;
private BufferedContainer superFlash;
private GlowingSpriteText rankText;
public RankText(ScoreRank rank)
{
@ -35,17 +39,38 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
[BackgroundDependencyLoader]
private void load()
{
InternalChildren = new[]
InternalChildren = new Drawable[]
{
new GlowingSpriteText
rankText = new GlowingSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
GlowColour = OsuColour.ForRank(rank),
Spacing = new Vector2(-15, 0),
Text = DrawableRank.GetRankName(rank),
Font = OsuFont.Numeric.With(size: 76),
UseFullGlyphHeight = false
},
superFlash = new BufferedContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
BlurSigma = new Vector2(85),
Size = new Vector2(600),
CacheDrawnFrameBuffer = true,
Blending = BlendingParameters.Additive,
Alpha = 0,
Children = new[]
{
new Box
{
Colour = Color4.White,
Size = new Vector2(150),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
},
},
flash = new BufferedContainer
{
Anchor = Anchor.Centre,
@ -53,8 +78,10 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
BlurSigma = new Vector2(35),
BypassAutoSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.Both,
CacheDrawnFrameBuffer = true,
Blending = BlendingParameters.Additive,
Size = new Vector2(2f),
Alpha = 0,
Size = new Vector2(2f), // increase buffer size to allow for scale
Scale = new Vector2(1.8f),
Children = new[]
{
@ -75,9 +102,36 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
public void Appear()
{
this.FadeIn(0, Easing.In);
this.FadeIn();
flash.FadeIn(0, Easing.In).Then().FadeOut(800, Easing.OutQuint);
if (rank < ScoreRank.A)
{
this
.MoveToOffset(new Vector2(0, -20))
.MoveToOffset(new Vector2(0, 20), 200, Easing.OutBounce);
if (rank <= ScoreRank.D)
{
this.Delay(700)
.RotateTo(5, 150, Easing.In)
.MoveToOffset(new Vector2(0, 3), 150, Easing.In);
}
this.FadeInFromZero(200, Easing.OutQuint);
return;
}
flash.Colour = OsuColour.ForRank(rank);
flash.FadeIn().Then().FadeOut(1200, Easing.OutQuint);
if (rank >= ScoreRank.S)
rankText.ScaleTo(1.05f).ScaleTo(1, 3000, Easing.OutQuint);
if (rank >= ScoreRank.X)
{
flash.FadeIn().Then().FadeOut(3000);
superFlash.FadeIn().Then().FadeOut(800, Easing.OutQuint);
}
}
}
}

View File

@ -1,15 +1,64 @@
// 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.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Users;
using osu.Game.Users.Drawables;
using osuTK;
namespace osu.Game.Screens.Ranking.Expanded
{
/// <summary>
/// The content that appears in the middle section of the <see cref="ScorePanel"/>.
/// </summary>
public class ExpandedPanelTopContent : CompositeDrawable
{
private readonly User user;
/// <summary>
/// Creates a new <see cref="ExpandedPanelTopContent"/>.
/// </summary>
/// <param name="user">The <see cref="User"/> to display.</param>
public ExpandedPanelTopContent(User user)
{
this.user = user;
Anchor = Anchor.TopCentre;
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
InternalChild = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new UpdateableAvatar(user)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Size = new Vector2(80),
CornerRadius = 20,
CornerExponent = 2.5f,
Masking = true,
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = user.Username,
Font = OsuFont.Torus.With(size: 16, weight: FontWeight.SemiBold)
}
}
};
}
}
}

View File

@ -23,7 +23,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
<PackageReference Include="ppy.osu.Framework" Version="2020.314.0" />
<PackageReference Include="ppy.osu.Framework" Version="2020.317.0" />
<PackageReference Include="Sentry" Version="2.1.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" />
<PackageReference Include="NUnit" Version="3.12.0" />

View File

@ -71,7 +71,7 @@
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.315.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.314.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.317.0" />
</ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
<ItemGroup Label="Transitive Dependencies">
@ -79,7 +79,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.314.0" />
<PackageReference Include="ppy.osu.Framework" Version="2020.317.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />