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

Merge branch 'master' into scale-tool

This commit is contained in:
Bartłomiej Dach 2024-05-29 10:15:48 +02:00
commit 7b7e439d03
No known key found for this signature in database
39 changed files with 433 additions and 158 deletions

View File

@ -10,7 +10,7 @@
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.523.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.528.1" />
</ItemGroup>
<PropertyGroup>
<!-- Fody does not handle Android build well, and warns when unchanged.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

@ -10,9 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Skinning.Default;
using osu.Game.Screens.Play;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
@ -63,22 +61,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
base.ApplyTransformsAt(time, false);
}
private Vector2? lastPosition;
public void UpdateProgress(double completionProgress)
{
Position = drawableSlider.HitObject.CurvePositionAt(completionProgress);
Slider slider = drawableSlider.HitObject;
Position = slider.CurvePositionAt(completionProgress);
var diff = lastPosition.HasValue ? lastPosition.Value - Position : Position - drawableSlider.HitObject.CurvePositionAt(completionProgress + 0.01f);
bool rewinding = (Clock as IGameplayClock)?.IsRewinding == true;
//0.1 / slider.Path.Distance is the additional progress needed to ensure the diff length is 0.1
var diff = slider.CurvePositionAt(completionProgress) - slider.CurvePositionAt(Math.Min(1, completionProgress + 0.1 / slider.Path.Distance));
// Ensure the value is substantially high enough to allow for Atan2 to get a valid angle.
// Needed for when near completion, or in case of a very short slider.
if (diff.LengthFast < 0.01f)
return;
ball.Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI) + (rewinding ? 180 : 0);
lastPosition = Position;
ball.Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI);
}
}
}

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Alpha = 0,
Scale = new Vector2(0.7f),
Scale = new Vector2(TaikoLegacyHitTarget.SCALE),
Colour = new Colour4(255, 228, 0, 255),
};
@ -58,8 +58,8 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
if (!result.IsHit || !isKiaiActive)
return;
sprite.ScaleTo(0.85f).Then()
.ScaleTo(0.7f, 80, Easing.OutQuad);
sprite.ScaleTo(TaikoLegacyHitTarget.SCALE + 0.15f).Then()
.ScaleTo(TaikoLegacyHitTarget.SCALE, 80, Easing.OutQuad);
}
}
}

View File

