1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 09:23:06 +08:00

Merge branch 'master' into beatmap-track-rework

This commit is contained in:
Dan Balasescu 2020-09-01 16:06:38 +09:00 committed by GitHub
commit f08e7828da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 999 additions and 313 deletions

View File

@ -6,6 +6,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Skinning
{
@ -61,7 +62,12 @@ namespace osu.Game.Rulesets.Catch.Skinning
switch (lookup)
{
case CatchSkinColour colour:
return Source.GetConfig<SkinCustomColourLookup, TValue>(new SkinCustomColourLookup(colour));
var result = (Bindable<Color4>)Source.GetConfig<SkinCustomColourLookup, TValue>(new SkinCustomColourLookup(colour));
if (result == null)
return null;
result.Value = LegacyColourCompatibility.DisallowZeroAlpha(result.Value);
return (IBindable<TValue>)result;
}
return Source.GetConfig<TLookup, TValue>(lookup);

View File

@ -40,7 +40,6 @@ namespace osu.Game.Rulesets.Catch.Skinning
colouredSprite = new Sprite
{
Texture = skin.GetTexture(lookupName),
Colour = drawableObject.AccentColour.Value,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
@ -76,7 +75,7 @@ namespace osu.Game.Rulesets.Catch.Skinning
{
base.LoadComplete();
accentColour.BindValueChanged(colour => colouredSprite.Colour = colour.NewValue, true);
accentColour.BindValueChanged(colour => colouredSprite.Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue), true);
}
}
}

View File

@ -23,6 +23,7 @@ namespace osu.Game.Rulesets.Mania.Tests
[TestCase(LegacyMods.Perfect | LegacyMods.SuddenDeath, new[] { typeof(ManiaModPerfect) })]
[TestCase(LegacyMods.Perfect | LegacyMods.SuddenDeath | LegacyMods.DoubleTime, new[] { typeof(ManiaModDoubleTime), typeof(ManiaModPerfect) })]
[TestCase(LegacyMods.Random | LegacyMods.SuddenDeath, new[] { typeof(ManiaModRandom), typeof(ManiaModSuddenDeath) })]
[TestCase(LegacyMods.Flashlight | LegacyMods.Mirror, new[] { typeof(ManiaModFlashlight), typeof(ManiaModMirror) })]
public new void Test(LegacyMods legacyMods, Type[] expectedMods) => base.Test(legacyMods, expectedMods);
protected override Ruleset CreateRuleset() => new ManiaRuleset();

View File

@ -22,18 +22,22 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
[Cached]
private readonly Column column;
public ColumnTestContainer(int column, ManiaAction action)
public ColumnTestContainer(int column, ManiaAction action, bool showColumn = false)
{
this.column = new Column(column)
InternalChildren = new[]
{
Action = { Value = action },
AccentColour = Color4.Orange,
ColumnType = column % 2 == 0 ? ColumnType.Even : ColumnType.Odd
};
InternalChild = content = new ManiaInputManager(new ManiaRuleset().RulesetInfo, 4)
{
RelativeSizeAxes = Axes.Both
this.column = new Column(column)
{
Action = { Value = action },
AccentColour = Color4.Orange,
ColumnType = column % 2 == 0 ? ColumnType.Even : ColumnType.Odd,
Alpha = showColumn ? 1 : 0
},
content = new ManiaInputManager(new ManiaRuleset().RulesetInfo, 4)
{
RelativeSizeAxes = Axes.Both
},
this.column.TopLevelContainer.CreateProxy()
};
}
}

View File

@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
Direction = FillDirection.Horizontal,
Children = new Drawable[]
{
new ColumnTestContainer(0, ManiaAction.Key1)
new ColumnTestContainer(0, ManiaAction.Key1, true)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
}));
})
},
new ColumnTestContainer(1, ManiaAction.Key2)
new ColumnTestContainer(1, ManiaAction.Key2, true)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -0,0 +1,117 @@
// 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.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Extensions.TypeExtensions;
using osu.Framework.Screens;
using osu.Framework.Utils;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Replays;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Replays;
using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Mania.Tests
{
public class TestSceneOutOfOrderHits : RateAdjustedBeatmapTestScene
{
[Test]
public void TestPreviousHitWindowDoesNotExtendPastNextObject()
{
var objects = new List<ManiaHitObject>();
var frames = new List<ReplayFrame>();
for (int i = 0; i < 7; i++)
{
double time = 1000 + i * 100;
objects.Add(new Note { StartTime = time });
if (i > 0)
{
frames.Add(new ManiaReplayFrame(time + 10, ManiaAction.Key1));
frames.Add(new ManiaReplayFrame(time + 11));
}
}
performTest(objects, frames);
addJudgementAssert(objects[0], HitResult.Miss);
for (int i = 1; i < 7; i++)
{
addJudgementAssert(objects[i], HitResult.Perfect);
addJudgementOffsetAssert(objects[i], 10);
}
}
private void addJudgementAssert(ManiaHitObject hitObject, HitResult result)
{
AddAssert($"({hitObject.GetType().ReadableName()} @ {hitObject.StartTime}) judgement is {result}",
() => judgementResults.Single(r => r.HitObject == hitObject).Type == result);
}
private void addJudgementOffsetAssert(ManiaHitObject hitObject, double offset)
{
AddAssert($"({hitObject.GetType().ReadableName()} @ {hitObject.StartTime}) judged at {offset}",
() => Precision.AlmostEquals(judgementResults.Single(r => r.HitObject == hitObject).TimeOffset, offset, 100));
}
private ScoreAccessibleReplayPlayer currentPlayer;
private List<JudgementResult> judgementResults;
private void performTest(List<ManiaHitObject> hitObjects, List<ReplayFrame> frames)
{
AddStep("load player", () =>
{
Beatmap.Value = CreateWorkingBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 })
{
HitObjects = hitObjects,
BeatmapInfo =
{
Ruleset = new ManiaRuleset().RulesetInfo
},
});
Beatmap.Value.Beatmap.ControlPointInfo.Add(0, new DifficultyControlPoint { SpeedMultiplier = 0.1f });
var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } });
p.OnLoadComplete += _ =>
{
p.ScoreProcessor.NewJudgement += result =>
{
if (currentPlayer == p) judgementResults.Add(result);
};
};
LoadScreen(currentPlayer = p);
judgementResults = new List<JudgementResult>();
});
AddUntilStep("Beatmap at 0", () => Beatmap.Value.Track.CurrentTime == 0);
AddUntilStep("Wait until player is loaded", () => currentPlayer.IsCurrentScreen());
AddUntilStep("Wait for completion", () => currentPlayer.ScoreProcessor.HasCompleted.Value);
}
private class ScoreAccessibleReplayPlayer : ReplayPlayer
{
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
protected override bool PauseOnFocusLost => false;
public ScoreAccessibleReplayPlayer(Score score)
: base(score, false, false)
{
}
}
}
}

View File

@ -126,6 +126,9 @@ namespace osu.Game.Rulesets.Mania
if (mods.HasFlag(LegacyMods.Random))
yield return new ManiaModRandom();
if (mods.HasFlag(LegacyMods.Mirror))
yield return new ManiaModMirror();
}
public override LegacyMods ConvertToLegacyMods(Mod[] mods)
@ -175,6 +178,10 @@ namespace osu.Game.Rulesets.Mania
case ManiaModFadeIn _:
value |= LegacyMods.FadeIn;
break;
case ManiaModMirror _:
value |= LegacyMods.Mirror;
break;
}
}
@ -326,6 +333,16 @@ namespace osu.Game.Rulesets.Mania
Height = 250
}),
}
},
new StatisticRow
{
Columns = new[]
{
new StatisticItem(string.Empty, new SimpleStatisticTable(3, new SimpleStatisticItem[]
{
new UnstableRate(score.HitEvents)
}))
}
}
};
}

View File

