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

Merge branch 'master' into save-replay-hotkey

This commit is contained in:
Bartłomiej Dach 2023-06-22 18:51:30 +02:00 committed by GitHub
commit 65d4506ef2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 99 additions and 10 deletions

View File

@ -11,7 +11,7 @@
<AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger> <AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.618.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2023.620.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AndroidManifestOverlay Include="$(MSBuildThisFileDirectory)osu.Android\Properties\AndroidManifestOverlay.xml" /> <AndroidManifestOverlay Include="$(MSBuildThisFileDirectory)osu.Android\Properties\AndroidManifestOverlay.xml" />

View File

@ -185,7 +185,18 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
AddAssert("Ensure cursor is on a grid line", () => AddAssert("Ensure cursor is on a grid line", () =>
{ {
return grid.ChildrenOfType<CircularProgress>().Any(p => Precision.AlmostEquals(p.ScreenSpaceDrawQuad.TopRight.X, grid.ToScreenSpace(cursor.LastSnappedPosition).X)); return grid.ChildrenOfType<CircularProgress>().Any(ring =>
{
// the grid rings are actually slightly _larger_ than the snapping radii.
// this is done such that the snapping radius falls right in the middle of each grid ring thickness-wise,
// but it does however complicate the following calculations slightly.
// we want to calculate the coordinates of the rightmost point on the grid line, which is in the exact middle of the ring thickness-wise.
// for the X component, we take the entire width of the ring, minus one half of the inner radius (since we want the middle of the line on the right side).
// for the Y component, we just take 0.5f.
var rightMiddleOfGridLine = ring.ToScreenSpace(ring.DrawSize * new Vector2(1 - ring.InnerRadius / 2, 0.5f));
return Precision.AlmostEquals(rightMiddleOfGridLine.X, grid.ToScreenSpace(cursor.LastSnappedPosition).X);
});
}); });
} }

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.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Screens.Edit;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Mods
{
/// <summary>
/// Mod that colours <see cref="HitObject"/>s based on the musical division they are on
/// </summary>
public class OsuModSynesthesia : ModSynesthesia, IApplicableToBeatmap, IApplicableToDrawableHitObject
{
private readonly OsuColour colours = new OsuColour();
private IBeatmap? currentBeatmap { get; set; }
public void ApplyToBeatmap(IBeatmap beatmap)
{
//Store a reference to the current beatmap to look up the beat divisor when notes are drawn
if (currentBeatmap != beatmap)
currentBeatmap = beatmap;
}
public void ApplyToDrawableHitObject(DrawableHitObject d)
{
if (currentBeatmap == null) return;
Color4? timingBasedColour = null;
d.HitObjectApplied += _ =>
{
// slider tails are a painful edge case, as their start time is offset 36ms back (see `LegacyLastTick`).
// to work around this, look up the slider tail's parenting slider's end time instead to ensure proper snap.
double snapTime = d is DrawableSliderTail tail
? tail.Slider.GetEndTime()
: d.HitObject.StartTime;
timingBasedColour = BindableBeatDivisor.GetColourFor(currentBeatmap.ControlPointInfo.GetClosestBeatDivisor(snapTime), colours);
};
// Need to set this every update to ensure it doesn't get overwritten by DrawableHitObject.OnApply() -> UpdateComboColour().
d.OnUpdate += _ =>
{
if (timingBasedColour != null)
d.AccentColour.Value = timingBasedColour.Value;
};
}
}
}

View File

@ -204,7 +204,8 @@ namespace osu.Game.Rulesets.Osu
new MultiMod(new OsuModMagnetised(), new OsuModRepel()), new MultiMod(new OsuModMagnetised(), new OsuModRepel()),
new ModAdaptiveSpeed(), new ModAdaptiveSpeed(),
new OsuModFreezeFrame(), new OsuModFreezeFrame(),
new OsuModBubbles() new OsuModBubbles(),
new OsuModSynesthesia()
}; };
case ModType.System: case ModType.System:

View File

@ -58,16 +58,18 @@ namespace osu.Game.Overlays.BeatmapSet
private void updateDisplay() private void updateDisplay()
{ {
bpm.Value = BeatmapSet?.BPM.ToLocalisableString(@"0.##") ?? (LocalisableString)"-";
if (beatmapInfo == null) if (beatmapInfo == null)
{ {
bpm.Value = "-";
length.Value = string.Empty; length.Value = string.Empty;
circleCount.Value = string.Empty; circleCount.Value = string.Empty;
sliderCount.Value = string.Empty; sliderCount.Value = string.Empty;
} }
else else
{ {
bpm.Value = beatmapInfo.BPM.ToLocalisableString(@"0.##");
length.Value = TimeSpan.FromMilliseconds(beatmapInfo.Length).ToFormattedDuration(); length.Value = TimeSpan.FromMilliseconds(beatmapInfo.Length).ToFormattedDuration();
if (beatmapInfo is not IBeatmapOnlineInfo onlineInfo) return; if (beatmapInfo is not IBeatmapOnlineInfo onlineInfo) return;

View File

@ -118,7 +118,7 @@ namespace osu.Game.Overlays
private void updateProcessingMode() private void updateProcessingMode()
{ {
bool enabled = OverlayActivationMode.Value == OverlayActivation.All || State.Value == Visibility.Visible; bool enabled = OverlayActivationMode.Value != OverlayActivation.Disabled || State.Value == Visibility.Visible;
notificationsEnabler?.Cancel(); notificationsEnabler?.Cancel();

View File

@ -0,0 +1,19 @@
// 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.Localisation;
namespace osu.Game.Rulesets.Mods
{
/// <summary>
/// Mod that colours hitobjects based on the musical division they are on
/// </summary>
public class ModSynesthesia : Mod
{
public override string Name => "Synesthesia";
public override string Acronym => "SY";
public override LocalisableString Description => "Colours hit objects based on the rhythm.";
public override double ScoreMultiplier => 1;
public override ModType Type => ModType.Fun;
}
}

View File

@ -65,14 +65,15 @@ namespace osu.Game.Screens.Edit.Compose.Components
for (int i = 0; i < requiredCircles; i++) for (int i = 0; i < requiredCircles; i++)
{ {
float diameter = (offset + (i + 1) * DistanceBetweenTicks) * 2; const float thickness = 4;
float diameter = (offset + (i + 1) * DistanceBetweenTicks + thickness / 2) * 2;
AddInternal(new Ring(ReferenceObject, GetColourForIndexFromPlacement(i)) AddInternal(new Ring(ReferenceObject, GetColourForIndexFromPlacement(i))
{ {
Position = StartPosition, Position = StartPosition,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(diameter), Size = new Vector2(diameter),
InnerRadius = 4 * 1f / diameter, InnerRadius = thickness * 1f / diameter,
}); });
} }
} }

View File

@ -36,7 +36,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Realm" Version="10.20.0" /> <PackageReference Include="Realm" Version="10.20.0" />
<PackageReference Include="ppy.osu.Framework" Version="2023.618.0" /> <PackageReference Include="ppy.osu.Framework" Version="2023.620.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.605.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2023.605.0" />
<PackageReference Include="Sentry" Version="3.28.1" /> <PackageReference Include="Sentry" Version="3.28.1" />
<PackageReference Include="SharpCompress" Version="0.32.2" /> <PackageReference Include="SharpCompress" Version="0.32.2" />

View File

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