@ -12,6 +12,12 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
{
public partial class TaikoLegacyHitTarget : CompositeDrawable
{
/// <summary>
/// In stable this is 0.7f (see https://github.com/peppy/osu-stable-reference/blob/7519cafd1823f1879c0d9c991ba0e5c7fd3bfa02/osu!/GameModes/Play/Rulesets/Taiko/RulesetTaiko.cs#L592)
/// but for whatever reason this doesn't match visually.
/// </summary>
public const float SCALE = 0.8f;
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
@ -22,7 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
new Sprite
{
Texture = skin.GetTexture("approachcircle"),
Scale = new Vector2(0.83f),
Scale = new Vector2(SCALE + 0.03f),
Alpha = 0.47f, // eyeballed to match stable
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -30,7 +36,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
new Sprite
{
Texture = skin.GetTexture("taikobigcircle"),
Scale = new Vector2(0.8f),
Scale = new Vector2(SCALE),
Alpha = 0.22f, // eyeballed to match stable
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -33,6 +33,7 @@ using osu.Game.Scoring;
using osu.Game.Scoring.Legacy;
using osu.Game.Tests.Resources;
using osu.Game.Users;
using osuTK;
namespace osu.Game.Tests.Beatmaps.Formats
{
@ -126,17 +127,20 @@ namespace osu.Game.Tests.Beatmaps.Formats
[TestCase(LegacyBeatmapDecoder.LATEST_VERSION, false)]
public void TestLegacyBeatmapReplayOffsetsDecode(int beatmapVersion, bool offsetApplied)
{
const double first_frame_time = 48;
const double second_frame_time = 65;
const double first_frame_time = 31;
const double second_frame_time = 48;
const double third_frame_time = 65;
var decoder = new TestLegacyScoreDecoder(beatmapVersion);
using (var resourceStream = TestResources.OpenResource("Replays/mania-replay.osr"))
{
var score = decoder.Parse(resourceStream);
int offset = offsetApplied ? LegacyBeatmapDecoder.EARLY_VERSION_TIMING_OFFSET : 0;
Assert.That(score.Replay.Frames[0].Time, Is.EqualTo(first_frame_time + (offsetApplied ? LegacyBeatmapDecoder.EARLY_VERSION_TIMING_OFFSET : 0)));
Assert.That(score.Replay.Frames[1].Time, Is.EqualTo(second_frame_time + (offsetApplied ? LegacyBeatmapDecoder.EARLY_VERSION_TIMING_OFFSET : 0)));
Assert.That(score.Replay.Frames[0].Time, Is.EqualTo(first_frame_time + offset));
Assert.That(score.Replay.Frames[1].Time, Is.EqualTo(second_frame_time + offset));
Assert.That(score.Replay.Frames[2].Time, Is.EqualTo(third_frame_time + offset));
}
}
@ -177,6 +181,94 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.That(decodedAfterEncode.Replay.Frames[1].Time, Is.EqualTo(second_frame_time));
}
[Test]
public void TestNegativeFrameSkipped()
{
var ruleset = new OsuRuleset().RulesetInfo;
var scoreInfo = TestResources.CreateTestScoreInfo(ruleset);
var beatmap = new TestBeatmap(ruleset);
var score = new Score
{
ScoreInfo = scoreInfo,
Replay = new Replay
{
Frames = new List<ReplayFrame>
{
new OsuReplayFrame(0, new Vector2()),
new OsuReplayFrame(1000, OsuPlayfield.BASE_SIZE),
new OsuReplayFrame(500, OsuPlayfield.BASE_SIZE / 2),
new OsuReplayFrame(2000, OsuPlayfield.BASE_SIZE),
}
}
};
var decodedAfterEncode = encodeThenDecode(LegacyScoreEncoder.LATEST_VERSION, score, beatmap);
Assert.That(decodedAfterEncode.Replay.Frames, Has.Count.EqualTo(3));
Assert.That(decodedAfterEncode.Replay.Frames[0].Time, Is.EqualTo(0));
Assert.That(decodedAfterEncode.Replay.Frames[1].Time, Is.EqualTo(1000));
Assert.That(decodedAfterEncode.Replay.Frames[2].Time, Is.EqualTo(2000));
}
[Test]
public void FirstTwoFramesSwappedIfInWrongOrder()
{
var ruleset = new OsuRuleset().RulesetInfo;
var scoreInfo = TestResources.CreateTestScoreInfo(ruleset);
var beatmap = new TestBeatmap(ruleset);
var score = new Score
{
ScoreInfo = scoreInfo,
Replay = new Replay
{
Frames = new List<ReplayFrame>
{
new OsuReplayFrame(100, new Vector2()),
new OsuReplayFrame(50, OsuPlayfield.BASE_SIZE / 2),
new OsuReplayFrame(1000, OsuPlayfield.BASE_SIZE),
}
}
};
var decodedAfterEncode = encodeThenDecode(LegacyScoreEncoder.LATEST_VERSION, score, beatmap);
Assert.That(decodedAfterEncode.Replay.Frames, Has.Count.EqualTo(3));
Assert.That(decodedAfterEncode.Replay.Frames[0].Time, Is.EqualTo(0));
Assert.That(decodedAfterEncode.Replay.Frames[1].Time, Is.EqualTo(100));
Assert.That(decodedAfterEncode.Replay.Frames[2].Time, Is.EqualTo(1000));
}
[Test]
public void FirstTwoFramesPulledTowardThirdIfTheyAreAfterIt()
{
var ruleset = new OsuRuleset().RulesetInfo;
var scoreInfo = TestResources.CreateTestScoreInfo(ruleset);
var beatmap = new TestBeatmap(ruleset);
var score = new Score
{
ScoreInfo = scoreInfo,
Replay = new Replay
{
Frames = new List<ReplayFrame>
{
new OsuReplayFrame(0, new Vector2()),
new OsuReplayFrame(500, OsuPlayfield.BASE_SIZE / 2),
new OsuReplayFrame(-1500, OsuPlayfield.BASE_SIZE),
}
}
};
var decodedAfterEncode = encodeThenDecode(LegacyScoreEncoder.LATEST_VERSION, score, beatmap);
Assert.That(decodedAfterEncode.Replay.Frames, Has.Count.EqualTo(3));
Assert.That(decodedAfterEncode.Replay.Frames[0].Time, Is.EqualTo(-1500));
Assert.That(decodedAfterEncode.Replay.Frames[1].Time, Is.EqualTo(-1500));
Assert.That(decodedAfterEncode.Replay.Frames[2].Time, Is.EqualTo(-1500));
}
[Test]
public void TestCultureInvariance()
{

View File

@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual.Beatmaps
var beatmapSet = CreateAPIBeatmapSet(Ruleset.Value);
beatmapSet.OnlineID = 241526; // ID hardcoded to ensure that the preview track exists online.
Child = thumbnail = new BeatmapCardThumbnail(beatmapSet)
Child = thumbnail = new BeatmapCardThumbnail(beatmapSet, beatmapSet)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -16,6 +16,7 @@ using osu.Framework.Platform;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Beatmaps.Drawables.Cards;
using osu.Game.Database;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Cursor;
@ -317,13 +318,13 @@ namespace osu.Game.Tests.Visual.Multiplayer
p.RequestResults = _ => resultsRequested = true;
});
AddUntilStep("wait for load", () => playlist.ChildrenOfType<DrawableLinkCompiler>().Any() && playlist.ChildrenOfType<BeatmapCardThumbnail>().First().DrawWidth > 0);
AddStep("move mouse to first item title", () =>
{
var drawQuad = playlist.ChildrenOfType<LinkFlowContainer>().First().ScreenSpaceDrawQuad;
var location = (drawQuad.TopLeft + drawQuad.BottomLeft) / 2 + new Vector2(drawQuad.Width * 0.2f, 0);
InputManager.MoveMouseTo(location);
});
AddUntilStep("wait for text load", () => playlist.ChildrenOfType<DrawableLinkCompiler>().Any());
AddAssert("first item title not hovered", () => playlist.ChildrenOfType<DrawableLinkCompiler>().First().IsHovered, () => Is.False);
AddStep("click left mouse", () => InputManager.Click(MouseButton.Left));
AddUntilStep("first item selected", () => playlist.ChildrenOfType<DrawableRoomPlaylistItem>().First().IsSelectedItem, () => Is.True);

View File

@ -7,11 +7,13 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osuTK;
using osuTK.Input;
namespace osu.Game.Tests.Visual.UserInterface
@ -35,7 +37,7 @@ namespace osu.Game.Tests.Visual.UserInterface
if (bigButton)
{
Child = button = new ShearedButton(400)
Child = button = new ShearedButton(400, 80)
{
LighterColour = Colour4.FromHex("#FFFFFF"),
DarkerColour = Colour4.FromHex("#FFCC22"),
@ -44,13 +46,12 @@ namespace osu.Game.Tests.Visual.UserInterface
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Let's GO!",
Height = 80,
Action = () => actionFired = true,
};
}
else
{
Child = button = new ShearedButton(200)
Child = button = new ShearedButton(200, 80)
{
LighterColour = Colour4.FromHex("#FF86DD"),
DarkerColour = Colour4.FromHex("#DE31AE"),
@ -58,7 +59,6 @@ namespace osu.Game.Tests.Visual.UserInterface
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Press me",
Height = 80,
Action = () => actionFired = true,
};
}
@ -171,5 +171,48 @@ namespace osu.Game.Tests.Visual.UserInterface
void setToggleDisabledState(bool disabled) => AddStep($"{(disabled ? "disable" : "enable")} toggle", () => button.Active.Disabled = disabled);
}
[Test]
public void TestButtons()
{
AddStep("create buttons", () => Children = new[]
{
new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
Scale = new Vector2(2.5f),
Children = new Drawable[]
{
new ShearedButton(120)
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Text = "Test",
Action = () => { },
Padding = new MarginPadding(),
},
new ShearedButton(120, 40)
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Text = "Test",
Action = () => { },
Padding = new MarginPadding { Left = -1f },
},
new ShearedButton(120, 70)
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Text = "Test",
Action = () => { },
Padding = new MarginPadding { Left = 3f },
},
}
}
});
}
}
}