@ -238,7 +238,10 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (Tail.AllJudged)
{
ApplyResult(r => r.Type = HitResult.Perfect);
endHold();
}
if (Tail.Result.Type == HitResult.Miss)
HasBroken = true;
@ -252,6 +255,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
if (action != Action.Value)
return false;
if (CheckHittable?.Invoke(this, Time.Current) == false)
return false;
// The tail has a lenience applied to it which is factored into the miss window (i.e. the miss judgement will be delayed).
// But the hold cannot ever be started within the late-lenience window, so we should skip trying to begin the hold during that time.
// Note: Unlike below, we use the tail's start time to determine the time offset.

View File

@ -1,6 +1,7 @@
// 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 JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -8,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
@ -34,6 +36,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
}
}
/// <summary>
/// Whether this <see cref="DrawableManiaHitObject"/> can be hit, given a time value.
/// If non-null, judgements will be ignored whilst the function returns false.
/// </summary>
public Func<DrawableHitObject, double, bool> CheckHittable;
protected DrawableManiaHitObject(ManiaHitObject hitObject)
: base(hitObject)
{
@ -124,6 +132,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
break;
}
}
/// <summary>
/// Causes this <see cref="DrawableManiaHitObject"/> to get missed, disregarding all conditions in implementations of <see cref="DrawableHitObject.CheckForResult"/>.
/// </summary>
public void MissForcefully() => ApplyResult(r => r.Type = HitResult.Miss);
}
public abstract class DrawableManiaHitObject<TObject> : DrawableManiaHitObject

View File

@ -64,6 +64,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
if (action != Action.Value)
return false;
if (CheckHittable?.Invoke(this, Time.Current) == false)
return false;
return UpdateResult(true);
}

View File

@ -0,0 +1,46 @@
// 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.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Mania.Skinning
{
public class HitTargetInsetContainer : Container
{
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
protected override Container<Drawable> Content => content;
private readonly Container content;
private float hitPosition;
public HitTargetInsetContainer()
{
RelativeSizeAxes = Axes.Both;
InternalChild = content = new Container { RelativeSizeAxes = Axes.Both };
}
[BackgroundDependencyLoader]
private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
{
hitPosition = skin.GetManiaSkinConfig<float>(LegacyManiaSkinConfigurationLookups.HitPosition)?.Value ?? Stage.HIT_TARGET_POSITION;
direction.BindTo(scrollingInfo.Direction);
direction.BindValueChanged(onDirectionChanged, true);
}
private void onDirectionChanged(ValueChangedEvent<ScrollingDirection> direction)
{
content.Padding = direction.NewValue == ScrollingDirection.Up
? new MarginPadding { Top = hitPosition }
: new MarginPadding { Bottom = hitPosition };
}
}
}

View File

@ -1,6 +1,8 @@
// 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 JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -19,7 +21,14 @@ namespace osu.Game.Rulesets.Mania.Skinning
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
private readonly IBindable<bool> isHitting = new Bindable<bool>();
private Drawable sprite;
[CanBeNull]
private Drawable bodySprite;
[CanBeNull]
private Drawable lightContainer;
[CanBeNull]
private Drawable light;
public LegacyBodyPiece()
{
@ -32,7 +41,39 @@ namespace osu.Game.Rulesets.Mania.Skinning
string imageName = GetColumnSkinConfig<string>(skin, LegacyManiaSkinConfigurationLookups.HoldNoteBodyImage)?.Value
?? $"mania-note{FallbackColumnIndex}L";
sprite = skin.GetAnimation(imageName, WrapMode.ClampToEdge, WrapMode.ClampToEdge, true, true).With(d =>
string lightImage = GetColumnSkinConfig<string>(skin, LegacyManiaSkinConfigurationLookups.HoldNoteLightImage)?.Value
?? "lightingL";
float lightScale = GetColumnSkinConfig<float>(skin, LegacyManiaSkinConfigurationLookups.HoldNoteLightScale)?.Value
?? 1;
// Create a temporary animation to retrieve the number of frames, in an effort to calculate the intended frame length.
// This animation is discarded and re-queried with the appropriate frame length afterwards.
var tmp = skin.GetAnimation(lightImage, true, false);
double frameLength = 0;
if (tmp is IFramedAnimation tmpAnimation && tmpAnimation.FrameCount > 0)
frameLength = Math.Max(1000 / 60.0, 170.0 / tmpAnimation.FrameCount);
light = skin.GetAnimation(lightImage, true, true, frameLength: frameLength).With(d =>
{
if (d == null)
return;
d.Origin = Anchor.Centre;
d.Blending = BlendingParameters.Additive;
d.Scale = new Vector2(lightScale);
});
if (light != null)
{
lightContainer = new HitTargetInsetContainer
{
Alpha = 0,
Child = light
};
}
bodySprite = skin.GetAnimation(imageName, WrapMode.ClampToEdge, WrapMode.ClampToEdge, true, true).With(d =>
{
if (d == null)
return;
@ -47,8 +88,8 @@ namespace osu.Game.Rulesets.Mania.Skinning
// Todo: Wrap
});
if (sprite != null)
InternalChild = sprite;
if (bodySprite != null)
InternalChild = bodySprite;
direction.BindTo(scrollingInfo.Direction);
direction.BindValueChanged(onDirectionChanged, true);
@ -60,28 +101,68 @@ namespace osu.Game.Rulesets.Mania.Skinning
private void onIsHittingChanged(ValueChangedEvent<bool> isHitting)
{
if (!(sprite is TextureAnimation animation))
if (bodySprite is TextureAnimation bodyAnimation)
{
bodyAnimation.GotoFrame(0);
bodyAnimation.IsPlaying = isHitting.NewValue;
}
if (lightContainer == null)
return;
animation.GotoFrame(0);
animation.IsPlaying = isHitting.NewValue;
if (isHitting.NewValue)
{
// Clear the fade out and, more importantly, the removal.
lightContainer.ClearTransforms();
// Only add the container if the removal has taken place.
if (lightContainer.Parent == null)
Column.TopLevelContainer.Add(lightContainer);
// The light must be seeked only after being loaded, otherwise a nullref occurs (https://github.com/ppy/osu-framework/issues/3847).
if (light is TextureAnimation lightAnimation)
lightAnimation.GotoFrame(0);
lightContainer.FadeIn(80);
}
else
{
lightContainer.FadeOut(120)
.OnComplete(d => Column.TopLevelContainer.Remove(d));
}
}
private void onDirectionChanged(ValueChangedEvent<ScrollingDirection> direction)
{
if (sprite == null)
return;
if (direction.NewValue == ScrollingDirection.Up)
{
sprite.Origin = Anchor.BottomCentre;
sprite.Scale = new Vector2(1, -1);
if (bodySprite != null)
{
bodySprite.Origin = Anchor.BottomCentre;
bodySprite.Scale = new Vector2(1, -1);
}
if (light != null)
light.Anchor = Anchor.TopCentre;
}
else
{
sprite.Origin = Anchor.TopCentre;
sprite.Scale = Vector2.One;
if (bodySprite != null)
{
bodySprite.Origin = Anchor.TopCentre;
bodySprite.Scale = Vector2.One;
}
if (light != null)
light.Anchor = Anchor.BottomCentre;
}
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
lightContainer?.Expire();
}
}
}

View File

@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Mania.Skinning
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Colour = lightColour,
Colour = LegacyColourCompatibility.DisallowZeroAlpha(lightColour),
Texture = skin.GetTexture(lightImage),
RelativeSizeAxes = Axes.X,
Width = 1,

View File

@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Mania.Skinning
Anchor = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
Height = 1,
Colour = lineColour,
Colour = LegacyColourCompatibility.DisallowZeroAlpha(lineColour),
Alpha = showJudgementLine ? 0.9f : 0
}
}

View File

@ -65,6 +65,9 @@ namespace osu.Game.Rulesets.Mania.Skinning
direction.BindTo(scrollingInfo.Direction);
direction.BindValueChanged(onDirectionChanged, true);
if (GetColumnSkinConfig<bool>(skin, LegacyManiaSkinConfigurationLookups.KeysUnderNotes)?.Value ?? false)
Column.UnderlayElements.Add(CreateProxy());
}
private void onDirectionChanged(ValueChangedEvent<ScrollingDirection> direction)

