mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:52:53 +08:00
Merge branch 'master' into convert-object-hitwindows
This commit is contained in:
commit
e39af1c906
@ -14,7 +14,7 @@ using osu.Game.Tests.Beatmaps;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Tests
|
namespace osu.Game.Rulesets.Catch.Tests
|
||||||
{
|
{
|
||||||
public class CatchBeatmapConversionTest : BeatmapConversionTest<TestCatchRuleset, ConvertValue>
|
internal class CatchBeatmapConversionTest : BeatmapConversionTest<TestCatchRuleset, ConvertValue>
|
||||||
{
|
{
|
||||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Catch";
|
protected override string ResourceAssembly => "osu.Game.Rulesets.Catch";
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new CatchBeatmapConverter(beatmap);
|
protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new CatchBeatmapConverter(beatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct ConvertValue : IEquatable<ConvertValue>
|
internal struct ConvertValue : IEquatable<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.
|
||||||
@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
&& Precision.AlmostEquals(Position, other.Position, conversion_lenience);
|
&& Precision.AlmostEquals(Position, other.Position, conversion_lenience);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TestCatchRuleset : CatchRuleset
|
internal class TestCatchRuleset : CatchRuleset
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ using osu.Game.Tests.Beatmaps;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Tests
|
namespace osu.Game.Rulesets.Mania.Tests
|
||||||
{
|
{
|
||||||
public class ManiaBeatmapConversionTest : BeatmapConversionTest<TestManiaRuleset, ConvertValue>
|
internal class ManiaBeatmapConversionTest : BeatmapConversionTest<TestManiaRuleset, ConvertValue>
|
||||||
{
|
{
|
||||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Mania";
|
protected override string ResourceAssembly => "osu.Game.Rulesets.Mania";
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap);
|
protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct ConvertValue : IEquatable<ConvertValue>
|
internal struct ConvertValue : IEquatable<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.
|
||||||
@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
&& Column == other.Column;
|
&& Column == other.Column;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TestManiaRuleset : ManiaRuleset
|
internal class TestManiaRuleset : ManiaRuleset
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ using OpenTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
{
|
{
|
||||||
public class OsuBeatmapConversionTest : BeatmapConversionTest<TestOsuRuleset, ConvertValue>
|
internal class OsuBeatmapConversionTest : BeatmapConversionTest<TestOsuRuleset, ConvertValue>
|
||||||
{
|
{
|
||||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu";
|
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu";
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new OsuBeatmapConverter(beatmap);
|
protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new OsuBeatmapConverter(beatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct ConvertValue : IEquatable<ConvertValue>
|
internal struct ConvertValue : IEquatable<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.
|
||||||
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
&& Precision.AlmostEquals(EndY, other.EndY, conversion_lenience);
|
&& Precision.AlmostEquals(EndY, other.EndY, conversion_lenience);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TestOsuRuleset : OsuRuleset
|
internal class TestOsuRuleset : OsuRuleset
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,17 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
private readonly int beatmapMaxCombo;
|
private readonly int beatmapMaxCombo;
|
||||||
|
|
||||||
private Mod[] mods;
|
private Mod[] mods;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Approach rate adjusted by mods.
|
||||||
|
/// </summary>
|
||||||
private double realApproachRate;
|
private double realApproachRate;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overall difficulty adjusted by mods.
|
||||||
|
/// </summary>
|
||||||
|
private double realOverallDifficulty;
|
||||||
|
|
||||||
private double accuracy;
|
private double accuracy;
|
||||||
private int scoreMaxCombo;
|
private int scoreMaxCombo;
|
||||||
private int count300;
|
private int count300;
|
||||||
@ -58,8 +68,12 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
ar = Math.Min(10, ar * 1.4);
|
ar = Math.Min(10, ar * 1.4);
|
||||||
if (mods.Any(m => m is OsuModEasy))
|
if (mods.Any(m => m is OsuModEasy))
|
||||||
ar = Math.Max(0, ar / 2);
|
ar = Math.Max(0, ar / 2);
|
||||||
double preEmpt = BeatmapDifficulty.DifficultyRange(ar, 1800, 1200, 450);
|
|
||||||
|
double preEmpt = BeatmapDifficulty.DifficultyRange(ar, 1800, 1200, 450) / TimeRate;
|
||||||
|
double hitWindow300 = (Beatmap.HitObjects.First().HitWindows.Great / 2 - 0.5) / TimeRate;
|
||||||
|
|
||||||
realApproachRate = preEmpt > 1200 ? (1800 - preEmpt) / 120 : (1200 - preEmpt) / 150 + 5;
|
realApproachRate = preEmpt > 1200 ? (1800 - preEmpt) / 120 : (1200 - preEmpt) / 150 + 5;
|
||||||
|
realOverallDifficulty = (80 - 0.5 - hitWindow300) / 6;
|
||||||
|
|
||||||
// Custom multipliers for NoFail and SpunOut.
|
// Custom multipliers for NoFail and SpunOut.
|
||||||
double multiplier = 1.12f; // This is being adjusted to keep the final pp value scaled around what it used to be when changing things
|
double multiplier = 1.12f; // This is being adjusted to keep the final pp value scaled around what it used to be when changing things
|
||||||
@ -85,6 +99,9 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
categoryRatings.Add("Aim", aimValue);
|
categoryRatings.Add("Aim", aimValue);
|
||||||
categoryRatings.Add("Speed", speedValue);
|
categoryRatings.Add("Speed", speedValue);
|
||||||
categoryRatings.Add("Accuracy", accuracyValue);
|
categoryRatings.Add("Accuracy", accuracyValue);
|
||||||
|
categoryRatings.Add("OD", realOverallDifficulty);
|
||||||
|
categoryRatings.Add("AR", realApproachRate);
|
||||||
|
categoryRatings.Add("Max Combo", beatmapMaxCombo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return totalValue;
|
return totalValue;
|
||||||
@ -121,8 +138,9 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
|
|
||||||
aimValue *= approachRateFactor;
|
aimValue *= approachRateFactor;
|
||||||
|
|
||||||
|
// We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
|
||||||
if (mods.Any(h => h is OsuModHidden))
|
if (mods.Any(h => h is OsuModHidden))
|
||||||
aimValue *= 1.03f;
|
aimValue *= 1.02 + (11.0f - realApproachRate) / 50.0; // Gives a 1.04 bonus for AR10, a 1.06 bonus for AR9, a 1.02 bonus for AR11.
|
||||||
|
|
||||||
if (mods.Any(h => h is OsuModFlashlight))
|
if (mods.Any(h => h is OsuModFlashlight))
|
||||||
{
|
{
|
||||||
@ -133,7 +151,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
// Scale the aim value with accuracy _slightly_
|
// Scale the aim value with accuracy _slightly_
|
||||||
aimValue *= 0.5f + accuracy / 2.0f;
|
aimValue *= 0.5f + accuracy / 2.0f;
|
||||||
// It is important to also consider accuracy difficulty when doing that
|
// It is important to also consider accuracy difficulty when doing that
|
||||||
aimValue *= 0.98f + Math.Pow(Beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty, 2) / 2500;
|
aimValue *= 0.98f + Math.Pow(realOverallDifficulty, 2) / 2500;
|
||||||
|
|
||||||
return aimValue;
|
return aimValue;
|
||||||
}
|
}
|
||||||
@ -159,7 +177,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
// Scale the speed value with accuracy _slightly_
|
// Scale the speed value with accuracy _slightly_
|
||||||
speedValue *= 0.5f + accuracy / 2.0f;
|
speedValue *= 0.5f + accuracy / 2.0f;
|
||||||
// It is important to also consider accuracy difficulty when doing that
|
// It is important to also consider accuracy difficulty when doing that
|
||||||
speedValue *= 0.98f + Math.Pow(Beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty, 2) / 2500;
|
speedValue *= 0.98f + Math.Pow(realOverallDifficulty, 2) / 2500;
|
||||||
|
|
||||||
return speedValue;
|
return speedValue;
|
||||||
}
|
}
|
||||||
@ -181,7 +199,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
|
|
||||||
// Lots of arbitrary values from testing.
|
// Lots of arbitrary values from testing.
|
||||||
// Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution
|
// Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution
|
||||||
double accuracyValue = Math.Pow(1.52163f, Beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty) * Math.Pow(betterAccuracyPercentage, 24) * 2.83f;
|
double accuracyValue = Math.Pow(1.52163f, realOverallDifficulty) * Math.Pow(betterAccuracyPercentage, 24) * 2.83f;
|
||||||
|
|
||||||
// Bonus for many hitcircles - it's harder to keep good accuracy up for longer
|
// Bonus for many hitcircles - it's harder to keep good accuracy up for longer
|
||||||
accuracyValue *= Math.Min(1.15f, Math.Pow(amountHitObjectsWithAccuracy / 1000.0f, 0.3f));
|
accuracyValue *= Math.Min(1.15f, Math.Pow(amountHitObjectsWithAccuracy / 1000.0f, 0.3f));
|
||||||
|
@ -14,7 +14,7 @@ using osu.Game.Tests.Beatmaps;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Tests
|
namespace osu.Game.Rulesets.Taiko.Tests
|
||||||
{
|
{
|
||||||
public class TaikoBeatmapConversionTest : BeatmapConversionTest<TestTaikoRuleset, ConvertValue>
|
internal class TaikoBeatmapConversionTest : BeatmapConversionTest<TestTaikoRuleset, ConvertValue>
|
||||||
{
|
{
|
||||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko";
|
protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko";
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new TaikoBeatmapConverter(beatmap);
|
protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new TaikoBeatmapConverter(beatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct ConvertValue : IEquatable<ConvertValue>
|
internal struct ConvertValue : IEquatable<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.
|
||||||
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
&& IsStrong == other.IsStrong;
|
&& IsStrong == other.IsStrong;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TestTaikoRuleset : TaikoRuleset
|
internal class TestTaikoRuleset : TaikoRuleset
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,8 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private double tickSpacing = 100;
|
private double tickSpacing = 100;
|
||||||
|
|
||||||
|
private float overallDifficulty = BeatmapDifficulty.DEFAULT_DIFFICULTY;
|
||||||
|
|
||||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
||||||
{
|
{
|
||||||
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||||
@ -47,9 +49,7 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
|||||||
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
||||||
|
|
||||||
tickSpacing = timingPoint.BeatLength / TickRate;
|
tickSpacing = timingPoint.BeatLength / TickRate;
|
||||||
|
overallDifficulty = difficulty.OverallDifficulty;
|
||||||
RequiredGoodHits = NestedHitObjects.Count * Math.Min(0.15, 0.05 + 0.10 / 6 * difficulty.OverallDifficulty);
|
|
||||||
RequiredGreatHits = NestedHitObjects.Count * Math.Min(0.30, 0.10 + 0.20 / 6 * difficulty.OverallDifficulty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateNestedHitObjects()
|
protected override void CreateNestedHitObjects()
|
||||||
@ -57,6 +57,9 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
|||||||
base.CreateNestedHitObjects();
|
base.CreateNestedHitObjects();
|
||||||
|
|
||||||
createTicks();
|
createTicks();
|
||||||
|
|
||||||
|
RequiredGoodHits = NestedHitObjects.Count * Math.Min(0.15, 0.05 + 0.10 / 6 * overallDifficulty);
|
||||||
|
RequiredGreatHits = NestedHitObjects.Count * Math.Min(0.30, 0.10 + 0.20 / 6 * overallDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createTicks()
|
private void createTicks()
|
||||||
|
62
osu.Game.Tests/Visual/TestCaseHoldToConfirmOverlay.cs
Normal file
62
osu.Game.Tests/Visual/TestCaseHoldToConfirmOverlay.cs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Screens.Menu;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual
|
||||||
|
{
|
||||||
|
public class TestCaseHoldToConfirmOverlay : OsuTestCase
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ExitConfirmOverlay) };
|
||||||
|
|
||||||
|
public TestCaseHoldToConfirmOverlay()
|
||||||
|
{
|
||||||
|
bool fired = false;
|
||||||
|
|
||||||
|
var firedText = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Text = "Fired!",
|
||||||
|
TextSize = 50,
|
||||||
|
Alpha = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
var overlay = new TestHoldToConfirmOverlay
|
||||||
|
{
|
||||||
|
Action = () =>
|
||||||
|
{
|
||||||
|
fired = true;
|
||||||
|
firedText.FadeTo(1).Then().FadeOut(1000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
overlay,
|
||||||
|
firedText
|
||||||
|
};
|
||||||
|
|
||||||
|
AddStep("start confirming", () => overlay.Begin());
|
||||||
|
AddStep("abort confirming", () => overlay.Abort());
|
||||||
|
|
||||||
|
AddAssert("ensure aborted", () => !fired);
|
||||||
|
|
||||||
|
AddStep("start confirming", () => overlay.Begin());
|
||||||
|
|
||||||
|
AddUntilStep(() => fired, "wait until confirmed");
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestHoldToConfirmOverlay : ExitConfirmOverlay
|
||||||
|
{
|
||||||
|
protected override bool AllowMultipleFires => true;
|
||||||
|
|
||||||
|
public void Begin() => BeginConfirm();
|
||||||
|
public void Abort() => AbortConfirm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -14,7 +14,7 @@ namespace osu.Game.Beatmaps
|
|||||||
protected readonly IBeatmap Beatmap;
|
protected readonly IBeatmap Beatmap;
|
||||||
protected readonly Mod[] Mods;
|
protected readonly Mod[] Mods;
|
||||||
|
|
||||||
protected double TimeRate = 1;
|
protected double TimeRate { get; private set; } = 1;
|
||||||
|
|
||||||
protected DifficultyCalculator(IBeatmap beatmap, Mod[] mods = null)
|
protected DifficultyCalculator(IBeatmap beatmap, Mod[] mods = null)
|
||||||
{
|
{
|
||||||
|
@ -44,19 +44,6 @@ namespace osu.Game.Graphics.Containers
|
|||||||
return base.OnClick(state);
|
return base.OnClick(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnDragStart(InputState state)
|
|
||||||
{
|
|
||||||
if (!base.ReceiveMouseInputAt(state.Mouse.NativeState.Position))
|
|
||||||
{
|
|
||||||
State = Visibility.Hidden;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.OnDragStart(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnDrag(InputState state) => State == Visibility.Hidden;
|
|
||||||
|
|
||||||
private void onStateChanged(Visibility visibility)
|
private void onStateChanged(Visibility visibility)
|
||||||
{
|
{
|
||||||
switch (visibility)
|
switch (visibility)
|
||||||
|
66
osu.Game/Overlays/HoldToConfirmOverlay.cs
Normal file
66
osu.Game/Overlays/HoldToConfirmOverlay.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An overlay which will display a black screen that dims over a period before confirming an exit action.
|
||||||
|
/// Action is BYO (derived class will need to call <see cref="BeginConfirm"/> and <see cref="AbortConfirm"/> from a user event).
|
||||||
|
/// </summary>
|
||||||
|
public abstract class HoldToConfirmOverlay : Container
|
||||||
|
{
|
||||||
|
public Action Action;
|
||||||
|
|
||||||
|
private Box overlay;
|
||||||
|
|
||||||
|
private const int activate_delay = 400;
|
||||||
|
private const int fadeout_delay = 200;
|
||||||
|
|
||||||
|
private bool fired;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the overlay should be allowed to return from a fired state.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual bool AllowMultipleFires => false;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
AlwaysPresent = true;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
overlay = new Box
|
||||||
|
{
|
||||||
|
Alpha = 0,
|
||||||
|
Colour = Color4.Black,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void BeginConfirm()
|
||||||
|
{
|
||||||
|
if (!AllowMultipleFires && fired) return;
|
||||||
|
overlay.FadeIn(activate_delay * (1 - overlay.Alpha), Easing.Out).OnComplete(_ =>
|
||||||
|
{
|
||||||
|
Action?.Invoke();
|
||||||
|
fired = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void AbortConfirm()
|
||||||
|
{
|
||||||
|
if (!AllowMultipleFires && fired) return;
|
||||||
|
overlay.FadeOut(fadeout_delay, Easing.Out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,7 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Input;
|
using osu.Game.Input;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
@ -43,7 +44,7 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
}
|
}
|
||||||
|
|
||||||
private OsuSpriteText text;
|
private OsuSpriteText text;
|
||||||
private OsuSpriteText pressAKey;
|
private OsuTextFlowContainer pressAKey;
|
||||||
|
|
||||||
private FillFlowContainer<KeyButton> buttons;
|
private FillFlowContainer<KeyButton> buttons;
|
||||||
|
|
||||||
@ -95,10 +96,11 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight
|
Origin = Anchor.TopRight
|
||||||
},
|
},
|
||||||
pressAKey = new OsuSpriteText
|
pressAKey = new OsuTextFlowContainer
|
||||||
{
|
{
|
||||||
Text = "Press a key to change binding, DEL to delete, ESC to cancel.",
|
Text = "Press a key to change binding, Shift+Delete to delete, Escape to cancel.",
|
||||||
Y = height,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
Margin = new MarginPadding(padding),
|
Margin = new MarginPadding(padding),
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Colour = colours.YellowDark
|
Colour = colours.YellowDark
|
||||||
@ -204,9 +206,16 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
finalise();
|
finalise();
|
||||||
return true;
|
return true;
|
||||||
case Key.Delete:
|
case Key.Delete:
|
||||||
bindTarget.UpdateKeyCombination(InputKey.None);
|
{
|
||||||
finalise();
|
if (state.Keyboard.ShiftPressed)
|
||||||
return true;
|
{
|
||||||
|
bindTarget.UpdateKeyCombination(InputKey.None);
|
||||||
|
finalise();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state));
|
bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state));
|
||||||
@ -261,7 +270,7 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
GetContainingInputManager().ChangeFocus(null);
|
GetContainingInputManager().ChangeFocus(null);
|
||||||
|
|
||||||
pressAKey.FadeOut(300, Easing.OutQuint);
|
pressAKey.FadeOut(300, Easing.OutQuint);
|
||||||
pressAKey.Padding = new MarginPadding { Bottom = -pressAKey.DrawHeight };
|
pressAKey.Padding = new MarginPadding { Top = height, Bottom = -pressAKey.DrawHeight };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnFocus(InputState state)
|
protected override void OnFocus(InputState state)
|
||||||
@ -270,7 +279,7 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
AutoSizeEasing = Easing.OutQuint;
|
AutoSizeEasing = Easing.OutQuint;
|
||||||
|
|
||||||
pressAKey.FadeIn(300, Easing.OutQuint);
|
pressAKey.FadeIn(300, Easing.OutQuint);
|
||||||
pressAKey.Padding = new MarginPadding();
|
pressAKey.Padding = new MarginPadding { Top = height };
|
||||||
|
|
||||||
updateBindTarget();
|
updateBindTarget();
|
||||||
base.OnFocus(state);
|
base.OnFocus(state);
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
@ -16,7 +17,8 @@ namespace osu.Game.Overlays.Music
|
|||||||
{
|
{
|
||||||
public class PlaylistList : CompositeDrawable
|
public class PlaylistList : CompositeDrawable
|
||||||
{
|
{
|
||||||
public Action<BeatmapSetInfo> OnSelect;
|
public Action<BeatmapSetInfo> Selected;
|
||||||
|
public Action<BeatmapSetInfo, int> OrderChanged;
|
||||||
|
|
||||||
private readonly ItemsScrollContainer items;
|
private readonly ItemsScrollContainer items;
|
||||||
|
|
||||||
@ -25,7 +27,8 @@ namespace osu.Game.Overlays.Music
|
|||||||
InternalChild = items = new ItemsScrollContainer
|
InternalChild = items = new ItemsScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
OnSelect = set => OnSelect?.Invoke(set)
|
Selected = set => Selected?.Invoke(set),
|
||||||
|
OrderChanged = (s, i) => OrderChanged?.Invoke(s, i)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,34 +38,20 @@ namespace osu.Game.Overlays.Music
|
|||||||
set { base.Padding = value; }
|
set { base.Padding = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<BeatmapSetInfo> BeatmapSets
|
|
||||||
{
|
|
||||||
get { return items.Sets; }
|
|
||||||
set { items.Sets = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public BeatmapSetInfo FirstVisibleSet => items.FirstVisibleSet;
|
public BeatmapSetInfo FirstVisibleSet => items.FirstVisibleSet;
|
||||||
public BeatmapSetInfo NextSet => items.NextSet;
|
|
||||||
public BeatmapSetInfo PreviousSet => items.PreviousSet;
|
|
||||||
|
|
||||||
public BeatmapSetInfo SelectedSet
|
|
||||||
{
|
|
||||||
get { return items.SelectedSet; }
|
|
||||||
set { items.SelectedSet = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddBeatmapSet(BeatmapSetInfo beatmapSet) => items.AddBeatmapSet(beatmapSet);
|
|
||||||
public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet) => items.RemoveBeatmapSet(beatmapSet);
|
|
||||||
|
|
||||||
public void Filter(string searchTerm) => items.SearchTerm = searchTerm;
|
public void Filter(string searchTerm) => items.SearchTerm = searchTerm;
|
||||||
|
|
||||||
private class ItemsScrollContainer : OsuScrollContainer
|
private class ItemsScrollContainer : OsuScrollContainer
|
||||||
{
|
{
|
||||||
public Action<BeatmapSetInfo> OnSelect;
|
public Action<BeatmapSetInfo> Selected;
|
||||||
|
public Action<BeatmapSetInfo, int> OrderChanged;
|
||||||
|
|
||||||
private readonly SearchContainer search;
|
private readonly SearchContainer search;
|
||||||
private readonly FillFlowContainer<PlaylistItem> items;
|
private readonly FillFlowContainer<PlaylistItem> items;
|
||||||
|
|
||||||
|
private readonly IBindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
public ItemsScrollContainer()
|
public ItemsScrollContainer()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -83,14 +72,36 @@ namespace osu.Game.Overlays.Music
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<BeatmapSetInfo> Sets
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(BeatmapManager beatmaps, OsuGameBase osuGame)
|
||||||
{
|
{
|
||||||
get { return items.Select(x => x.BeatmapSetInfo).ToList(); }
|
beatmaps.GetAllUsableBeatmapSets().ForEach(addBeatmapSet);
|
||||||
set
|
beatmaps.ItemAdded += addBeatmapSet;
|
||||||
{
|
beatmaps.ItemRemoved += removeBeatmapSet;
|
||||||
items.Clear();
|
|
||||||
value.ForEach(AddBeatmapSet);
|
beatmapBacking.BindTo(osuGame.Beatmap);
|
||||||
}
|
beatmapBacking.ValueChanged += _ => updateSelectedSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addBeatmapSet(BeatmapSetInfo obj)
|
||||||
|
{
|
||||||
|
var newItem = new PlaylistItem(obj) { OnSelect = set => Selected?.Invoke(set) };
|
||||||
|
|
||||||
|
items.Add(newItem);
|
||||||
|
items.SetLayoutPosition(newItem, items.Count - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeBeatmapSet(BeatmapSetInfo obj)
|
||||||
|
{
|
||||||
|
var itemToRemove = items.FirstOrDefault(i => i.BeatmapSetInfo.ID == obj.ID);
|
||||||
|
if (itemToRemove != null)
|
||||||
|
items.Remove(itemToRemove);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSelectedSet()
|
||||||
|
{
|
||||||
|
foreach (PlaylistItem s in items.Children)
|
||||||
|
s.Selected = s.BeatmapSetInfo.ID == beatmapBacking.Value.BeatmapSetInfo.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SearchTerm
|
public string SearchTerm
|
||||||
@ -99,34 +110,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
set { search.SearchTerm = value; }
|
set { search.SearchTerm = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddBeatmapSet(BeatmapSetInfo beatmapSet)
|
|
||||||
{
|
|
||||||
var newItem = new PlaylistItem(beatmapSet) { OnSelect = set => OnSelect?.Invoke(set) };
|
|
||||||
|
|
||||||
items.Add(newItem);
|
|
||||||
items.SetLayoutPosition(newItem, items.Count);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet)
|
|
||||||
{
|
|
||||||
var itemToRemove = items.FirstOrDefault(i => i.BeatmapSetInfo.ID == beatmapSet.ID);
|
|
||||||
if (itemToRemove != null)
|
|
||||||
items.Remove(itemToRemove);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BeatmapSetInfo SelectedSet
|
|
||||||
{
|
|
||||||
get { return items.FirstOrDefault(i => i.Selected)?.BeatmapSetInfo; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
foreach (PlaylistItem s in items.Children)
|
|
||||||
s.Selected = s.BeatmapSetInfo.ID == value?.ID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public BeatmapSetInfo FirstVisibleSet => items.FirstOrDefault(i => i.MatchingFilter)?.BeatmapSetInfo;
|
public BeatmapSetInfo FirstVisibleSet => items.FirstOrDefault(i => i.MatchingFilter)?.BeatmapSetInfo;
|
||||||
public BeatmapSetInfo NextSet => (items.SkipWhile(i => !i.Selected).Skip(1).FirstOrDefault() ?? items.FirstOrDefault())?.BeatmapSetInfo;
|
|
||||||
public BeatmapSetInfo PreviousSet => (items.TakeWhile(i => !i.Selected).LastOrDefault() ?? items.LastOrDefault())?.BeatmapSetInfo;
|
|
||||||
|
|
||||||
private Vector2 nativeDragPosition;
|
private Vector2 nativeDragPosition;
|
||||||
private PlaylistItem draggedItem;
|
private PlaylistItem draggedItem;
|
||||||
@ -227,6 +211,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
}
|
}
|
||||||
|
|
||||||
items.SetLayoutPosition(draggedItem, dstIndex);
|
items.SetLayoutPosition(draggedItem, dstIndex);
|
||||||
|
OrderChanged?.Invoke(draggedItem.BeatmapSetInfo, dstIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ItemSearchContainer : FillFlowContainer<PlaylistItem>, IHasFilterableChildren
|
private class ItemSearchContainer : FillFlowContainer<PlaylistItem>, IHasFilterableChildren
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
@ -19,18 +19,16 @@ namespace osu.Game.Overlays.Music
|
|||||||
public class PlaylistOverlay : OverlayContainer
|
public class PlaylistOverlay : OverlayContainer
|
||||||
{
|
{
|
||||||
private const float transition_duration = 600;
|
private const float transition_duration = 600;
|
||||||
|
|
||||||
private const float playlist_height = 510;
|
private const float playlist_height = 510;
|
||||||
|
|
||||||
|
public Action<BeatmapSetInfo, int> OrderChanged;
|
||||||
|
|
||||||
|
private BeatmapManager beatmaps;
|
||||||
private FilterControl filter;
|
private FilterControl filter;
|
||||||
private PlaylistList list;
|
private PlaylistList list;
|
||||||
|
|
||||||
private BeatmapManager beatmaps;
|
|
||||||
|
|
||||||
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
public IEnumerable<BeatmapSetInfo> BeatmapSets => list.BeatmapSets;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, BeatmapManager beatmaps, OsuColour colours)
|
private void load(OsuGameBase game, BeatmapManager beatmaps, OsuColour colours)
|
||||||
{
|
{
|
||||||
@ -60,7 +58,8 @@ namespace osu.Game.Overlays.Music
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Top = 95, Bottom = 10, Right = 10 },
|
Padding = new MarginPadding { Top = 95, Bottom = 10, Right = 10 },
|
||||||
OnSelect = itemSelected,
|
Selected = itemSelected,
|
||||||
|
OrderChanged = (s, i) => OrderChanged?.Invoke(s, i)
|
||||||
},
|
},
|
||||||
filter = new FilterControl
|
filter = new FilterControl
|
||||||
{
|
{
|
||||||
@ -74,30 +73,16 @@ namespace osu.Game.Overlays.Music
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
beatmaps.ItemAdded += handleBeatmapAdded;
|
|
||||||
beatmaps.ItemRemoved += handleBeatmapRemoved;
|
|
||||||
|
|
||||||
list.BeatmapSets = beatmaps.GetAllUsableBeatmapSets();
|
|
||||||
|
|
||||||
beatmapBacking.BindTo(game.Beatmap);
|
beatmapBacking.BindTo(game.Beatmap);
|
||||||
|
|
||||||
filter.Search.OnCommit = (sender, newText) =>
|
filter.Search.OnCommit = (sender, newText) =>
|
||||||
{
|
{
|
||||||
var beatmap = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
|
BeatmapInfo beatmap = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
|
||||||
if (beatmap != null) playSpecified(beatmap);
|
if (beatmap != null)
|
||||||
|
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(beatmap);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
beatmapBacking.ValueChanged += b => list.SelectedSet = b?.BeatmapSetInfo;
|
|
||||||
beatmapBacking.TriggerChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleBeatmapAdded(BeatmapSetInfo setInfo) => Schedule(() => list.AddBeatmapSet(setInfo));
|
|
||||||
private void handleBeatmapRemoved(BeatmapSetInfo setInfo) => Schedule(() => list.RemoveBeatmapSet(setInfo));
|
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
filter.Search.HoldFocus = true;
|
filter.Search.HoldFocus = true;
|
||||||
@ -123,49 +108,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
playSpecified(set.Beatmaps.First());
|
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(set.Beatmaps.First());
|
||||||
}
|
|
||||||
|
|
||||||
public void PlayPrevious()
|
|
||||||
{
|
|
||||||
var playable = list.PreviousSet;
|
|
||||||
|
|
||||||
if (playable != null)
|
|
||||||
{
|
|
||||||
playSpecified(playable.Beatmaps.First());
|
|
||||||
list.SelectedSet = playable;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PlayNext()
|
|
||||||
{
|
|
||||||
var playable = list.NextSet;
|
|
||||||
|
|
||||||
if (playable != null)
|
|
||||||
{
|
|
||||||
playSpecified(playable.Beatmaps.First());
|
|
||||||
list.SelectedSet = playable;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void playSpecified(BeatmapInfo info)
|
|
||||||
{
|
|
||||||
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(info, beatmapBacking);
|
|
||||||
|
|
||||||
var track = beatmapBacking.Value.Track;
|
|
||||||
|
|
||||||
track.Restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
|
|
||||||
if (beatmaps != null)
|
|
||||||
{
|
|
||||||
beatmaps.ItemAdded -= handleBeatmapAdded;
|
|
||||||
beatmaps.ItemRemoved -= handleBeatmapRemoved;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -50,7 +51,10 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private LocalisationEngine localisation;
|
private LocalisationEngine localisation;
|
||||||
|
|
||||||
|
private BeatmapManager beatmaps;
|
||||||
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
||||||
|
private List<BeatmapSetInfo> beatmapSets;
|
||||||
|
private BeatmapSetInfo currentSet;
|
||||||
|
|
||||||
private Container dragContainer;
|
private Container dragContainer;
|
||||||
private Container playerContainer;
|
private Container playerContainer;
|
||||||
@ -93,8 +97,9 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, OsuColour colours, LocalisationEngine localisation)
|
private void load(OsuGameBase game, BeatmapManager beatmaps, OsuColour colours, LocalisationEngine localisation)
|
||||||
{
|
{
|
||||||
|
this.beatmaps = beatmaps;
|
||||||
this.localisation = localisation;
|
this.localisation = localisation;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -111,6 +116,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Y = player_height + 10,
|
Y = player_height + 10,
|
||||||
|
OrderChanged = playlistOrderChanged
|
||||||
},
|
},
|
||||||
playerContainer = new Container
|
playerContainer = new Container
|
||||||
{
|
{
|
||||||
@ -185,7 +191,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Action = next,
|
Action = () => next(),
|
||||||
Icon = FontAwesome.fa_step_forward,
|
Icon = FontAwesome.fa_step_forward,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -214,11 +220,24 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
beatmapSets = beatmaps.GetAllUsableBeatmapSets();
|
||||||
|
beatmaps.ItemAdded += handleBeatmapAdded;
|
||||||
|
beatmaps.ItemRemoved += handleBeatmapRemoved;
|
||||||
|
|
||||||
beatmapBacking.BindTo(game.Beatmap);
|
beatmapBacking.BindTo(game.Beatmap);
|
||||||
|
|
||||||
playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
|
playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void playlistOrderChanged(BeatmapSetInfo beatmapSetInfo, int index)
|
||||||
|
{
|
||||||
|
beatmapSets.Remove(beatmapSetInfo);
|
||||||
|
beatmapSets.Insert(index, beatmapSetInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleBeatmapAdded(BeatmapSetInfo obj) => beatmapSets.Add(obj);
|
||||||
|
private void handleBeatmapRemoved(BeatmapSetInfo obj) => beatmapSets.RemoveAll(s => s.ID == obj.ID);
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
beatmapBacking.ValueChanged += beatmapChanged;
|
beatmapBacking.ValueChanged += beatmapChanged;
|
||||||
@ -257,7 +276,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
|
playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
|
||||||
|
|
||||||
if (track.HasCompleted && !track.Looping && !beatmapBacking.Disabled && playlist.BeatmapSets.Any())
|
if (track.HasCompleted && !track.Looping && !beatmapBacking.Disabled && beatmapSets.Any())
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -271,7 +290,7 @@ namespace osu.Game.Overlays
|
|||||||
if (track == null)
|
if (track == null)
|
||||||
{
|
{
|
||||||
if (!beatmapBacking.Disabled)
|
if (!beatmapBacking.Disabled)
|
||||||
playlist.PlayNext();
|
next(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,13 +303,26 @@ namespace osu.Game.Overlays
|
|||||||
private void prev()
|
private void prev()
|
||||||
{
|
{
|
||||||
queuedDirection = TransformDirection.Prev;
|
queuedDirection = TransformDirection.Prev;
|
||||||
playlist.PlayPrevious();
|
|
||||||
|
var playable = beatmapSets.TakeWhile(i => i.ID != current.BeatmapSetInfo.ID).LastOrDefault() ?? beatmapSets.LastOrDefault();
|
||||||
|
if (playable != null)
|
||||||
|
{
|
||||||
|
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmapBacking);
|
||||||
|
beatmapBacking.Value.Track.Restart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void next()
|
private void next(bool instant = false)
|
||||||
{
|
{
|
||||||
queuedDirection = TransformDirection.Next;
|
if (!instant)
|
||||||
playlist.PlayNext();
|
queuedDirection = TransformDirection.Next;
|
||||||
|
|
||||||
|
var playable = beatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).Skip(1).FirstOrDefault() ?? beatmapSets.FirstOrDefault();
|
||||||
|
if (playable != null)
|
||||||
|
{
|
||||||
|
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmapBacking);
|
||||||
|
beatmapBacking.Value.Track.Restart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorkingBeatmap current;
|
private WorkingBeatmap current;
|
||||||
@ -314,8 +346,8 @@ namespace osu.Game.Overlays
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//figure out the best direction based on order in playlist.
|
//figure out the best direction based on order in playlist.
|
||||||
var last = playlist.BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count();
|
var last = beatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count();
|
||||||
var next = beatmap == null ? -1 : playlist.BeatmapSets.TakeWhile(b => b.ID != beatmap.BeatmapSetInfo?.ID).Count();
|
var next = beatmap == null ? -1 : beatmapSets.TakeWhile(b => b.ID != beatmap.BeatmapSetInfo?.ID).Count();
|
||||||
|
|
||||||
direction = last > next ? TransformDirection.Prev : TransformDirection.Next;
|
direction = last > next ? TransformDirection.Prev : TransformDirection.Next;
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,8 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
public bool Adjust(GlobalAction action)
|
public bool Adjust(GlobalAction action)
|
||||||
{
|
{
|
||||||
|
if (!IsLoaded) return false;
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case GlobalAction.DecreaseVolume:
|
case GlobalAction.DecreaseVolume:
|
||||||
|
@ -112,7 +112,7 @@ namespace osu.Game.Rulesets
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var assembly = Assembly.LoadFrom(file);
|
var assembly = Assembly.LoadFrom(file);
|
||||||
loaded_assemblies[assembly] = assembly.GetTypes().First(t => t.IsSubclassOf(typeof(Ruleset)));
|
loaded_assemblies[assembly] = assembly.GetTypes().First(t => t.IsPublic && t.IsSubclassOf(typeof(Ruleset)));
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Scoring.Legacy
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="LegacyScoreParser"/> which retrieves the applicable <see cref="Beatmap"/> and <see cref="Ruleset"/>
|
||||||
|
/// for the score from the database.
|
||||||
|
/// </summary>
|
||||||
|
public class DatabasedLegacyScoreParser : LegacyScoreParser
|
||||||
|
{
|
||||||
|
private readonly RulesetStore rulesets;
|
||||||
|
private readonly BeatmapManager beatmaps;
|
||||||
|
|
||||||
|
public DatabasedLegacyScoreParser(RulesetStore rulesets, BeatmapManager beatmaps)
|
||||||
|
{
|
||||||
|
this.rulesets = rulesets;
|
||||||
|
this.beatmaps = beatmaps;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Ruleset GetRuleset(int rulesetId) => rulesets.GetRuleset(rulesetId).CreateInstance();
|
||||||
|
protected override WorkingBeatmap GetBeatmap(string md5Hash) => beatmaps.GetWorkingBeatmap(beatmaps.QueryBeatmap(b => b.MD5Hash == md5Hash));
|
||||||
|
}
|
||||||
|
}
|
@ -14,17 +14,8 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Scoring.Legacy
|
namespace osu.Game.Rulesets.Scoring.Legacy
|
||||||
{
|
{
|
||||||
public class LegacyScoreParser
|
public abstract class LegacyScoreParser
|
||||||
{
|
{
|
||||||
private readonly RulesetStore rulesets;
|
|
||||||
private readonly BeatmapManager beatmaps;
|
|
||||||
|
|
||||||
public LegacyScoreParser(RulesetStore rulesets, BeatmapManager beatmaps)
|
|
||||||
{
|
|
||||||
this.rulesets = rulesets;
|
|
||||||
this.beatmaps = beatmaps;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IBeatmap currentBeatmap;
|
private IBeatmap currentBeatmap;
|
||||||
private Ruleset currentRuleset;
|
private Ruleset currentRuleset;
|
||||||
|
|
||||||
@ -34,16 +25,15 @@ namespace osu.Game.Rulesets.Scoring.Legacy
|
|||||||
|
|
||||||
using (SerializationReader sr = new SerializationReader(stream))
|
using (SerializationReader sr = new SerializationReader(stream))
|
||||||
{
|
{
|
||||||
score = new Score { Ruleset = rulesets.GetRuleset(sr.ReadByte()) };
|
currentRuleset = GetRuleset(sr.ReadByte());
|
||||||
currentRuleset = score.Ruleset.CreateInstance();
|
score = new Score { Ruleset = currentRuleset.RulesetInfo };
|
||||||
|
|
||||||
/* score.Pass = true;*/
|
/* score.Pass = true;*/
|
||||||
var version = sr.ReadInt32();
|
var version = sr.ReadInt32();
|
||||||
|
|
||||||
/* score.FileChecksum = */
|
/* score.FileChecksum = */
|
||||||
var beatmapHash = sr.ReadString();
|
currentBeatmap = GetBeatmap(sr.ReadString()).Beatmap;
|
||||||
score.Beatmap = beatmaps.QueryBeatmap(b => b.MD5Hash == beatmapHash);
|
score.Beatmap = currentBeatmap.BeatmapInfo;
|
||||||
currentBeatmap = beatmaps.GetWorkingBeatmap(score.Beatmap).Beatmap;
|
|
||||||
|
|
||||||
/* score.PlayerName = */
|
/* score.PlayerName = */
|
||||||
score.User = new User { Username = sr.ReadString() };
|
score.User = new User { Username = sr.ReadString() };
|
||||||
@ -181,5 +171,19 @@ namespace osu.Game.Rulesets.Scoring.Legacy
|
|||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the <see cref="Ruleset"/> for a specific id.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="rulesetId">The id.</param>
|
||||||
|
/// <returns>The <see cref="Ruleset"/>.</returns>
|
||||||
|
protected abstract Ruleset GetRuleset(int rulesetId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the <see cref="WorkingBeatmap"/> corresponding to an MD5 hash.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="md5Hash">The MD5 hash.</param>
|
||||||
|
/// <returns>The <see cref="WorkingBeatmap"/>.</returns>
|
||||||
|
protected abstract WorkingBeatmap GetBeatmap(string md5Hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Scoring
|
namespace osu.Game.Rulesets.Scoring
|
||||||
{
|
{
|
||||||
@ -14,6 +18,8 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
protected readonly IBeatmap Beatmap;
|
protected readonly IBeatmap Beatmap;
|
||||||
protected readonly Score Score;
|
protected readonly Score Score;
|
||||||
|
|
||||||
|
protected double TimeRate { get; private set; } = 1;
|
||||||
|
|
||||||
protected PerformanceCalculator(Ruleset ruleset, IBeatmap beatmap, Score score)
|
protected PerformanceCalculator(Ruleset ruleset, IBeatmap beatmap, Score score)
|
||||||
{
|
{
|
||||||
Score = score;
|
Score = score;
|
||||||
@ -22,6 +28,15 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
|
|
||||||
var diffCalc = ruleset.CreateDifficultyCalculator(beatmap, score.Mods);
|
var diffCalc = ruleset.CreateDifficultyCalculator(beatmap, score.Mods);
|
||||||
diffCalc.Calculate(attributes);
|
diffCalc.Calculate(attributes);
|
||||||
|
|
||||||
|
ApplyMods(score.Mods);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void ApplyMods(Mod[] mods)
|
||||||
|
{
|
||||||
|
var clock = new StopwatchClock();
|
||||||
|
mods.OfType<IApplicableToClock>().ForEach(m => m.ApplyToClock(clock));
|
||||||
|
TimeRate = clock.Rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract double Calculate(Dictionary<string, double> categoryDifficulty = null);
|
public abstract double Calculate(Dictionary<string, double> categoryDifficulty = null);
|
||||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
public Score ReadReplayFile(string replayFilename)
|
public Score ReadReplayFile(string replayFilename)
|
||||||
{
|
{
|
||||||
using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename)))
|
using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename)))
|
||||||
return new LegacyScoreParser(rulesets, beatmaps).Parse(s);
|
return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
34
osu.Game/Screens/Menu/ExitConfirmOverlay.cs
Normal file
34
osu.Game/Screens/Menu/ExitConfirmOverlay.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using OpenTK.Input;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Menu
|
||||||
|
{
|
||||||
|
public class ExitConfirmOverlay : HoldToConfirmOverlay
|
||||||
|
{
|
||||||
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
{
|
||||||
|
if (args.Key == Key.Escape && !args.Repeat)
|
||||||
|
{
|
||||||
|
BeginConfirm();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.OnKeyDown(state, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args)
|
||||||
|
{
|
||||||
|
if (args.Key == Key.Escape)
|
||||||
|
{
|
||||||
|
AbortConfirm();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.OnKeyUp(state, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -39,6 +39,10 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
new ExitConfirmOverlay
|
||||||
|
{
|
||||||
|
Action = Exit,
|
||||||
|
},
|
||||||
new ParallaxContainer
|
new ParallaxContainer
|
||||||
{
|
{
|
||||||
ParallaxAmount = 0.01f,
|
ParallaxAmount = 0.01f,
|
||||||
|
@ -1,50 +1,19 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using System;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using OpenTK.Graphics;
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class HotkeyRetryOverlay : Container, IKeyBindingHandler<GlobalAction>
|
public class HotkeyRetryOverlay : HoldToConfirmOverlay, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
public Action Action;
|
|
||||||
|
|
||||||
private Box overlay;
|
|
||||||
|
|
||||||
private const int activate_delay = 400;
|
|
||||||
private const int fadeout_delay = 200;
|
|
||||||
|
|
||||||
private bool fired;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
AlwaysPresent = true;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
overlay = new Box
|
|
||||||
{
|
|
||||||
Alpha = 0,
|
|
||||||
Colour = Color4.Black,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool OnPressed(GlobalAction action)
|
public bool OnPressed(GlobalAction action)
|
||||||
{
|
{
|
||||||
if (action != GlobalAction.QuickRetry) return false;
|
if (action != GlobalAction.QuickRetry) return false;
|
||||||
|
|
||||||
overlay.FadeIn(activate_delay, Easing.Out);
|
BeginConfirm();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,18 +21,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
if (action != GlobalAction.QuickRetry) return false;
|
if (action != GlobalAction.QuickRetry) return false;
|
||||||
|
|
||||||
overlay.FadeOut(fadeout_delay, Easing.Out);
|
AbortConfirm();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
if (!fired && overlay.Alpha == 1)
|
|
||||||
{
|
|
||||||
fired = true;
|
|
||||||
Action?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ namespace osu.Game.Screens.Play
|
|||||||
hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused;
|
hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused;
|
||||||
},
|
},
|
||||||
OnResume = () => hudOverlay.KeyCounter.IsCounting = true,
|
OnResume = () => hudOverlay.KeyCounter.IsCounting = true,
|
||||||
Children = new Drawable[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
storyboardContainer = new Container
|
storyboardContainer = new Container
|
||||||
{
|
{
|
||||||
@ -174,12 +174,12 @@ namespace osu.Game.Screens.Play
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = RulesetContainer
|
Child = RulesetContainer
|
||||||
},
|
},
|
||||||
new SkipOverlay(firstObjectTime)
|
new BreakOverlay(beatmap.BeatmapInfo.LetterboxInBreaks, scoreProcessor)
|
||||||
{
|
{
|
||||||
Clock = Clock, // skip button doesn't want to use the audio clock directly
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
ProcessCustomClock = false,
|
ProcessCustomClock = false,
|
||||||
AdjustableClock = adjustableClock,
|
Breaks = beatmap.Breaks
|
||||||
FramedClock = offsetClock,
|
|
||||||
},
|
},
|
||||||
hudOverlay = new HUDOverlay(scoreProcessor, RulesetContainer, working, offsetClock, adjustableClock)
|
hudOverlay = new HUDOverlay(scoreProcessor, RulesetContainer, working, offsetClock, adjustableClock)
|
||||||
{
|
{
|
||||||
@ -188,13 +188,14 @@ namespace osu.Game.Screens.Play
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
},
|
},
|
||||||
new BreakOverlay(beatmap.BeatmapInfo.LetterboxInBreaks, scoreProcessor)
|
RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
|
||||||
|
new SkipOverlay(firstObjectTime)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Clock = Clock, // skip button doesn't want to use the audio clock directly
|
||||||
Origin = Anchor.Centre,
|
|
||||||
ProcessCustomClock = false,
|
ProcessCustomClock = false,
|
||||||
Breaks = beatmap.Breaks
|
AdjustableClock = adjustableClock,
|
||||||
}
|
FramedClock = offsetClock,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
failOverlay = new FailOverlay
|
failOverlay = new FailOverlay
|
||||||
|
@ -85,11 +85,13 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
if (currentSecond != previousSecond && songCurrentTime < songLength)
|
if (currentSecond != previousSecond && songCurrentTime < songLength)
|
||||||
{
|
{
|
||||||
timeCurrent.Text = TimeSpan.FromSeconds(currentSecond).ToString(songCurrentTime < 0 ? @"\-m\:ss" : @"m\:ss");
|
timeCurrent.Text = formatTime(TimeSpan.FromSeconds(currentSecond));
|
||||||
timeLeft.Text = TimeSpan.FromMilliseconds(endTime - AudioClock.CurrentTime).ToString(@"\-m\:ss");
|
timeLeft.Text = formatTime(TimeSpan.FromMilliseconds(endTime - AudioClock.CurrentTime));
|
||||||
|
|
||||||
previousSecond = currentSecond;
|
previousSecond = currentSecond;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string formatTime(TimeSpan timeSpan) => $"{(timeSpan < TimeSpan.Zero ? "-" : "")}{timeSpan.Duration().TotalMinutes:N0}:{timeSpan.Duration().Seconds:D2}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,17 +88,27 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private void loadBeatmap()
|
private void loadBeatmap()
|
||||||
{
|
{
|
||||||
|
void updateState()
|
||||||
|
{
|
||||||
|
State = beatmap == null ? Visibility.Hidden : Visibility.Visible;
|
||||||
|
|
||||||
|
Info?.FadeOut(250);
|
||||||
|
Info?.Expire();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (beatmap == null)
|
||||||
|
{
|
||||||
|
updateState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LoadComponentAsync(new BufferedWedgeInfo(beatmap, ruleset.Value)
|
LoadComponentAsync(new BufferedWedgeInfo(beatmap, ruleset.Value)
|
||||||
{
|
{
|
||||||
Shear = -Shear,
|
Shear = -Shear,
|
||||||
Depth = Info?.Depth + 1 ?? 0,
|
Depth = Info?.Depth + 1 ?? 0,
|
||||||
}, newInfo =>
|
}, newInfo =>
|
||||||
{
|
{
|
||||||
State = beatmap == null ? Visibility.Hidden : Visibility.Visible;
|
updateState();
|
||||||
|
|
||||||
Info?.FadeOut(250);
|
|
||||||
Info?.Expire();
|
|
||||||
|
|
||||||
Add(Info = newInfo);
|
Add(Info = newInfo);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user