View File

@ -61,7 +61,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
thumbnail = new BeatmapCardThumbnail(BeatmapSet)
thumbnail = new BeatmapCardThumbnail(BeatmapSet, BeatmapSet)
{
Name = @"Left (icon) area",
Size = new Vector2(height),

View File

@ -62,7 +62,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
thumbnail = new BeatmapCardThumbnail(BeatmapSet)
thumbnail = new BeatmapCardThumbnail(BeatmapSet, BeatmapSet)
{
Name = @"Left (icon) area",
Size = new Vector2(height),

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.Drawables.Cards.Buttons;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
using osu.Framework.Graphics.UserInterface;
using osuTK;
@ -36,14 +35,14 @@ namespace osu.Game.Beatmaps.Drawables.Cards
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
public BeatmapCardThumbnail(APIBeatmapSet beatmapSetInfo)
public BeatmapCardThumbnail(IBeatmapSetInfo beatmapSetInfo, IBeatmapSetOnlineInfo onlineInfo)
{
InternalChildren = new Drawable[]
{
new UpdateableOnlineBeatmapSetCover(BeatmapSetCoverType.List)
{
RelativeSizeAxes = Axes.Both,
OnlineInfo = beatmapSetInfo
OnlineInfo = onlineInfo
},
background = new Box
{
@ -62,7 +61,6 @@ namespace osu.Game.Beatmaps.Drawables.Cards
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(50),
InnerRadius = 0.2f
},
content = new Container
@ -93,6 +91,9 @@ namespace osu.Game.Beatmaps.Drawables.Cards
{
base.Update();
progress.Progress = playButton.Progress.Value;
playButton.Scale = new Vector2(DrawWidth / 100);
progress.Size = new Vector2(50 * DrawWidth / 100);
}
private void updateState()

View File

@ -16,7 +16,6 @@ using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Scoring.Legacy;
using osu.Game.Scoring;
using osu.Game.Scoring.Legacy;
namespace osu.Game.Database
{
@ -248,8 +247,7 @@ namespace osu.Game.Database
// warning: ordering is important here - both total score and ranks are dependent on accuracy!
score.Accuracy = computeAccuracy(score, scoreProcessor);
score.Rank = computeRank(score, scoreProcessor);
score.TotalScore = convertFromLegacyTotalScore(score, ruleset, beatmap);
LegacyScoreDecoder.PopulateTotalScoreWithoutMods(score);
(score.TotalScoreWithoutMods, score.TotalScore) = convertFromLegacyTotalScore(score, ruleset, beatmap);
}
/// <summary>
@ -273,7 +271,7 @@ namespace osu.Game.Database
// warning: ordering is important here - both total score and ranks are dependent on accuracy!
score.Accuracy = computeAccuracy(score, scoreProcessor);
score.Rank = computeRank(score, scoreProcessor);
score.TotalScore = convertFromLegacyTotalScore(score, ruleset, difficulty, attributes);
(score.TotalScoreWithoutMods, score.TotalScore) = convertFromLegacyTotalScore(score, ruleset, difficulty, attributes);
}
/// <summary>
@ -283,17 +281,13 @@ namespace osu.Game.Database
/// <param name="ruleset">The <see cref="Ruleset"/> in which the score was set.</param>
/// <param name="beatmap">The <see cref="WorkingBeatmap"/> applicable for this score.</param>
/// <returns>The standardised total score.</returns>
private static long convertFromLegacyTotalScore(ScoreInfo score, Ruleset ruleset, WorkingBeatmap beatmap)
private static (long withoutMods, long withMods) convertFromLegacyTotalScore(ScoreInfo score, Ruleset ruleset, WorkingBeatmap beatmap)
{
if (!score.IsLegacyScore)
return score.TotalScore;
return (score.TotalScoreWithoutMods, score.TotalScore);
if (ruleset is not ILegacyRuleset legacyRuleset)
return score.TotalScore;
var mods = score.Mods;
if (mods.Any(mod => mod is ModScoreV2))
return score.TotalScore;
return (score.TotalScoreWithoutMods, score.TotalScore);
var playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo, score.Mods);
@ -302,8 +296,13 @@ namespace osu.Game.Database
ILegacyScoreSimulator sv1Simulator = legacyRuleset.CreateLegacyScoreSimulator();
LegacyScoreAttributes attributes = sv1Simulator.Simulate(beatmap, playableBeatmap);
var legacyBeatmapConversionDifficultyInfo = LegacyBeatmapConversionDifficultyInfo.FromBeatmap(beatmap.Beatmap);
return convertFromLegacyTotalScore(score, ruleset, LegacyBeatmapConversionDifficultyInfo.FromBeatmap(beatmap.Beatmap), attributes);
var mods = score.Mods;
if (mods.Any(mod => mod is ModScoreV2))
return ((long)Math.Round(score.TotalScore / sv1Simulator.GetLegacyScoreMultiplier(mods, legacyBeatmapConversionDifficultyInfo)), score.TotalScore);
return convertFromLegacyTotalScore(score, ruleset, legacyBeatmapConversionDifficultyInfo, attributes);
}
/// <summary>
@ -314,15 +313,15 @@ namespace osu.Game.Database
/// <param name="difficulty">The beatmap difficulty.</param>
/// <param name="attributes">The legacy scoring attributes for the beatmap which the score was set on.</param>
/// <returns>The standardised total score.</returns>
private static long convertFromLegacyTotalScore(ScoreInfo score, Ruleset ruleset, LegacyBeatmapConversionDifficultyInfo difficulty, LegacyScoreAttributes attributes)
private static (long withoutMods, long withMods) convertFromLegacyTotalScore(ScoreInfo score, Ruleset ruleset, LegacyBeatmapConversionDifficultyInfo difficulty, LegacyScoreAttributes attributes)
{
if (!score.IsLegacyScore)
return score.TotalScore;
return (score.TotalScoreWithoutMods, score.TotalScore);
Debug.Assert(score.LegacyTotalScore != null);
if (ruleset is not ILegacyRuleset legacyRuleset)
return score.TotalScore;
return (score.TotalScoreWithoutMods, score.TotalScore);
double legacyModMultiplier = legacyRuleset.CreateLegacyScoreSimulator().GetLegacyScoreMultiplier(score.Mods, difficulty);
int maximumLegacyAccuracyScore = attributes.AccuracyScore;
@ -354,17 +353,18 @@ namespace osu.Game.Database
double modMultiplier = score.Mods.Select(m => m.ScoreMultiplier).Aggregate(1.0, (c, n) => c * n);
long convertedTotalScore;
long convertedTotalScoreWithoutMods;
switch (score.Ruleset.OnlineID)
{
case 0:
if (score.MaxCombo == 0 || score.Accuracy == 0)
{
return (long)Math.Round((
convertedTotalScoreWithoutMods = (long)Math.Round(
0
+ 500000 * Math.Pow(score.Accuracy, 5)
+ bonusProportion) * modMultiplier);
+ bonusProportion);
break;
}
// see similar check above.
@ -372,10 +372,11 @@ namespace osu.Game.Database
// are either pointless or wildly wrong.
if (maximumLegacyComboScore + maximumLegacyBonusScore == 0)
{
return (long)Math.Round((
convertedTotalScoreWithoutMods = (long)Math.Round(
500000 * comboProportion // as above, zero if mods result in zero multiplier, one otherwise
+ 500000 * Math.Pow(score.Accuracy, 5)
+ bonusProportion) * modMultiplier);
+ bonusProportion);
break;
}
// Assumptions:
@ -472,17 +473,17 @@ namespace osu.Game.Database
double newComboScoreProportion = estimatedComboPortionInStandardisedScore / maximumAchievableComboPortionInStandardisedScore;
convertedTotalScore = (long)Math.Round((
convertedTotalScoreWithoutMods = (long)Math.Round(
500000 * newComboScoreProportion * score.Accuracy
+ 500000 * Math.Pow(score.Accuracy, 5)
+ bonusProportion) * modMultiplier);
+ bonusProportion);
break;
case 1:
convertedTotalScore = (long)Math.Round((
convertedTotalScoreWithoutMods = (long)Math.Round(
250000 * comboProportion
+ 750000 * Math.Pow(score.Accuracy, 3.6)
+ bonusProportion) * modMultiplier);
+ bonusProportion);
break;
case 2:
@ -507,28 +508,28 @@ namespace osu.Game.Database
? 0
: (double)score.Statistics.GetValueOrDefault(HitResult.SmallTickHit) / score.MaximumStatistics.GetValueOrDefault(HitResult.SmallTickHit);
convertedTotalScore = (long)Math.Round((
convertedTotalScoreWithoutMods = (long)Math.Round(
comboPortion * estimateComboProportionForCatch(attributes.MaxCombo, score.MaxCombo, score.Statistics.GetValueOrDefault(HitResult.Miss))
+ dropletsPortion * dropletsHit
+ bonusProportion) * modMultiplier);
+ bonusProportion);
break;
case 3:
convertedTotalScore = (long)Math.Round((
convertedTotalScoreWithoutMods = (long)Math.Round(
850000 * comboProportion
+ 150000 * Math.Pow(score.Accuracy, 2 + 2 * score.Accuracy)
+ bonusProportion) * modMultiplier);
+ bonusProportion);
break;
default:
convertedTotalScore = score.TotalScore;
break;
return (score.TotalScoreWithoutMods, score.TotalScore);
}
if (convertedTotalScore < 0)
throw new InvalidOperationException($"Total score conversion operation returned invalid total of {convertedTotalScore}");
if (convertedTotalScoreWithoutMods < 0)
throw new InvalidOperationException($"Total score conversion operation returned invalid total of {convertedTotalScoreWithoutMods}");
return convertedTotalScore;
long convertedTotalScore = (long)Math.Round(convertedTotalScoreWithoutMods * modMultiplier);
return (convertedTotalScoreWithoutMods, convertedTotalScore);
}
/// <summary>

View File

@ -17,7 +17,7 @@ namespace osu.Game.Graphics.UserInterface
{
public partial class ShearedButton : OsuClickableContainer
{
public const float HEIGHT = 50;
public const float DEFAULT_HEIGHT = 50;
public const float CORNER_RADIUS = 7;
public const float BORDER_THICKNESS = 2;
@ -66,7 +66,7 @@ namespace osu.Game.Graphics.UserInterface
private readonly Box background;
private readonly OsuSpriteText text;
private const float shear = 0.2f;
private const float shear = OsuGame.SHEAR;
private Colour4? darkerColour;
private Colour4? lighterColour;
@ -75,6 +75,8 @@ namespace osu.Game.Graphics.UserInterface
private readonly Container backgroundLayer;
private readonly Box flashLayer;
protected readonly Container ButtonContent;
/// <summary>
/// Creates a new <see cref="ShearedToggleButton"/>
/// </summary>
@ -85,10 +87,11 @@ namespace osu.Game.Graphics.UserInterface
/// <item>If a <see langword="null"/> value is provided (or the argument is omitted entirely), the button will autosize in width to fit the text.</item>
/// </list>
/// </param>
public ShearedButton(float? width = null)
/// <param name="height">The height of the button.</param>
public ShearedButton(float? width = null, float height = DEFAULT_HEIGHT)
{
Height = HEIGHT;
Padding = new MarginPadding { Horizontal = shear * 50 };
Height = height;
Padding = new MarginPadding { Horizontal = shear * height };
Content.CornerRadius = CORNER_RADIUS;
Content.Shear = new Vector2(shear, 0);
@ -109,12 +112,16 @@ namespace osu.Game.Graphics.UserInterface
{
RelativeSizeAxes = Axes.Both
},
text = new OsuSpriteText
ButtonContent = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.TorusAlternate.With(size: 17),
Shear = new Vector2(-shear, 0)
AutoSizeAxes = Axes.Both,
Shear = new Vector2(-shear, 0),
Child = text = new OsuSpriteText
{
Font = OsuFont.TorusAlternate.With(size: 17),
}
},
}
},
@ -188,7 +195,7 @@ namespace osu.Game.Graphics.UserInterface
{
var colourDark = darkerColour ?? ColourProvider.Background3;
var colourLight = lighterColour ?? ColourProvider.Background1;
var colourText = textColour ?? ColourProvider.Content1;
var colourContent = textColour ?? ColourProvider.Content1;
if (!Enabled.Value)
{
@ -205,9 +212,9 @@ namespace osu.Game.Graphics.UserInterface
backgroundLayer.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(colourDark, colourLight), 150, Easing.OutQuint);
if (!Enabled.Value)
colourText = colourText.Opacity(0.6f);
colourContent = colourContent.Opacity(0.6f);
text.FadeColour(colourText, 150, Easing.OutQuint);
ButtonContent.FadeColour(colourContent, 150, Easing.OutQuint);
}
}
}