View File

@ -2,14 +2,12 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
@ -108,75 +106,43 @@ namespace osu.Game.Rulesets.Mania.Skinning
InternalChildren = new Drawable[]
{
new Container
LegacyColourCompatibility.ApplyWithDoubledAlpha(new Box
{
RelativeSizeAxes = Axes.Both,
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = backgroundColour
},
},
RelativeSizeAxes = Axes.Both
}, backgroundColour),
new HitTargetInsetContainer
{
RelativeSizeAxes = Axes.Both,
Children = new[]
{
new Box
new Container
{
RelativeSizeAxes = Axes.Y,
Width = leftLineWidth,
Scale = new Vector2(0.740f, 1),
Colour = lineColour,
Alpha = hasLeftLine ? 1 : 0
Alpha = hasLeftLine ? 1 : 0,
Child = LegacyColourCompatibility.ApplyWithDoubledAlpha(new Box
{
RelativeSizeAxes = Axes.Both
}, lineColour)
},
new Box
new Container
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Y,
Width = rightLineWidth,
Scale = new Vector2(0.740f, 1),
Colour = lineColour,
Alpha = hasRightLine ? 1 : 0
Alpha = hasRightLine ? 1 : 0,
Child = LegacyColourCompatibility.ApplyWithDoubledAlpha(new Box
{
RelativeSizeAxes = Axes.Both
}, lineColour)
},
}
}
};
}
}
private class HitTargetInsetContainer : Container
{
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
protected override Container<Drawable> Content => content;
private readonly Container content;
private float hitPosition;
public HitTargetInsetContainer()
{
RelativeSizeAxes = Axes.Both;
InternalChild = content = new Container { RelativeSizeAxes = Axes.Both };
}
[BackgroundDependencyLoader]
private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
{
hitPosition = skin.GetManiaSkinConfig<float>(LegacyManiaSkinConfigurationLookups.HitPosition)?.Value ?? Stage.HIT_TARGET_POSITION;
direction.BindTo(scrollingInfo.Direction);
direction.BindValueChanged(onDirectionChanged, true);
}
private void onDirectionChanged(ValueChangedEvent<ScrollingDirection> direction)
{
content.Padding = direction.NewValue == ScrollingDirection.Up
? new MarginPadding { Top = hitPosition }
: new MarginPadding { Bottom = hitPosition };
}
}
}
}

View File

@ -17,6 +17,7 @@ using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning;
using osuTK;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.UI
{
@ -36,6 +37,7 @@ namespace osu.Game.Rulesets.Mania.UI
public readonly ColumnHitObjectArea HitObjectArea;
internal readonly Container TopLevelContainer;
private readonly DrawablePool<PoolableHitExplosion> hitExplosionPool;
private readonly OrderedHitPolicy hitPolicy;
public Container UnderlayElements => HitObjectArea.UnderlayElements;
@ -65,6 +67,8 @@ namespace osu.Game.Rulesets.Mania.UI
TopLevelContainer = new Container { RelativeSizeAxes = Axes.Both }
};
hitPolicy = new OrderedHitPolicy(HitObjectContainer);
TopLevelContainer.Add(HitObjectArea.Explosions.CreateProxy());
}
@ -90,6 +94,9 @@ namespace osu.Game.Rulesets.Mania.UI
hitObject.AccentColour.Value = AccentColour;
hitObject.OnNewResult += OnNewResult;
DrawableManiaHitObject maniaObject = (DrawableManiaHitObject)hitObject;
maniaObject.CheckHittable = hitPolicy.IsHittable;
HitObjectContainer.Add(hitObject);
}
@ -104,6 +111,9 @@ namespace osu.Game.Rulesets.Mania.UI
internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)
{
if (result.IsHit)
hitPolicy.HandleHit(judgedObject);
if (!result.IsHit || !judgedObject.DisplayResult || !DisplayJudgements.Value)
return;

View File

@ -0,0 +1,78 @@
// 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.Extensions.IEnumerableExtensions;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mania.UI
{
/// <summary>
/// Ensures that only the most recent <see cref="HitObject"/> is hittable, affectionately known as "note lock".
/// </summary>
public class OrderedHitPolicy
{
private readonly HitObjectContainer hitObjectContainer;
public OrderedHitPolicy(HitObjectContainer hitObjectContainer)
{
this.hitObjectContainer = hitObjectContainer;
}
/// <summary>
/// Determines whether a <see cref="DrawableHitObject"/> can be hit at a point in time.
/// </summary>
/// <remarks>
/// Only the most recent <see cref="DrawableHitObject"/> can be hit, a previous hitobject's window cannot extend past the next one.
/// </remarks>
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to check.</param>
/// <param name="time">The time to check.</param>
/// <returns>Whether <paramref name="hitObject"/> can be hit at the given <paramref name="time"/>.</returns>
public bool IsHittable(DrawableHitObject hitObject, double time)
{
var nextObject = hitObjectContainer.AliveObjects.GetNext(hitObject);
return nextObject == null || time < nextObject.HitObject.StartTime;
}
/// <summary>
/// Handles a <see cref="HitObject"/> being hit to potentially miss all earlier <see cref="HitObject"/>s.
/// </summary>
/// <param name="hitObject">The <see cref="HitObject"/> that was hit.</param>
public void HandleHit(DrawableHitObject hitObject)
{
if (!IsHittable(hitObject, hitObject.HitObject.StartTime + hitObject.Result.TimeOffset))
throw new InvalidOperationException($"A {hitObject} was hit before it became hittable!");
foreach (var obj in enumerateHitObjectsUpTo(hitObject.HitObject.StartTime))
{
if (obj.Judged)
continue;
((DrawableManiaHitObject)obj).MissForcefully();
}
}
private IEnumerable<DrawableHitObject> enumerateHitObjectsUpTo(double targetTime)
{
foreach (var obj in hitObjectContainer.AliveObjects)
{
if (obj.HitObject.GetEndTime() >= targetTime)
yield break;
yield return obj;
foreach (var nestedObj in obj.NestedHitObjects)
{
if (nestedObj.HitObject.GetEndTime() >= targetTime)
break;
yield return nestedObj;
}
}
}
}
}

View File

@ -79,7 +79,6 @@ namespace osu.Game.Rulesets.Mania.UI
columnFlow = new ColumnFlow<Column>(definition)
{
RelativeSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = COLUMN_SPACING, Right = COLUMN_SPACING },
},
new Container
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -9,6 +9,7 @@ using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osuTK;
namespace osu.Game.Rulesets.Osu.Tests
{
@ -62,7 +63,8 @@ namespace osu.Game.Rulesets.Osu.Tests
drawableSpinner = new TestDrawableSpinner(spinner, auto)
{
Anchor = Anchor.Centre,
Depth = depthIndex++
Depth = depthIndex++,
Scale = new Vector2(0.75f)
};
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObjects>())

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected override float SamplePlaybackPosition => HitObject.X / OsuPlayfield.BASE_SIZE.X;
/// <summary>
/// Whether this <see cref="DrawableOsuHitObject"/> can be hit.
/// Whether this <see cref="DrawableOsuHitObject"/> can be hit, given a time value.
/// If non-null, judgements will be ignored (resulting in a shake) whilst the function returns false.
/// </summary>
public Func<DrawableHitObject, double, bool> CheckHittable;

View File

