Merge branch 'master' into tourney-asset-refactor
@ -2,7 +2,7 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.osu.Desktop/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.osu.Desktop/riderModule.iml" />
|
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.osu.Desktop/.idea/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.osu.Desktop/.idea/riderModule.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -51,7 +51,7 @@
|
|||||||
<Reference Include="Java.Interop" />
|
<Reference Include="Java.Interop" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.904.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.1004.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.1009.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -29,6 +29,11 @@ namespace osu.Desktop.Updater
|
|||||||
|
|
||||||
private static readonly Logger logger = Logger.GetLogger("updater");
|
private static readonly Logger logger = Logger.GetLogger("updater");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether an update has been downloaded but not yet applied.
|
||||||
|
/// </summary>
|
||||||
|
private bool updatePending;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(NotificationOverlay notification)
|
private void load(NotificationOverlay notification)
|
||||||
{
|
{
|
||||||
@ -37,9 +42,9 @@ namespace osu.Desktop.Updater
|
|||||||
Splat.Locator.CurrentMutable.Register(() => new SquirrelLogger(), typeof(Splat.ILogger));
|
Splat.Locator.CurrentMutable.Register(() => new SquirrelLogger(), typeof(Splat.ILogger));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task PerformUpdateCheck() => await checkForUpdateAsync();
|
protected override async Task<bool> PerformUpdateCheck() => await checkForUpdateAsync();
|
||||||
|
|
||||||
private async Task checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null)
|
private async Task<bool> checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null)
|
||||||
{
|
{
|
||||||
// should we schedule a retry on completion of this check?
|
// should we schedule a retry on completion of this check?
|
||||||
bool scheduleRecheck = true;
|
bool scheduleRecheck = true;
|
||||||
@ -49,9 +54,19 @@ namespace osu.Desktop.Updater
|
|||||||
updateManager ??= await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true);
|
updateManager ??= await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true);
|
||||||
|
|
||||||
var info = await updateManager.CheckForUpdate(!useDeltaPatching);
|
var info = await updateManager.CheckForUpdate(!useDeltaPatching);
|
||||||
|
|
||||||
if (info.ReleasesToApply.Count == 0)
|
if (info.ReleasesToApply.Count == 0)
|
||||||
|
{
|
||||||
|
if (updatePending)
|
||||||
|
{
|
||||||
|
// the user may have dismissed the completion notice, so show it again.
|
||||||
|
notificationOverlay.Post(new UpdateCompleteNotification(this));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// no updates available. bail and retry later.
|
// no updates available. bail and retry later.
|
||||||
return;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (notification == null)
|
if (notification == null)
|
||||||
{
|
{
|
||||||
@ -72,6 +87,7 @@ namespace osu.Desktop.Updater
|
|||||||
await updateManager.ApplyReleases(info, p => notification.Progress = p / 100f);
|
await updateManager.ApplyReleases(info, p => notification.Progress = p / 100f);
|
||||||
|
|
||||||
notification.State = ProgressNotificationState.Completed;
|
notification.State = ProgressNotificationState.Completed;
|
||||||
|
updatePending = true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -103,6 +119,8 @@ namespace osu.Desktop.Updater
|
|||||||
Scheduler.AddDelayed(async () => await checkForUpdateAsync(), 60000 * 30);
|
Scheduler.AddDelayed(async () => await checkForUpdateAsync(), 60000 * 30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
@ -111,10 +129,27 @@ namespace osu.Desktop.Updater
|
|||||||
updateManager?.Dispose();
|
updateManager?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class UpdateCompleteNotification : ProgressCompletionNotification
|
||||||
|
{
|
||||||
|
[Resolved]
|
||||||
|
private OsuGame game { get; set; }
|
||||||
|
|
||||||
|
public UpdateCompleteNotification(SquirrelUpdateManager updateManager)
|
||||||
|
{
|
||||||
|
Text = @"Update ready to install. Click to restart!";
|
||||||
|
|
||||||
|
Activated = () =>
|
||||||
|
{
|
||||||
|
updateManager.PrepareUpdateAsync()
|
||||||
|
.ContinueWith(_ => updateManager.Schedule(() => game.GracefullyExit()));
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class UpdateProgressNotification : ProgressNotification
|
private class UpdateProgressNotification : ProgressNotification
|
||||||
{
|
{
|
||||||
private readonly SquirrelUpdateManager updateManager;
|
private readonly SquirrelUpdateManager updateManager;
|
||||||
private OsuGame game;
|
|
||||||
|
|
||||||
public UpdateProgressNotification(SquirrelUpdateManager updateManager)
|
public UpdateProgressNotification(SquirrelUpdateManager updateManager)
|
||||||
{
|
{
|
||||||
@ -123,23 +158,12 @@ namespace osu.Desktop.Updater
|
|||||||
|
|
||||||
protected override Notification CreateCompletionNotification()
|
protected override Notification CreateCompletionNotification()
|
||||||
{
|
{
|
||||||
return new ProgressCompletionNotification
|
return new UpdateCompleteNotification(updateManager);
|
||||||
{
|
|
||||||
Text = @"Update ready to install. Click to restart!",
|
|
||||||
Activated = () =>
|
|
||||||
{
|
|
||||||
updateManager.PrepareUpdateAsync()
|
|
||||||
.ContinueWith(_ => updateManager.Schedule(() => game.GracefullyExit()));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, OsuGame game)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
this.game = game;
|
|
||||||
|
|
||||||
IconContent.AddRange(new Drawable[]
|
IconContent.AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
|
@ -5,24 +5,24 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
namespace osu.Desktop.Windows
|
namespace osu.Desktop.Windows
|
||||||
{
|
{
|
||||||
public class GameplayWinKeyBlocker : Component
|
public class GameplayWinKeyBlocker : Component
|
||||||
{
|
{
|
||||||
private Bindable<bool> allowScreenSuspension;
|
|
||||||
private Bindable<bool> disableWinKey;
|
private Bindable<bool> disableWinKey;
|
||||||
|
private Bindable<bool> localUserPlaying;
|
||||||
|
|
||||||
private GameHost host;
|
[Resolved]
|
||||||
|
private GameHost host { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host, OsuConfigManager config)
|
private void load(OsuGame game, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
this.host = host;
|
localUserPlaying = game.LocalUserPlaying.GetBoundCopy();
|
||||||
|
localUserPlaying.BindValueChanged(_ => updateBlocking());
|
||||||
allowScreenSuspension = host.AllowScreenSuspension.GetBoundCopy();
|
|
||||||
allowScreenSuspension.BindValueChanged(_ => updateBlocking());
|
|
||||||
|
|
||||||
disableWinKey = config.GetBindable<bool>(OsuSetting.GameplayDisableWinKey);
|
disableWinKey = config.GetBindable<bool>(OsuSetting.GameplayDisableWinKey);
|
||||||
disableWinKey.BindValueChanged(_ => updateBlocking(), true);
|
disableWinKey.BindValueChanged(_ => updateBlocking(), true);
|
||||||
@ -30,7 +30,7 @@ namespace osu.Desktop.Windows
|
|||||||
|
|
||||||
private void updateBlocking()
|
private void updateBlocking()
|
||||||
{
|
{
|
||||||
bool shouldDisable = disableWinKey.Value && !allowScreenSuspension.Value;
|
bool shouldDisable = disableWinKey.Value && localUserPlaying.Value;
|
||||||
|
|
||||||
if (shouldDisable)
|
if (shouldDisable)
|
||||||
host.InputThread.Scheduler.Add(WindowsKey.Disable);
|
host.InputThread.Scheduler.Add(WindowsKey.Disable);
|
||||||
|
@ -141,6 +141,35 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
|
|
||||||
public override Drawable CreateIcon() => new SpriteIcon { Icon = OsuIcon.RulesetCatch };
|
public override Drawable CreateIcon() => new SpriteIcon { Icon = OsuIcon.RulesetCatch };
|
||||||
|
|
||||||
|
protected override IEnumerable<HitResult> GetValidHitResults()
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
HitResult.Great,
|
||||||
|
|
||||||
|
HitResult.LargeTickHit,
|
||||||
|
HitResult.SmallTickHit,
|
||||||
|
HitResult.LargeBonus,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GetDisplayNameForHitResult(HitResult result)
|
||||||
|
{
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case HitResult.LargeTickHit:
|
||||||
|
return "large droplet";
|
||||||
|
|
||||||
|
case HitResult.SmallTickHit:
|
||||||
|
return "small droplet";
|
||||||
|
|
||||||
|
case HitResult.LargeBonus:
|
||||||
|
return "banana";
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.GetDisplayNameForHitResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(this, beatmap);
|
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(this, beatmap);
|
||||||
|
|
||||||
public override ISkin CreateLegacySkinProvider(ISkinSource source, IBeatmap beatmap) => new CatchLegacySkinTransformer(source);
|
public override ISkin CreateLegacySkinProvider(ISkinSource source, IBeatmap beatmap) => new CatchLegacySkinTransformer(source);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -56,6 +57,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
Volume = s.Volume
|
Volume = s.Volume
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
int nodeIndex = 0;
|
||||||
SliderEventDescriptor? lastEvent = null;
|
SliderEventDescriptor? lastEvent = null;
|
||||||
|
|
||||||
foreach (var e in SliderEventGenerator.Generate(StartTime, SpanDuration, Velocity, TickDistance, Path.Distance, this.SpanCount(), LegacyLastTickOffset, cancellationToken))
|
foreach (var e in SliderEventGenerator.Generate(StartTime, SpanDuration, Velocity, TickDistance, Path.Distance, this.SpanCount(), LegacyLastTickOffset, cancellationToken))
|
||||||
@ -105,7 +107,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
case SliderEventType.Repeat:
|
case SliderEventType.Repeat:
|
||||||
AddNested(new Fruit
|
AddNested(new Fruit
|
||||||
{
|
{
|
||||||
Samples = Samples,
|
Samples = this.GetNodeSamples(nodeIndex++),
|
||||||
StartTime = e.Time,
|
StartTime = e.Time,
|
||||||
X = X + Path.PositionAt(e.PathProgress).X,
|
X = X + Path.PositionAt(e.PathProgress).X,
|
||||||
});
|
});
|
||||||
@ -119,7 +121,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
public double Duration
|
public double Duration
|
||||||
{
|
{
|
||||||
get => this.SpanCount() * Path.Distance / Velocity;
|
get => this.SpanCount() * Path.Distance / Velocity;
|
||||||
set => throw new System.NotSupportedException($"Adjust via {nameof(RepeatCount)} instead"); // can be implemented if/when needed.
|
set => throw new NotSupportedException($"Adjust via {nameof(RepeatCount)} instead"); // can be implemented if/when needed.
|
||||||
}
|
}
|
||||||
|
|
||||||
public double EndTime => StartTime + Duration;
|
public double EndTime => StartTime + Duration;
|
||||||
|
@ -13,6 +13,11 @@ namespace osu.Game.Rulesets.Catch.Skinning
|
|||||||
{
|
{
|
||||||
public class CatchLegacySkinTransformer : LegacySkinTransformer
|
public class CatchLegacySkinTransformer : LegacySkinTransformer
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// For simplicity, let's use legacy combo font texture existence as a way to identify legacy skins from default.
|
||||||
|
/// </summary>
|
||||||
|
private bool providesComboCounter => this.HasFont(GetConfig<LegacySetting, string>(LegacySetting.ComboPrefix)?.Value ?? "score");
|
||||||
|
|
||||||
public CatchLegacySkinTransformer(ISkinSource source)
|
public CatchLegacySkinTransformer(ISkinSource source)
|
||||||
: base(source)
|
: base(source)
|
||||||
{
|
{
|
||||||
@ -20,6 +25,16 @@ namespace osu.Game.Rulesets.Catch.Skinning
|
|||||||
|
|
||||||
public override Drawable GetDrawableComponent(ISkinComponent component)
|
public override Drawable GetDrawableComponent(ISkinComponent component)
|
||||||
{
|
{
|
||||||
|
if (component is HUDSkinComponent hudComponent)
|
||||||
|
{
|
||||||
|
switch (hudComponent.Component)
|
||||||
|
{
|
||||||
|
case HUDSkinComponents.ComboCounter:
|
||||||
|
// catch may provide its own combo counter; hide the default.
|
||||||
|
return providesComboCounter ? Drawable.Empty() : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(component is CatchSkinComponent catchSkinComponent))
|
if (!(component is CatchSkinComponent catchSkinComponent))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -55,11 +70,9 @@ namespace osu.Game.Rulesets.Catch.Skinning
|
|||||||
this.GetAnimation("fruit-ryuuta", true, true, true);
|
this.GetAnimation("fruit-ryuuta", true, true, true);
|
||||||
|
|
||||||
case CatchSkinComponents.CatchComboCounter:
|
case CatchSkinComponents.CatchComboCounter:
|
||||||
var comboFont = GetConfig<LegacySetting, string>(LegacySetting.ComboPrefix)?.Value ?? "score";
|
|
||||||
|
|
||||||
// For simplicity, let's use legacy combo font texture existence as a way to identify legacy skins from default.
|
if (providesComboCounter)
|
||||||
if (this.HasFont(comboFont))
|
return new LegacyCatchComboCounter(Source);
|
||||||
return new LegacyComboCounter(Source);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,13 @@ namespace osu.Game.Rulesets.Catch.Skinning
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A combo counter implementation that visually behaves almost similar to stable's osu!catch combo counter.
|
/// A combo counter implementation that visually behaves almost similar to stable's osu!catch combo counter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class LegacyComboCounter : CompositeDrawable, ICatchComboCounter
|
public class LegacyCatchComboCounter : CompositeDrawable, ICatchComboCounter
|
||||||
{
|
{
|
||||||
private readonly LegacyRollingCounter counter;
|
private readonly LegacyRollingCounter counter;
|
||||||
|
|
||||||
private readonly LegacyRollingCounter explosion;
|
private readonly LegacyRollingCounter explosion;
|
||||||
|
|
||||||
public LegacyComboCounter(ISkin skin)
|
public LegacyCatchComboCounter(ISkin skin)
|
||||||
{
|
{
|
||||||
var fontName = skin.GetConfig<LegacySetting, string>(LegacySetting.ComboPrefix)?.Value ?? "score";
|
var fontName = skin.GetConfig<LegacySetting, string>(LegacySetting.ComboPrefix)?.Value ?? "score";
|
||||||
var fontOverlap = skin.GetConfig<LegacySetting, float>(LegacySetting.ComboOverlap)?.Value ?? -2f;
|
var fontOverlap = skin.GetConfig<LegacySetting, float>(LegacySetting.ComboOverlap)?.Value ?? -2f;
|
@ -83,11 +83,17 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
RandomZ = snapshot.RandomZ;
|
RandomZ = snapshot.RandomZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void PostProcess()
|
||||||
|
{
|
||||||
|
base.PostProcess();
|
||||||
|
Objects.Sort();
|
||||||
|
}
|
||||||
|
|
||||||
public bool Equals(ManiaConvertMapping other) => other != null && RandomW == other.RandomW && RandomX == other.RandomX && RandomY == other.RandomY && RandomZ == other.RandomZ;
|
public bool Equals(ManiaConvertMapping other) => other != null && RandomW == other.RandomW && RandomX == other.RandomX && RandomY == other.RandomY && RandomZ == other.RandomZ;
|
||||||
public override bool Equals(ConvertMapping<ConvertValue> other) => base.Equals(other) && Equals(other as ManiaConvertMapping);
|
public override bool Equals(ConvertMapping<ConvertValue> other) => base.Equals(other) && Equals(other as ManiaConvertMapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct ConvertValue : IEquatable<ConvertValue>
|
public struct ConvertValue : IEquatable<ConvertValue>, IComparable<ConvertValue>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A sane value to account for osu!stable using ints everwhere.
|
/// A sane value to account for osu!stable using ints everwhere.
|
||||||
@ -102,5 +108,15 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
=> Precision.AlmostEquals(StartTime, other.StartTime, conversion_lenience)
|
=> Precision.AlmostEquals(StartTime, other.StartTime, conversion_lenience)
|
||||||
&& Precision.AlmostEquals(EndTime, other.EndTime, conversion_lenience)
|
&& Precision.AlmostEquals(EndTime, other.EndTime, conversion_lenience)
|
||||||
&& Column == other.Column;
|
&& Column == other.Column;
|
||||||
|
|
||||||
|
public int CompareTo(ConvertValue other)
|
||||||
|
{
|
||||||
|
var result = StartTime.CompareTo(other.StartTime);
|
||||||
|
|
||||||
|
if (result != 0)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
return Column.CompareTo(other.Column);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
{
|
{
|
||||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Mania";
|
protected override string ResourceAssembly => "osu.Game.Rulesets.Mania";
|
||||||
|
|
||||||
[TestCase(2.3683365342338796d, "diffcalc-test")]
|
[TestCase(2.3449735700206298d, "diffcalc-test")]
|
||||||
public void Test(double expected, string name)
|
public void Test(double expected, string name)
|
||||||
=> base.Test(expected, name);
|
=> base.Test(expected, name);
|
||||||
|
|
||||||
|
@ -21,13 +21,20 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int TotalColumns => Stages.Sum(g => g.Columns);
|
public int TotalColumns => Stages.Sum(g => g.Columns);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The total number of columns that were present in this <see cref="ManiaBeatmap"/> before any user adjustments.
|
||||||
|
/// </summary>
|
||||||
|
public readonly int OriginalTotalColumns;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="ManiaBeatmap"/>.
|
/// Creates a new <see cref="ManiaBeatmap"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="defaultStage">The initial stages.</param>
|
/// <param name="defaultStage">The initial stages.</param>
|
||||||
public ManiaBeatmap(StageDefinition defaultStage)
|
/// <param name="originalTotalColumns">The total number of columns present before any user adjustments. Defaults to the total columns in <paramref name="defaultStage"/>.</param>
|
||||||
|
public ManiaBeatmap(StageDefinition defaultStage, int? originalTotalColumns = null)
|
||||||
{
|
{
|
||||||
Stages.Add(defaultStage);
|
Stages.Add(defaultStage);
|
||||||
|
OriginalTotalColumns = originalTotalColumns ?? defaultStage.Columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<BeatmapStatistic> GetStatistics()
|
public override IEnumerable<BeatmapStatistic> GetStatistics()
|
||||||
|
@ -28,6 +28,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
|||||||
public bool Dual;
|
public bool Dual;
|
||||||
public readonly bool IsForCurrentRuleset;
|
public readonly bool IsForCurrentRuleset;
|
||||||
|
|
||||||
|
private readonly int originalTargetColumns;
|
||||||
|
|
||||||
// Internal for testing purposes
|
// Internal for testing purposes
|
||||||
internal FastRandom Random { get; private set; }
|
internal FastRandom Random { get; private set; }
|
||||||
|
|
||||||
@ -65,6 +67,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
|||||||
else
|
else
|
||||||
TargetColumns = Math.Max(4, Math.Min((int)roundedOverallDifficulty + 1, 7));
|
TargetColumns = Math.Max(4, Math.Min((int)roundedOverallDifficulty + 1, 7));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
originalTargetColumns = TargetColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanConvert() => Beatmap.HitObjects.All(h => h is IHasXPosition);
|
public override bool CanConvert() => Beatmap.HitObjects.All(h => h is IHasXPosition);
|
||||||
@ -81,7 +85,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
|||||||
|
|
||||||
protected override Beatmap<ManiaHitObject> CreateBeatmap()
|
protected override Beatmap<ManiaHitObject> CreateBeatmap()
|
||||||
{
|
{
|
||||||
beatmap = new ManiaBeatmap(new StageDefinition { Columns = TargetColumns });
|
beatmap = new ManiaBeatmap(new StageDefinition { Columns = TargetColumns }, originalTargetColumns);
|
||||||
|
|
||||||
if (Dual)
|
if (Dual)
|
||||||
beatmap.Stages.Add(new StageDefinition { Columns = TargetColumns });
|
beatmap.Stages.Add(new StageDefinition { Columns = TargetColumns });
|
||||||
@ -116,7 +120,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
|||||||
prevNoteTimes.RemoveAt(0);
|
prevNoteTimes.RemoveAt(0);
|
||||||
prevNoteTimes.Add(newNoteTime);
|
prevNoteTimes.Add(newNoteTime);
|
||||||
|
|
||||||
density = (prevNoteTimes[^1] - prevNoteTimes[0]) / prevNoteTimes.Count;
|
if (prevNoteTimes.Count >= 2)
|
||||||
|
density = (prevNoteTimes[^1] - prevNoteTimes[0]) / prevNoteTimes.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double lastTime;
|
private double lastTime;
|
||||||
@ -180,7 +185,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
|||||||
|
|
||||||
case IHasDuration endTimeData:
|
case IHasDuration endTimeData:
|
||||||
{
|
{
|
||||||
conversion = new EndTimeObjectPatternGenerator(Random, original, beatmap, originalBeatmap);
|
conversion = new EndTimeObjectPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap);
|
||||||
|
|
||||||
recordNote(endTimeData.EndTime, new Vector2(256, 192));
|
recordNote(endTimeData.EndTime, new Vector2(256, 192));
|
||||||
computeDensity(endTimeData.EndTime);
|
computeDensity(endTimeData.EndTime);
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Utils;
|
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.MathUtils;
|
using osu.Game.Rulesets.Mania.MathUtils;
|
||||||
@ -12,6 +12,7 @@ using osu.Game.Rulesets.Objects;
|
|||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Beatmaps.Formats;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
||||||
{
|
{
|
||||||
@ -25,8 +26,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private const float osu_base_scoring_distance = 100;
|
private const float osu_base_scoring_distance = 100;
|
||||||
|
|
||||||
public readonly double EndTime;
|
public readonly int StartTime;
|
||||||
public readonly double SegmentDuration;
|
public readonly int EndTime;
|
||||||
|
public readonly int SegmentDuration;
|
||||||
public readonly int SpanCount;
|
public readonly int SpanCount;
|
||||||
|
|
||||||
private PatternType convertType;
|
private PatternType convertType;
|
||||||
@ -41,20 +43,26 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
var distanceData = hitObject as IHasDistance;
|
var distanceData = hitObject as IHasDistance;
|
||||||
var repeatsData = hitObject as IHasRepeats;
|
var repeatsData = hitObject as IHasRepeats;
|
||||||
|
|
||||||
SpanCount = repeatsData?.SpanCount() ?? 1;
|
Debug.Assert(distanceData != null);
|
||||||
|
|
||||||
TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(hitObject.StartTime);
|
TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(hitObject.StartTime);
|
||||||
DifficultyControlPoint difficultyPoint = beatmap.ControlPointInfo.DifficultyPointAt(hitObject.StartTime);
|
DifficultyControlPoint difficultyPoint = beatmap.ControlPointInfo.DifficultyPointAt(hitObject.StartTime);
|
||||||
|
|
||||||
// The true distance, accounting for any repeats
|
double beatLength;
|
||||||
double distance = (distanceData?.Distance ?? 0) * SpanCount;
|
#pragma warning disable 618
|
||||||
// The velocity of the osu! hit object - calculated as the velocity of a slider
|
if (difficultyPoint is LegacyBeatmapDecoder.LegacyDifficultyControlPoint legacyDifficultyPoint)
|
||||||
double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier / timingPoint.BeatLength;
|
#pragma warning restore 618
|
||||||
// The duration of the osu! hit object
|
beatLength = timingPoint.BeatLength * legacyDifficultyPoint.BpmMultiplier;
|
||||||
double osuDuration = distance / osuVelocity;
|
else
|
||||||
|
beatLength = timingPoint.BeatLength / difficultyPoint.SpeedMultiplier;
|
||||||
|
|
||||||
EndTime = hitObject.StartTime + osuDuration;
|
SpanCount = repeatsData?.SpanCount() ?? 1;
|
||||||
SegmentDuration = (EndTime - HitObject.StartTime) / SpanCount;
|
StartTime = (int)Math.Round(hitObject.StartTime);
|
||||||
|
|
||||||
|
// This matches stable's calculation.
|
||||||
|
EndTime = (int)Math.Floor(StartTime + distanceData.Distance * beatLength * SpanCount * 0.01 / beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier);
|
||||||
|
|
||||||
|
SegmentDuration = (EndTime - StartTime) / SpanCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<Pattern> Generate()
|
public override IEnumerable<Pattern> Generate()
|
||||||
@ -76,7 +84,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
|
|
||||||
foreach (var obj in originalPattern.HitObjects)
|
foreach (var obj in originalPattern.HitObjects)
|
||||||
{
|
{
|
||||||
if (!Precision.AlmostEquals(EndTime, obj.GetEndTime()))
|
if (EndTime != (int)Math.Round(obj.GetEndTime()))
|
||||||
intermediatePattern.Add(obj);
|
intermediatePattern.Add(obj);
|
||||||
else
|
else
|
||||||
endTimePattern.Add(obj);
|
endTimePattern.Add(obj);
|
||||||
@ -91,35 +99,35 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
if (TotalColumns == 1)
|
if (TotalColumns == 1)
|
||||||
{
|
{
|
||||||
var pattern = new Pattern();
|
var pattern = new Pattern();
|
||||||
addToPattern(pattern, 0, HitObject.StartTime, EndTime);
|
addToPattern(pattern, 0, StartTime, EndTime);
|
||||||
return pattern;
|
return pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SpanCount > 1)
|
if (SpanCount > 1)
|
||||||
{
|
{
|
||||||
if (SegmentDuration <= 90)
|
if (SegmentDuration <= 90)
|
||||||
return generateRandomHoldNotes(HitObject.StartTime, 1);
|
return generateRandomHoldNotes(StartTime, 1);
|
||||||
|
|
||||||
if (SegmentDuration <= 120)
|
if (SegmentDuration <= 120)
|
||||||
{
|
{
|
||||||
convertType |= PatternType.ForceNotStack;
|
convertType |= PatternType.ForceNotStack;
|
||||||
return generateRandomNotes(HitObject.StartTime, SpanCount + 1);
|
return generateRandomNotes(StartTime, SpanCount + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SegmentDuration <= 160)
|
if (SegmentDuration <= 160)
|
||||||
return generateStair(HitObject.StartTime);
|
return generateStair(StartTime);
|
||||||
|
|
||||||
if (SegmentDuration <= 200 && ConversionDifficulty > 3)
|
if (SegmentDuration <= 200 && ConversionDifficulty > 3)
|
||||||
return generateRandomMultipleNotes(HitObject.StartTime);
|
return generateRandomMultipleNotes(StartTime);
|
||||||
|
|
||||||
double duration = EndTime - HitObject.StartTime;
|
double duration = EndTime - StartTime;
|
||||||
if (duration >= 4000)
|
if (duration >= 4000)
|
||||||
return generateNRandomNotes(HitObject.StartTime, 0.23, 0, 0);
|
return generateNRandomNotes(StartTime, 0.23, 0, 0);
|
||||||
|
|
||||||
if (SegmentDuration > 400 && SpanCount < TotalColumns - 1 - RandomStart)
|
if (SegmentDuration > 400 && SpanCount < TotalColumns - 1 - RandomStart)
|
||||||
return generateTiledHoldNotes(HitObject.StartTime);
|
return generateTiledHoldNotes(StartTime);
|
||||||
|
|
||||||
return generateHoldAndNormalNotes(HitObject.StartTime);
|
return generateHoldAndNormalNotes(StartTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SegmentDuration <= 110)
|
if (SegmentDuration <= 110)
|
||||||
@ -128,37 +136,37 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
convertType |= PatternType.ForceNotStack;
|
convertType |= PatternType.ForceNotStack;
|
||||||
else
|
else
|
||||||
convertType &= ~PatternType.ForceNotStack;
|
convertType &= ~PatternType.ForceNotStack;
|
||||||
return generateRandomNotes(HitObject.StartTime, SegmentDuration < 80 ? 1 : 2);
|
return generateRandomNotes(StartTime, SegmentDuration < 80 ? 1 : 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConversionDifficulty > 6.5)
|
if (ConversionDifficulty > 6.5)
|
||||||
{
|
{
|
||||||
if (convertType.HasFlag(PatternType.LowProbability))
|
if (convertType.HasFlag(PatternType.LowProbability))
|
||||||
return generateNRandomNotes(HitObject.StartTime, 0.78, 0.3, 0);
|
return generateNRandomNotes(StartTime, 0.78, 0.3, 0);
|
||||||
|
|
||||||
return generateNRandomNotes(HitObject.StartTime, 0.85, 0.36, 0.03);
|
return generateNRandomNotes(StartTime, 0.85, 0.36, 0.03);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConversionDifficulty > 4)
|
if (ConversionDifficulty > 4)
|
||||||
{
|
{
|
||||||
if (convertType.HasFlag(PatternType.LowProbability))
|
if (convertType.HasFlag(PatternType.LowProbability))
|
||||||
return generateNRandomNotes(HitObject.StartTime, 0.43, 0.08, 0);
|
return generateNRandomNotes(StartTime, 0.43, 0.08, 0);
|
||||||
|
|
||||||
return generateNRandomNotes(HitObject.StartTime, 0.56, 0.18, 0);
|
return generateNRandomNotes(StartTime, 0.56, 0.18, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConversionDifficulty > 2.5)
|
if (ConversionDifficulty > 2.5)
|
||||||
{
|
{
|
||||||
if (convertType.HasFlag(PatternType.LowProbability))
|
if (convertType.HasFlag(PatternType.LowProbability))
|
||||||
return generateNRandomNotes(HitObject.StartTime, 0.3, 0, 0);
|
return generateNRandomNotes(StartTime, 0.3, 0, 0);
|
||||||
|
|
||||||
return generateNRandomNotes(HitObject.StartTime, 0.37, 0.08, 0);
|
return generateNRandomNotes(StartTime, 0.37, 0.08, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (convertType.HasFlag(PatternType.LowProbability))
|
if (convertType.HasFlag(PatternType.LowProbability))
|
||||||
return generateNRandomNotes(HitObject.StartTime, 0.17, 0, 0);
|
return generateNRandomNotes(StartTime, 0.17, 0, 0);
|
||||||
|
|
||||||
return generateNRandomNotes(HitObject.StartTime, 0.27, 0, 0);
|
return generateNRandomNotes(StartTime, 0.27, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -167,7 +175,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
/// <param name="startTime">Start time of each hold note.</param>
|
/// <param name="startTime">Start time of each hold note.</param>
|
||||||
/// <param name="noteCount">Number of hold notes.</param>
|
/// <param name="noteCount">Number of hold notes.</param>
|
||||||
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
||||||
private Pattern generateRandomHoldNotes(double startTime, int noteCount)
|
private Pattern generateRandomHoldNotes(int startTime, int noteCount)
|
||||||
{
|
{
|
||||||
// - - - -
|
// - - - -
|
||||||
// ■ - ■ ■
|
// ■ - ■ ■
|
||||||
@ -202,7 +210,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
/// <param name="startTime">The start time.</param>
|
/// <param name="startTime">The start time.</param>
|
||||||
/// <param name="noteCount">The number of notes.</param>
|
/// <param name="noteCount">The number of notes.</param>
|
||||||
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
||||||
private Pattern generateRandomNotes(double startTime, int noteCount)
|
private Pattern generateRandomNotes(int startTime, int noteCount)
|
||||||
{
|
{
|
||||||
// - - - -
|
// - - - -
|
||||||
// x - - -
|
// x - - -
|
||||||
@ -234,7 +242,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="startTime">The start time.</param>
|
/// <param name="startTime">The start time.</param>
|
||||||
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
||||||
private Pattern generateStair(double startTime)
|
private Pattern generateStair(int startTime)
|
||||||
{
|
{
|
||||||
// - - - -
|
// - - - -
|
||||||
// x - - -
|
// x - - -
|
||||||
@ -286,7 +294,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="startTime">The start time.</param>
|
/// <param name="startTime">The start time.</param>
|
||||||
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
||||||
private Pattern generateRandomMultipleNotes(double startTime)
|
private Pattern generateRandomMultipleNotes(int startTime)
|
||||||
{
|
{
|
||||||
// - - - -
|
// - - - -
|
||||||
// x - - -
|
// x - - -
|
||||||
@ -329,7 +337,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
/// <param name="p3">The probability required for 3 hold notes to be generated.</param>
|
/// <param name="p3">The probability required for 3 hold notes to be generated.</param>
|
||||||
/// <param name="p4">The probability required for 4 hold notes to be generated.</param>
|
/// <param name="p4">The probability required for 4 hold notes to be generated.</param>
|
||||||
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
||||||
private Pattern generateNRandomNotes(double startTime, double p2, double p3, double p4)
|
private Pattern generateNRandomNotes(int startTime, double p2, double p3, double p4)
|
||||||
{
|
{
|
||||||
// - - - -
|
// - - - -
|
||||||
// ■ - ■ ■
|
// ■ - ■ ■
|
||||||
@ -366,7 +374,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
static bool isDoubleSample(HitSampleInfo sample) => sample.Name == HitSampleInfo.HIT_CLAP || sample.Name == HitSampleInfo.HIT_FINISH;
|
static bool isDoubleSample(HitSampleInfo sample) => sample.Name == HitSampleInfo.HIT_CLAP || sample.Name == HitSampleInfo.HIT_FINISH;
|
||||||
|
|
||||||
bool canGenerateTwoNotes = !convertType.HasFlag(PatternType.LowProbability);
|
bool canGenerateTwoNotes = !convertType.HasFlag(PatternType.LowProbability);
|
||||||
canGenerateTwoNotes &= HitObject.Samples.Any(isDoubleSample) || sampleInfoListAt(HitObject.StartTime).Any(isDoubleSample);
|
canGenerateTwoNotes &= HitObject.Samples.Any(isDoubleSample) || sampleInfoListAt(StartTime).Any(isDoubleSample);
|
||||||
|
|
||||||
if (canGenerateTwoNotes)
|
if (canGenerateTwoNotes)
|
||||||
p2 = 1;
|
p2 = 1;
|
||||||
@ -379,7 +387,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="startTime">The first hold note start time.</param>
|
/// <param name="startTime">The first hold note start time.</param>
|
||||||
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
||||||
private Pattern generateTiledHoldNotes(double startTime)
|
private Pattern generateTiledHoldNotes(int startTime)
|
||||||
{
|
{
|
||||||
// - - - -
|
// - - - -
|
||||||
// ■ ■ ■ ■
|
// ■ ■ ■ ■
|
||||||
@ -394,6 +402,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
|
|
||||||
int columnRepeat = Math.Min(SpanCount, TotalColumns);
|
int columnRepeat = Math.Min(SpanCount, TotalColumns);
|
||||||
|
|
||||||
|
// Due to integer rounding, this is not guaranteed to be the same as EndTime (the class-level variable).
|
||||||
|
int endTime = startTime + SegmentDuration * SpanCount;
|
||||||
|
|
||||||
int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true);
|
int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true);
|
||||||
if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns)
|
if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns)
|
||||||
nextColumn = FindAvailableColumn(nextColumn, PreviousPattern);
|
nextColumn = FindAvailableColumn(nextColumn, PreviousPattern);
|
||||||
@ -401,7 +412,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
for (int i = 0; i < columnRepeat; i++)
|
for (int i = 0; i < columnRepeat; i++)
|
||||||
{
|
{
|
||||||
nextColumn = FindAvailableColumn(nextColumn, pattern);
|
nextColumn = FindAvailableColumn(nextColumn, pattern);
|
||||||
addToPattern(pattern, nextColumn, startTime, EndTime);
|
addToPattern(pattern, nextColumn, startTime, endTime);
|
||||||
startTime += SegmentDuration;
|
startTime += SegmentDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,7 +424,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="startTime">The start time of notes.</param>
|
/// <param name="startTime">The start time of notes.</param>
|
||||||
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
/// <returns>The <see cref="Pattern"/> containing the hit objects.</returns>
|
||||||
private Pattern generateHoldAndNormalNotes(double startTime)
|
private Pattern generateHoldAndNormalNotes(int startTime)
|
||||||
{
|
{
|
||||||
// - - - -
|
// - - - -
|
||||||
// ■ x x -
|
// ■ x x -
|
||||||
@ -448,7 +459,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
|
|
||||||
for (int i = 0; i <= SpanCount; i++)
|
for (int i = 0; i <= SpanCount; i++)
|
||||||
{
|
{
|
||||||
if (!(ignoreHead && startTime == HitObject.StartTime))
|
if (!(ignoreHead && startTime == StartTime))
|
||||||
{
|
{
|
||||||
for (int j = 0; j < noteCount; j++)
|
for (int j = 0; j < noteCount; j++)
|
||||||
{
|
{
|
||||||
@ -471,19 +482,18 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="time">The time to retrieve the sample info list from.</param>
|
/// <param name="time">The time to retrieve the sample info list from.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private IList<HitSampleInfo> sampleInfoListAt(double time) => nodeSamplesAt(time)?.First() ?? HitObject.Samples;
|
private IList<HitSampleInfo> sampleInfoListAt(int time) => nodeSamplesAt(time)?.First() ?? HitObject.Samples;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the list of node samples that occur at time greater than or equal to <paramref name="time"/>.
|
/// Retrieves the list of node samples that occur at time greater than or equal to <paramref name="time"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="time">The time to retrieve node samples at.</param>
|
/// <param name="time">The time to retrieve node samples at.</param>
|
||||||
private List<IList<HitSampleInfo>> nodeSamplesAt(double time)
|
private List<IList<HitSampleInfo>> nodeSamplesAt(int time)
|
||||||
{
|
{
|
||||||
if (!(HitObject is IHasPathWithRepeats curveData))
|
if (!(HitObject is IHasPathWithRepeats curveData))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// mathematically speaking this should be a whole number always, but floating-point arithmetic is not so kind
|
var index = SegmentDuration == 0 ? 0 : (time - StartTime) / SegmentDuration;
|
||||||
var index = (int)Math.Round(SegmentDuration == 0 ? 0 : (time - HitObject.StartTime) / SegmentDuration, MidpointRounding.AwayFromZero);
|
|
||||||
|
|
||||||
// avoid slicing the list & creating copies, if at all possible.
|
// avoid slicing the list & creating copies, if at all possible.
|
||||||
return index == 0 ? curveData.NodeSamples : curveData.NodeSamples.Skip(index).ToList();
|
return index == 0 ? curveData.NodeSamples : curveData.NodeSamples.Skip(index).ToList();
|
||||||
@ -496,7 +506,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
/// <param name="column">The column to add the note to.</param>
|
/// <param name="column">The column to add the note to.</param>
|
||||||
/// <param name="startTime">The start time of the note.</param>
|
/// <param name="startTime">The start time of the note.</param>
|
||||||
/// <param name="endTime">The end time of the note (set to <paramref name="startTime"/> for a non-hold note).</param>
|
/// <param name="endTime">The end time of the note (set to <paramref name="startTime"/> for a non-hold note).</param>
|
||||||
private void addToPattern(Pattern pattern, int column, double startTime, double endTime)
|
private void addToPattern(Pattern pattern, int column, int startTime, int endTime)
|
||||||
{
|
{
|
||||||
ManiaHitObject newObject;
|
ManiaHitObject newObject;
|
||||||
|
|
||||||
|
@ -14,12 +14,17 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
{
|
{
|
||||||
internal class EndTimeObjectPatternGenerator : PatternGenerator
|
internal class EndTimeObjectPatternGenerator : PatternGenerator
|
||||||
{
|
{
|
||||||
private readonly double endTime;
|
private readonly int endTime;
|
||||||
|
private readonly PatternType convertType;
|
||||||
|
|
||||||
public EndTimeObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, IBeatmap originalBeatmap)
|
public EndTimeObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap)
|
||||||
: base(random, hitObject, beatmap, new Pattern(), originalBeatmap)
|
: base(random, hitObject, beatmap, previousPattern, originalBeatmap)
|
||||||
{
|
{
|
||||||
endTime = (HitObject as IHasDuration)?.EndTime ?? 0;
|
endTime = (int)((HitObject as IHasDuration)?.EndTime ?? 0);
|
||||||
|
|
||||||
|
convertType = PreviousPattern.ColumnWithObjects == TotalColumns
|
||||||
|
? PatternType.None
|
||||||
|
: PatternType.ForceNotStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<Pattern> Generate()
|
public override IEnumerable<Pattern> Generate()
|
||||||
@ -40,18 +45,25 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
addToPattern(pattern, FindAvailableColumn(GetRandomColumn(), PreviousPattern), generateHold);
|
addToPattern(pattern, getRandomColumn(), generateHold);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (TotalColumns > 0)
|
addToPattern(pattern, getRandomColumn(0), generateHold);
|
||||||
addToPattern(pattern, GetRandomColumn(), generateHold);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pattern;
|
return pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getRandomColumn(int? lowerBound = null)
|
||||||
|
{
|
||||||
|
if ((convertType & PatternType.ForceNotStack) > 0)
|
||||||
|
return FindAvailableColumn(GetRandomColumn(lowerBound), lowerBound, patterns: PreviousPattern);
|
||||||
|
|
||||||
|
return FindAvailableColumn(GetRandomColumn(lowerBound), lowerBound);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs and adds a note to a pattern.
|
/// Constructs and adds a note to a pattern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -397,7 +397,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
centreProbability = 0;
|
centreProbability = 0;
|
||||||
p2 = Math.Min(p2 * 2, 0.2);
|
|
||||||
|
// Stable requires rngValue > x, which is an inverse-probability. Lazer uses true probability (1 - x).
|
||||||
|
// But multiplying this value by 2 (stable) is not the same operation as dividing it by 2 (lazer),
|
||||||
|
// so it needs to be converted to from a probability and then back after the multiplication.
|
||||||
|
p2 = 1 - Math.Max((1 - p2) * 2, 0.8);
|
||||||
p3 = 0;
|
p3 = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -408,11 +412,20 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
|||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
centreProbability = 0;
|
centreProbability = 0;
|
||||||
p2 = Math.Min(p2 * 2, 0.5);
|
|
||||||
p3 = Math.Min(p3 * 2, 0.15);
|
// Stable requires rngValue > x, which is an inverse-probability. Lazer uses true probability (1 - x).
|
||||||
|
// But multiplying this value by 2 (stable) is not the same operation as dividing it by 2 (lazer),
|
||||||
|
// so it needs to be converted to from a probability and then back after the multiplication.
|
||||||
|
p2 = 1 - Math.Max((1 - p2) * 2, 0.5);
|
||||||
|
p3 = 1 - Math.Max((1 - p3) * 2, 0.85);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The stable values were allowed to exceed 1, which indicate <0% probability.
|
||||||
|
// These values needs to be clamped otherwise GetRandomNoteCount() will throw an exception.
|
||||||
|
p2 = Math.Clamp(p2, 0, 1);
|
||||||
|
p3 = Math.Clamp(p3, 0, 1);
|
||||||
|
|
||||||
double centreVal = Random.NextDouble();
|
double centreVal = Random.NextDouble();
|
||||||
int noteCount = GetRandomNoteCount(p2, p3);
|
int noteCount = GetRandomNoteCount(p2, p3);
|
||||||
|
|
||||||
|
@ -8,5 +8,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
|||||||
public class ManiaDifficultyAttributes : DifficultyAttributes
|
public class ManiaDifficultyAttributes : DifficultyAttributes
|
||||||
{
|
{
|
||||||
public double GreatHitWindow;
|
public double GreatHitWindow;
|
||||||
|
public double ScoreMultiplier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -10,10 +11,12 @@ using osu.Game.Rulesets.Difficulty.Skills;
|
|||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Difficulty.Preprocessing;
|
using osu.Game.Rulesets.Mania.Difficulty.Preprocessing;
|
||||||
using osu.Game.Rulesets.Mania.Difficulty.Skills;
|
using osu.Game.Rulesets.Mania.Difficulty.Skills;
|
||||||
|
using osu.Game.Rulesets.Mania.MathUtils;
|
||||||
using osu.Game.Rulesets.Mania.Mods;
|
using osu.Game.Rulesets.Mania.Mods;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.Scoring;
|
using osu.Game.Rulesets.Mania.Scoring;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Difficulty
|
namespace osu.Game.Rulesets.Mania.Difficulty
|
||||||
@ -23,11 +26,13 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
|||||||
private const double star_scaling_factor = 0.018;
|
private const double star_scaling_factor = 0.018;
|
||||||
|
|
||||||
private readonly bool isForCurrentRuleset;
|
private readonly bool isForCurrentRuleset;
|
||||||
|
private readonly double originalOverallDifficulty;
|
||||||
|
|
||||||
public ManiaDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
|
public ManiaDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap)
|
||||||
{
|
{
|
||||||
isForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.Equals(ruleset.RulesetInfo);
|
isForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.Equals(ruleset.RulesetInfo);
|
||||||
|
originalOverallDifficulty = beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
|
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
|
||||||
@ -40,64 +45,33 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
|||||||
|
|
||||||
return new ManiaDifficultyAttributes
|
return new ManiaDifficultyAttributes
|
||||||
{
|
{
|
||||||
StarRating = difficultyValue(skills) * star_scaling_factor,
|
StarRating = skills[0].DifficultyValue() * star_scaling_factor,
|
||||||
Mods = mods,
|
Mods = mods,
|
||||||
// Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future
|
// Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future
|
||||||
GreatHitWindow = (int)(hitWindows.WindowFor(HitResult.Great)) / clockRate,
|
GreatHitWindow = (int)Math.Ceiling(getHitWindow300(mods) / clockRate),
|
||||||
|
ScoreMultiplier = getScoreMultiplier(beatmap, mods),
|
||||||
MaxCombo = beatmap.HitObjects.Sum(h => h is HoldNote ? 2 : 1),
|
MaxCombo = beatmap.HitObjects.Sum(h => h is HoldNote ? 2 : 1),
|
||||||
Skills = skills
|
Skills = skills
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private double difficultyValue(Skill[] skills)
|
|
||||||
{
|
|
||||||
// Preprocess the strains to find the maximum overall + individual (aggregate) strain from each section
|
|
||||||
var overall = skills.OfType<Overall>().Single();
|
|
||||||
var aggregatePeaks = new List<double>(Enumerable.Repeat(0.0, overall.StrainPeaks.Count));
|
|
||||||
|
|
||||||
foreach (var individual in skills.OfType<Individual>())
|
|
||||||
{
|
|
||||||
for (int i = 0; i < individual.StrainPeaks.Count; i++)
|
|
||||||
{
|
|
||||||
double aggregate = individual.StrainPeaks[i] + overall.StrainPeaks[i];
|
|
||||||
|
|
||||||
if (aggregate > aggregatePeaks[i])
|
|
||||||
aggregatePeaks[i] = aggregate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
aggregatePeaks.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain.
|
|
||||||
|
|
||||||
double difficulty = 0;
|
|
||||||
double weight = 1;
|
|
||||||
|
|
||||||
// Difficulty is the weighted sum of the highest strains from every section.
|
|
||||||
foreach (double strain in aggregatePeaks)
|
|
||||||
{
|
|
||||||
difficulty += strain * weight;
|
|
||||||
weight *= 0.9;
|
|
||||||
}
|
|
||||||
|
|
||||||
return difficulty;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
||||||
{
|
{
|
||||||
for (int i = 1; i < beatmap.HitObjects.Count; i++)
|
var sortedObjects = beatmap.HitObjects.ToArray();
|
||||||
yield return new ManiaDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate);
|
|
||||||
|
LegacySortHelper<HitObject>.Sort(sortedObjects, Comparer<HitObject>.Create((a, b) => (int)Math.Round(a.StartTime) - (int)Math.Round(b.StartTime)));
|
||||||
|
|
||||||
|
for (int i = 1; i < sortedObjects.Length; i++)
|
||||||
|
yield return new ManiaDifficultyHitObject(sortedObjects[i], sortedObjects[i - 1], clockRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Skill[] CreateSkills(IBeatmap beatmap)
|
// Sorting is done in CreateDifficultyHitObjects, since the full list of hitobjects is required.
|
||||||
|
protected override IEnumerable<DifficultyHitObject> SortObjects(IEnumerable<DifficultyHitObject> input) => input;
|
||||||
|
|
||||||
|
protected override Skill[] CreateSkills(IBeatmap beatmap) => new Skill[]
|
||||||
{
|
{
|
||||||
int columnCount = ((ManiaBeatmap)beatmap).TotalColumns;
|
new Strain(((ManiaBeatmap)beatmap).TotalColumns)
|
||||||
|
};
|
||||||
var skills = new List<Skill> { new Overall(columnCount) };
|
|
||||||
|
|
||||||
for (int i = 0; i < columnCount; i++)
|
|
||||||
skills.Add(new Individual(i, columnCount));
|
|
||||||
|
|
||||||
return skills.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Mod[] DifficultyAdjustmentMods
|
protected override Mod[] DifficultyAdjustmentMods
|
||||||
{
|
{
|
||||||
@ -122,12 +96,73 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
|||||||
new ManiaModKey3(),
|
new ManiaModKey3(),
|
||||||
new ManiaModKey4(),
|
new ManiaModKey4(),
|
||||||
new ManiaModKey5(),
|
new ManiaModKey5(),
|
||||||
|
new MultiMod(new ManiaModKey5(), new ManiaModDualStages()),
|
||||||
new ManiaModKey6(),
|
new ManiaModKey6(),
|
||||||
|
new MultiMod(new ManiaModKey6(), new ManiaModDualStages()),
|
||||||
new ManiaModKey7(),
|
new ManiaModKey7(),
|
||||||
|
new MultiMod(new ManiaModKey7(), new ManiaModDualStages()),
|
||||||
new ManiaModKey8(),
|
new ManiaModKey8(),
|
||||||
|
new MultiMod(new ManiaModKey8(), new ManiaModDualStages()),
|
||||||
new ManiaModKey9(),
|
new ManiaModKey9(),
|
||||||
|
new MultiMod(new ManiaModKey9(), new ManiaModDualStages()),
|
||||||
}).ToArray();
|
}).ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getHitWindow300(Mod[] mods)
|
||||||
|
{
|
||||||
|
if (isForCurrentRuleset)
|
||||||
|
{
|
||||||
|
double od = Math.Min(10.0, Math.Max(0, 10.0 - originalOverallDifficulty));
|
||||||
|
return applyModAdjustments(34 + 3 * od, mods);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Math.Round(originalOverallDifficulty) > 4)
|
||||||
|
return applyModAdjustments(34, mods);
|
||||||
|
|
||||||
|
return applyModAdjustments(47, mods);
|
||||||
|
|
||||||
|
static int applyModAdjustments(double value, Mod[] mods)
|
||||||
|
{
|
||||||
|
if (mods.Any(m => m is ManiaModHardRock))
|
||||||
|
value /= 1.4;
|
||||||
|
else if (mods.Any(m => m is ManiaModEasy))
|
||||||
|
value *= 1.4;
|
||||||
|
|
||||||
|
if (mods.Any(m => m is ManiaModDoubleTime))
|
||||||
|
value *= 1.5;
|
||||||
|
else if (mods.Any(m => m is ManiaModHalfTime))
|
||||||
|
value *= 0.75;
|
||||||
|
|
||||||
|
return (int)value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double getScoreMultiplier(IBeatmap beatmap, Mod[] mods)
|
||||||
|
{
|
||||||
|
double scoreMultiplier = 1;
|
||||||
|
|
||||||
|
foreach (var m in mods)
|
||||||
|
{
|
||||||
|
switch (m)
|
||||||
|
{
|
||||||
|
case ManiaModNoFail _:
|
||||||
|
case ManiaModEasy _:
|
||||||
|
case ManiaModHalfTime _:
|
||||||
|
scoreMultiplier *= 0.5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var maniaBeatmap = (ManiaBeatmap)beatmap;
|
||||||
|
int diff = maniaBeatmap.TotalColumns - maniaBeatmap.OriginalTotalColumns;
|
||||||
|
|
||||||
|
if (diff > 0)
|
||||||
|
scoreMultiplier *= 0.9;
|
||||||
|
else if (diff < 0)
|
||||||
|
scoreMultiplier *= 0.9 + 0.04 * diff;
|
||||||
|
|
||||||
|
return scoreMultiplier;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,47 +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 System.Linq;
|
|
||||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
|
||||||
using osu.Game.Rulesets.Difficulty.Skills;
|
|
||||||
using osu.Game.Rulesets.Mania.Difficulty.Preprocessing;
|
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Difficulty.Skills
|
|
||||||
{
|
|
||||||
public class Individual : Skill
|
|
||||||
{
|
|
||||||
protected override double SkillMultiplier => 1;
|
|
||||||
protected override double StrainDecayBase => 0.125;
|
|
||||||
|
|
||||||
private readonly double[] holdEndTimes;
|
|
||||||
|
|
||||||
private readonly int column;
|
|
||||||
|
|
||||||
public Individual(int column, int columnCount)
|
|
||||||
{
|
|
||||||
this.column = column;
|
|
||||||
|
|
||||||
holdEndTimes = new double[columnCount];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override double StrainValueOf(DifficultyHitObject current)
|
|
||||||
{
|
|
||||||
var maniaCurrent = (ManiaDifficultyHitObject)current;
|
|
||||||
var endTime = maniaCurrent.BaseObject.GetEndTime();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (maniaCurrent.BaseObject.Column != column)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// We give a slight bonus if something is held meanwhile
|
|
||||||
return holdEndTimes.Any(t => t > endTime) ? 2.5 : 2;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
holdEndTimes[maniaCurrent.BaseObject.Column] = endTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +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.Game.Rulesets.Difficulty.Preprocessing;
|
|
||||||
using osu.Game.Rulesets.Difficulty.Skills;
|
|
||||||
using osu.Game.Rulesets.Mania.Difficulty.Preprocessing;
|
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Difficulty.Skills
|
|
||||||
{
|
|
||||||
public class Overall : Skill
|
|
||||||
{
|
|
||||||
protected override double SkillMultiplier => 1;
|
|
||||||
protected override double StrainDecayBase => 0.3;
|
|
||||||
|
|
||||||
private readonly double[] holdEndTimes;
|
|
||||||
|
|
||||||
private readonly int columnCount;
|
|
||||||
|
|
||||||
public Overall(int columnCount)
|
|
||||||
{
|
|
||||||
this.columnCount = columnCount;
|
|
||||||
|
|
||||||
holdEndTimes = new double[columnCount];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override double StrainValueOf(DifficultyHitObject current)
|
|
||||||
{
|
|
||||||
var maniaCurrent = (ManiaDifficultyHitObject)current;
|
|
||||||
var endTime = maniaCurrent.BaseObject.GetEndTime();
|
|
||||||
|
|
||||||
double holdFactor = 1.0; // Factor in case something else is held
|
|
||||||
double holdAddition = 0; // Addition to the current note in case it's a hold and has to be released awkwardly
|
|
||||||
|
|
||||||
for (int i = 0; i < columnCount; i++)
|
|
||||||
{
|
|
||||||
// If there is at least one other overlapping end or note, then we get an addition, buuuuuut...
|
|
||||||
if (current.BaseObject.StartTime < holdEndTimes[i] && endTime > holdEndTimes[i])
|
|
||||||
holdAddition = 1.0;
|
|
||||||
|
|
||||||
// ... this addition only is valid if there is _no_ other note with the same ending.
|
|
||||||
// Releasing multiple notes at the same time is just as easy as releasing one
|
|
||||||
if (endTime == holdEndTimes[i])
|
|
||||||
holdAddition = 0;
|
|
||||||
|
|
||||||
// We give a slight bonus if something is held meanwhile
|
|
||||||
if (holdEndTimes[i] > endTime)
|
|
||||||
holdFactor = 1.25;
|
|
||||||
}
|
|
||||||
|
|
||||||
holdEndTimes[maniaCurrent.BaseObject.Column] = endTime;
|
|
||||||
|
|
||||||
return (1 + holdAddition) * holdFactor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
80
osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
// 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 osu.Framework.Utils;
|
||||||
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||||
|
using osu.Game.Rulesets.Difficulty.Skills;
|
||||||
|
using osu.Game.Rulesets.Mania.Difficulty.Preprocessing;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Difficulty.Skills
|
||||||
|
{
|
||||||
|
public class Strain : Skill
|
||||||
|
{
|
||||||
|
private const double individual_decay_base = 0.125;
|
||||||
|
private const double overall_decay_base = 0.30;
|
||||||
|
|
||||||
|
protected override double SkillMultiplier => 1;
|
||||||
|
protected override double StrainDecayBase => 1;
|
||||||
|
|
||||||
|
private readonly double[] holdEndTimes;
|
||||||
|
private readonly double[] individualStrains;
|
||||||
|
|
||||||
|
private double individualStrain;
|
||||||
|
private double overallStrain;
|
||||||
|
|
||||||
|
public Strain(int totalColumns)
|
||||||
|
{
|
||||||
|
holdEndTimes = new double[totalColumns];
|
||||||
|
individualStrains = new double[totalColumns];
|
||||||
|
overallStrain = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override double StrainValueOf(DifficultyHitObject current)
|
||||||
|
{
|
||||||
|
var maniaCurrent = (ManiaDifficultyHitObject)current;
|
||||||
|
var endTime = maniaCurrent.BaseObject.GetEndTime();
|
||||||
|
var column = maniaCurrent.BaseObject.Column;
|
||||||
|
|
||||||
|
double holdFactor = 1.0; // Factor to all additional strains in case something else is held
|
||||||
|
double holdAddition = 0; // Addition to the current note in case it's a hold and has to be released awkwardly
|
||||||
|
|
||||||
|
// Fill up the holdEndTimes array
|
||||||
|
for (int i = 0; i < holdEndTimes.Length; ++i)
|
||||||
|
{
|
||||||
|
// If there is at least one other overlapping end or note, then we get an addition, buuuuuut...
|
||||||
|
if (Precision.DefinitelyBigger(holdEndTimes[i], maniaCurrent.BaseObject.StartTime, 1) && Precision.DefinitelyBigger(endTime, holdEndTimes[i], 1))
|
||||||
|
holdAddition = 1.0;
|
||||||
|
|
||||||
|
// ... this addition only is valid if there is _no_ other note with the same ending. Releasing multiple notes at the same time is just as easy as releasing 1
|
||||||
|
if (Precision.AlmostEquals(endTime, holdEndTimes[i], 1))
|
||||||
|
holdAddition = 0;
|
||||||
|
|
||||||
|
// We give a slight bonus to everything if something is held meanwhile
|
||||||
|
if (Precision.DefinitelyBigger(holdEndTimes[i], endTime, 1))
|
||||||
|
holdFactor = 1.25;
|
||||||
|
|
||||||
|
// Decay individual strains
|
||||||
|
individualStrains[i] = applyDecay(individualStrains[i], current.DeltaTime, individual_decay_base);
|
||||||
|
}
|
||||||
|
|
||||||
|
holdEndTimes[column] = endTime;
|
||||||
|
|
||||||
|
// Increase individual strain in own column
|
||||||
|
individualStrains[column] += 2.0 * holdFactor;
|
||||||
|
individualStrain = individualStrains[column];
|
||||||
|
|
||||||
|
overallStrain = applyDecay(overallStrain, current.DeltaTime, overall_decay_base) + (1 + holdAddition) * holdFactor;
|
||||||
|
|
||||||
|
return individualStrain + overallStrain - CurrentStrain;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override double GetPeakStrain(double offset)
|
||||||
|
=> applyDecay(individualStrain, offset - Previous[0].BaseObject.StartTime, individual_decay_base)
|
||||||
|
+ applyDecay(overallStrain, offset - Previous[0].BaseObject.StartTime, overall_decay_base);
|
||||||
|
|
||||||
|
private double applyDecay(double value, double deltaTime, double decayBase)
|
||||||
|
=> value * Math.Pow(decayBase, deltaTime / 1000);
|
||||||
|
}
|
||||||
|
}
|
@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
int minColumn = int.MaxValue;
|
int minColumn = int.MaxValue;
|
||||||
int maxColumn = int.MinValue;
|
int maxColumn = int.MinValue;
|
||||||
|
|
||||||
foreach (var obj in SelectedHitObjects.OfType<ManiaHitObject>())
|
foreach (var obj in EditorBeatmap.SelectedHitObjects.OfType<ManiaHitObject>())
|
||||||
{
|
{
|
||||||
if (obj.Column < minColumn)
|
if (obj.Column < minColumn)
|
||||||
minColumn = obj.Column;
|
minColumn = obj.Column;
|
||||||
@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
|
|
||||||
columnDelta = Math.Clamp(columnDelta, -minColumn, maniaPlayfield.TotalColumns - 1 - maxColumn);
|
columnDelta = Math.Clamp(columnDelta, -minColumn, maniaPlayfield.TotalColumns - 1 - maxColumn);
|
||||||
|
|
||||||
foreach (var obj in SelectedHitObjects.OfType<ManiaHitObject>())
|
foreach (var obj in EditorBeatmap.SelectedHitObjects.OfType<ManiaHitObject>())
|
||||||
obj.Column += columnDelta;
|
obj.Column += columnDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,6 +319,31 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
return (PlayfieldType)Enum.GetValues(typeof(PlayfieldType)).Cast<int>().OrderByDescending(i => i).First(v => variant >= v);
|
return (PlayfieldType)Enum.GetValues(typeof(PlayfieldType)).Cast<int>().OrderByDescending(i => i).First(v => variant >= v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override IEnumerable<HitResult> GetValidHitResults()
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
HitResult.Perfect,
|
||||||
|
HitResult.Great,
|
||||||
|
HitResult.Good,
|
||||||
|
HitResult.Ok,
|
||||||
|
HitResult.Meh,
|
||||||
|
|
||||||
|
HitResult.LargeTickHit,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GetDisplayNameForHitResult(HitResult result)
|
||||||
|
{
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case HitResult.LargeTickHit:
|
||||||
|
return "hold tick";
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.GetDisplayNameForHitResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
public override StatisticRow[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap) => new[]
|
public override StatisticRow[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap) => new[]
|
||||||
{
|
{
|
||||||
new StatisticRow
|
new StatisticRow
|
||||||
|
165
osu.Game.Rulesets.Mania/MathUtils/LegacySortHelper.cs
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
// 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.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.MathUtils
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides access to .NET4.0 unstable sorting methods.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Source: https://referencesource.microsoft.com/#mscorlib/system/collections/generic/arraysorthelper.cs
|
||||||
|
/// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
/// </remarks>
|
||||||
|
internal static class LegacySortHelper<T>
|
||||||
|
{
|
||||||
|
private const int quick_sort_depth_threshold = 32;
|
||||||
|
|
||||||
|
public static void Sort(T[] keys, IComparer<T> comparer)
|
||||||
|
{
|
||||||
|
if (keys == null)
|
||||||
|
throw new ArgumentNullException(nameof(keys));
|
||||||
|
|
||||||
|
if (keys.Length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
comparer ??= Comparer<T>.Default;
|
||||||
|
depthLimitedQuickSort(keys, 0, keys.Length - 1, comparer, quick_sort_depth_threshold);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void depthLimitedQuickSort(T[] keys, int left, int right, IComparer<T> comparer, int depthLimit)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (depthLimit == 0)
|
||||||
|
{
|
||||||
|
heapsort(keys, left, right, comparer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int i = left;
|
||||||
|
int j = right;
|
||||||
|
|
||||||
|
// pre-sort the low, middle (pivot), and high values in place.
|
||||||
|
// this improves performance in the face of already sorted data, or
|
||||||
|
// data that is made up of multiple sorted runs appended together.
|
||||||
|
int middle = i + ((j - i) >> 1);
|
||||||
|
swapIfGreater(keys, comparer, i, middle); // swap the low with the mid point
|
||||||
|
swapIfGreater(keys, comparer, i, j); // swap the low with the high
|
||||||
|
swapIfGreater(keys, comparer, middle, j); // swap the middle with the high
|
||||||
|
|
||||||
|
T x = keys[middle];
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
while (comparer.Compare(keys[i], x) < 0) i++;
|
||||||
|
while (comparer.Compare(x, keys[j]) < 0) j--;
|
||||||
|
Contract.Assert(i >= left && j <= right, "(i>=left && j<=right) Sort failed - Is your IComparer bogus?");
|
||||||
|
if (i > j) break;
|
||||||
|
|
||||||
|
if (i < j)
|
||||||
|
{
|
||||||
|
T key = keys[i];
|
||||||
|
keys[i] = keys[j];
|
||||||
|
keys[j] = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
j--;
|
||||||
|
} while (i <= j);
|
||||||
|
|
||||||
|
// The next iteration of the while loop is to "recursively" sort the larger half of the array and the
|
||||||
|
// following calls recrusively sort the smaller half. So we subtrack one from depthLimit here so
|
||||||
|
// both sorts see the new value.
|
||||||
|
depthLimit--;
|
||||||
|
|
||||||
|
if (j - left <= right - i)
|
||||||
|
{
|
||||||
|
if (left < j) depthLimitedQuickSort(keys, left, j, comparer, depthLimit);
|
||||||
|
left = i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (i < right) depthLimitedQuickSort(keys, i, right, comparer, depthLimit);
|
||||||
|
right = j;
|
||||||
|
}
|
||||||
|
} while (left < right);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void heapsort(T[] keys, int lo, int hi, IComparer<T> comparer)
|
||||||
|
{
|
||||||
|
Contract.Requires(keys != null);
|
||||||
|
Contract.Requires(comparer != null);
|
||||||
|
Contract.Requires(lo >= 0);
|
||||||
|
Contract.Requires(hi > lo);
|
||||||
|
Contract.Requires(hi < keys.Length);
|
||||||
|
|
||||||
|
int n = hi - lo + 1;
|
||||||
|
|
||||||
|
for (int i = n / 2; i >= 1; i = i - 1)
|
||||||
|
{
|
||||||
|
downHeap(keys, i, n, lo, comparer);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = n; i > 1; i = i - 1)
|
||||||
|
{
|
||||||
|
swap(keys, lo, lo + i - 1);
|
||||||
|
downHeap(keys, 1, i - 1, lo, comparer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void downHeap(T[] keys, int i, int n, int lo, IComparer<T> comparer)
|
||||||
|
{
|
||||||
|
Contract.Requires(keys != null);
|
||||||
|
Contract.Requires(comparer != null);
|
||||||
|
Contract.Requires(lo >= 0);
|
||||||
|
Contract.Requires(lo < keys.Length);
|
||||||
|
|
||||||
|
T d = keys[lo + i - 1];
|
||||||
|
|
||||||
|
while (i <= n / 2)
|
||||||
|
{
|
||||||
|
var child = 2 * i;
|
||||||
|
|
||||||
|
if (child < n && comparer.Compare(keys[lo + child - 1], keys[lo + child]) < 0)
|
||||||
|
{
|
||||||
|
child++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(comparer.Compare(d, keys[lo + child - 1]) < 0))
|
||||||
|
break;
|
||||||
|
|
||||||
|
keys[lo + i - 1] = keys[lo + child - 1];
|
||||||
|
i = child;
|
||||||
|
}
|
||||||
|
|
||||||
|
keys[lo + i - 1] = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void swap(T[] a, int i, int j)
|
||||||
|
{
|
||||||
|
if (i != j)
|
||||||
|
{
|
||||||
|
T t = a[i];
|
||||||
|
a[i] = a[j];
|
||||||
|
a[j] = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void swapIfGreater(T[] keys, IComparer<T> comparer, int a, int b)
|
||||||
|
{
|
||||||
|
if (a != b)
|
||||||
|
{
|
||||||
|
if (comparer.Compare(keys[a], keys[b]) > 0)
|
||||||
|
{
|
||||||
|
T key = keys[a];
|
||||||
|
keys[a] = keys[b];
|
||||||
|
keys[b] = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -39,6 +39,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
typeof(ManiaModKey7),
|
typeof(ManiaModKey7),
|
||||||
typeof(ManiaModKey8),
|
typeof(ManiaModKey8),
|
||||||
typeof(ManiaModKey9),
|
typeof(ManiaModKey9),
|
||||||
|
typeof(ManiaModKey10),
|
||||||
}.Except(new[] { GetType() }).ToArray();
|
}.Except(new[] { GetType() }).ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
["soft-hitnormal"],
|
["soft-hitnormal"],
|
||||||
["drum-hitnormal"]
|
["drum-hitnormal"]
|
||||||
],
|
],
|
||||||
"Samples": ["drum-hitnormal"]
|
"Samples": ["-hitnormal"]
|
||||||
}, {
|
}, {
|
||||||
"StartTime": 1875.0,
|
"StartTime": 1875.0,
|
||||||
"EndTime": 2750.0,
|
"EndTime": 2750.0,
|
||||||
@ -19,7 +19,7 @@
|
|||||||
["soft-hitnormal"],
|
["soft-hitnormal"],
|
||||||
["drum-hitnormal"]
|
["drum-hitnormal"]
|
||||||
],
|
],
|
||||||
"Samples": ["drum-hitnormal"]
|
"Samples": ["-hitnormal"]
|
||||||
}]
|
}]
|
||||||
}, {
|
}, {
|
||||||
"StartTime": 3750.0,
|
"StartTime": 3750.0,
|
||||||
|
@ -21,6 +21,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
|
|||||||
InternalChild = circlePiece = new HitCirclePiece();
|
InternalChild = circlePiece = new HitCirclePiece();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
BeginPlacement();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
@ -49,6 +49,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
OriginPosition = body.PathOffset;
|
OriginPosition = body.PathOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RecyclePath() => body.RecyclePath();
|
||||||
|
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => body.ReceivePositionalInputAt(screenSpacePos);
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => body.ReceivePositionalInputAt(screenSpacePos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
{
|
{
|
||||||
public class SliderSelectionBlueprint : OsuSelectionBlueprint<Slider>
|
public class SliderSelectionBlueprint : OsuSelectionBlueprint<Slider>
|
||||||
{
|
{
|
||||||
protected readonly SliderBodyPiece BodyPiece;
|
protected SliderBodyPiece BodyPiece { get; private set; }
|
||||||
protected readonly SliderCircleSelectionBlueprint HeadBlueprint;
|
protected SliderCircleSelectionBlueprint HeadBlueprint { get; private set; }
|
||||||
protected readonly SliderCircleSelectionBlueprint TailBlueprint;
|
protected SliderCircleSelectionBlueprint TailBlueprint { get; private set; }
|
||||||
protected readonly PathControlPointVisualiser ControlPointVisualiser;
|
protected PathControlPointVisualiser ControlPointVisualiser { get; private set; }
|
||||||
|
|
||||||
|
private readonly DrawableSlider slider;
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private HitObjectComposer composer { get; set; }
|
private HitObjectComposer composer { get; set; }
|
||||||
@ -44,17 +46,17 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
public SliderSelectionBlueprint(DrawableSlider slider)
|
public SliderSelectionBlueprint(DrawableSlider slider)
|
||||||
: base(slider)
|
: base(slider)
|
||||||
{
|
{
|
||||||
var sliderObject = (Slider)slider.HitObject;
|
this.slider = slider;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
BodyPiece = new SliderBodyPiece(),
|
BodyPiece = new SliderBodyPiece(),
|
||||||
HeadBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.Start),
|
HeadBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.Start),
|
||||||
TailBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.End),
|
TailBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.End),
|
||||||
ControlPointVisualiser = new PathControlPointVisualiser(sliderObject, true)
|
|
||||||
{
|
|
||||||
RemoveControlPointsRequested = removeControlPoints
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,13 +68,35 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
|
|
||||||
pathVersion = HitObject.Path.Version.GetBoundCopy();
|
pathVersion = HitObject.Path.Version.GetBoundCopy();
|
||||||
pathVersion.BindValueChanged(_ => updatePath());
|
pathVersion.BindValueChanged(_ => updatePath());
|
||||||
|
|
||||||
|
BodyPiece.UpdateFrom(HitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
BodyPiece.UpdateFrom(HitObject);
|
if (IsSelected)
|
||||||
|
BodyPiece.UpdateFrom(HitObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSelected()
|
||||||
|
{
|
||||||
|
AddInternal(ControlPointVisualiser = new PathControlPointVisualiser((Slider)slider.HitObject, true)
|
||||||
|
{
|
||||||
|
RemoveControlPointsRequested = removeControlPoints
|
||||||
|
});
|
||||||
|
|
||||||
|
base.OnSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDeselected()
|
||||||
|
{
|
||||||
|
base.OnDeselected();
|
||||||
|
|
||||||
|
// throw away frame buffers on deselection.
|
||||||
|
ControlPointVisualiser?.Expire();
|
||||||
|
BodyPiece.RecyclePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector2 rightClickPosition;
|
private Vector2 rightClickPosition;
|
||||||
@ -182,7 +206,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
private void updatePath()
|
private void updatePath()
|
||||||
{
|
{
|
||||||
HitObject.Path.ExpectedDistance.Value = composer?.GetSnappedDistanceFromDistance(HitObject.StartTime, (float)HitObject.Path.CalculatedDistance) ?? (float)HitObject.Path.CalculatedDistance;
|
HitObject.Path.ExpectedDistance.Value = composer?.GetSnappedDistanceFromDistance(HitObject.StartTime, (float)HitObject.Path.CalculatedDistance) ?? (float)HitObject.Path.CalculatedDistance;
|
||||||
editorBeatmap?.UpdateHitObject(HitObject);
|
editorBeatmap?.Update(HitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override MenuItem[] ContextMenuItems => new MenuItem[]
|
public override MenuItem[] ContextMenuItems => new MenuItem[]
|
||||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
@ -20,11 +21,12 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
{
|
{
|
||||||
base.OnSelectionChanged();
|
base.OnSelectionChanged();
|
||||||
|
|
||||||
bool canOperate = SelectedHitObjects.Count() > 1 || SelectedHitObjects.Any(s => s is Slider);
|
bool canOperate = EditorBeatmap.SelectedHitObjects.Count > 1 || EditorBeatmap.SelectedHitObjects.Any(s => s is Slider);
|
||||||
|
|
||||||
SelectionBox.CanRotate = canOperate;
|
SelectionBox.CanRotate = canOperate;
|
||||||
SelectionBox.CanScaleX = canOperate;
|
SelectionBox.CanScaleX = canOperate;
|
||||||
SelectionBox.CanScaleY = canOperate;
|
SelectionBox.CanScaleY = canOperate;
|
||||||
|
SelectionBox.CanReverse = canOperate;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnOperationEnded()
|
protected override void OnOperationEnded()
|
||||||
@ -41,6 +43,54 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private Vector2? referenceOrigin;
|
private Vector2? referenceOrigin;
|
||||||
|
|
||||||
|
public override bool HandleReverse()
|
||||||
|
{
|
||||||
|
var hitObjects = selectedMovableObjects;
|
||||||
|
|
||||||
|
double endTime = hitObjects.Max(h => h.GetEndTime());
|
||||||
|
double startTime = hitObjects.Min(h => h.StartTime);
|
||||||
|
|
||||||
|
bool moreThanOneObject = hitObjects.Length > 1;
|
||||||
|
|
||||||
|
foreach (var h in hitObjects)
|
||||||
|
{
|
||||||
|
if (moreThanOneObject)
|
||||||
|
h.StartTime = endTime - (h.GetEndTime() - startTime);
|
||||||
|
|
||||||
|
if (h is Slider slider)
|
||||||
|
{
|
||||||
|
var points = slider.Path.ControlPoints.ToArray();
|
||||||
|
Vector2 endPos = points.Last().Position.Value;
|
||||||
|
|
||||||
|
slider.Path.ControlPoints.Clear();
|
||||||
|
|
||||||
|
slider.Position += endPos;
|
||||||
|
|
||||||
|
PathType? lastType = null;
|
||||||
|
|
||||||
|
for (var i = 0; i < points.Length; i++)
|
||||||
|
{
|
||||||
|
var p = points[i];
|
||||||
|
p.Position.Value -= endPos;
|
||||||
|
|
||||||
|
// propagate types forwards to last null type
|
||||||
|
if (i == points.Length - 1)
|
||||||
|
p.Type.Value = lastType;
|
||||||
|
else if (p.Type.Value != null)
|
||||||
|
{
|
||||||
|
var newType = p.Type.Value;
|
||||||
|
p.Type.Value = lastType;
|
||||||
|
lastType = newType;
|
||||||
|
}
|
||||||
|
|
||||||
|
slider.Path.ControlPoints.Insert(0, p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool HandleFlip(Direction direction)
|
public override bool HandleFlip(Direction direction)
|
||||||
{
|
{
|
||||||
var hitObjects = selectedMovableObjects;
|
var hitObjects = selectedMovableObjects;
|
||||||
@ -182,7 +232,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
/// <param name="points">The points to calculate a quad for.</param>
|
/// <param name="points">The points to calculate a quad for.</param>
|
||||||
private Quad getSurroundingQuad(IEnumerable<Vector2> points)
|
private Quad getSurroundingQuad(IEnumerable<Vector2> points)
|
||||||
{
|
{
|
||||||
if (!SelectedHitObjects.Any())
|
if (!EditorBeatmap.SelectedHitObjects.Any())
|
||||||
return new Quad();
|
return new Quad();
|
||||||
|
|
||||||
Vector2 minPosition = new Vector2(float.MaxValue, float.MaxValue);
|
Vector2 minPosition = new Vector2(float.MaxValue, float.MaxValue);
|
||||||
@ -203,10 +253,10 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// All osu! hitobjects which can be moved/rotated/scaled.
|
/// All osu! hitobjects which can be moved/rotated/scaled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private OsuHitObject[] selectedMovableObjects => SelectedHitObjects
|
private OsuHitObject[] selectedMovableObjects => EditorBeatmap.SelectedHitObjects
|
||||||
.OfType<OsuHitObject>()
|
.OfType<OsuHitObject>()
|
||||||
.Where(h => !(h is Spinner))
|
.Where(h => !(h is Spinner))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rotate a point around an arbitrary origin.
|
/// Rotate a point around an arbitrary origin.
|
||||||
|
@ -42,7 +42,11 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
private double lastSliderHeadFadeOutStartTime;
|
private double lastSliderHeadFadeOutStartTime;
|
||||||
private double lastSliderHeadFadeOutDuration;
|
private double lastSliderHeadFadeOutDuration;
|
||||||
|
|
||||||
protected override void ApplyHiddenState(DrawableHitObject drawable, ArmedState state)
|
protected override void ApplyFirstObjectIncreaseVisibilityState(DrawableHitObject drawable, ArmedState state) => applyState(drawable, true);
|
||||||
|
|
||||||
|
protected override void ApplyHiddenState(DrawableHitObject drawable, ArmedState state) => applyState(drawable, false);
|
||||||
|
|
||||||
|
private void applyState(DrawableHitObject drawable, bool increaseVisibility)
|
||||||
{
|
{
|
||||||
if (!(drawable is DrawableOsuHitObject d))
|
if (!(drawable is DrawableOsuHitObject d))
|
||||||
return;
|
return;
|
||||||
@ -86,14 +90,23 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
lastSliderHeadFadeOutStartTime = fadeOutStartTime;
|
lastSliderHeadFadeOutStartTime = fadeOutStartTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we don't want to see the approach circle
|
Drawable fadeTarget = circle;
|
||||||
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
|
|
||||||
circle.ApproachCircle.Hide();
|
if (increaseVisibility)
|
||||||
|
{
|
||||||
|
// only fade the circle piece (not the approach circle) for the increased visibility object.
|
||||||
|
fadeTarget = circle.CirclePiece;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we don't want to see the approach circle
|
||||||
|
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
|
||||||
|
circle.ApproachCircle.Hide();
|
||||||
|
}
|
||||||
|
|
||||||
// fade out immediately after fade in.
|
// fade out immediately after fade in.
|
||||||
using (drawable.BeginAbsoluteSequence(fadeOutStartTime, true))
|
using (drawable.BeginAbsoluteSequence(fadeOutStartTime, true))
|
||||||
circle.FadeOut(fadeOutDuration);
|
fadeTarget.FadeOut(fadeOutDuration);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DrawableSlider slider:
|
case DrawableSlider slider:
|
||||||
|
@ -137,6 +137,10 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
|
|
||||||
Velocity = scoringDistance / timingPoint.BeatLength;
|
Velocity = scoringDistance / timingPoint.BeatLength;
|
||||||
TickDistance = scoringDistance / difficulty.SliderTickRate * TickDistanceMultiplier;
|
TickDistance = scoringDistance / difficulty.SliderTickRate * TickDistanceMultiplier;
|
||||||
|
|
||||||
|
// The samples should be attached to the slider tail, however this can only be done after LegacyLastTick is removed otherwise they would play earlier than they're intended to.
|
||||||
|
// For now, the samples are attached to and played by the slider itself at the correct end time.
|
||||||
|
Samples = this.GetNodeSamples(repeatCount + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
||||||
@ -230,15 +234,12 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
tick.Samples = sampleList;
|
tick.Samples = sampleList;
|
||||||
|
|
||||||
foreach (var repeat in NestedHitObjects.OfType<SliderRepeat>())
|
foreach (var repeat in NestedHitObjects.OfType<SliderRepeat>())
|
||||||
repeat.Samples = getNodeSamples(repeat.RepeatIndex + 1);
|
repeat.Samples = this.GetNodeSamples(repeat.RepeatIndex + 1);
|
||||||
|
|
||||||
if (HeadCircle != null)
|
if (HeadCircle != null)
|
||||||
HeadCircle.Samples = getNodeSamples(0);
|
HeadCircle.Samples = this.GetNodeSamples(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IList<HitSampleInfo> getNodeSamples(int nodeIndex) =>
|
|
||||||
nodeIndex < NodeSamples.Count ? NodeSamples[nodeIndex] : Samples;
|
|
||||||
|
|
||||||
public override Judgement CreateJudgement() => new OsuIgnoreJudgement();
|
public override Judgement CreateJudgement() => new OsuIgnoreJudgement();
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||||
|
@ -191,6 +191,41 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
|
|
||||||
public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new OsuRulesetConfigManager(settings, RulesetInfo);
|
public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new OsuRulesetConfigManager(settings, RulesetInfo);
|
||||||
|
|
||||||
|
protected override IEnumerable<HitResult> GetValidHitResults()
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
HitResult.Great,
|
||||||
|
HitResult.Ok,
|
||||||
|
HitResult.Meh,
|
||||||
|
|
||||||
|
HitResult.LargeTickHit,
|
||||||
|
HitResult.SmallTickHit,
|
||||||
|
HitResult.SmallBonus,
|
||||||
|
HitResult.LargeBonus,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GetDisplayNameForHitResult(HitResult result)
|
||||||
|
{
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case HitResult.LargeTickHit:
|
||||||
|
return "slider tick";
|
||||||
|
|
||||||
|
case HitResult.SmallTickHit:
|
||||||
|
return "slider end";
|
||||||
|
|
||||||
|
case HitResult.SmallBonus:
|
||||||
|
return "spinner spin";
|
||||||
|
|
||||||
|
case HitResult.LargeBonus:
|
||||||
|
return "spinner bonus";
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.GetDisplayNameForHitResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
public override StatisticRow[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap)
|
public override StatisticRow[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap)
|
||||||
{
|
{
|
||||||
var timedHitEvents = score.HitEvents.Where(e => e.HitObject is HitCircle && !(e.HitObject is SliderTailCircle)).ToList();
|
var timedHitEvents = score.HitEvents.Where(e => e.HitObject is HitCircle && !(e.HitObject is SliderTailCircle)).ToList();
|
||||||
|
@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
|||||||
converted.HitObjects = converted.HitObjects.GroupBy(t => t.StartTime).Select(x =>
|
converted.HitObjects = converted.HitObjects.GroupBy(t => t.StartTime).Select(x =>
|
||||||
{
|
{
|
||||||
TaikoHitObject first = x.First();
|
TaikoHitObject first = x.First();
|
||||||
if (x.Skip(1).Any() && !(first is Swell))
|
if (x.Skip(1).Any() && first.CanBeStrong)
|
||||||
first.IsStrong = true;
|
first.IsStrong = true;
|
||||||
return first;
|
return first;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
@ -52,32 +52,32 @@ namespace osu.Game.Rulesets.Taiko.Edit
|
|||||||
|
|
||||||
public void SetStrongState(bool state)
|
public void SetStrongState(bool state)
|
||||||
{
|
{
|
||||||
var hits = SelectedHitObjects.OfType<Hit>();
|
var hits = EditorBeatmap.SelectedHitObjects.OfType<Hit>();
|
||||||
|
|
||||||
ChangeHandler.BeginChange();
|
EditorBeatmap.BeginChange();
|
||||||
|
|
||||||
foreach (var h in hits)
|
foreach (var h in hits)
|
||||||
{
|
{
|
||||||
if (h.IsStrong != state)
|
if (h.IsStrong != state)
|
||||||
{
|
{
|
||||||
h.IsStrong = state;
|
h.IsStrong = state;
|
||||||
EditorBeatmap.UpdateHitObject(h);
|
EditorBeatmap.Update(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeHandler.EndChange();
|
EditorBeatmap.EndChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRimState(bool state)
|
public void SetRimState(bool state)
|
||||||
{
|
{
|
||||||
var hits = SelectedHitObjects.OfType<Hit>();
|
var hits = EditorBeatmap.SelectedHitObjects.OfType<Hit>();
|
||||||
|
|
||||||
ChangeHandler.BeginChange();
|
EditorBeatmap.BeginChange();
|
||||||
|
|
||||||
foreach (var h in hits)
|
foreach (var h in hits)
|
||||||
h.Type = state ? HitType.Rim : HitType.Centre;
|
h.Type = state ? HitType.Rim : HitType.Centre;
|
||||||
|
|
||||||
ChangeHandler.EndChange();
|
EditorBeatmap.EndChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint> selection)
|
protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint> selection)
|
||||||
@ -89,12 +89,14 @@ namespace osu.Game.Rulesets.Taiko.Edit
|
|||||||
yield return new TernaryStateMenuItem("Strong") { State = { BindTarget = selectionStrongState } };
|
yield return new TernaryStateMenuItem("Strong") { State = { BindTarget = selectionStrongState } };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool HandleMovement(MoveSelectionEvent moveEvent) => true;
|
||||||
|
|
||||||
protected override void UpdateTernaryStates()
|
protected override void UpdateTernaryStates()
|
||||||
{
|
{
|
||||||
base.UpdateTernaryStates();
|
base.UpdateTernaryStates();
|
||||||
|
|
||||||
selectionRimState.Value = GetStateFromSelection(SelectedHitObjects.OfType<Hit>(), h => h.Type == HitType.Rim);
|
selectionRimState.Value = GetStateFromSelection(EditorBeatmap.SelectedHitObjects.OfType<Hit>(), h => h.Type == HitType.Rim);
|
||||||
selectionStrongState.Value = GetStateFromSelection(SelectedHitObjects.OfType<TaikoHitObject>(), h => h.IsStrong);
|
selectionStrongState.Value = GetStateFromSelection(EditorBeatmap.SelectedHitObjects.OfType<TaikoHitObject>(), h => h.IsStrong);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
{
|
{
|
||||||
base.LoadSamples();
|
base.LoadSamples();
|
||||||
|
|
||||||
isStrong.Value = getStrongSamples().Any();
|
if (HitObject.CanBeStrong)
|
||||||
|
isStrong.Value = getStrongSamples().Any();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSamplesFromStrong()
|
private void updateSamplesFromStrong()
|
||||||
|
@ -17,6 +17,8 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
|||||||
set => Duration = value - StartTime;
|
set => Duration = value - StartTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool CanBeStrong => false;
|
||||||
|
|
||||||
public double Duration { get; set; }
|
public double Duration { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
@ -30,6 +31,11 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
|||||||
|
|
||||||
public readonly Bindable<bool> IsStrongBindable = new BindableBool();
|
public readonly Bindable<bool> IsStrongBindable = new BindableBool();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this <see cref="TaikoHitObject"/> can be made a "strong" (large) hit.
|
||||||
|
/// </summary>
|
||||||
|
public virtual bool CanBeStrong => true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this HitObject is a "strong" type.
|
/// Whether this HitObject is a "strong" type.
|
||||||
/// Strong hit objects give more points for hitting the hit object with both keys.
|
/// Strong hit objects give more points for hitting the hit object with both keys.
|
||||||
@ -37,7 +43,13 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
|||||||
public bool IsStrong
|
public bool IsStrong
|
||||||
{
|
{
|
||||||
get => IsStrongBindable.Value;
|
get => IsStrongBindable.Value;
|
||||||
set => IsStrongBindable.Value = value;
|
set
|
||||||
|
{
|
||||||
|
if (value && !CanBeStrong)
|
||||||
|
throw new InvalidOperationException($"Object of type {GetType()} cannot be strong");
|
||||||
|
|
||||||
|
IsStrongBindable.Value = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
||||||
|
@ -159,6 +159,33 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
|
|
||||||
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TaikoReplayFrame();
|
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TaikoReplayFrame();
|
||||||
|
|
||||||
|
protected override IEnumerable<HitResult> GetValidHitResults()
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
HitResult.Great,
|
||||||
|
HitResult.Ok,
|
||||||
|
|
||||||
|
HitResult.SmallTickHit,
|
||||||
|
|
||||||
|
HitResult.SmallBonus,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GetDisplayNameForHitResult(HitResult result)
|
||||||
|
{
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case HitResult.SmallTickHit:
|
||||||
|
return "drum tick";
|
||||||
|
|
||||||
|
case HitResult.SmallBonus:
|
||||||
|
return "strong bonus";
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.GetDisplayNameForHitResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
public override StatisticRow[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap)
|
public override StatisticRow[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap)
|
||||||
{
|
{
|
||||||
var timedHitEvents = score.HitEvents.Where(e => e.HitObject is Hit).ToList();
|
var timedHitEvents = score.HitEvents.Where(e => e.HitObject is Hit).ToList();
|
||||||
|
@ -28,5 +28,28 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
|
|
||||||
Assert.That(key1, Is.EqualTo(key2));
|
Assert.That(key1, Is.EqualTo(key2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase(1.3, DifficultyRating.Easy)]
|
||||||
|
[TestCase(1.993, DifficultyRating.Easy)]
|
||||||
|
[TestCase(1.998, DifficultyRating.Normal)]
|
||||||
|
[TestCase(2.4, DifficultyRating.Normal)]
|
||||||
|
[TestCase(2.693, DifficultyRating.Normal)]
|
||||||
|
[TestCase(2.698, DifficultyRating.Hard)]
|
||||||
|
[TestCase(3.5, DifficultyRating.Hard)]
|
||||||
|
[TestCase(3.993, DifficultyRating.Hard)]
|
||||||
|
[TestCase(3.997, DifficultyRating.Insane)]
|
||||||
|
[TestCase(5.0, DifficultyRating.Insane)]
|
||||||
|
[TestCase(5.292, DifficultyRating.Insane)]
|
||||||
|
[TestCase(5.297, DifficultyRating.Expert)]
|
||||||
|
[TestCase(6.2, DifficultyRating.Expert)]
|
||||||
|
[TestCase(6.493, DifficultyRating.Expert)]
|
||||||
|
[TestCase(6.498, DifficultyRating.ExpertPlus)]
|
||||||
|
[TestCase(8.3, DifficultyRating.ExpertPlus)]
|
||||||
|
public void TestDifficultyRatingMapping(double starRating, DifficultyRating expectedBracket)
|
||||||
|
{
|
||||||
|
var actualBracket = BeatmapDifficultyManager.GetDifficultyRating(starRating);
|
||||||
|
|
||||||
|
Assert.AreEqual(expectedBracket, actualBracket);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -651,5 +651,63 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
Assert.IsInstanceOf<LegacyDifficultyCalculatorBeatmapDecoder>(decoder);
|
Assert.IsInstanceOf<LegacyDifficultyCalculatorBeatmapDecoder>(decoder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMultiSegmentSliders()
|
||||||
|
{
|
||||||
|
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
|
||||||
|
|
||||||
|
using (var resStream = TestResources.OpenResource("multi-segment-slider.osu"))
|
||||||
|
using (var stream = new LineBufferedReader(resStream))
|
||||||
|
{
|
||||||
|
var decoded = decoder.Decode(stream);
|
||||||
|
|
||||||
|
// Multi-segment
|
||||||
|
var first = ((IHasPath)decoded.HitObjects[0]).Path;
|
||||||
|
|
||||||
|
Assert.That(first.ControlPoints[0].Position.Value, Is.EqualTo(Vector2.Zero));
|
||||||
|
Assert.That(first.ControlPoints[0].Type.Value, Is.EqualTo(PathType.PerfectCurve));
|
||||||
|
Assert.That(first.ControlPoints[1].Position.Value, Is.EqualTo(new Vector2(161, -244)));
|
||||||
|
Assert.That(first.ControlPoints[1].Type.Value, Is.EqualTo(null));
|
||||||
|
|
||||||
|
Assert.That(first.ControlPoints[2].Position.Value, Is.EqualTo(new Vector2(376, -3)));
|
||||||
|
Assert.That(first.ControlPoints[2].Type.Value, Is.EqualTo(PathType.Bezier));
|
||||||
|
Assert.That(first.ControlPoints[3].Position.Value, Is.EqualTo(new Vector2(68, 15)));
|
||||||
|
Assert.That(first.ControlPoints[3].Type.Value, Is.EqualTo(null));
|
||||||
|
Assert.That(first.ControlPoints[4].Position.Value, Is.EqualTo(new Vector2(259, -132)));
|
||||||
|
Assert.That(first.ControlPoints[4].Type.Value, Is.EqualTo(null));
|
||||||
|
Assert.That(first.ControlPoints[5].Position.Value, Is.EqualTo(new Vector2(92, -107)));
|
||||||
|
Assert.That(first.ControlPoints[5].Type.Value, Is.EqualTo(null));
|
||||||
|
|
||||||
|
// Single-segment
|
||||||
|
var second = ((IHasPath)decoded.HitObjects[1]).Path;
|
||||||
|
|
||||||
|
Assert.That(second.ControlPoints[0].Position.Value, Is.EqualTo(Vector2.Zero));
|
||||||
|
Assert.That(second.ControlPoints[0].Type.Value, Is.EqualTo(PathType.PerfectCurve));
|
||||||
|
Assert.That(second.ControlPoints[1].Position.Value, Is.EqualTo(new Vector2(161, -244)));
|
||||||
|
Assert.That(second.ControlPoints[1].Type.Value, Is.EqualTo(null));
|
||||||
|
Assert.That(second.ControlPoints[2].Position.Value, Is.EqualTo(new Vector2(376, -3)));
|
||||||
|
Assert.That(second.ControlPoints[2].Type.Value, Is.EqualTo(null));
|
||||||
|
|
||||||
|
// Implicit multi-segment
|
||||||
|
var third = ((IHasPath)decoded.HitObjects[2]).Path;
|
||||||
|
|
||||||
|
Assert.That(third.ControlPoints[0].Position.Value, Is.EqualTo(Vector2.Zero));
|
||||||
|
Assert.That(third.ControlPoints[0].Type.Value, Is.EqualTo(PathType.Bezier));
|
||||||
|
Assert.That(third.ControlPoints[1].Position.Value, Is.EqualTo(new Vector2(0, 192)));
|
||||||
|
Assert.That(third.ControlPoints[1].Type.Value, Is.EqualTo(null));
|
||||||
|
Assert.That(third.ControlPoints[2].Position.Value, Is.EqualTo(new Vector2(224, 192)));
|
||||||
|
Assert.That(third.ControlPoints[2].Type.Value, Is.EqualTo(null));
|
||||||
|
|
||||||
|
Assert.That(third.ControlPoints[3].Position.Value, Is.EqualTo(new Vector2(224, 0)));
|
||||||
|
Assert.That(third.ControlPoints[3].Type.Value, Is.EqualTo(PathType.Bezier));
|
||||||
|
Assert.That(third.ControlPoints[4].Position.Value, Is.EqualTo(new Vector2(224, -192)));
|
||||||
|
Assert.That(third.ControlPoints[4].Type.Value, Is.EqualTo(null));
|
||||||
|
Assert.That(third.ControlPoints[5].Position.Value, Is.EqualTo(new Vector2(480, -192)));
|
||||||
|
Assert.That(third.ControlPoints[5].Type.Value, Is.EqualTo(null));
|
||||||
|
Assert.That(third.ControlPoints[6].Position.Value, Is.EqualTo(new Vector2(480, 0)));
|
||||||
|
Assert.That(third.ControlPoints[6].Type.Value, Is.EqualTo(null));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
private static readonly DllResourceStore beatmaps_resource_store = TestResources.GetStore();
|
private static readonly DllResourceStore beatmaps_resource_store = TestResources.GetStore();
|
||||||
|
|
||||||
private static IEnumerable<string> allBeatmaps = beatmaps_resource_store.GetAvailableResources().Where(res => res.EndsWith(".osu"));
|
private static IEnumerable<string> allBeatmaps = beatmaps_resource_store.GetAvailableResources().Where(res => res.EndsWith(".osu", StringComparison.Ordinal));
|
||||||
|
|
||||||
[TestCaseSource(nameof(allBeatmaps))]
|
[TestCaseSource(nameof(allBeatmaps))]
|
||||||
public void TestEncodeDecodeStability(string name)
|
public void TestEncodeDecodeStability(string name)
|
||||||
|
100
osu.Game.Tests/Editing/TransactionalCommitComponentTest.cs
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
// 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 NUnit.Framework;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Editing
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TransactionalCommitComponentTest
|
||||||
|
{
|
||||||
|
private TestHandler handler;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
handler = new TestHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCommitTransaction()
|
||||||
|
{
|
||||||
|
Assert.That(handler.StateUpdateCount, Is.EqualTo(0));
|
||||||
|
|
||||||
|
handler.BeginChange();
|
||||||
|
Assert.That(handler.StateUpdateCount, Is.EqualTo(0));
|
||||||
|
handler.EndChange();
|
||||||
|
|
||||||
|
Assert.That(handler.StateUpdateCount, Is.EqualTo(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSaveOutsideOfTransactionTriggersUpdates()
|
||||||
|
{
|
||||||
|
Assert.That(handler.StateUpdateCount, Is.EqualTo(0));
|
||||||
|
|
||||||
|
handler.SaveState();
|
||||||
|
Assert.That(handler.StateUpdateCount, Is.EqualTo(1));
|
||||||
|
|
||||||
|
handler.SaveState();
|
||||||
|
Assert.That(handler.StateUpdateCount, Is.EqualTo(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestEventsFire()
|
||||||
|
{
|
||||||
|
int transactionBegan = 0;
|
||||||
|
int transactionEnded = 0;
|
||||||
|
int stateSaved = 0;
|
||||||
|
|
||||||
|
handler.TransactionBegan += () => transactionBegan++;
|
||||||
|
handler.TransactionEnded += () => transactionEnded++;
|
||||||
|
handler.SaveStateTriggered += () => stateSaved++;
|
||||||
|
|
||||||
|
handler.BeginChange();
|
||||||
|
Assert.That(transactionBegan, Is.EqualTo(1));
|
||||||
|
|
||||||
|
handler.EndChange();
|
||||||
|
Assert.That(transactionEnded, Is.EqualTo(1));
|
||||||
|
|
||||||
|
Assert.That(stateSaved, Is.EqualTo(0));
|
||||||
|
handler.SaveState();
|
||||||
|
Assert.That(stateSaved, Is.EqualTo(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSaveDuringTransactionDoesntTriggerUpdate()
|
||||||
|
{
|
||||||
|
Assert.That(handler.StateUpdateCount, Is.EqualTo(0));
|
||||||
|
|
||||||
|
handler.BeginChange();
|
||||||
|
|
||||||
|
handler.SaveState();
|
||||||
|
Assert.That(handler.StateUpdateCount, Is.EqualTo(0));
|
||||||
|
|
||||||
|
handler.EndChange();
|
||||||
|
|
||||||
|
Assert.That(handler.StateUpdateCount, Is.EqualTo(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestEndWithoutBeginThrows()
|
||||||
|
{
|
||||||
|
handler.BeginChange();
|
||||||
|
handler.EndChange();
|
||||||
|
Assert.That(() => handler.EndChange(), Throws.TypeOf<InvalidOperationException>());
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestHandler : TransactionalCommitComponent
|
||||||
|
{
|
||||||
|
public int StateUpdateCount { get; private set; }
|
||||||
|
|
||||||
|
protected override void UpdateState()
|
||||||
|
{
|
||||||
|
StateUpdateCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -94,6 +94,52 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
Assert.IsTrue(combinations[2] is ModIncompatibleWithAofA);
|
Assert.IsTrue(combinations[2] is ModIncompatibleWithAofA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMultiModFlattening()
|
||||||
|
{
|
||||||
|
var combinations = new TestLegacyDifficultyCalculator(new ModA(), new MultiMod(new ModB(), new ModC())).CreateDifficultyAdjustmentModCombinations();
|
||||||
|
|
||||||
|
Assert.AreEqual(4, combinations.Length);
|
||||||
|
Assert.IsTrue(combinations[0] is ModNoMod);
|
||||||
|
Assert.IsTrue(combinations[1] is ModA);
|
||||||
|
Assert.IsTrue(combinations[2] is MultiMod);
|
||||||
|
Assert.IsTrue(combinations[3] is MultiMod);
|
||||||
|
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[2]).Mods[0] is ModA);
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[2]).Mods[1] is ModB);
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[2]).Mods[2] is ModC);
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[3]).Mods[0] is ModB);
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[3]).Mods[1] is ModC);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestIncompatibleThroughMultiMod()
|
||||||
|
{
|
||||||
|
var combinations = new TestLegacyDifficultyCalculator(new ModA(), new MultiMod(new ModB(), new ModIncompatibleWithA())).CreateDifficultyAdjustmentModCombinations();
|
||||||
|
|
||||||
|
Assert.AreEqual(3, combinations.Length);
|
||||||
|
Assert.IsTrue(combinations[0] is ModNoMod);
|
||||||
|
Assert.IsTrue(combinations[1] is ModA);
|
||||||
|
Assert.IsTrue(combinations[2] is MultiMod);
|
||||||
|
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[2]).Mods[0] is ModB);
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[2]).Mods[1] is ModIncompatibleWithA);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestIncompatibleWithSameInstanceViaMultiMod()
|
||||||
|
{
|
||||||
|
var combinations = new TestLegacyDifficultyCalculator(new ModA(), new MultiMod(new ModA(), new ModB())).CreateDifficultyAdjustmentModCombinations();
|
||||||
|
|
||||||
|
Assert.AreEqual(3, combinations.Length);
|
||||||
|
Assert.IsTrue(combinations[0] is ModNoMod);
|
||||||
|
Assert.IsTrue(combinations[1] is ModA);
|
||||||
|
Assert.IsTrue(combinations[2] is MultiMod);
|
||||||
|
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[2]).Mods[0] is ModA);
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[2]).Mods[1] is ModB);
|
||||||
|
}
|
||||||
|
|
||||||
private class ModA : Mod
|
private class ModA : Mod
|
||||||
{
|
{
|
||||||
public override string Name => nameof(ModA);
|
public override string Name => nameof(ModA);
|
||||||
@ -112,6 +158,13 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
public override Type[] IncompatibleMods => new[] { typeof(ModIncompatibleWithAAndB) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModIncompatibleWithAAndB) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ModC : Mod
|
||||||
|
{
|
||||||
|
public override string Name => nameof(ModC);
|
||||||
|
public override string Acronym => nameof(ModC);
|
||||||
|
public override double ScoreMultiplier => 1;
|
||||||
|
}
|
||||||
|
|
||||||
private class ModIncompatibleWithA : Mod
|
private class ModIncompatibleWithA : Mod
|
||||||
{
|
{
|
||||||
public override string Name => $"Incompatible With {nameof(ModA)}";
|
public override string Name => $"Incompatible With {nameof(ModA)}";
|
||||||
|
@ -197,5 +197,22 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
carouselItem.Filter(criteria);
|
carouselItem.Filter(criteria);
|
||||||
Assert.AreEqual(filtered, carouselItem.Filtered.Value);
|
Assert.AreEqual(filtered, carouselItem.Filtered.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase("202010", true)]
|
||||||
|
[TestCase("20201010", false)]
|
||||||
|
[TestCase("153", true)]
|
||||||
|
[TestCase("1535", false)]
|
||||||
|
public void TestCriteriaMatchingBeatmapIDs(string query, bool filtered)
|
||||||
|
{
|
||||||
|
var beatmap = getExampleBeatmap();
|
||||||
|
beatmap.OnlineBeatmapID = 20201010;
|
||||||
|
beatmap.BeatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = 1535 };
|
||||||
|
|
||||||
|
var criteria = new FilterCriteria { SearchText = query };
|
||||||
|
var carouselItem = new CarouselBeatmap(beatmap);
|
||||||
|
carouselItem.Filter(criteria);
|
||||||
|
|
||||||
|
Assert.AreEqual(filtered, carouselItem.Filtered.Value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
osu.Game.Tests/Resources/multi-segment-slider.osu
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
osu file format v128
|
||||||
|
|
||||||
|
[HitObjects]
|
||||||
|
// Multi-segment
|
||||||
|
63,301,1000,6,0,P|224:57|B|439:298|131:316|322:169|155:194,1,1040,0|0,0:0|0:0,0:0:0:0:
|
||||||
|
|
||||||
|
// Single-segment
|
||||||
|
63,301,2000,6,0,P|224:57|439:298,1,1040,0|0,0:0|0:0,0:0:0:0:
|
||||||
|
|
||||||
|
// Implicit multi-segment
|
||||||
|
32,192,3000,6,0,B|32:384|256:384|256:192|256:192|256:0|512:0|512:192,1,800
|
BIN
osu.Game.Tests/Resources/old-skin/score-0.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-1.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-2.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-3.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-4.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-5.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-6.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-7.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-8.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-9.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-comma.png
Normal file
After Width: | Height: | Size: 865 B |
BIN
osu.Game.Tests/Resources/old-skin/score-dot.png
Normal file
After Width: | Height: | Size: 771 B |
BIN
osu.Game.Tests/Resources/old-skin/score-percent.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-x.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-bg.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-colour-0.png
Normal file
After Width: | Height: | Size: 465 B |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-colour-1.png
Normal file
After Width: | Height: | Size: 475 B |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-colour-2.png
Normal file
After Width: | Height: | Size: 466 B |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-colour-3.png
Normal file
After Width: | Height: | Size: 464 B |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-ki.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-kidanger.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-kidanger2.png
Normal file
After Width: | Height: | Size: 9.1 KiB |
2
osu.Game.Tests/Resources/old-skin/skin.ini
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[General]
|
||||||
|
Version: 1.0
|
@ -193,6 +193,7 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
|
|
||||||
AddStep("Transition to Results", () => player.Push(results = new FadeAccessibleResults(new ScoreInfo
|
AddStep("Transition to Results", () => player.Push(results = new FadeAccessibleResults(new ScoreInfo
|
||||||
{
|
{
|
||||||
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
User = new User { Username = "osu!" },
|
User = new User { Username = "osu!" },
|
||||||
Beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo
|
Beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo
|
||||||
})));
|
})));
|
||||||
|
@ -5,7 +5,6 @@ using NUnit.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Editing
|
namespace osu.Game.Tests.Visual.Editing
|
||||||
@ -13,7 +12,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneTimelineTickDisplay : TimelineTestScene
|
public class TestSceneTimelineTickDisplay : TimelineTestScene
|
||||||
{
|
{
|
||||||
public override Drawable CreateTestComponent() => new TimelineTickDisplay();
|
public override Drawable CreateTestComponent() => Empty(); // tick display is implicitly inside the timeline.
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Threading;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
@ -76,7 +77,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for load", () => graph.ResampledWaveform != null);
|
AddUntilStep("wait for load", () => graph.Loaded.IsSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -98,12 +99,18 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for load", () => graph.ResampledWaveform != null);
|
AddUntilStep("wait for load", () => graph.Loaded.IsSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TestWaveformGraph : WaveformGraph
|
public class TestWaveformGraph : WaveformGraph
|
||||||
{
|
{
|
||||||
public new Waveform ResampledWaveform => base.ResampledWaveform;
|
public readonly ManualResetEventSlim Loaded = new ManualResetEventSlim();
|
||||||
|
|
||||||
|
protected override void OnWaveformRegenerated(Waveform waveform)
|
||||||
|
{
|
||||||
|
base.OnWaveformRegenerated(waveform);
|
||||||
|
Loaded.Set();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
47
osu.Game.Tests/Visual/Gameplay/TestSceneComboCounter.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// 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.Testing;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneComboCounter : SkinnableTestScene
|
||||||
|
{
|
||||||
|
private IEnumerable<SkinnableComboCounter> comboCounters => CreatedDrawables.OfType<SkinnableComboCounter>();
|
||||||
|
|
||||||
|
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||||
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
|
{
|
||||||
|
AddStep("Create combo counters", () => SetContents(() =>
|
||||||
|
{
|
||||||
|
var comboCounter = new SkinnableComboCounter();
|
||||||
|
comboCounter.Current.Value = 1;
|
||||||
|
return comboCounter;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestComboCounterIncrementing()
|
||||||
|
{
|
||||||
|
AddRepeatStep("increase combo", () =>
|
||||||
|
{
|
||||||
|
foreach (var counter in comboCounters)
|
||||||
|
counter.Current.Value++;
|
||||||
|
}, 10);
|
||||||
|
|
||||||
|
AddStep("reset combo", () =>
|
||||||
|
{
|
||||||
|
foreach (var counter in comboCounters)
|
||||||
|
counter.Current.Value = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -26,7 +26,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddStep("get variables", () =>
|
AddStep("get variables", () =>
|
||||||
{
|
{
|
||||||
gameplayClock = Player.ChildrenOfType<FrameStabilityContainer>().First().GameplayClock;
|
gameplayClock = Player.ChildrenOfType<FrameStabilityContainer>().First();
|
||||||
slider = Player.ChildrenOfType<DrawableSlider>().OrderBy(s => s.HitObject.StartTime).First();
|
slider = Player.ChildrenOfType<DrawableSlider>().OrderBy(s => s.HitObject.StartTime).First();
|
||||||
samples = slider.ChildrenOfType<DrawableSample>().ToArray();
|
samples = slider.ChildrenOfType<DrawableSample>().ToArray();
|
||||||
});
|
});
|
||||||
|
@ -2,23 +2,29 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
{
|
{
|
||||||
public class TestSceneHUDOverlay : OsuManualInputManagerTestScene
|
public class TestSceneHUDOverlay : SkinnableTestScene
|
||||||
{
|
{
|
||||||
private HUDOverlay hudOverlay;
|
private HUDOverlay hudOverlay;
|
||||||
|
|
||||||
|
private IEnumerable<HUDOverlay> hudOverlays => CreatedDrawables.OfType<HUDOverlay>();
|
||||||
|
|
||||||
// best way to check without exposing.
|
// best way to check without exposing.
|
||||||
private Drawable hideTarget => hudOverlay.KeyCounter;
|
private Drawable hideTarget => hudOverlay.KeyCounter;
|
||||||
private FillFlowContainer<KeyCounter> keyCounterFlow => hudOverlay.KeyCounter.ChildrenOfType<FillFlowContainer<KeyCounter>>().First();
|
private FillFlowContainer<KeyCounter> keyCounterFlow => hudOverlay.KeyCounter.ChildrenOfType<FillFlowContainer<KeyCounter>>().First();
|
||||||
@ -26,6 +32,24 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuConfigManager config { get; set; }
|
private OsuConfigManager config { get; set; }
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestComboCounterIncrementing()
|
||||||
|
{
|
||||||
|
createNew();
|
||||||
|
|
||||||
|
AddRepeatStep("increase combo", () =>
|
||||||
|
{
|
||||||
|
foreach (var hud in hudOverlays)
|
||||||
|
hud.ComboCounter.Current.Value++;
|
||||||
|
}, 10);
|
||||||
|
|
||||||
|
AddStep("reset combo", () =>
|
||||||
|
{
|
||||||
|
foreach (var hud in hudOverlays)
|
||||||
|
hud.ComboCounter.Current.Value = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestShownByDefault()
|
public void TestShownByDefault()
|
||||||
{
|
{
|
||||||
@ -45,7 +69,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
createNew(h => h.OnLoadComplete += _ => initialAlpha = hideTarget.Alpha);
|
createNew(h => h.OnLoadComplete += _ => initialAlpha = hideTarget.Alpha);
|
||||||
AddUntilStep("wait for load", () => hudOverlay.IsAlive);
|
AddUntilStep("wait for load", () => hudOverlay.IsAlive);
|
||||||
AddAssert("initial alpha was less than 1", () => initialAlpha != null && initialAlpha < 1);
|
AddAssert("initial alpha was less than 1", () => initialAlpha < 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -53,7 +77,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
createNew();
|
createNew();
|
||||||
|
|
||||||
AddStep("set showhud false", () => hudOverlay.ShowHud.Value = false);
|
AddStep("set showhud false", () => hudOverlays.ForEach(h => h.ShowHud.Value = false));
|
||||||
|
|
||||||
AddUntilStep("hidetarget is hidden", () => !hideTarget.IsPresent);
|
AddUntilStep("hidetarget is hidden", () => !hideTarget.IsPresent);
|
||||||
AddAssert("pause button is still visible", () => hudOverlay.HoldToQuit.IsPresent);
|
AddAssert("pause button is still visible", () => hudOverlay.HoldToQuit.IsPresent);
|
||||||
@ -89,14 +113,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddStep("set keycounter visible false", () =>
|
AddStep("set keycounter visible false", () =>
|
||||||
{
|
{
|
||||||
config.Set<bool>(OsuSetting.KeyOverlay, false);
|
config.Set<bool>(OsuSetting.KeyOverlay, false);
|
||||||
hudOverlay.KeyCounter.AlwaysVisible.Value = false;
|
hudOverlays.ForEach(h => h.KeyCounter.AlwaysVisible.Value = false);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("set showhud false", () => hudOverlay.ShowHud.Value = false);
|
AddStep("set showhud false", () => hudOverlays.ForEach(h => h.ShowHud.Value = false));
|
||||||
AddUntilStep("hidetarget is hidden", () => !hideTarget.IsPresent);
|
AddUntilStep("hidetarget is hidden", () => !hideTarget.IsPresent);
|
||||||
AddAssert("key counters hidden", () => !keyCounterFlow.IsPresent);
|
AddAssert("key counters hidden", () => !keyCounterFlow.IsPresent);
|
||||||
|
|
||||||
AddStep("set showhud true", () => hudOverlay.ShowHud.Value = true);
|
AddStep("set showhud true", () => hudOverlays.ForEach(h => h.ShowHud.Value = true));
|
||||||
AddUntilStep("hidetarget is visible", () => hideTarget.IsPresent);
|
AddUntilStep("hidetarget is visible", () => hideTarget.IsPresent);
|
||||||
AddAssert("key counters still hidden", () => !keyCounterFlow.IsPresent);
|
AddAssert("key counters still hidden", () => !keyCounterFlow.IsPresent);
|
||||||
|
|
||||||
@ -107,13 +131,22 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
AddStep("create overlay", () =>
|
AddStep("create overlay", () =>
|
||||||
{
|
{
|
||||||
Child = hudOverlay = new HUDOverlay(null, null, null, Array.Empty<Mod>());
|
SetContents(() =>
|
||||||
|
{
|
||||||
|
hudOverlay = new HUDOverlay(null, null, null, Array.Empty<Mod>());
|
||||||
|
|
||||||
// Add any key just to display the key counter visually.
|
// Add any key just to display the key counter visually.
|
||||||
hudOverlay.KeyCounter.Add(new KeyCounterKeyboard(Key.Space));
|
hudOverlay.KeyCounter.Add(new KeyCounterKeyboard(Key.Space));
|
||||||
|
|
||||||
action?.Invoke(hudOverlay);
|
hudOverlay.ComboCounter.Current.Value = 1;
|
||||||
|
|
||||||
|
action?.Invoke(hudOverlay);
|
||||||
|
|
||||||
|
return hudOverlay;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
private BarHitErrorMeter barMeter;
|
private BarHitErrorMeter barMeter;
|
||||||
private BarHitErrorMeter barMeter2;
|
private BarHitErrorMeter barMeter2;
|
||||||
|
private BarHitErrorMeter barMeter3;
|
||||||
private ColourHitErrorMeter colourMeter;
|
private ColourHitErrorMeter colourMeter;
|
||||||
private ColourHitErrorMeter colourMeter2;
|
private ColourHitErrorMeter colourMeter2;
|
||||||
|
private ColourHitErrorMeter colourMeter3;
|
||||||
private HitWindows hitWindows;
|
private HitWindows hitWindows;
|
||||||
|
|
||||||
public TestSceneHitErrorMeter()
|
public TestSceneHitErrorMeter()
|
||||||
@ -115,6 +117,13 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Add(barMeter3 = new BarHitErrorMeter(hitWindows, true)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Rotation = 270,
|
||||||
|
});
|
||||||
|
|
||||||
Add(colourMeter = new ColourHitErrorMeter(hitWindows)
|
Add(colourMeter = new ColourHitErrorMeter(hitWindows)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
@ -128,6 +137,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Margin = new MarginPadding { Left = 50 }
|
Margin = new MarginPadding { Left = 50 }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Add(colourMeter3 = new ColourHitErrorMeter(hitWindows)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Rotation = 270,
|
||||||
|
Margin = new MarginPadding { Left = 50 }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void newJudgement(double offset = 0)
|
private void newJudgement(double offset = 0)
|
||||||
@ -140,8 +157,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
barMeter.OnNewJudgement(judgement);
|
barMeter.OnNewJudgement(judgement);
|
||||||
barMeter2.OnNewJudgement(judgement);
|
barMeter2.OnNewJudgement(judgement);
|
||||||
|
barMeter3.OnNewJudgement(judgement);
|
||||||
colourMeter.OnNewJudgement(judgement);
|
colourMeter.OnNewJudgement(judgement);
|
||||||
colourMeter2.OnNewJudgement(judgement);
|
colourMeter2.OnNewJudgement(judgement);
|
||||||
|
colourMeter3.OnNewJudgement(judgement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
|
||||||
@ -23,33 +24,41 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestGameplayOverlayActivation()
|
public void TestGameplayOverlayActivation()
|
||||||
{
|
{
|
||||||
|
AddAssert("local user playing", () => Player.LocalUserPlaying.Value);
|
||||||
AddAssert("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
AddAssert("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestGameplayOverlayActivationPaused()
|
public void TestGameplayOverlayActivationPaused()
|
||||||
{
|
{
|
||||||
|
AddAssert("local user playing", () => Player.LocalUserPlaying.Value);
|
||||||
AddAssert("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
AddAssert("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
||||||
AddStep("pause gameplay", () => Player.Pause());
|
AddStep("pause gameplay", () => Player.Pause());
|
||||||
|
AddAssert("local user not playing", () => !Player.LocalUserPlaying.Value);
|
||||||
AddUntilStep("activation mode is user triggered", () => Player.OverlayActivationMode == OverlayActivation.UserTriggered);
|
AddUntilStep("activation mode is user triggered", () => Player.OverlayActivationMode == OverlayActivation.UserTriggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestGameplayOverlayActivationReplayLoaded()
|
public void TestGameplayOverlayActivationReplayLoaded()
|
||||||
{
|
{
|
||||||
|
AddAssert("local user playing", () => Player.LocalUserPlaying.Value);
|
||||||
AddAssert("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
AddAssert("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
||||||
AddStep("load a replay", () => Player.DrawableRuleset.HasReplayLoaded.Value = true);
|
AddStep("load a replay", () => Player.DrawableRuleset.HasReplayLoaded.Value = true);
|
||||||
|
AddAssert("local user not playing", () => !Player.LocalUserPlaying.Value);
|
||||||
AddAssert("activation mode is user triggered", () => Player.OverlayActivationMode == OverlayActivation.UserTriggered);
|
AddAssert("activation mode is user triggered", () => Player.OverlayActivationMode == OverlayActivation.UserTriggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestGameplayOverlayActivationBreaks()
|
public void TestGameplayOverlayActivationBreaks()
|
||||||
{
|
{
|
||||||
|
AddAssert("local user playing", () => Player.LocalUserPlaying.Value);
|
||||||
AddAssert("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
AddAssert("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
||||||
AddStep("seek to break", () => Player.GameplayClockContainer.Seek(Beatmap.Value.Beatmap.Breaks.First().StartTime));
|
AddStep("seek to break", () => Player.GameplayClockContainer.Seek(Beatmap.Value.Beatmap.Breaks.First().StartTime));
|
||||||
AddUntilStep("activation mode is user triggered", () => Player.OverlayActivationMode == OverlayActivation.UserTriggered);
|
AddUntilStep("activation mode is user triggered", () => Player.OverlayActivationMode == OverlayActivation.UserTriggered);
|
||||||
|
AddAssert("local user not playing", () => !Player.LocalUserPlaying.Value);
|
||||||
AddStep("seek to break end", () => Player.GameplayClockContainer.Seek(Beatmap.Value.Beatmap.Breaks.First().EndTime));
|
AddStep("seek to break end", () => Player.GameplayClockContainer.Seek(Beatmap.Value.Beatmap.Breaks.First().EndTime));
|
||||||
AddUntilStep("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
AddUntilStep("activation mode is disabled", () => Player.OverlayActivationMode == OverlayActivation.Disabled);
|
||||||
|
AddAssert("local user playing", () => Player.LocalUserPlaying.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new OverlayTestPlayer();
|
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new OverlayTestPlayer();
|
||||||
@ -57,6 +66,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
protected class OverlayTestPlayer : TestPlayer
|
protected class OverlayTestPlayer : TestPlayer
|
||||||
{
|
{
|
||||||
public new OverlayActivation OverlayActivationMode => base.OverlayActivationMode.Value;
|
public new OverlayActivation OverlayActivationMode => base.OverlayActivationMode.Value;
|
||||||
|
public new Bindable<bool> LocalUserPlaying => base.LocalUserPlaying;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,68 +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 NUnit.Framework;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using osu.Game.Screens.Play.HUD;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class TestSceneScoreCounter : OsuTestScene
|
|
||||||
{
|
|
||||||
public TestSceneScoreCounter()
|
|
||||||
{
|
|
||||||
int numerator = 0, denominator = 0;
|
|
||||||
|
|
||||||
ScoreCounter score = new ScoreCounter(7)
|
|
||||||
{
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Margin = new MarginPadding(20),
|
|
||||||
};
|
|
||||||
Add(score);
|
|
||||||
|
|
||||||
ComboCounter comboCounter = new StandardComboCounter
|
|
||||||
{
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Margin = new MarginPadding(10),
|
|
||||||
};
|
|
||||||
Add(comboCounter);
|
|
||||||
|
|
||||||
PercentageCounter accuracyCounter = new PercentageCounter
|
|
||||||
{
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Position = new Vector2(-20, 60),
|
|
||||||
};
|
|
||||||
Add(accuracyCounter);
|
|
||||||
|
|
||||||
AddStep(@"Reset all", delegate
|
|
||||||
{
|
|
||||||
score.Current.Value = 0;
|
|
||||||
comboCounter.Current.Value = 0;
|
|
||||||
numerator = denominator = 0;
|
|
||||||
accuracyCounter.SetFraction(0, 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStep(@"Hit! :D", delegate
|
|
||||||
{
|
|
||||||
score.Current.Value += 300 + (ulong)(300.0 * (comboCounter.Current.Value > 0 ? comboCounter.Current.Value - 1 : 0) / 25.0);
|
|
||||||
comboCounter.Increment();
|
|
||||||
numerator++;
|
|
||||||
denominator++;
|
|
||||||
accuracyCounter.SetFraction(numerator, denominator);
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStep(@"miss...", delegate
|
|
||||||
{
|
|
||||||
comboCounter.Current.Value = 0;
|
|
||||||
denominator++;
|
|
||||||
accuracyCounter.SetFraction(numerator, denominator);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,49 @@
|
|||||||
|
// 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.Testing;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneSkinnableAccuracyCounter : SkinnableTestScene
|
||||||
|
{
|
||||||
|
private IEnumerable<SkinnableAccuracyCounter> accuracyCounters => CreatedDrawables.OfType<SkinnableAccuracyCounter>();
|
||||||
|
|
||||||
|
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||||
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
|
{
|
||||||
|
AddStep("Create combo counters", () => SetContents(() =>
|
||||||
|
{
|
||||||
|
var accuracyCounter = new SkinnableAccuracyCounter();
|
||||||
|
|
||||||
|
accuracyCounter.Current.Value = 1;
|
||||||
|
|
||||||
|
return accuracyCounter;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangingAccuracy()
|
||||||
|
{
|
||||||
|
AddStep(@"Reset all", delegate
|
||||||
|
{
|
||||||
|
foreach (var s in accuracyCounters)
|
||||||
|
s.Current.Value = 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep(@"Hit! :D", delegate
|
||||||
|
{
|
||||||
|
foreach (var s in accuracyCounters)
|
||||||
|
s.Current.Value -= 0.023f;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
// 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.Testing;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Osu.Judgements;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneSkinnableHealthDisplay : SkinnableTestScene
|
||||||
|
{
|
||||||
|
private IEnumerable<SkinnableHealthDisplay> healthDisplays => CreatedDrawables.OfType<SkinnableHealthDisplay>();
|
||||||
|
|
||||||
|
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||||
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
|
{
|
||||||
|
AddStep("Create health displays", () =>
|
||||||
|
{
|
||||||
|
SetContents(() => new SkinnableHealthDisplay());
|
||||||
|
});
|
||||||
|
AddStep(@"Reset all", delegate
|
||||||
|
{
|
||||||
|
foreach (var s in healthDisplays)
|
||||||
|
s.Current.Value = 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHealthDisplayIncrementing()
|
||||||
|
{
|
||||||
|
AddRepeatStep(@"decrease hp", delegate
|
||||||
|
{
|
||||||
|
foreach (var healthDisplay in healthDisplays)
|
||||||
|
healthDisplay.Current.Value -= 0.08f;
|
||||||
|
}, 10);
|
||||||
|
|
||||||
|
AddRepeatStep(@"increase hp without flash", delegate
|
||||||
|
{
|
||||||
|
foreach (var healthDisplay in healthDisplays)
|
||||||
|
healthDisplay.Current.Value += 0.1f;
|
||||||
|
}, 3);
|
||||||
|
|
||||||
|
AddRepeatStep(@"increase hp with flash", delegate
|
||||||
|
{
|
||||||
|
foreach (var healthDisplay in healthDisplays)
|
||||||
|
{
|
||||||
|
healthDisplay.Current.Value += 0.1f;
|
||||||
|
healthDisplay.Flash(new JudgementResult(null, new OsuJudgement()));
|
||||||
|
}
|
||||||
|
}, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
// 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.IEnumerableExtensions;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneSkinnableScoreCounter : SkinnableTestScene
|
||||||
|
{
|
||||||
|
private IEnumerable<SkinnableScoreCounter> scoreCounters => CreatedDrawables.OfType<SkinnableScoreCounter>();
|
||||||
|
|
||||||
|
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||||
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
|
{
|
||||||
|
AddStep("Create combo counters", () => SetContents(() =>
|
||||||
|
{
|
||||||
|
var comboCounter = new SkinnableScoreCounter();
|
||||||
|
comboCounter.Current.Value = 1;
|
||||||
|
return comboCounter;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestScoreCounterIncrementing()
|
||||||
|
{
|
||||||
|
AddStep(@"Reset all", delegate
|
||||||
|
{
|
||||||
|
foreach (var s in scoreCounters)
|
||||||
|
s.Current.Value = 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep(@"Hit! :D", delegate
|
||||||
|
{
|
||||||
|
foreach (var s in scoreCounters)
|
||||||
|
s.Current.Value += 300;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestVeryLargeScore()
|
||||||
|
{
|
||||||
|
AddStep("set large score", () => scoreCounters.ForEach(counter => counter.Current.Value = 1_000_000_000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,6 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.OpenGL.Textures;
|
using osu.Framework.Graphics.OpenGL.Textures;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Timing;
|
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
@ -22,27 +21,24 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
public class TestSceneSkinnableSound : OsuTestScene
|
public class TestSceneSkinnableSound : OsuTestScene
|
||||||
{
|
{
|
||||||
[Cached(typeof(ISamplePlaybackDisabler))]
|
|
||||||
private GameplayClock gameplayClock = new GameplayClock(new FramedClock());
|
|
||||||
|
|
||||||
private TestSkinSourceContainer skinSource;
|
private TestSkinSourceContainer skinSource;
|
||||||
private PausableSkinnableSound skinnableSound;
|
private PausableSkinnableSound skinnableSound;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUp() => Schedule(() =>
|
public void SetUpSteps()
|
||||||
{
|
{
|
||||||
gameplayClock.IsPaused.Value = false;
|
AddStep("setup hierarchy", () =>
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
skinSource = new TestSkinSourceContainer
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Clock = gameplayClock,
|
skinSource = new TestSkinSourceContainer
|
||||||
RelativeSizeAxes = Axes.Both,
|
{
|
||||||
Child = skinnableSound = new PausableSkinnableSound(new SampleInfo("normal-sliderslide"))
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
Child = skinnableSound = new PausableSkinnableSound(new SampleInfo("normal-sliderslide"))
|
||||||
};
|
},
|
||||||
});
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestStoppedSoundDoesntResumeAfterPause()
|
public void TestStoppedSoundDoesntResumeAfterPause()
|
||||||
@ -62,8 +58,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddUntilStep("wait for sample to stop playing", () => !sample.Playing);
|
AddUntilStep("wait for sample to stop playing", () => !sample.Playing);
|
||||||
|
|
||||||
AddStep("pause gameplay clock", () => gameplayClock.IsPaused.Value = true);
|
AddStep("disable sample playback", () => skinSource.SamplePlaybackDisabled.Value = true);
|
||||||
AddStep("resume gameplay clock", () => gameplayClock.IsPaused.Value = false);
|
|
||||||
|
AddStep("enable sample playback", () => skinSource.SamplePlaybackDisabled.Value = false);
|
||||||
|
|
||||||
AddWaitStep("wait a bit", 5);
|
AddWaitStep("wait a bit", 5);
|
||||||
AddAssert("sample not playing", () => !sample.Playing);
|
AddAssert("sample not playing", () => !sample.Playing);
|
||||||
@ -82,8 +79,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddUntilStep("wait for sample to start playing", () => sample.Playing);
|
AddUntilStep("wait for sample to start playing", () => sample.Playing);
|
||||||
|
|
||||||
AddStep("pause gameplay clock", () => gameplayClock.IsPaused.Value = true);
|
AddStep("disable sample playback", () => skinSource.SamplePlaybackDisabled.Value = true);
|
||||||
AddUntilStep("wait for sample to stop playing", () => !sample.Playing);
|
AddUntilStep("wait for sample to stop playing", () => !sample.Playing);
|
||||||
|
|
||||||
|
AddStep("enable sample playback", () => skinSource.SamplePlaybackDisabled.Value = false);
|
||||||
|
AddUntilStep("wait for sample to start playing", () => sample.Playing);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -98,10 +98,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddAssert("sample playing", () => sample.Playing);
|
AddAssert("sample playing", () => sample.Playing);
|
||||||
|
|
||||||
AddStep("pause gameplay clock", () => gameplayClock.IsPaused.Value = true);
|
AddStep("disable sample playback", () => skinSource.SamplePlaybackDisabled.Value = true);
|
||||||
AddUntilStep("wait for sample to stop playing", () => !sample.Playing);
|
|
||||||
|
|
||||||
AddStep("resume gameplay clock", () => gameplayClock.IsPaused.Value = false);
|
AddUntilStep("sample not playing", () => !sample.Playing);
|
||||||
|
|
||||||
|
AddStep("enable sample playback", () => skinSource.SamplePlaybackDisabled.Value = false);
|
||||||
|
|
||||||
AddAssert("sample not playing", () => !sample.Playing);
|
AddAssert("sample not playing", () => !sample.Playing);
|
||||||
AddAssert("sample not playing", () => !sample.Playing);
|
AddAssert("sample not playing", () => !sample.Playing);
|
||||||
@ -120,7 +121,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddAssert("sample playing", () => sample.Playing);
|
AddAssert("sample playing", () => sample.Playing);
|
||||||
|
|
||||||
AddStep("pause gameplay clock", () => gameplayClock.IsPaused.Value = true);
|
AddStep("disable sample playback", () => skinSource.SamplePlaybackDisabled.Value = true);
|
||||||
AddUntilStep("wait for sample to stop playing", () => !sample.Playing);
|
AddUntilStep("wait for sample to stop playing", () => !sample.Playing);
|
||||||
|
|
||||||
AddStep("trigger skin change", () => skinSource.TriggerSourceChanged());
|
AddStep("trigger skin change", () => skinSource.TriggerSourceChanged());
|
||||||
@ -133,20 +134,25 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("new sample stopped", () => !sample.Playing);
|
AddAssert("new sample stopped", () => !sample.Playing);
|
||||||
AddStep("resume gameplay clock", () => gameplayClock.IsPaused.Value = false);
|
AddStep("enable sample playback", () => skinSource.SamplePlaybackDisabled.Value = false);
|
||||||
|
|
||||||
AddWaitStep("wait a bit", 5);
|
AddWaitStep("wait a bit", 5);
|
||||||
AddAssert("new sample not played", () => !sample.Playing);
|
AddAssert("new sample not played", () => !sample.Playing);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Cached(typeof(ISkinSource))]
|
[Cached(typeof(ISkinSource))]
|
||||||
private class TestSkinSourceContainer : Container, ISkinSource
|
[Cached(typeof(ISamplePlaybackDisabler))]
|
||||||
|
private class TestSkinSourceContainer : Container, ISkinSource, ISamplePlaybackDisabler
|
||||||
{
|
{
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private ISkinSource source { get; set; }
|
private ISkinSource source { get; set; }
|
||||||
|
|
||||||
public event Action SourceChanged;
|
public event Action SourceChanged;
|
||||||
|
|
||||||
|
public Bindable<bool> SamplePlaybackDisabled { get; } = new Bindable<bool>();
|
||||||
|
|
||||||
|
IBindable<bool> ISamplePlaybackDisabler.SamplePlaybackDisabled => SamplePlaybackDisabled;
|
||||||
|
|
||||||
public Drawable GetDrawableComponent(ISkinComponent component) => source?.GetDrawableComponent(component);
|
public Drawable GetDrawableComponent(ISkinComponent component) => source?.GetDrawableComponent(component);
|
||||||
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => source?.GetTexture(componentName, wrapModeS, wrapModeT);
|
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => source?.GetTexture(componentName, wrapModeS, wrapModeT);
|
||||||
public SampleChannel GetSample(ISampleInfo sampleInfo) => source?.GetSample(sampleInfo);
|
public SampleChannel GetSample(ISampleInfo sampleInfo) => source?.GetSample(sampleInfo);
|
||||||
|
@ -23,6 +23,12 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
createTest(CreateDistributedHitEvents());
|
createTest(CreateDistributedHitEvents());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAroundCentre()
|
||||||
|
{
|
||||||
|
createTest(Enumerable.Range(-150, 300).Select(i => new HitEvent(i / 50f, HitResult.Perfect, new HitCircle(), new HitCircle(), null)).ToList());
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestZeroTimeOffset()
|
public void TestZeroTimeOffset()
|
||||||
{
|
{
|
||||||
|
@ -394,7 +394,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddStep("Sort by author", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Author }, false));
|
AddStep("Sort by author", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Author }, false));
|
||||||
AddAssert("Check zzzzz is at bottom", () => carousel.BeatmapSets.Last().Metadata.AuthorString == "zzzzz");
|
AddAssert("Check zzzzz is at bottom", () => carousel.BeatmapSets.Last().Metadata.AuthorString == "zzzzz");
|
||||||
AddStep("Sort by artist", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Artist }, false));
|
AddStep("Sort by artist", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Artist }, false));
|
||||||
AddAssert($"Check #{set_count} is at bottom", () => carousel.BeatmapSets.Last().Metadata.Title.EndsWith($"#{set_count}!"));
|
AddAssert($"Check #{set_count} is at bottom", () => carousel.BeatmapSets.Last().Metadata.Title.EndsWith($"#{set_count}!", StringComparison.Ordinal));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
@ -18,10 +19,11 @@ using osu.Game.Rulesets.Difficulty;
|
|||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.UserInterface
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
{
|
{
|
||||||
public class TestSceneModSettings : OsuTestScene
|
public class TestSceneModSettings : OsuManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
private TestModSelectOverlay modSelect;
|
private TestModSelectOverlay modSelect;
|
||||||
|
|
||||||
@ -95,6 +97,41 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddAssert("copy has original value", () => Precision.AlmostEquals(1.5, copy.SpeedChange.Value));
|
AddAssert("copy has original value", () => Precision.AlmostEquals(1.5, copy.SpeedChange.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMultiModSettingsUnboundWhenCopied()
|
||||||
|
{
|
||||||
|
MultiMod original = null;
|
||||||
|
MultiMod copy = null;
|
||||||
|
|
||||||
|
AddStep("create mods", () =>
|
||||||
|
{
|
||||||
|
original = new MultiMod(new OsuModDoubleTime());
|
||||||
|
copy = (MultiMod)original.CreateCopy();
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("change property", () => ((OsuModDoubleTime)original.Mods[0]).SpeedChange.Value = 2);
|
||||||
|
|
||||||
|
AddAssert("original has new value", () => Precision.AlmostEquals(2.0, ((OsuModDoubleTime)original.Mods[0]).SpeedChange.Value));
|
||||||
|
AddAssert("copy has original value", () => Precision.AlmostEquals(1.5, ((OsuModDoubleTime)copy.Mods[0]).SpeedChange.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCustomisationMenuNoClickthrough()
|
||||||
|
{
|
||||||
|
createModSelect();
|
||||||
|
openModSelect();
|
||||||
|
|
||||||
|
AddStep("change mod settings menu width to full screen", () => modSelect.SetModSettingsWidth(1.0f));
|
||||||
|
AddStep("select cm2", () => modSelect.SelectMod(testCustomisableAutoOpenMod));
|
||||||
|
AddAssert("Customisation opened", () => modSelect.ModSettingsContainer.Alpha == 1);
|
||||||
|
AddStep("hover over mod behind settings menu", () => InputManager.MoveMouseTo(modSelect.GetModButton(testCustomisableMod)));
|
||||||
|
AddAssert("Mod is not considered hovered over", () => !modSelect.GetModButton(testCustomisableMod).IsHovered);
|
||||||
|
AddStep("left click mod", () => InputManager.Click(MouseButton.Left));
|
||||||
|
AddAssert("only cm2 is active", () => SelectedMods.Value.Count == 1);
|
||||||
|
AddStep("right click mod", () => InputManager.Click(MouseButton.Right));
|
||||||
|
AddAssert("only cm2 is active", () => SelectedMods.Value.Count == 1);
|
||||||
|
}
|
||||||
|
|
||||||
private void createModSelect()
|
private void createModSelect()
|
||||||
{
|
{
|
||||||
AddStep("create mod select", () =>
|
AddStep("create mod select", () =>
|
||||||
@ -121,9 +158,16 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
public bool ButtonsLoaded => ModSectionsContainer.Children.All(c => c.ModIconsLoaded);
|
public bool ButtonsLoaded => ModSectionsContainer.Children.All(c => c.ModIconsLoaded);
|
||||||
|
|
||||||
|
public ModButton GetModButton(Mod mod)
|
||||||
|
{
|
||||||
|
return ModSectionsContainer.ChildrenOfType<ModButton>().Single(b => b.Mods.Any(m => m.GetType() == mod.GetType()));
|
||||||
|
}
|
||||||
|
|
||||||
public void SelectMod(Mod mod) =>
|
public void SelectMod(Mod mod) =>
|
||||||
ModSectionsContainer.Children.Single(s => s.ModType == mod.Type)
|
GetModButton(mod).SelectNext(1);
|
||||||
.ButtonsContainer.OfType<ModButton>().Single(b => b.Mods.Any(m => m.GetType() == mod.GetType())).SelectNext(1);
|
|
||||||
|
public void SetModSettingsWidth(float newWidth) =>
|
||||||
|
ModSettingsContainer.Width = newWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TestRulesetInfo : RulesetInfo
|
public class TestRulesetInfo : RulesetInfo
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
@ -59,7 +60,7 @@ namespace osu.Game.Tests
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
using (var reader = getZipReader())
|
using (var reader = getZipReader())
|
||||||
return reader.Filenames.First(f => f.EndsWith(".mp3"));
|
return reader.Filenames.First(f => f.EndsWith(".mp3", StringComparison.Ordinal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ namespace osu.Game.Tests
|
|||||||
protected override Beatmap CreateBeatmap()
|
protected override Beatmap CreateBeatmap()
|
||||||
{
|
{
|
||||||
using (var reader = getZipReader())
|
using (var reader = getZipReader())
|
||||||
using (var beatmapStream = reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu"))))
|
using (var beatmapStream = reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu", StringComparison.Ordinal))))
|
||||||
using (var beatmapReader = new LineBufferedReader(beatmapStream))
|
using (var beatmapReader = new LineBufferedReader(beatmapStream))
|
||||||
return Decoder.GetDecoder<Beatmap>(beatmapReader).Decode(beatmapReader);
|
return Decoder.GetDecoder<Beatmap>(beatmapReader).Decode(beatmapReader);
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ namespace osu.Game.Tournament.Screens.Drawings
|
|||||||
if (string.IsNullOrEmpty(line))
|
if (string.IsNullOrEmpty(line))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (line.ToUpperInvariant().StartsWith("GROUP"))
|
if (line.ToUpperInvariant().StartsWith("GROUP", StringComparison.Ordinal))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// ReSharper disable once AccessToModifiedClosure
|
// ReSharper disable once AccessToModifiedClosure
|
||||||
|
@ -13,9 +13,12 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Lists;
|
using osu.Framework.Lists;
|
||||||
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
@ -124,13 +127,22 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <returns>The <see cref="DifficultyRating"/> that best describes <paramref name="starRating"/>.</returns>
|
/// <returns>The <see cref="DifficultyRating"/> that best describes <paramref name="starRating"/>.</returns>
|
||||||
public static DifficultyRating GetDifficultyRating(double starRating)
|
public static DifficultyRating GetDifficultyRating(double starRating)
|
||||||
{
|
{
|
||||||
if (starRating < 2.0) return DifficultyRating.Easy;
|
if (Precision.AlmostBigger(starRating, 6.5, 0.005))
|
||||||
if (starRating < 2.7) return DifficultyRating.Normal;
|
return DifficultyRating.ExpertPlus;
|
||||||
if (starRating < 4.0) return DifficultyRating.Hard;
|
|
||||||
if (starRating < 5.3) return DifficultyRating.Insane;
|
|
||||||
if (starRating < 6.5) return DifficultyRating.Expert;
|
|
||||||
|
|
||||||
return DifficultyRating.ExpertPlus;
|
if (Precision.AlmostBigger(starRating, 5.3, 0.005))
|
||||||
|
return DifficultyRating.Expert;
|
||||||
|
|
||||||
|
if (Precision.AlmostBigger(starRating, 4.0, 0.005))
|
||||||
|
return DifficultyRating.Insane;
|
||||||
|
|
||||||
|
if (Precision.AlmostBigger(starRating, 2.7, 0.005))
|
||||||
|
return DifficultyRating.Hard;
|
||||||
|
|
||||||
|
if (Precision.AlmostBigger(starRating, 2.0, 0.005))
|
||||||
|
return DifficultyRating.Normal;
|
||||||
|
|
||||||
|
return DifficultyRating.Easy;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CancellationTokenSource trackedUpdateCancellationSource;
|
private CancellationTokenSource trackedUpdateCancellationSource;
|
||||||
@ -228,6 +240,24 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
return difficultyCache[key] = new StarDifficulty(attributes.StarRating, attributes.MaxCombo);
|
return difficultyCache[key] = new StarDifficulty(attributes.StarRating, attributes.MaxCombo);
|
||||||
}
|
}
|
||||||
|
catch (BeatmapInvalidForRulesetException e)
|
||||||
|
{
|
||||||
|
// Conversion has failed for the given ruleset, so return the difficulty in the beatmap's default ruleset.
|
||||||
|
|
||||||
|
// Ensure the beatmap's default ruleset isn't the one already being converted to.
|
||||||
|
// This shouldn't happen as it means something went seriously wrong, but if it does an endless loop should be avoided.
|
||||||
|
if (rulesetInfo.Equals(beatmapInfo.Ruleset))
|
||||||
|
{
|
||||||
|
Logger.Error(e, $"Failed to convert {beatmapInfo.OnlineBeatmapID} to the beatmap's default ruleset ({beatmapInfo.Ruleset}).");
|
||||||
|
return difficultyCache[key] = new StarDifficulty();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the cache first because this is now a different ruleset than the one previously guarded against.
|
||||||
|
if (tryGetExisting(beatmapInfo, beatmapInfo.Ruleset, Array.Empty<Mod>(), out var existingDefault, out var existingDefaultKey))
|
||||||
|
return existingDefault;
|
||||||
|
|
||||||
|
return computeDifficulty(existingDefaultKey, beatmapInfo, beatmapInfo.Ruleset);
|
||||||
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return difficultyCache[key] = new StarDifficulty();
|
return difficultyCache[key] = new StarDifficulty();
|
||||||
|
@ -98,7 +98,7 @@ namespace osu.Game.Beatmaps
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string StoredBookmarks
|
public string StoredBookmarks
|
||||||
{
|
{
|
||||||
get => string.Join(",", Bookmarks);
|
get => string.Join(',', Bookmarks);
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(value))
|
if (string.IsNullOrEmpty(value))
|
||||||
|
@ -19,6 +19,7 @@ using osu.Framework.Graphics.Textures;
|
|||||||
using osu.Framework.Lists;
|
using osu.Framework.Lists;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
@ -36,6 +37,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps.
|
/// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[ExcludeFromDynamicCompile]
|
||||||
public partial class BeatmapManager : DownloadableArchiveModelManager<BeatmapSetInfo, BeatmapSetFileInfo>, IDisposable
|
public partial class BeatmapManager : DownloadableArchiveModelManager<BeatmapSetInfo, BeatmapSetFileInfo>, IDisposable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -389,7 +391,7 @@ namespace osu.Game.Beatmaps
|
|||||||
protected override BeatmapSetInfo CreateModel(ArchiveReader reader)
|
protected override BeatmapSetInfo CreateModel(ArchiveReader reader)
|
||||||
{
|
{
|
||||||
// let's make sure there are actually .osu files to import.
|
// let's make sure there are actually .osu files to import.
|
||||||
string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu"));
|
string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu", StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(mapName))
|
if (string.IsNullOrEmpty(mapName))
|
||||||
{
|
{
|
||||||
@ -417,7 +419,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
var beatmapInfos = new List<BeatmapInfo>();
|
var beatmapInfos = new List<BeatmapInfo>();
|
||||||
|
|
||||||
foreach (var file in files.Where(f => f.Filename.EndsWith(".osu")))
|
foreach (var file in files.Where(f => f.Filename.EndsWith(".osu", StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
using (var raw = Files.Store.GetStream(file.FileInfo.StoragePath))
|
using (var raw = Files.Store.GetStream(file.FileInfo.StoragePath))
|
||||||
using (var ms = new MemoryStream()) // we need a memory stream so we can seek
|
using (var ms = new MemoryStream()) // we need a memory stream so we can seek
|
||||||
|
@ -13,6 +13,7 @@ using osu.Framework.Development;
|
|||||||
using osu.Framework.IO.Network;
|
using osu.Framework.IO.Network;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
@ -23,6 +24,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
public partial class BeatmapManager
|
public partial class BeatmapManager
|
||||||
{
|
{
|
||||||
|
[ExcludeFromDynamicCompile]
|
||||||
private class BeatmapOnlineLookupQueue : IDisposable
|
private class BeatmapOnlineLookupQueue : IDisposable
|
||||||
{
|
{
|
||||||
private readonly IAPIProvider api;
|
private readonly IAPIProvider api;
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Audio.Track;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
@ -17,6 +18,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
public partial class BeatmapManager
|
public partial class BeatmapManager
|
||||||
{
|
{
|
||||||
|
[ExcludeFromDynamicCompile]
|
||||||
private class BeatmapManagerWorkingBeatmap : WorkingBeatmap
|
private class BeatmapManagerWorkingBeatmap : WorkingBeatmap
|
||||||
{
|
{
|
||||||
private readonly IResourceStore<byte[]> store;
|
private readonly IResourceStore<byte[]> store;
|
||||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public string Hash { get; set; }
|
public string Hash { get; set; }
|
||||||
|
|
||||||
public string StoryboardFile => Files?.Find(f => f.Filename.EndsWith(".osb"))?.Filename;
|
public string StoryboardFile => Files?.Find(f => f.Filename.EndsWith(".osb", StringComparison.OrdinalIgnoreCase))?.Filename;
|
||||||
|
|
||||||
public List<BeatmapSetFileInfo> Files { get; set; }
|
public List<BeatmapSetFileInfo> Files { get; set; }
|
||||||
|
|
||||||
|
@ -307,12 +307,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
double start = getOffsetTime(Parsing.ParseDouble(split[1]));
|
double start = getOffsetTime(Parsing.ParseDouble(split[1]));
|
||||||
double end = Math.Max(start, getOffsetTime(Parsing.ParseDouble(split[2])));
|
double end = Math.Max(start, getOffsetTime(Parsing.ParseDouble(split[2])));
|
||||||
|
|
||||||
var breakEvent = new BreakPeriod(start, end);
|
beatmap.Breaks.Add(new BreakPeriod(start, end));
|
||||||
|
|
||||||
if (!breakEvent.HasEffect)
|
|
||||||
return;
|
|
||||||
|
|
||||||
beatmap.Breaks.Add(breakEvent);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
var pair = SplitKeyVal(line);
|
var pair = SplitKeyVal(line);
|
||||||
|
|
||||||
bool isCombo = pair.Key.StartsWith(@"Combo");
|
bool isCombo = pair.Key.StartsWith(@"Combo", StringComparison.Ordinal);
|
||||||
|
|
||||||
string[] split = pair.Value.Split(',');
|
string[] split = pair.Value.Split(',');
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Beatmaps.Timing
|
|||||||
public double Duration => EndTime - StartTime;
|
public double Duration => EndTime - StartTime;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the break has any effect. Breaks that are too short are culled before they are added to the beatmap.
|
/// Whether the break has any effect.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasEffect => Duration >= MIN_BREAK_DURATION;
|
public bool HasEffect => Duration >= MIN_BREAK_DURATION;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Configuration.Tracking;
|
|||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Input;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
@ -69,6 +70,7 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
Set(OsuSetting.MouseDisableButtons, false);
|
Set(OsuSetting.MouseDisableButtons, false);
|
||||||
Set(OsuSetting.MouseDisableWheel, false);
|
Set(OsuSetting.MouseDisableWheel, false);
|
||||||
|
Set(OsuSetting.ConfineMouseMode, OsuConfineMouseMode.DuringGameplay);
|
||||||
|
|
||||||
// Graphics
|
// Graphics
|
||||||
Set(OsuSetting.ShowFpsDisplay, false);
|
Set(OsuSetting.ShowFpsDisplay, false);
|
||||||
@ -194,6 +196,7 @@ namespace osu.Game.Configuration
|
|||||||
FadePlayfieldWhenHealthLow,
|
FadePlayfieldWhenHealthLow,
|
||||||
MouseDisableButtons,
|
MouseDisableButtons,
|
||||||
MouseDisableWheel,
|
MouseDisableWheel,
|
||||||
|
ConfineMouseMode,
|
||||||
AudioOffset,
|
AudioOffset,
|
||||||
VolumeInactive,
|
VolumeInactive,
|
||||||
MenuMusic,
|
MenuMusic,
|
||||||
|
@ -16,7 +16,10 @@ namespace osu.Game.Configuration
|
|||||||
[Description("Hit Error (right)")]
|
[Description("Hit Error (right)")]
|
||||||
HitErrorRight,
|
HitErrorRight,
|
||||||
|
|
||||||
[Description("Hit Error (both)")]
|
[Description("Hit Error (bottom)")]
|
||||||
|
HitErrorBottom,
|
||||||
|
|
||||||
|
[Description("Hit Error (left+right)")]
|
||||||
HitErrorBoth,
|
HitErrorBoth,
|
||||||
|
|
||||||
[Description("Colour (left)")]
|
[Description("Colour (left)")]
|
||||||
@ -25,7 +28,10 @@ namespace osu.Game.Configuration
|
|||||||
[Description("Colour (right)")]
|
[Description("Colour (right)")]
|
||||||
ColourRight,
|
ColourRight,
|
||||||
|
|
||||||
[Description("Colour (both)")]
|
[Description("Colour (left+right)")]
|
||||||
ColourBoth,
|
ColourBoth,
|
||||||
|
|
||||||
|
[Description("Colour (bottom)")]
|
||||||
|
ColourBottom,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ namespace osu.Game.Database
|
|||||||
// for now, concatenate all .osu files in the set to create a unique hash.
|
// for now, concatenate all .osu files in the set to create a unique hash.
|
||||||
MemoryStream hashable = new MemoryStream();
|
MemoryStream hashable = new MemoryStream();
|
||||||
|
|
||||||
foreach (TFileModel file in item.Files.Where(f => HashableFileTypes.Any(f.Filename.EndsWith)).OrderBy(f => f.Filename))
|
foreach (TFileModel file in item.Files.Where(f => HashableFileTypes.Any(ext => f.Filename.EndsWith(ext, StringComparison.OrdinalIgnoreCase))).OrderBy(f => f.Filename))
|
||||||
{
|
{
|
||||||
using (Stream s = Files.Store.GetStream(file.FileInfo.StoragePath))
|
using (Stream s = Files.Store.GetStream(file.FileInfo.StoragePath))
|
||||||
s.CopyTo(hashable);
|
s.CopyTo(hashable);
|
||||||
@ -593,7 +593,7 @@ namespace osu.Game.Database
|
|||||||
var fileInfos = new List<TFileModel>();
|
var fileInfos = new List<TFileModel>();
|
||||||
|
|
||||||
string prefix = reader.Filenames.GetCommonPrefix();
|
string prefix = reader.Filenames.GetCommonPrefix();
|
||||||
if (!(prefix.EndsWith("/") || prefix.EndsWith("\\")))
|
if (!(prefix.EndsWith('/') || prefix.EndsWith('\\')))
|
||||||
prefix = string.Empty;
|
prefix = string.Empty;
|
||||||
|
|
||||||
// import files to manager
|
// import files to manager
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
@ -28,9 +27,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Current.Value = DisplayedCount = 1.0f;
|
Current.Value = DisplayedCount = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours) => Colour = colours.BlueLighter;
|
|
||||||
|
|
||||||
protected override string FormatCount(double count) => count.FormatAccuracy();
|
protected override string FormatCount(double count) => count.FormatAccuracy();
|
||||||
|
|
||||||
protected override double GetProportionalDuration(double currentValue, double newValue)
|
protected override double GetProportionalDuration(double currentValue, double newValue)
|
||||||
|
@ -1,18 +1,21 @@
|
|||||||
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public class ScoreCounter : RollingCounter<double>
|
public abstract class ScoreCounter : RollingCounter<double>, IScoreCounter
|
||||||
{
|
{
|
||||||
protected override double RollingDuration => 1000;
|
protected override double RollingDuration => 1000;
|
||||||
protected override Easing RollingEasing => Easing.Out;
|
protected override Easing RollingEasing => Easing.Out;
|
||||||
|
|
||||||
public bool UseCommaSeparator;
|
/// <summary>
|
||||||
|
/// Whether comma separators should be displayed.
|
||||||
|
/// </summary>
|
||||||
|
public bool UseCommaSeparator { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many leading zeroes the counter has.
|
/// How many leading zeroes the counter has.
|
||||||
@ -23,14 +26,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// Displays score.
|
/// Displays score.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="leading">How many leading zeroes the counter will have.</param>
|
/// <param name="leading">How many leading zeroes the counter will have.</param>
|
||||||
public ScoreCounter(uint leading = 0)
|
/// <param name="useCommaSeparator">Whether comma separators should be displayed.</param>
|
||||||
|
protected ScoreCounter(uint leading = 0, bool useCommaSeparator = false)
|
||||||
{
|
{
|
||||||
|
UseCommaSeparator = useCommaSeparator;
|
||||||
LeadingZeroes = leading;
|
LeadingZeroes = leading;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours) => Colour = colours.BlueLighter;
|
|
||||||
|
|
||||||
protected override double GetProportionalDuration(double currentValue, double newValue)
|
protected override double GetProportionalDuration(double currentValue, double newValue)
|
||||||
{
|
{
|
||||||
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
||||||
|