View File

@ -11,7 +11,6 @@ using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
using osu.Game.Resources.Localisation.Web;
using osuTK;
@ -53,7 +52,7 @@ namespace osu.Game.Graphics.UserInterface
public ShearedSearchTextBox()
{
Height = 42;
Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0);
Shear = new Vector2(OsuGame.SHEAR, 0);
Masking = true;
CornerRadius = corner_radius;
@ -116,7 +115,7 @@ namespace osu.Game.Graphics.UserInterface
PlaceholderText = CommonStrings.InputSearch;
CornerRadius = corner_radius;
TextContainer.Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0);
TextContainer.Shear = new Vector2(-OsuGame.SHEAR, 0);
}
protected override SpriteText CreatePlaceholder() => new SearchPlaceholder();

View File

@ -91,6 +91,11 @@ namespace osu.Game
/// </summary>
protected const float SIDE_OVERLAY_OFFSET_RATIO = 0.05f;
/// <summary>
/// A common shear factor applied to most components of the game.
/// </summary>
public const float SHEAR = 0.2f;
public Toolbar Toolbar { get; private set; }
private ChatOverlay chatOverlay;

View File

@ -16,7 +16,6 @@ using osu.Game.Beatmaps;
using osu.Game.Extensions;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Resources.Localisation.Web;
using osuTK;
@ -26,9 +25,9 @@ namespace osu.Game.Overlays.BeatmapSet
{
private readonly Statistic length, bpm, circleCount, sliderCount;
private APIBeatmapSet beatmapSet;
private IBeatmapSetInfo beatmapSet;
public APIBeatmapSet BeatmapSet
public IBeatmapSetInfo BeatmapSet
{
get => beatmapSet;
set

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests.Responses;
@ -28,9 +29,9 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
[CanBeNull]
public PreviewTrack Preview { get; private set; }
private APIBeatmapSet beatmapSet;
private IBeatmapSetInfo beatmapSet;
public APIBeatmapSet BeatmapSet
public IBeatmapSetInfo BeatmapSet
{
get => beatmapSet;
set

View File

@ -8,9 +8,9 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests.Responses;
using osuTK;
namespace osu.Game.Overlays.BeatmapSet.Buttons
@ -24,7 +24,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
public IBindable<bool> Playing => playButton.Playing;
public APIBeatmapSet BeatmapSet
public IBeatmapSetInfo BeatmapSet
{
get => playButton.BeatmapSet;
set => playButton.BeatmapSet = value;
@ -32,8 +32,6 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
public PreviewButton()
{
Height = 42;
Children = new Drawable[]
{
background = new Box

View File

@ -68,6 +68,7 @@ namespace osu.Game.Overlays.BeatmapSet
preview = new PreviewButton
{
RelativeSizeAxes = Axes.X,
Height = 42,
},
new DetailBox
{

View File

@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Mods
[BackgroundDependencyLoader]
private void load()
{
const float shear = ShearedOverlayContainer.SHEAR;
const float shear = OsuGame.SHEAR;
LeftContent.AddRange(new Drawable[]
{

View File

@ -106,7 +106,7 @@ namespace osu.Game.Overlays.Mods
Origin = Anchor.CentreLeft,
Scale = new Vector2(0.8f),
RelativeSizeAxes = Axes.X,
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0)
Shear = new Vector2(-OsuGame.SHEAR, 0)
});
ItemsFlow.Padding = new MarginPadding
{

View File

@ -36,8 +36,8 @@ namespace osu.Game.Overlays.Mods
Origin = Anchor.BottomRight,
Anchor = Anchor.BottomRight,
AutoSizeAxes = Axes.X,
Height = ShearedButton.HEIGHT,
Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0),
Height = ShearedButton.DEFAULT_HEIGHT,
Shear = new Vector2(OsuGame.SHEAR, 0),
CornerRadius = ShearedButton.CORNER_RADIUS,
BorderThickness = ShearedButton.BORDER_THICKNESS,
Masking = true,

View File

@ -36,7 +36,7 @@ namespace osu.Game.Overlays.Mods
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Active = { BindTarget = Active },
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
Shear = new Vector2(-OsuGame.SHEAR, 0),
Scale = new Vector2(HEIGHT / ModSwitchSmall.DEFAULT_SIZE)
};
}

View File

@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Mods
{
Width = WIDTH;
RelativeSizeAxes = Axes.Y;
Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0);
Shear = new Vector2(OsuGame.SHEAR, 0);
InternalChildren = new Drawable[]
{
@ -96,7 +96,7 @@ namespace osu.Game.Overlays.Mods
{
RelativeSizeAxes = Axes.X,
Height = header_height,
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
Shear = new Vector2(-OsuGame.SHEAR, 0),
Velocity = 0.7f,
ClampAxes = Axes.Y
},
@ -111,7 +111,7 @@ namespace osu.Game.Overlays.Mods
AutoSizeAxes = Axes.Y,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
Shear = new Vector2(-OsuGame.SHEAR, 0),
Padding = new MarginPadding
{
Horizontal = 17,

View File

@ -227,7 +227,7 @@ namespace osu.Game.Overlays.Mods
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Direction = FillDirection.Horizontal,
Shear = new Vector2(SHEAR, 0),
Shear = new Vector2(OsuGame.SHEAR, 0),
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Margin = new MarginPadding { Horizontal = 70 },
@ -847,7 +847,7 @@ namespace osu.Game.Overlays.Mods
// DrawWidth/DrawPosition do not include shear effects, and we want to know the full extents of the columns post-shear,
// so we have to manually compensate.
var topLeft = column.ToSpaceOfOtherDrawable(Vector2.Zero, ScrollContent);
var bottomRight = column.ToSpaceOfOtherDrawable(new Vector2(column.DrawWidth - column.DrawHeight * SHEAR, 0), ScrollContent);
var bottomRight = column.ToSpaceOfOtherDrawable(new Vector2(column.DrawWidth - column.DrawHeight * OsuGame.SHEAR, 0), ScrollContent);
bool isCurrentlyVisible = Precision.AlmostBigger(topLeft.X, leftVisibleBound)
&& Precision.DefinitelyBigger(rightVisibleBound, bottomRight.X);

View File

@ -87,7 +87,7 @@ namespace osu.Game.Overlays.Mods
Content.CornerRadius = CORNER_RADIUS;
Content.BorderThickness = 2;
Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0);
Shear = new Vector2(OsuGame.SHEAR, 0);
Children = new Drawable[]
{
@ -128,10 +128,10 @@ namespace osu.Game.Overlays.Mods
{
Font = OsuFont.TorusAlternate.With(size: 18, weight: FontWeight.SemiBold),
RelativeSizeAxes = Axes.X,
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
Shear = new Vector2(-OsuGame.SHEAR, 0),
Margin = new MarginPadding
{
Left = -18 * ShearedOverlayContainer.SHEAR
Left = -18 * OsuGame.SHEAR
},
ShowTooltip = false, // Tooltip is handled by `IncompatibilityDisplayingModPanel`.
},
@ -139,7 +139,7 @@ namespace osu.Game.Overlays.Mods
{
Font = OsuFont.Default.With(size: 12),
RelativeSizeAxes = Axes.X,
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
Shear = new Vector2(-OsuGame.SHEAR, 0),
ShowTooltip = false, // Tooltip is handled by `IncompatibilityDisplayingModPanel`.
}
}

View File

@ -52,7 +52,7 @@ namespace osu.Game.Overlays.Mods
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
RelativeSizeAxes = Axes.Both,
Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0),
Shear = new Vector2(OsuGame.SHEAR, 0),
CornerRadius = ShearedButton.CORNER_RADIUS,
Masking = true,
Children = new Drawable[]
@ -79,7 +79,7 @@ namespace osu.Game.Overlays.Mods
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
Shear = new Vector2(-OsuGame.SHEAR, 0),
Font = OsuFont.Default.With(size: 17, weight: FontWeight.SemiBold)
}
}
@ -94,7 +94,7 @@ namespace osu.Game.Overlays.Mods
Origin = Anchor.Centre,
Child = counter = new EffectCounter
{
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
Shear = new Vector2(-OsuGame.SHEAR, 0),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Current = { BindTarget = ModMultiplier }

View File

@ -22,8 +22,6 @@ namespace osu.Game.Overlays.Mods
{
protected const float PADDING = 14;
public const float SHEAR = 0.2f;
[Cached]
protected readonly OverlayColourProvider ColourProvider;

View File

@ -36,6 +36,8 @@ namespace osu.Game.Rulesets.Mods
{
overlay.ShowHud.Value = false;
overlay.ShowHud.Disabled = true;
overlay.PlayfieldSkinLayer.Hide();
}
public void ApplyToPlayer(Player player)

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// 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.
#nullable disable
@ -21,6 +21,7 @@ using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.Scoring;
using osuTK;
using SharpCompress.Compressors.LZMA;
namespace osu.Game.Scoring.Legacy
@ -262,7 +263,7 @@ namespace osu.Game.Scoring.Legacy
private void readLegacyReplay(Replay replay, StreamReader reader)
{
float lastTime = beatmapOffset;
ReplayFrame currentFrame = null;
var legacyFrames = new List<LegacyReplayFrame>();
string[] frames = reader.ReadToEnd().Split(',');
@ -285,23 +286,44 @@ namespace osu.Game.Scoring.Legacy
lastTime += diff;
if (i < 2 && mouseX == 256 && mouseY == -500)
// at the start of the replay, stable places two replay frames, at time 0 and SkipBoundary - 1, respectively.
// both frames use a position of (256, -500).
// ignore these frames as they serve no real purpose (and can even mislead ruleset-specific handlers - see mania)
continue;
// Todo: At some point we probably want to rewind and play back the negative-time frames
// but for now we'll achieve equal playback to stable by skipping negative frames
if (diff < 0)
continue;
currentFrame = convertFrame(new LegacyReplayFrame(lastTime,
legacyFrames.Add(new LegacyReplayFrame(lastTime,
mouseX,
mouseY,
(ReplayButtonState)Parsing.ParseInt(split[3])), currentFrame);
(ReplayButtonState)Parsing.ParseInt(split[3])));
}
replay.Frames.Add(currentFrame);
// https://github.com/peppy/osu-stable-reference/blob/e53980dd76857ee899f66ce519ba1597e7874f28/osu!/GameModes/Play/ReplayWatcher.cs#L62-L67
if (legacyFrames.Count >= 2 && legacyFrames[1].Time < legacyFrames[0].Time)
{
legacyFrames[1].Time = legacyFrames[0].Time;
legacyFrames[0].Time = 0;
}
// https://github.com/peppy/osu-stable-reference/blob/e53980dd76857ee899f66ce519ba1597e7874f28/osu!/GameModes/Play/ReplayWatcher.cs#L69-L71
if (legacyFrames.Count >= 3 && legacyFrames[0].Time > legacyFrames[2].Time)
legacyFrames[0].Time = legacyFrames[1].Time = legacyFrames[2].Time;
// at the start of the replay, stable places two replay frames, at time 0 and SkipBoundary - 1, respectively.
// both frames use a position of (256, -500).
// ignore these frames as they serve no real purpose (and can even mislead ruleset-specific handlers - see mania)
if (legacyFrames.Count >= 2 && legacyFrames[1].Position == new Vector2(256, -500))
legacyFrames.RemoveAt(1);
if (legacyFrames.Count >= 1 && legacyFrames[0].Position == new Vector2(256, -500))
legacyFrames.RemoveAt(0);
ReplayFrame currentFrame = null;
foreach (var legacyFrame in legacyFrames)
{
// never allow backwards time traversal in relation to the current frame.
// this handles frames with negative delta.
// this doesn't match stable 100% as stable will do something similar to adding an interpolated "intermediate frame"
// at the point wherein time flow changes from backwards to forwards, but it'll do for now.
if (currentFrame != null && legacyFrame.Time < currentFrame.Time)
continue;
replay.Frames.Add(currentFrame = convertFrame(legacyFrame, currentFrame));
}
}

View File

@ -0,0 +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.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Footer
{
public partial class ScreenBackButton : ShearedButton
{
// todo: see https://github.com/ppy/osu-framework/issues/3271
private const float torus_scale_factor = 1.2f;
public const float BUTTON_WIDTH = 240;
public ScreenBackButton()
: base(BUTTON_WIDTH, 70)
{
}
[BackgroundDependencyLoader]
private void load()
{
ButtonContent.Child = new FillFlowContainer
{
X = -10f,
RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(20f, 0f),
Children = new Drawable[]
{
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(20f),
Icon = FontAwesome.Solid.ChevronLeft,
},
new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.TorusAlternate.With(size: 20 * torus_scale_factor),
Text = CommonStrings.Back,
UseFullGlyphHeight = false,
}
}
};
DarkerColour = Color4Extensions.FromHex("#DE31AE");
LighterColour = Color4Extensions.FromHex("#FF86DD");
TextColour = Color4.White;
}
}
}

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osuTK;
@ -15,9 +14,8 @@ namespace osu.Game.Screens.Footer
{
public partial class ScreenFooter : InputBlockingContainer
{
//Should be 60, setting to 50 for now for the sake of matching the current BackButton height.
private const int height = 50;
private const int padding = 80;
private const int height = 60;
private const int padding = 60;
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
@ -68,13 +66,20 @@ namespace osu.Game.Screens.Footer
},
buttons = new FillFlowContainer<ScreenFooterButton>
{
Position = new Vector2(TwoLayerButton.SIZE_EXTENDED.X + padding, 10),
Position = new Vector2(ScreenBackButton.BUTTON_WIDTH + padding, 10),
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(7, 0),
AutoSizeAxes = Axes.Both
}
},
new ScreenBackButton
{
Margin = new MarginPadding { Bottom = 10f, Left = 12f },
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Action = () => { },
},
};
}
}