@ -193,30 +193,46 @@ namespace osu.Game.Rulesets.Osu
public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new OsuRulesetConfigManager(settings, RulesetInfo);
public override StatisticRow[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap) => new[]
public override StatisticRow[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap)
{
new StatisticRow
var timedHitEvents = score.HitEvents.Where(e => e.HitObject is HitCircle && !(e.HitObject is SliderTailCircle)).ToList();
return new[]
{
Columns = new[]
new StatisticRow
{
new StatisticItem("Timing Distribution", new HitEventTimingDistributionGraph(score.HitEvents.Where(e => e.HitObject is HitCircle && !(e.HitObject is SliderTailCircle)).ToList())
Columns = new[]
{
RelativeSizeAxes = Axes.X,
Height = 250
}),
}
},
new StatisticRow
{
Columns = new[]
new StatisticItem("Timing Distribution",
new HitEventTimingDistributionGraph(timedHitEvents)
{
RelativeSizeAxes = Axes.X,
Height = 250
}),
}
},
new StatisticRow
{
new StatisticItem("Accuracy Heatmap", new AccuracyHeatmap(score, playableBeatmap)
Columns = new[]
{
RelativeSizeAxes = Axes.X,
Height = 250
}),
new StatisticItem("Accuracy Heatmap", new AccuracyHeatmap(score, playableBeatmap)
{
RelativeSizeAxes = Axes.X,
Height = 250
}),
}
},
new StatisticRow
{
Columns = new[]
{
new StatisticItem(string.Empty, new SimpleStatisticTable(3, new SimpleStatisticItem[]
{
new UnstableRate(timedHitEvents)
}))
}
}
}
};
};
}
}
}

View File

@ -154,8 +154,12 @@ namespace osu.Game.Rulesets.Osu.Replays
// The startPosition for the slider should not be its .Position, but the point on the circle whose tangent crosses the current cursor position
// We also modify spinnerDirection so it spins in the direction it enters the spin circle, to make a smooth transition.
// TODO: Shouldn't the spinner always spin in the same direction?
if (h is Spinner)
if (h is Spinner spinner)
{
// spinners with 0 spins required will auto-complete - don't bother
if (spinner.SpinsRequired == 0)
return;
calcSpinnerStartPosAndDirection(((OsuReplayFrame)Frames[^1]).Position, out startPosition, out spinnerDirection);
Vector2 spinCentreOffset = SPINNER_CENTRE - ((OsuReplayFrame)Frames[^1]).Position;

View File

@ -59,7 +59,6 @@ namespace osu.Game.Rulesets.Osu.Skinning
hitCircleSprite = new Sprite
{
Texture = getTextureWithFallback(string.Empty),
Colour = drawableObject.AccentColour.Value,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
@ -107,7 +106,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
base.LoadComplete();
state.BindValueChanged(updateState, true);
accentColour.BindValueChanged(colour => hitCircleSprite.Colour = colour.NewValue, true);
accentColour.BindValueChanged(colour => hitCircleSprite.Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue), true);
indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true);
}

View File

@ -22,11 +22,11 @@ namespace osu.Game.Rulesets.Osu.Skinning
{
private DrawableSpinner drawableSpinner;
private Sprite disc;
private Sprite metreSprite;
private Container metre;
private const float background_y_offset = 20;
private const float sprite_scale = 1 / 1.6f;
private const float final_metre_height = 692 * sprite_scale;
[BackgroundDependencyLoader]
private void load(ISkinSource source, DrawableHitObject drawableObject)
@ -35,50 +35,58 @@ namespace osu.Game.Rulesets.Osu.Skinning
RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
InternalChild = new Container
{
new Sprite
// the old-style spinner relied heavily on absolute screen-space coordinate values.
// wrap everything in a container simulating absolute coords to preserve alignment
// as there are skins that depend on it.
Width = 640,
Height = 480,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Texture = source.GetTexture("spinner-background"),
Y = background_y_offset,
Scale = new Vector2(sprite_scale)
},
disc = new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = source.GetTexture("spinner-circle"),
Scale = new Vector2(sprite_scale)
},
metre = new Container
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Y = background_y_offset,
Masking = true,
Child = new Sprite
new Sprite
{
Texture = source.GetTexture("spinner-metre"),
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = source.GetTexture("spinner-background"),
Scale = new Vector2(sprite_scale)
},
Scale = new Vector2(0.625f)
disc = new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = source.GetTexture("spinner-circle"),
Scale = new Vector2(sprite_scale)
},
metre = new Container
{
AutoSizeAxes = Axes.Both,
// this anchor makes no sense, but that's what stable uses.
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
// adjustment for stable (metre has additional offset)
Margin = new MarginPadding { Top = 20 },
Masking = true,
Child = metreSprite = new Sprite
{
Texture = source.GetTexture("spinner-metre"),
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Scale = new Vector2(0.625f)
}
}
}
};
}
private Vector2 metreFinalSize;
protected override void LoadComplete()
{
base.LoadComplete();
this.FadeOut();
drawableSpinner.State.BindValueChanged(updateStateTransforms, true);
metreFinalSize = metre.Size = metre.Child.Size;
}
private void updateStateTransforms(ValueChangedEvent<ArmedState> state)
@ -93,7 +101,16 @@ namespace osu.Game.Rulesets.Osu.Skinning
{
base.Update();
disc.Rotation = drawableSpinner.RotationTracker.Rotation;
metre.Height = getMetreHeight(drawableSpinner.Progress);
// careful: need to call this exactly once for all calculations in a frame
// as the function has a random factor in it
var metreHeight = getMetreHeight(drawableSpinner.Progress);
// hack to make the metre blink up from below than down from above.
// move down the container to be able to apply masking for the metre,
// and then move the sprite back up the same amount to keep its position absolute.
metre.Y = final_metre_height - metreHeight;
metreSprite.Y = -metre.Y;
}
private const int total_bars = 10;
@ -108,7 +125,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
if (RNG.NextBool(((int)progress % 10) / 10f))
barCount++;
return (float)barCount / total_bars * metreFinalSize.Y;
return (float)barCount / total_bars * final_metre_height;
}
}
}

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
[BackgroundDependencyLoader]
private void load(ISkinSource skin, DrawableHitObject drawableObject)
{
animationContent.Colour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderBall)?.Value ?? Color4.White;
var ballColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderBall)?.Value ?? Color4.White;
InternalChildren = new[]
{
@ -39,11 +39,11 @@ namespace osu.Game.Rulesets.Osu.Skinning
Texture = skin.GetTexture("sliderb-nd"),
Colour = new Color4(5, 5, 5, 255),
},
animationContent.With(d =>
LegacyColourCompatibility.ApplyWithDoubledAlpha(animationContent.With(d =>
{
d.Anchor = Anchor.Centre;
d.Origin = Anchor.Centre;
}),
}), ballColour),
layerSpec = new Sprite
{
Anchor = Anchor.Centre,

View File

@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning
private void updateAccentColour()
{
backgroundLayer.Colour = accentColour;
backgroundLayer.Colour = LegacyColourCompatibility.DisallowZeroAlpha(accentColour);
}
}
}

View File

@ -76,9 +76,11 @@ namespace osu.Game.Rulesets.Taiko.Skinning
private void updateAccentColour()
{
headCircle.AccentColour = accentColour;
body.Colour = accentColour;
end.Colour = accentColour;
var colour = LegacyColourCompatibility.DisallowZeroAlpha(accentColour);
headCircle.AccentColour = colour;
body.Colour = colour;
end.Colour = colour;
}
}
}

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Skinning;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Taiko.Skinning
@ -18,9 +19,10 @@ namespace osu.Game.Rulesets.Taiko.Skinning
[BackgroundDependencyLoader]
private void load()
{
AccentColour = component == TaikoSkinComponents.CentreHit
? new Color4(235, 69, 44, 255)
: new Color4(67, 142, 172, 255);
AccentColour = LegacyColourCompatibility.DisallowZeroAlpha(
component == TaikoSkinComponents.CentreHit
? new Color4(235, 69, 44, 255)
: new Color4(67, 142, 172, 255));
}
}
}

View File

