mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:35:10 +08:00
Merge branch 'master' into spectator-remove-back-button
This commit is contained in:
commit
92eb206b49
@ -10,7 +10,7 @@
|
||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.221.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.223.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<!-- Fody does not handle Android build well, and warns when unchanged.
|
||||
|
@ -92,9 +92,10 @@ namespace osu.Desktop
|
||||
return;
|
||||
}
|
||||
|
||||
if (status.Value == UserStatus.Online && activity.Value != null)
|
||||
if (activity.Value != null)
|
||||
{
|
||||
bool hideIdentifiableInformation = privacyMode.Value == DiscordRichPresenceMode.Limited;
|
||||
bool hideIdentifiableInformation = privacyMode.Value == DiscordRichPresenceMode.Limited || status.Value == UserStatus.DoNotDisturb;
|
||||
|
||||
presence.State = truncate(activity.Value.GetStatus(hideIdentifiableInformation));
|
||||
presence.Details = truncate(activity.Value.GetDetails(hideIdentifiableInformation) ?? string.Empty);
|
||||
|
||||
|
@ -80,11 +80,29 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
base.UpdateInitialTransforms();
|
||||
|
||||
foreach (var piece in DimmablePieces)
|
||||
{
|
||||
// if the specified dimmable piece is a DHO, it is generally not safe to tack transforms onto it directly
|
||||
// as they may be cleared via the `updateState()` DHO flow,
|
||||
// so use `ApplyCustomUpdateState` instead. which does not have this pitfall.
|
||||
if (piece is DrawableHitObject drawableObjectPiece)
|
||||
{
|
||||
// this method can be called multiple times, and we don't want to subscribe to the event more than once,
|
||||
// so this is what it is going to have to be...
|
||||
drawableObjectPiece.ApplyCustomUpdateState -= applyDimToDrawableHitObject;
|
||||
drawableObjectPiece.ApplyCustomUpdateState += applyDimToDrawableHitObject;
|
||||
}
|
||||
else
|
||||
applyDim(piece);
|
||||
}
|
||||
|
||||
void applyDim(Drawable piece)
|
||||
{
|
||||
piece.FadeColour(new Color4(195, 195, 195, 255));
|
||||
using (piece.BeginDelayedSequence(InitialLifetimeOffset - OsuHitWindows.MISS_WINDOW))
|
||||
piece.FadeColour(Color4.White, 100);
|
||||
}
|
||||
|
||||
void applyDimToDrawableHitObject(DrawableHitObject dho, ArmedState _) => applyDim(dho);
|
||||
}
|
||||
|
||||
protected sealed override double InitialLifetimeOffset => HitObject.TimePreempt;
|
||||
|
@ -44,7 +44,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
|
||||
SnakingOut.BindTo(configSnakingOut);
|
||||
|
||||
BorderSize = skin.GetConfig<OsuSkinConfiguration, float>(OsuSkinConfiguration.SliderBorderSize)?.Value ?? 1;
|
||||
BorderColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderBorder)?.Value ?? Color4.White;
|
||||
}
|
||||
|
||||
|
@ -23,29 +23,35 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
|
||||
private partial class LegacyDrawableSliderPath : DrawableSliderPath
|
||||
{
|
||||
private const float shadow_portion = 1 - (OsuLegacySkinTransformer.LEGACY_CIRCLE_RADIUS / OsuHitObject.OBJECT_RADIUS);
|
||||
|
||||
protected new float CalculatedBorderPortion
|
||||
// Roughly matches osu!stable's slider border portions.
|
||||
=> base.CalculatedBorderPortion * 0.77f;
|
||||
|
||||
protected override Color4 ColourAt(float position)
|
||||
{
|
||||
float realBorderPortion = shadow_portion + CalculatedBorderPortion;
|
||||
float realGradientPortion = 1 - realBorderPortion;
|
||||
|
||||
if (position <= shadow_portion)
|
||||
return new Color4(0f, 0f, 0f, 0.25f * position / shadow_portion);
|
||||
|
||||
if (position <= realBorderPortion)
|
||||
return BorderColour;
|
||||
|
||||
position -= realBorderPortion;
|
||||
// https://github.com/peppy/osu-stable-reference/blob/3ea48705eb67172c430371dcfc8a16a002ed0d3d/osu!/Graphics/Renderers/MmSliderRendererGL.cs#L99
|
||||
// float aaWidth = Math.Min(Math.Max(0.5f / PathRadius, 3.0f / 256.0f), 1.0f / 16.0f);
|
||||
// applying the aa_width constant from stable makes sliders blurry, especially on CS>5. set to zero for now.
|
||||
// this might be related to SmoothPath applying AA internally, but disabling that does not seem to have much of an effect.
|
||||
const float aa_width = 0f;
|
||||
|
||||
Color4 shadow = new Color4(0, 0, 0, 0.25f);
|
||||
Color4 outerColour = AccentColour.Darken(0.1f);
|
||||
Color4 innerColour = lighten(AccentColour, 0.5f);
|
||||
|
||||
return LegacyUtils.InterpolateNonLinear(position / realGradientPortion, outerColour, innerColour, 0, 1);
|
||||
// https://github.com/peppy/osu-stable-reference/blob/3ea48705eb67172c430371dcfc8a16a002ed0d3d/osu!/Graphics/Renderers/MmSliderRendererGL.cs#L59-L70
|
||||
const float shadow_portion = 1 - (OsuLegacySkinTransformer.LEGACY_CIRCLE_RADIUS / OsuHitObject.OBJECT_RADIUS);
|
||||
const float border_portion = 0.1875f;
|
||||
|
||||
if (position <= shadow_portion - aa_width)
|
||||
return LegacyUtils.InterpolateNonLinear(position, Color4.Black.Opacity(0f), shadow, 0, shadow_portion - aa_width);
|
||||
|
||||
if (position <= shadow_portion + aa_width)
|
||||
return LegacyUtils.InterpolateNonLinear(position, shadow, BorderColour, shadow_portion - aa_width, shadow_portion + aa_width);
|
||||
|
||||
if (position <= border_portion - aa_width)
|
||||
return BorderColour;
|
||||
|
||||
if (position <= border_portion + aa_width)
|
||||
return LegacyUtils.InterpolateNonLinear(position, BorderColour, outerColour, border_portion - aa_width, border_portion + aa_width);
|
||||
|
||||
return LegacyUtils.InterpolateNonLinear(position, outerColour, innerColour, border_portion + aa_width, 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -5,7 +5,6 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
{
|
||||
public enum OsuSkinConfiguration
|
||||
{
|
||||
SliderBorderSize,
|
||||
SliderPathRadius,
|
||||
CursorCentre,
|
||||
CursorExpand,
|
||||
|
@ -37,15 +37,9 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() => Child = advancedStats = new TestAdvancedStats
|
||||
{
|
||||
Width = 500
|
||||
Width = 500,
|
||||
});
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
AddStep("reset game ruleset", () => Ruleset.Value = new OsuRuleset().RulesetInfo);
|
||||
}
|
||||
|
||||
private BeatmapInfo exampleBeatmapInfo => new BeatmapInfo
|
||||
{
|
||||
Ruleset = rulesets.AvailableRulesets.First(),
|
||||
@ -74,45 +68,12 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestManiaFirstBarTextManiaBeatmap()
|
||||
public void TestFirstBarText()
|
||||
{
|
||||
AddStep("set game ruleset to mania", () => Ruleset.Value = new ManiaRuleset().RulesetInfo);
|
||||
|
||||
AddStep("set beatmap", () => advancedStats.BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
Ruleset = rulesets.GetRuleset(3) ?? throw new InvalidOperationException("osu!mania ruleset not found"),
|
||||
Difficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 5,
|
||||
DrainRate = 4.3f,
|
||||
OverallDifficulty = 4.5f,
|
||||
ApproachRate = 3.1f
|
||||
},
|
||||
StarRating = 8
|
||||
});
|
||||
|
||||
AddAssert("first bar text is correct", () => advancedStats.ChildrenOfType<SpriteText>().First().Text == BeatmapsetsStrings.ShowStatsCsMania);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestManiaFirstBarTextConvert()
|
||||
{
|
||||
AddStep("set game ruleset to mania", () => Ruleset.Value = new ManiaRuleset().RulesetInfo);
|
||||
|
||||
AddStep("set beatmap", () => advancedStats.BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
Ruleset = new OsuRuleset().RulesetInfo,
|
||||
Difficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 5,
|
||||
DrainRate = 4.3f,
|
||||
OverallDifficulty = 4.5f,
|
||||
ApproachRate = 3.1f
|
||||
},
|
||||
StarRating = 8
|
||||
});
|
||||
|
||||
AddStep("set ruleset to mania", () => advancedStats.Ruleset.Value = new ManiaRuleset().RulesetInfo);
|
||||
AddAssert("first bar text is correct", () => advancedStats.ChildrenOfType<SpriteText>().First().Text == BeatmapsetsStrings.ShowStatsCsMania);
|
||||
AddStep("set ruleset to osu", () => advancedStats.Ruleset.Value = new OsuRuleset().RulesetInfo);
|
||||
AddAssert("first bar text is correct", () => advancedStats.ChildrenOfType<SpriteText>().First().Text == BeatmapsetsStrings.ShowStatsCs);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -127,7 +127,7 @@ namespace osu.Game.Graphics.Containers
|
||||
}
|
||||
|
||||
protected virtual void ScrollFromMouseEvent(MouseEvent e) =>
|
||||
ScrollTo(Clamp(ToLocalSpace(e.ScreenSpaceMousePosition)[ScrollDim] / DrawSize[ScrollDim]) * Content.DrawSize[ScrollDim], true, DistanceDecayOnRightMouseScrollbar);
|
||||
ScrollTo(Clamp(ToLocalSpace(e.ScreenSpaceMousePosition)[ScrollDim] / DrawSize[ScrollDim] * Content.DrawSize[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar);
|
||||
|
||||
protected override ScrollbarContainer CreateScrollbar(Direction direction) => new OsuScrollbar(direction);
|
||||
|
||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays.BeatmapSet.Buttons;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.Select.Details;
|
||||
using osuTK;
|
||||
|
||||
@ -33,10 +34,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
if (value == beatmapSet) return;
|
||||
|
||||
beatmapSet = value;
|
||||
basic.BeatmapSet = preview.BeatmapSet = beatmapSet = value;
|
||||
|
||||
basic.BeatmapSet = preview.BeatmapSet = BeatmapSet;
|
||||
updateDisplay();
|
||||
if (IsLoaded)
|
||||
updateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,13 +51,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
if (value == beatmapInfo) return;
|
||||
|
||||
basic.BeatmapInfo = advanced.BeatmapInfo = beatmapInfo = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDisplay()
|
||||
{
|
||||
Ratings.Ratings = BeatmapSet?.Ratings;
|
||||
ratingBox.Alpha = BeatmapSet?.Status > 0 ? 1 : 0;
|
||||
if (IsLoaded)
|
||||
updateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
public Details()
|
||||
@ -101,12 +99,22 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
[Resolved]
|
||||
private RulesetStore rulesets { get; set; }
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
private void updateDisplay()
|
||||
{
|
||||
Ratings.Ratings = BeatmapSet?.Ratings;
|
||||
ratingBox.Alpha = BeatmapSet?.Status > 0 ? 1 : 0;
|
||||
advanced.Ruleset.Value = rulesets.GetRuleset(beatmapInfo?.Ruleset.OnlineID ?? 0);
|
||||
}
|
||||
|
||||
private partial class DetailBox : Container
|
||||
{
|
||||
private readonly Container content;
|
||||
|
@ -215,6 +215,12 @@ namespace osu.Game.Screens.Select
|
||||
InternalChild = new OsuContextMenuContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
// Avoid clash between scrollbar and osu! logo.
|
||||
Top = 10,
|
||||
Bottom = 100,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
setPool,
|
||||
|
@ -38,11 +38,6 @@ namespace osu.Game.Screens.Select.Details
|
||||
[Resolved]
|
||||
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private OsuGameBase game { get; set; }
|
||||
|
||||
private IBindable<RulesetInfo> gameRuleset;
|
||||
|
||||
protected readonly StatisticRow FirstValue, HpDrain, Accuracy, ApproachRate;
|
||||
private readonly StatisticRow starDifficulty;
|
||||
|
||||
@ -64,6 +59,15 @@ namespace osu.Game.Screens.Select.Details
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ruleset to be used for certain elements of display.
|
||||
/// When set, this will override the set <see cref="Beatmap"/>'s own ruleset.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// No checks are done as to whether the ruleset specified is valid for the currently <see cref="BeatmapInfo"/>.
|
||||
/// </remarks>
|
||||
public Bindable<RulesetInfo> Ruleset { get; } = new Bindable<RulesetInfo>();
|
||||
|
||||
public AdvancedStats(int columns = 1)
|
||||
{
|
||||
switch (columns)
|
||||
@ -137,12 +141,7 @@ namespace osu.Game.Screens.Select.Details
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
// the cached ruleset bindable might be a decoupled bindable provided by SongSelect,
|
||||
// which we can't rely on in combination with the game-wide selected mods list,
|
||||
// since mods could be updated to the new ruleset instances while the decoupled bindable is held behind,
|
||||
// therefore resulting in performing difficulty calculation with invalid states.
|
||||
gameRuleset = game.Ruleset.GetBoundCopy();
|
||||
gameRuleset.BindValueChanged(_ => updateStatistics());
|
||||
Ruleset.BindValueChanged(_ => updateStatistics());
|
||||
|
||||
mods.BindValueChanged(modsChanged, true);
|
||||
}
|
||||
@ -169,8 +168,6 @@ namespace osu.Game.Screens.Select.Details
|
||||
IBeatmapDifficultyInfo baseDifficulty = BeatmapInfo?.Difficulty;
|
||||
BeatmapDifficulty adjustedDifficulty = null;
|
||||
|
||||
IRulesetInfo ruleset = gameRuleset?.Value ?? beatmapInfo.Ruleset;
|
||||
|
||||
if (baseDifficulty != null)
|
||||
{
|
||||
BeatmapDifficulty originalDifficulty = new BeatmapDifficulty(baseDifficulty);
|
||||
@ -180,24 +177,24 @@ namespace osu.Game.Screens.Select.Details
|
||||
|
||||
adjustedDifficulty = originalDifficulty;
|
||||
|
||||
if (gameRuleset != null)
|
||||
if (Ruleset.Value != null)
|
||||
{
|
||||
double rate = 1;
|
||||
foreach (var mod in mods.Value.OfType<IApplicableToRate>())
|
||||
rate = mod.ApplyToRate(0, rate);
|
||||
|
||||
adjustedDifficulty = ruleset.CreateInstance().GetRateAdjustedDisplayDifficulty(originalDifficulty, rate);
|
||||
adjustedDifficulty = Ruleset.Value.CreateInstance().GetRateAdjustedDisplayDifficulty(originalDifficulty, rate);
|
||||
|
||||
TooltipContent = new AdjustedAttributesTooltip.Data(originalDifficulty, adjustedDifficulty);
|
||||
}
|
||||
}
|
||||
|
||||
switch (ruleset.OnlineID)
|
||||
switch (Ruleset.Value?.OnlineID)
|
||||
{
|
||||
case 3:
|
||||
// Account for mania differences locally for now.
|
||||
// Eventually this should be handled in a more modular way, allowing rulesets to return arbitrary difficulty attributes.
|
||||
ILegacyRuleset legacyRuleset = (ILegacyRuleset)ruleset.CreateInstance();
|
||||
ILegacyRuleset legacyRuleset = (ILegacyRuleset)Ruleset.Value.CreateInstance();
|
||||
|
||||
// For the time being, the key count is static no matter what, because:
|
||||
// a) The method doesn't have knowledge of the active keymods. Doing so may require considerations for filtering.
|
||||
@ -206,7 +203,6 @@ namespace osu.Game.Screens.Select.Details
|
||||
|
||||
FirstValue.Title = BeatmapsetsStrings.ShowStatsCsMania;
|
||||
FirstValue.Value = (keyCount, keyCount);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -240,8 +236,8 @@ namespace osu.Game.Screens.Select.Details
|
||||
|
||||
starDifficultyCancellationSource = new CancellationTokenSource();
|
||||
|
||||
var normalStarDifficultyTask = difficultyCache.GetDifficultyAsync(BeatmapInfo, gameRuleset.Value, null, starDifficultyCancellationSource.Token);
|
||||
var moddedStarDifficultyTask = difficultyCache.GetDifficultyAsync(BeatmapInfo, gameRuleset.Value, mods.Value, starDifficultyCancellationSource.Token);
|
||||
var normalStarDifficultyTask = difficultyCache.GetDifficultyAsync(BeatmapInfo, Ruleset.Value, null, starDifficultyCancellationSource.Token);
|
||||
var moddedStarDifficultyTask = difficultyCache.GetDifficultyAsync(BeatmapInfo, Ruleset.Value, mods.Value, starDifficultyCancellationSource.Token);
|
||||
|
||||
Task.WhenAll(normalStarDifficultyTask, moddedStarDifficultyTask).ContinueWith(_ => Schedule(() =>
|
||||
{
|
||||
|
@ -286,7 +286,7 @@ namespace osu.Game.Screens.Select
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Padding = new MarginPadding(10)
|
||||
Padding = new MarginPadding(10),
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -585,6 +585,11 @@ namespace osu.Game.Screens.Select
|
||||
beatmapInfoPrevious = beatmap;
|
||||
}
|
||||
|
||||
// we can't run this in the debounced run due to the selected mods bindable not being debounced,
|
||||
// since mods could be updated to the new ruleset instances while the decoupled bindable is held behind,
|
||||
// therefore resulting in performing difficulty calculation with invalid states.
|
||||
advancedStats.Ruleset.Value = ruleset;
|
||||
|
||||
void run()
|
||||
{
|
||||
// clear pending task immediately to track any potential nested debounce operation.
|
||||
|
@ -36,7 +36,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="11.5.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2024.221.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2024.223.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.207.0" />
|
||||
<PackageReference Include="Sentry" Version="3.41.3" />
|
||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||
|
@ -23,6 +23,6 @@
|
||||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.221.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.223.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user