View File

@ -25,8 +25,7 @@ namespace osu.Game.Screens.Footer
{
public partial class ScreenFooterButton : OsuClickableContainer, IKeyBindingHandler<GlobalAction>
{
// This should be 12 by design, but an extra allowance is added due to the corner radius specification.
private const float shear_width = 13.5f;
private const float shear = OsuGame.SHEAR;
protected const int CORNER_RADIUS = 10;
protected const int BUTTON_HEIGHT = 90;
@ -34,7 +33,7 @@ namespace osu.Game.Screens.Footer
public Bindable<Visibility> OverlayState = new Bindable<Visibility>();
protected static readonly Vector2 BUTTON_SHEAR = new Vector2(shear_width / BUTTON_HEIGHT, 0);
protected static readonly Vector2 BUTTON_SHEAR = new Vector2(shear, 0);
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;

View File

@ -22,6 +22,7 @@ using osu.Framework.Localisation;
using osu.Framework.Logging;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Beatmaps.Drawables.Cards;
using osu.Game.Collections;
using osu.Game.Database;
using osu.Game.Graphics;
@ -81,7 +82,7 @@ namespace osu.Game.Screens.OnlinePlay
private Mod[] requiredMods = Array.Empty<Mod>();
private Container maskingContainer;
private Container difficultyIconContainer;
private FillFlowContainer difficultyIconContainer;
private LinkFlowContainer beatmapText;
private LinkFlowContainer authorText;
private ExplicitContentBeatmapBadge explicitContent;
@ -93,6 +94,7 @@ namespace osu.Game.Screens.OnlinePlay
private Drawable removeButton;
private PanelBackground panelBackground;
private FillFlowContainer mainFillFlow;
private BeatmapCardThumbnail thumbnail;
[Resolved]
private RealmAccess realm { get; set; }
@ -282,10 +284,23 @@ namespace osu.Game.Screens.OnlinePlay
if (beatmap != null)
{
difficultyIconContainer.Child = new DifficultyIcon(beatmap, ruleset, requiredMods)
difficultyIconContainer.Children = new Drawable[]
{
Size = new Vector2(icon_height),
TooltipType = DifficultyIconTooltipType.Extended,
thumbnail = new BeatmapCardThumbnail(beatmap.BeatmapSet!, (IBeatmapSetOnlineInfo)beatmap.BeatmapSet!)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Width = 60,
RelativeSizeAxes = Axes.Y,
Dimmed = { Value = IsHovered }
},
new DifficultyIcon(beatmap, ruleset, requiredMods)
{
Size = new Vector2(icon_height),
TooltipType = DifficultyIconTooltipType.Extended,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
};
}
else
@ -329,7 +344,7 @@ namespace osu.Game.Screens.OnlinePlay
protected override Drawable CreateContent()
{
Action<SpriteText> fontParameters = s => s.Font = OsuFont.Default.With(weight: FontWeight.SemiBold);
Action<SpriteText> fontParameters = s => s.Font = OsuFont.Default.With(size: 14, weight: FontWeight.SemiBold);
return maskingContainer = new Container
{
@ -364,12 +379,15 @@ namespace osu.Game.Screens.OnlinePlay
{
new Drawable[]
{
difficultyIconContainer = new Container
difficultyIconContainer = new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Left = 8, Right = 8 },
AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(4),
Margin = new MarginPadding { Right = 4 },
},
mainFillFlow = new MainFlow(() => SelectedItem.Value == Model || !AllowSelection)
{
@ -398,6 +416,8 @@ namespace osu.Game.Screens.OnlinePlay
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10f, 0),
Children = new Drawable[]
@ -420,7 +440,8 @@ namespace osu.Game.Screens.OnlinePlay
Child = modDisplay = new ModDisplay
{
Scale = new Vector2(0.4f),
ExpansionMode = ExpansionMode.AlwaysExpanded
ExpansionMode = ExpansionMode.AlwaysExpanded,
Margin = new MarginPadding { Vertical = -6 },
}
}
}
@ -484,6 +505,20 @@ namespace osu.Game.Screens.OnlinePlay
},
};
protected override bool OnHover(HoverEvent e)
{
if (thumbnail != null)
thumbnail.Dimmed.Value = true;
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
if (thumbnail != null)
thumbnail.Dimmed.Value = false;
base.OnHoverLost(e);
}
protected override bool OnClick(ClickEvent e)
{
if (AllowSelection && valid.Value)

View File

@ -109,7 +109,10 @@ namespace osu.Game.Screens.Play
private readonly List<Drawable> hideTargets;
private readonly Drawable playfieldComponents;
/// <summary>
/// The container for skin components attached to <see cref="SkinComponentsContainerLookup.TargetArea.Playfield"/>
/// </summary>
internal readonly Drawable PlayfieldSkinLayer;
public HUDOverlay([CanBeNull] DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods, bool alwaysShowLeaderboard = true)
{
@ -129,7 +132,7 @@ namespace osu.Game.Screens.Play
drawableRuleset != null
? (rulesetComponents = new HUDComponentsContainer(drawableRuleset.Ruleset.RulesetInfo) { AlwaysPresent = true, })
: Empty(),
playfieldComponents = drawableRuleset != null
PlayfieldSkinLayer = drawableRuleset != null
? new SkinComponentsContainer(new SkinComponentsContainerLookup(SkinComponentsContainerLookup.TargetArea.Playfield, drawableRuleset.Ruleset.RulesetInfo)) { AlwaysPresent = true, }
: Empty(),
topRightElements = new FillFlowContainer
@ -247,10 +250,10 @@ namespace osu.Game.Screens.Play
{
Quad playfieldScreenSpaceDrawQuad = drawableRuleset.Playfield.SkinnableComponentScreenSpaceDrawQuad;
playfieldComponents.Position = ToLocalSpace(playfieldScreenSpaceDrawQuad.TopLeft);
playfieldComponents.Width = (ToLocalSpace(playfieldScreenSpaceDrawQuad.TopRight) - ToLocalSpace(playfieldScreenSpaceDrawQuad.TopLeft)).Length;
playfieldComponents.Height = (ToLocalSpace(playfieldScreenSpaceDrawQuad.BottomLeft) - ToLocalSpace(playfieldScreenSpaceDrawQuad.TopLeft)).Length;
playfieldComponents.Rotation = drawableRuleset.Playfield.Rotation;
PlayfieldSkinLayer.Position = ToLocalSpace(playfieldScreenSpaceDrawQuad.TopLeft);
PlayfieldSkinLayer.Width = (ToLocalSpace(playfieldScreenSpaceDrawQuad.TopRight) - ToLocalSpace(playfieldScreenSpaceDrawQuad.TopLeft)).Length;
PlayfieldSkinLayer.Height = (ToLocalSpace(playfieldScreenSpaceDrawQuad.BottomLeft) - ToLocalSpace(playfieldScreenSpaceDrawQuad.TopLeft)).Length;
PlayfieldSkinLayer.Rotation = drawableRuleset.Playfield.Rotation;
}
float? lowestTopScreenSpaceLeft = null;

View File

@ -33,12 +33,9 @@ namespace osu.Game.Screens.SelectV2.Footer
{
// todo: see https://github.com/ppy/osu-framework/issues/3271
private const float torus_scale_factor = 1.2f;
private const float bar_shear_width = 7f;
private const float bar_height = 37f;
private const float mod_display_portion = 0.65f;
private static readonly Vector2 bar_shear = new Vector2(bar_shear_width / bar_height, 0);
private readonly BindableWithCurrent<IReadOnlyList<Mod>> current = new BindableWithCurrent<IReadOnlyList<Mod>>(Array.Empty<Mod>());
public Bindable<IReadOnlyList<Mod>> Current
@ -77,7 +74,7 @@ namespace osu.Game.Screens.SelectV2.Footer
Y = -5f,
Depth = float.MaxValue,
Origin = Anchor.BottomLeft,
Shear = bar_shear,
Shear = BUTTON_SHEAR,
CornerRadius = CORNER_RADIUS,
Size = new Vector2(BUTTON_WIDTH, bar_height),
Masking = true,
@ -107,7 +104,7 @@ namespace osu.Game.Screens.SelectV2.Footer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Shear = -bar_shear,
Shear = -BUTTON_SHEAR,
UseFullGlyphHeight = false,
Font = OsuFont.Torus.With(size: 14 * torus_scale_factor, weight: FontWeight.Bold)
}
@ -129,7 +126,7 @@ namespace osu.Game.Screens.SelectV2.Footer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Shear = -bar_shear,
Shear = -BUTTON_SHEAR,
Scale = new Vector2(0.6f),
Current = { BindTarget = Current },
ExpansionMode = ExpansionMode.AlwaysContracted,
@ -138,7 +135,7 @@ namespace osu.Game.Screens.SelectV2.Footer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Shear = -bar_shear,
Shear = -BUTTON_SHEAR,
Font = OsuFont.Torus.With(size: 14 * torus_scale_factor, weight: FontWeight.Bold),
Mods = { BindTarget = Current },
}
@ -304,7 +301,7 @@ namespace osu.Game.Screens.SelectV2.Footer
Y = -5f;
Depth = float.MaxValue;
Origin = Anchor.BottomLeft;
Shear = bar_shear;
Shear = BUTTON_SHEAR;
CornerRadius = CORNER_RADIUS;
AutoSizeAxes = Axes.X;
Height = bar_height;
@ -328,7 +325,7 @@ namespace osu.Game.Screens.SelectV2.Footer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Shear = -bar_shear,
Shear = -BUTTON_SHEAR,
Text = ModSelectOverlayStrings.Unranked.ToUpper(),
Margin = new MarginPadding { Horizontal = 15 },
UseFullGlyphHeight = false,

View File

@ -35,7 +35,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Realm" Version="11.5.0" />
<PackageReference Include="ppy.osu.Framework" Version="2024.523.0" />
<PackageReference Include="ppy.osu.Framework" Version="2024.528.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.517.0" />
<PackageReference Include="Sentry" Version="4.3.0" />
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->

View File

@ -23,6 +23,6 @@
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.523.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.528.1" />
</ItemGroup>
</Project>