@ -161,19 +161,34 @@ namespace osu.Game.Rulesets.Taiko
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TaikoReplayFrame();
public override StatisticRow[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap) => new[]
public override StatisticRow[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap)
{
new StatisticRow
var timedHitEvents = score.HitEvents.Where(e => e.HitObject is Hit).ToList();
return new[]
{
Columns = new[]
new StatisticRow
{
new StatisticItem("Timing Distribution", new HitEventTimingDistributionGraph(score.HitEvents.Where(e => e.HitObject is Hit).ToList())
Columns = new[]
{
RelativeSizeAxes = Axes.X,
Height = 250
}),
new StatisticItem("Timing Distribution", new HitEventTimingDistributionGraph(timedHitEvents)
{
RelativeSizeAxes = Axes.X,
Height = 250
}),
}
},
new StatisticRow
{
Columns = new[]
{
new StatisticItem(string.Empty, new SimpleStatisticTable(3, new SimpleStatisticItem[]
{
new UnstableRate(timedHitEvents)
}))
}
}
}
};
};
}
}
}

View File

@ -0,0 +1,32 @@
// 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 NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
namespace osu.Game.Tests.Beatmaps
{
[TestFixture]
public class BeatmapDifficultyManagerTest
{
[Test]
public void TestKeyEqualsWithDifferentModInstances()
{
var key1 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
var key2 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
Assert.That(key1, Is.EqualTo(key2));
}
[Test]
public void TestKeyEqualsWithDifferentModOrder()
{
var key1 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
var key2 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHidden(), new OsuModHardRock() });
Assert.That(key1, Is.EqualTo(key2));
}
}
}

View File

@ -0,0 +1,70 @@
// 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.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko;
using osu.Game.Scoring;
using osu.Game.Scoring.Legacy;
using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Beatmaps.Formats
{
[TestFixture]
public class LegacyScoreDecoderTest
{
[Test]
public void TestDecodeManiaReplay()
{
var decoder = new TestLegacyScoreDecoder();
using (var resourceStream = TestResources.OpenResource("Replays/mania-replay.osr"))
{
var score = decoder.Parse(resourceStream);
Assert.AreEqual(3, score.ScoreInfo.Ruleset.ID);
Assert.AreEqual(2, score.ScoreInfo.Statistics[HitResult.Great]);
Assert.AreEqual(1, score.ScoreInfo.Statistics[HitResult.Good]);
Assert.AreEqual(829_931, score.ScoreInfo.TotalScore);
Assert.AreEqual(3, score.ScoreInfo.MaxCombo);
Assert.IsTrue(Precision.AlmostEquals(0.8889, score.ScoreInfo.Accuracy, 0.0001));
Assert.AreEqual(ScoreRank.B, score.ScoreInfo.Rank);
Assert.That(score.Replay.Frames, Is.Not.Empty);
}
}
private class TestLegacyScoreDecoder : LegacyScoreDecoder
{
private static readonly Dictionary<int, Ruleset> rulesets = new Ruleset[]
{
new OsuRuleset(),
new TaikoRuleset(),
new CatchRuleset(),
new ManiaRuleset()
}.ToDictionary(ruleset => ((ILegacyRuleset)ruleset).LegacyID);
protected override Ruleset GetRuleset(int rulesetId) => rulesets[rulesetId];
protected override WorkingBeatmap GetBeatmap(string md5Hash) => new TestWorkingBeatmap(new Beatmap
{
BeatmapInfo = new BeatmapInfo
{
MD5Hash = md5Hash,
Ruleset = new OsuRuleset().RulesetInfo,
BaseDifficulty = new BeatmapDifficulty()
}
});
}
}
}

View File

@ -0,0 +1,43 @@
// 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.Linq;
using NUnit.Framework;
using osu.Framework.Utils;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Ranking.Statistics;
namespace osu.Game.Tests.NonVisual.Ranking
{
[TestFixture]
public class UnstableRateTest
{
[Test]
public void TestDistributedHits()
{
var events = Enumerable.Range(-5, 11)
.Select(t => new HitEvent(t - 5, HitResult.Great, new HitObject(), null, null));
var unstableRate = new UnstableRate(events);
Assert.IsTrue(Precision.AlmostEquals(unstableRate.Value, 10 * Math.Sqrt(10)));
}
[Test]
public void TestMissesAndEmptyWindows()
{
var events = new[]
{
new HitEvent(-100, HitResult.Miss, new HitObject(), null, null),
new HitEvent(0, HitResult.Great, new HitObject(), null, null),
new HitEvent(200, HitResult.Meh, new HitObject { HitWindows = HitWindows.Empty }, null, null),
};
var unstableRate = new UnstableRate(events);
Assert.AreEqual(0, unstableRate.Value);
}
}
}

Binary file not shown.

View File

@ -1,5 +0,0 @@
[General]
Version: latest
[Colours]
Combo1: 255,255,255,0

View File

@ -108,15 +108,5 @@ namespace osu.Game.Tests.Skins
using (var stream = new LineBufferedReader(resStream))
Assert.That(decoder.Decode(stream).LegacyVersion, Is.EqualTo(1.0m));
}
[Test]
public void TestDecodeColourWithZeroAlpha()
{
var decoder = new LegacySkinDecoder();
using (var resStream = TestResources.OpenResource("skin-zero-alpha-colour.ini"))
using (var stream = new LineBufferedReader(resStream))
Assert.That(decoder.Decode(stream).ComboColours[0].A, Is.EqualTo(1.0f));
}
}
}

View File

@ -35,6 +35,18 @@ namespace osu.Game.Tests.Visual.Ranking
createTest(new List<HitEvent>());
}
[Test]
public void TestMissesDontShow()
{
createTest(Enumerable.Range(0, 100).Select(i =>
{
if (i % 2 == 0)
return new HitEvent(0, HitResult.Perfect, new HitCircle(), new HitCircle(), null);
return new HitEvent(30, HitResult.Miss, new HitCircle(), new HitCircle(), null);
}).ToList());
}
private void createTest(List<HitEvent> events) => AddStep("create test", () =>
{
Children = new Drawable[]

View File

@ -13,6 +13,7 @@ using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Rulesets.Osu;
using osu.Game.Scoring;
@ -212,6 +213,25 @@ namespace osu.Game.Tests.Visual.Ranking
AddAssert("expanded panel still on screen", () => this.ChildrenOfType<ScorePanel>().Single(p => p.State == PanelState.Expanded).ScreenSpaceDrawQuad.TopLeft.X > 0);
}
[Test]
public void TestDownloadButtonInitiallyDisabled()
{
TestResultsScreen screen = null;
AddStep("load results", () => Child = new TestResultsContainer(screen = createResultsScreen()));
AddAssert("download button is disabled", () => !screen.ChildrenOfType<DownloadButton>().Single().Enabled.Value);
AddStep("click contracted panel", () =>
{
var contractedPanel = this.ChildrenOfType<ScorePanel>().First(p => p.State == PanelState.Contracted && p.ScreenSpaceDrawQuad.TopLeft.X > screen.ScreenSpaceDrawQuad.TopLeft.X);
InputManager.MoveMouseTo(contractedPanel);
InputManager.Click(MouseButton.Left);
});
AddAssert("download button is enabled", () => screen.ChildrenOfType<DownloadButton>().Single().Enabled.Value);
}
private class TestResultsContainer : Container
{
[Cached(typeof(Player))]
@ -255,6 +275,7 @@ namespace osu.Game.Tests.Visual.Ranking
{
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo);
score.TotalScore += 10 - i;
score.Hash = $"test{i}";
scores.Add(score);
}

View File

@ -13,7 +13,7 @@ using osu.Game.Screens.Ranking.Statistics;
namespace osu.Game.Tests.Visual.Ranking
{
public class TestSceneSimpleStatisticRow : OsuTestScene
public class TestSceneSimpleStatisticTable : OsuTestScene
{
private Container container;
@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.Ranking
public void TestEmpty()
{
AddStep("create with no items",
() => container.Add(new SimpleStatisticRow(2, Enumerable.Empty<SimpleStatisticItem>())));
() => container.Add(new SimpleStatisticTable(2, Enumerable.Empty<SimpleStatisticItem>())));
}
[Test]
@ -61,7 +61,7 @@ namespace osu.Game.Tests.Visual.Ranking
Value = RNG.Next(100)
});
container.Add(new SimpleStatisticRow(columnCount, items));
container.Add(new SimpleStatisticTable(columnCount, items));
});
}
}

View File

@ -89,8 +89,14 @@ namespace osu.Game.Beatmaps
if (tryGetExisting(beatmapInfo, rulesetInfo, mods, out var existing, out var key))
return existing;
return await Task.Factory.StartNew(() => computeDifficulty(key, beatmapInfo, rulesetInfo), cancellationToken,
TaskCreationOptions.HideScheduler | TaskCreationOptions.RunContinuationsAsynchronously, updateScheduler);
return await Task.Factory.StartNew(() =>
{
// Computation may have finished in a previous task.
if (tryGetExisting(beatmapInfo, rulesetInfo, mods, out existing, out _))
return existing;
return computeDifficulty(key, beatmapInfo, rulesetInfo);
}, cancellationToken, TaskCreationOptions.HideScheduler | TaskCreationOptions.RunContinuationsAsynchronously, updateScheduler);
}
/// <summary>
@ -245,7 +251,7 @@ namespace osu.Game.Beatmaps
updateScheduler?.Dispose();
}
private readonly struct DifficultyCacheLookup : IEquatable<DifficultyCacheLookup>
public readonly struct DifficultyCacheLookup : IEquatable<DifficultyCacheLookup>
{
public readonly int BeatmapId;
public readonly int RulesetId;
@ -261,7 +267,7 @@ namespace osu.Game.Beatmaps
public bool Equals(DifficultyCacheLookup other)
=> BeatmapId == other.BeatmapId
&& RulesetId == other.RulesetId
&& Mods.SequenceEqual(other.Mods);
&& Mods.Select(m => m.Acronym).SequenceEqual(other.Mods.Select(m => m.Acronym));
public override int GetHashCode()
{

View File

@ -104,10 +104,6 @@ namespace osu.Game.Beatmaps.Formats
try
{
byte alpha = split.Length == 4 ? byte.Parse(split[3]) : (byte)255;
if (alpha == 0)
alpha = 255;
colour = new Color4(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]), alpha);
}
catch

View File

@ -38,5 +38,6 @@ namespace osu.Game.Beatmaps.Legacy
Key1 = 1 << 26,
Key3 = 1 << 27,
Key2 = 1 << 28,
Mirror = 1 << 30,
}
}

View File

@ -40,10 +40,5 @@ namespace osu.Game.Graphics.UserInterface
protected override OsuSpriteText CreateSpriteText()
=> base.CreateSpriteText().With(s => s.Font = s.Font.With(size: 20f, fixedWidth: true));
public override void Increment(double amount)
{
Current.Value += amount;
}
}
}

View File

@ -57,20 +57,12 @@ namespace osu.Game.Graphics.UserInterface
}
}
public abstract void Increment(T amount);
/// <summary>
/// Skeleton of a numeric counter which value rolls over time.
/// </summary>
protected RollingCounter()
{
AutoSizeAxes = Axes.Both;
Current.ValueChanged += val =>
{
if (IsLoaded)
TransformCount(DisplayedCount, val.NewValue);
};
}
[BackgroundDependencyLoader]
@ -81,6 +73,13 @@ namespace osu.Game.Graphics.UserInterface
Child = displayedCountSpriteText;
}
protected override void LoadComplete()
{
base.LoadComplete();
Current.BindValueChanged(val => TransformCount(DisplayedCount, val.NewValue), true);
}
/// <summary>
/// Sets count value, bypassing rollover animation.
/// </summary>

View File

@ -51,10 +51,5 @@ namespace osu.Game.Graphics.UserInterface
protected override OsuSpriteText CreateSpriteText()
=> base.CreateSpriteText().With(s => s.Font = s.Font.With(fixedWidth: true));
public override void Increment(double amount)
{
Current.Value += amount;
}
}
}

View File

@ -33,11 +33,6 @@ namespace osu.Game.Graphics.UserInterface
return Math.Abs(currentValue - newValue) * RollingDuration * 100.0f;
}
public override void Increment(int amount)
{
Current.Value += amount;
}
protected override OsuSpriteText CreateSpriteText()
=> base.CreateSpriteText().With(s => s.Font = s.Font.With(size: 20f));
}

View File

@ -119,7 +119,7 @@ namespace osu.Game.Online.Chat
case "http":
case "https":
// length > 3 since all these links need another argument to work
if (args.Length > 3 && (args[1] == "osu.ppy.sh" || args[1] == "new.ppy.sh"))
if (args.Length > 3 && args[1] == "osu.ppy.sh")
{
switch (args[2])
{

View File

@ -13,7 +13,6 @@ using osu.Game.Replays.Legacy;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.Scoring;
using osu.Game.Users;
using SharpCompress.Compressors.LZMA;
@ -123,12 +122,12 @@ namespace osu.Game.Scoring.Legacy
protected void CalculateAccuracy(ScoreInfo score)
{
score.Statistics.TryGetValue(HitResult.Miss, out int countMiss);
score.Statistics.TryGetValue(HitResult.Meh, out int count50);
score.Statistics.TryGetValue(HitResult.Good, out int count100);
score.Statistics.TryGetValue(HitResult.Great, out int count300);
score.Statistics.TryGetValue(HitResult.Perfect, out int countGeki);
score.Statistics.TryGetValue(HitResult.Ok, out int countKatu);
int countMiss = score.GetCountMiss() ?? 0;
int count50 = score.GetCount50() ?? 0;
int count100 = score.GetCount100() ?? 0;
int count300 = score.GetCount300() ?? 0;
int countGeki = score.GetCountGeki() ?? 0;
int countKatu = score.GetCountKatu() ?? 0;
switch (score.Ruleset.ID)
{
@ -241,12 +240,15 @@ namespace osu.Game.Scoring.Legacy
}
var diff = Parsing.ParseFloat(split[0]);
var mouseX = Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE);
var mouseY = Parsing.ParseFloat(split[2], Parsing.MAX_COORDINATE_VALUE);
lastTime += diff;
if (i == 0 && diff == 0)
// osu-stable adds a zero-time frame before potentially valid negative user frames.
// we need to ignore this.
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
@ -255,8 +257,8 @@ namespace osu.Game.Scoring.Legacy
continue;
currentFrame = convertFrame(new LegacyReplayFrame(lastTime,
Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE),
Parsing.ParseFloat(split[2], Parsing.MAX_COORDINATE_VALUE),
mouseX,
mouseY,
(ReplayButtonState)Parsing.ParseInt(split[3])), currentFrame);
replay.Frames.Add(currentFrame);

View File

@ -284,7 +284,7 @@ namespace osu.Game.Screens.Edit
// this is a special case to handle the "pivot" scenario.
// if we are precise scrolling in one direction then change our mind and scroll backwards,
// the existing accumulation should be applied in the inverse direction to maintain responsiveness.
if (Math.Sign(scrollAccumulation) != scrollDirection)
if (scrollAccumulation != 0 && Math.Sign(scrollAccumulation) != scrollDirection)
scrollAccumulation = scrollDirection * (precision - Math.Abs(scrollAccumulation));
scrollAccumulation += scrollComponent * (e.IsPrecise ? 0.1 : 1);

View File

@ -205,6 +205,7 @@ namespace osu.Game.Screens.Menu
const int line_end_offset = 120;
smallRing.Foreground.ResizeTo(1, line_duration, Easing.OutQuint);
smallRing.Delay(400).FadeColour(Color4.Black, 300);
lineTopLeft.MoveTo(new Vector2(-line_end_offset, -line_end_offset), line_duration, Easing.OutQuint);
lineTopRight.MoveTo(new Vector2(line_end_offset, -line_end_offset), line_duration, Easing.OutQuint);

View File

@ -1,32 +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.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Play.HUD
{
/// <summary>
/// Used to display combo with a roll-up animation in results screen.
/// </summary>
public class ComboResultCounter : RollingCounter<long>
{
protected override double RollingDuration => 500;
protected override Easing RollingEasing => Easing.Out;
protected override double GetProportionalDuration(long currentValue, long newValue)
{
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
}
protected override string FormatCount(long count)
{
return $@"{count}x";
}
public override void Increment(long amount)
{
Current.Value += amount;
}
}
}

View File

@ -46,9 +46,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
protected override string FormatCount(double count) => count.FormatAccuracy();
public override void Increment(double amount)
=> Current.Value += amount;
protected override OsuSpriteText CreateSpriteText() => base.CreateSpriteText().With(s =>
{
s.Font = OsuFont.Torus.With(size: 20, fixedWidth: true);

View File

@ -49,9 +49,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
s.Font = OsuFont.Torus.With(size: 20, fixedWidth: true);
s.Spacing = new Vector2(-2, 0);
});
public override void Increment(int amount)
=> Current.Value += amount;
}
}
}

View File

@ -36,8 +36,5 @@ namespace osu.Game.Screens.Ranking.Expanded
s.Font = OsuFont.Torus.With(size: 60, weight: FontWeight.Light, fixedWidth: true);
s.Spacing = new Vector2(-5, 0);
});
public override void Increment(long amount)
=> Current.Value += amount;
}
}

View File

@ -74,23 +74,33 @@ namespace osu.Game.Screens.Ranking
{
button.State.Value = state.NewValue;
switch (replayAvailability)
{
case ReplayAvailability.Local:
button.TooltipText = @"watch replay";
break;
case ReplayAvailability.Online:
button.TooltipText = @"download replay";
break;
default:
button.TooltipText = @"replay unavailable";
break;
}
updateTooltip();
}, true);
button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable;
Model.BindValueChanged(_ =>
{
button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable;
updateTooltip();
}, true);
}
private void updateTooltip()
{
switch (replayAvailability)
{
case ReplayAvailability.Local:
button.TooltipText = @"watch replay";
break;
case ReplayAvailability.Online:
button.TooltipText = @"download replay";
break;
default:
button.TooltipText = @"replay unavailable";
break;
}
}
private enum ReplayAvailability

View File

@ -48,7 +48,7 @@ namespace osu.Game.Screens.Ranking.Statistics
/// <param name="hitEvents">The <see cref="HitEvent"/>s to display the timing distribution of.</param>
public HitEventTimingDistributionGraph(IReadOnlyList<HitEvent> hitEvents)
{
this.hitEvents = hitEvents.Where(e => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows)).ToList();
this.hitEvents = hitEvents.Where(e => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows) && e.Result != HitResult.Miss).ToList();
}
[BackgroundDependencyLoader]

View File

@ -41,13 +41,14 @@ namespace osu.Game.Screens.Ranking.Statistics
{
Text = Name,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 14)
},
value = new OsuSpriteText
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Font = OsuFont.Torus.With(weight: FontWeight.Bold)
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold)
}
});
}
@ -58,12 +59,19 @@ namespace osu.Game.Screens.Ranking.Statistics
/// </summary>
public class SimpleStatisticItem<TValue> : SimpleStatisticItem
{
private TValue value;
/// <summary>
/// The statistic's value to be displayed.
/// </summary>
public new TValue Value
{
set => base.Value = DisplayValue(value);
get => value;
set
{
this.value = value;
base.Value = DisplayValue(value);
}
}
/// <summary>

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@ -13,10 +14,10 @@ using osu.Framework.Graphics.Shapes;
namespace osu.Game.Screens.Ranking.Statistics
{
/// <summary>
/// Represents a statistic row with simple statistics (ones that only need textual display).
/// Represents a table with simple statistics (ones that only need textual display).
/// Richer visualisations should be done with <see cref="StatisticRow"/>s and <see cref="StatisticItem"/>s.
/// </summary>
public class SimpleStatisticRow : CompositeDrawable
public class SimpleStatisticTable : CompositeDrawable
{
private readonly SimpleStatisticItem[] items;
private readonly int columnCount;
@ -28,7 +29,7 @@ namespace osu.Game.Screens.Ranking.Statistics
/// </summary>
/// <param name="columnCount">The number of columns to layout the <paramref name="items"/> into.</param>
/// <param name="items">The <see cref="SimpleStatisticItem"/>s to display in this row.</param>
public SimpleStatisticRow(int columnCount, IEnumerable<SimpleStatisticItem> items)
public SimpleStatisticTable(int columnCount, [ItemNotNull] IEnumerable<SimpleStatisticItem> items)
{
if (columnCount < 1)
throw new ArgumentOutOfRangeException(nameof(columnCount));

View File

@ -32,33 +32,9 @@ namespace osu.Game.Screens.Ranking.Statistics
AutoSizeAxes = Axes.Y,
Content = new[]
{
new Drawable[]
new[]
{
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{
new Circle
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Height = 9,
Width = 4,
Colour = Color4Extensions.FromHex("#00FFAA")
},
new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = item.Name,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold),
}
}
}
createHeader(item)
},
new Drawable[]
{
@ -78,5 +54,37 @@ namespace osu.Game.Screens.Ranking.Statistics
}
};
}
private static Drawable createHeader(StatisticItem item)
{
if (string.IsNullOrEmpty(item.Name))
return Empty();
return new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{
new Circle
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Height = 9,
Width = 4,
Colour = Color4Extensions.FromHex("#00FFAA")
},
new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = item.Name,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold),
}
}
};
}
}
}

View File

@ -30,7 +30,7 @@ namespace osu.Game.Screens.Ranking.Statistics
/// <summary>
/// Creates a new <see cref="StatisticItem"/>, to be displayed inside a <see cref="StatisticRow"/> in the results screen.
/// </summary>
/// <param name="name">The name of the item.</param>
/// <param name="name">The name of the item. Can be <see cref="string.Empty"/> to hide the item header.</param>
/// <param name="content">The <see cref="Drawable"/> content to be displayed.</param>
/// <param name="dimension">The <see cref="Dimension"/> of this item. This can be thought of as the column dimension of an encompassing <see cref="GridContainer"/>.</param>
public StatisticItem([NotNull] string name, [NotNull] Drawable content, [CanBeNull] Dimension dimension = null)

View File

@ -94,14 +94,15 @@ namespace osu.Game.Screens.Ranking.Statistics
RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(30, 15),
Alpha = 0
};
foreach (var row in newScore.Ruleset.CreateInstance().CreateStatisticsForScore(newScore, playableBeatmap))
{
rows.Add(new GridContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Content = new[]
@ -125,6 +126,7 @@ namespace osu.Game.Screens.Ranking.Statistics
spinner.Hide();
content.Add(d);
d.FadeIn(250, Easing.OutQuint);
}, localCancellationSource.Token);
}), localCancellationSource.Token);
}

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 System.Linq;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Screens.Ranking.Statistics
{
/// <summary>
/// Displays the unstable rate statistic for a given play.
/// </summary>
public class UnstableRate : SimpleStatisticItem<double>
{
/// <summary>
/// Creates and computes an <see cref="UnstableRate"/> statistic.
/// </summary>
/// <param name="hitEvents">Sequence of <see cref="HitEvent"/>s to calculate the unstable rate based on.</param>
public UnstableRate(IEnumerable<HitEvent> hitEvents)
: base("Unstable Rate")
{
var timeOffsets = hitEvents.Where(e => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows) && e.Result != HitResult.Miss)
.Select(ev => ev.TimeOffset).ToArray();
Value = 10 * standardDeviation(timeOffsets);
}
private static double standardDeviation(double[] timeOffsets)
{
if (timeOffsets.Length == 0)
return double.NaN;
var mean = timeOffsets.Average();
var squares = timeOffsets.Select(offset => Math.Pow(offset - mean, 2)).Sum();
return Math.Sqrt(squares / timeOffsets.Length);
}
protected override string DisplayValue(double value) => double.IsNaN(value) ? "(not available)" : value.ToString("N2");
}
}

View File

@ -27,6 +27,7 @@ using osu.Framework.Logging;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Ranking.Expanded;
namespace osu.Game.Screens.Select
{
@ -222,10 +223,20 @@ namespace osu.Game.Screens.Select
Direction = FillDirection.Vertical,
Padding = new MarginPadding { Top = 14, Right = shear_width / 2 },
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
Shear = wedged_container_shear,
Children = new[]
{
createStarRatingDisplay(beatmapInfo).With(display =>
{
display.Anchor = Anchor.TopRight;
display.Origin = Anchor.TopRight;
display.Shear = -wedged_container_shear;
}),
StatusPill = new BeatmapSetOnlineStatusPill
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Shear = -wedged_container_shear,
TextSize = 11,
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
Status = beatmapInfo.Status,
@ -282,6 +293,13 @@ namespace osu.Game.Screens.Select
StatusPill.Hide();
}
private static Drawable createStarRatingDisplay(BeatmapInfo beatmapInfo) => beatmapInfo.StarDifficulty > 0
? new StarRatingDisplay(beatmapInfo)
{
Margin = new MarginPadding { Bottom = 5 }
}
: Empty();
private void setMetadata(string source)
{
ArtistLabel.Text = artistBinding.Value;

View File

@ -0,0 +1,46 @@
// 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 osuTK.Graphics;
namespace osu.Game.Skinning
{
/// <summary>
/// Compatibility methods to convert osu!stable colours to osu!lazer-compatible ones. Should be used for legacy skins only.
/// </summary>
public static class LegacyColourCompatibility
{
/// <summary>
/// Forces an alpha of 1 if a given <see cref="Color4"/> is fully transparent.
/// </summary>
/// <remarks>
/// This is equivalent to setting colour post-constructor in osu!stable.
/// </remarks>
/// <param name="colour">The <see cref="Color4"/> to disallow zero alpha on.</param>
/// <returns>The resultant <see cref="Color4"/>.</returns>
public static Color4 DisallowZeroAlpha(Color4 colour)
{
if (colour.A == 0)
colour.A = 1;
return colour;
}
/// <summary>
/// Applies a <see cref="Color4"/> to a <see cref="Drawable"/>, doubling the alpha value into the <see cref="Drawable.Alpha"/> property.
/// </summary>
/// <remarks>
/// This is equivalent to setting colour in the constructor in osu!stable.
/// </remarks>
/// <param name="drawable">The <see cref="Drawable"/> to apply the colour to.</param>
/// <param name="colour">The <see cref="Color4"/> to apply.</param>
/// <returns>The given <paramref name="drawable"/>.</returns>
public static T ApplyWithDoubledAlpha<T>(T drawable, Color4 colour)
where T : Drawable
{
drawable.Alpha = colour.A;
drawable.Colour = DisallowZeroAlpha(colour);
return drawable;
}
}
}

View File

@ -31,10 +31,12 @@ namespace osu.Game.Skinning
public readonly float[] ColumnSpacing;
public readonly float[] ColumnWidth;
public readonly float[] ExplosionWidth;
public readonly float[] HoldNoteLightWidth;
public float HitPosition = (480 - 402) * POSITION_SCALE_FACTOR;
public float LightPosition = (480 - 413) * POSITION_SCALE_FACTOR;
public bool ShowJudgementLine = true;
public bool KeysUnderNotes;
public LegacyManiaSkinConfiguration(int keys)
{
@ -44,6 +46,7 @@ namespace osu.Game.Skinning
ColumnSpacing = new float[keys - 1];
ColumnWidth = new float[keys];
ExplosionWidth = new float[keys];
HoldNoteLightWidth = new float[keys];
ColumnLineWidth.AsSpan().Fill(2);
ColumnWidth.AsSpan().Fill(DEFAULT_COLUMN_SIZE);

View File

@ -34,6 +34,8 @@ namespace osu.Game.Skinning
HoldNoteHeadImage,
HoldNoteTailImage,
HoldNoteBodyImage,
HoldNoteLightImage,
HoldNoteLightScale,
ExplosionImage,
ExplosionScale,
ColumnLineColour,
@ -50,5 +52,6 @@ namespace osu.Game.Skinning
Hit100,
Hit50,
Hit0,
KeysUnderNotes,
}
}

View File

@ -97,10 +97,18 @@ namespace osu.Game.Skinning
currentConfig.ShowJudgementLine = pair.Value == "1";
break;
case "KeysUnderNotes":
currentConfig.KeysUnderNotes = pair.Value == "1";
break;
case "LightingNWidth":
parseArrayValue(pair.Value, currentConfig.ExplosionWidth);
break;
case "LightingLWidth":
parseArrayValue(pair.Value, currentConfig.HoldNoteLightWidth);
break;
case "WidthForNoteHeightScale":
float minWidth = float.Parse(pair.Value, CultureInfo.InvariantCulture) * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR;
if (minWidth > 0)
@ -116,6 +124,7 @@ namespace osu.Game.Skinning
case string _ when pair.Key.StartsWith("KeyImage"):
case string _ when pair.Key.StartsWith("Hit"):
case string _ when pair.Key.StartsWith("Stage"):
case string _ when pair.Key.StartsWith("Lighting"):
currentConfig.ImageLookups[pair.Key] = pair.Value;
break;
}

View File

@ -173,6 +173,9 @@ namespace osu.Game.Skinning
case LegacyManiaSkinConfigurationLookups.ShowJudgementLine:
return SkinUtils.As<TValue>(new Bindable<bool>(existing.ShowJudgementLine));
case LegacyManiaSkinConfigurationLookups.ExplosionImage:
return SkinUtils.As<TValue>(getManiaImage(existing, "LightingN"));
case LegacyManiaSkinConfigurationLookups.ExplosionScale:
Debug.Assert(maniaLookup.TargetColumn != null);
@ -217,6 +220,20 @@ namespace osu.Game.Skinning
Debug.Assert(maniaLookup.TargetColumn != null);
return SkinUtils.As<TValue>(getManiaImage(existing, $"NoteImage{maniaLookup.TargetColumn}L"));
case LegacyManiaSkinConfigurationLookups.HoldNoteLightImage:
return SkinUtils.As<TValue>(getManiaImage(existing, "LightingL"));
case LegacyManiaSkinConfigurationLookups.HoldNoteLightScale:
Debug.Assert(maniaLookup.TargetColumn != null);
if (GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value < 2.5m)
return SkinUtils.As<TValue>(new Bindable<float>(1));
if (existing.HoldNoteLightWidth[maniaLookup.TargetColumn.Value] != 0)
return SkinUtils.As<TValue>(new Bindable<float>(existing.HoldNoteLightWidth[maniaLookup.TargetColumn.Value] / LegacyManiaSkinConfiguration.DEFAULT_COLUMN_SIZE));
return SkinUtils.As<TValue>(new Bindable<float>(existing.ColumnWidth[maniaLookup.TargetColumn.Value] / LegacyManiaSkinConfiguration.DEFAULT_COLUMN_SIZE));
case LegacyManiaSkinConfigurationLookups.KeyImage:
Debug.Assert(maniaLookup.TargetColumn != null);
return SkinUtils.As<TValue>(getManiaImage(existing, $"KeyImage{maniaLookup.TargetColumn}"));
@ -255,6 +272,9 @@ namespace osu.Game.Skinning
case LegacyManiaSkinConfigurationLookups.Hit300:
case LegacyManiaSkinConfigurationLookups.Hit300g:
return SkinUtils.As<TValue>(getManiaImage(existing, maniaLookup.Lookup.ToString()));
case LegacyManiaSkinConfigurationLookups.KeysUnderNotes:
return SkinUtils.As<TValue>(new Bindable<bool>(existing.KeysUnderNotes));
}
return null;