mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 11:42:54 +08:00
Merge remote-tracking branch 'origin/master' into android
This commit is contained in:
commit
e865ac2086
@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Catch";
|
||||
|
||||
[TestCase(4.2038001515546597d, "diffcalc-test")]
|
||||
[TestCase(4.2058561036909863d, "diffcalc-test")]
|
||||
public void Test(double expected, string name)
|
||||
=> base.Test(expected, name);
|
||||
|
||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Catch.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Catch.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Catch.Mods;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Catch.UI;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
@ -88,5 +89,13 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
||||
{
|
||||
new Movement(),
|
||||
};
|
||||
|
||||
protected override Mod[] DifficultyAdjustmentMods => new Mod[]
|
||||
{
|
||||
new CatchModDoubleTime(),
|
||||
new CatchModHalfTime(),
|
||||
new CatchModHardRock(),
|
||||
new CatchModEasy(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Audio;
|
||||
@ -25,6 +24,11 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
public double Velocity;
|
||||
public double TickDistance;
|
||||
|
||||
/// <summary>
|
||||
/// The length of one span of this <see cref="JuiceStream"/>.
|
||||
/// </summary>
|
||||
public double SpanDuration => Duration / this.SpanCount();
|
||||
|
||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
||||
{
|
||||
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||
@ -41,19 +45,6 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
protected override void CreateNestedHitObjects()
|
||||
{
|
||||
base.CreateNestedHitObjects();
|
||||
createTicks();
|
||||
}
|
||||
|
||||
private void createTicks()
|
||||
{
|
||||
if (TickDistance == 0)
|
||||
return;
|
||||
|
||||
var length = Path.Distance;
|
||||
var tickDistance = Math.Min(TickDistance, length);
|
||||
var spanDuration = length / Velocity;
|
||||
|
||||
var minDistanceFromEnd = Velocity * 0.01;
|
||||
|
||||
var tickSamples = Samples.Select(s => new SampleInfo
|
||||
{
|
||||
@ -62,81 +53,59 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
Volume = s.Volume
|
||||
}).ToList();
|
||||
|
||||
AddNested(new Fruit
|
||||
SliderEventDescriptor? lastEvent = null;
|
||||
|
||||
foreach (var e in SliderEventGenerator.Generate(StartTime, SpanDuration, Velocity, TickDistance, Path.Distance, this.SpanCount(), LegacyLastTickOffset))
|
||||
{
|
||||
Samples = Samples,
|
||||
StartTime = StartTime,
|
||||
X = X
|
||||
});
|
||||
|
||||
double lastTickTime = StartTime;
|
||||
|
||||
for (int span = 0; span < this.SpanCount(); span++)
|
||||
{
|
||||
var spanStartTime = StartTime + span * spanDuration;
|
||||
var reversed = span % 2 == 1;
|
||||
|
||||
for (double d = tickDistance;; d += tickDistance)
|
||||
// generate tiny droplets since the last point
|
||||
if (lastEvent != null)
|
||||
{
|
||||
bool isLastTick = false;
|
||||
if (d + minDistanceFromEnd >= length)
|
||||
double sinceLastTick = e.Time - lastEvent.Value.Time;
|
||||
|
||||
if (sinceLastTick > 80)
|
||||
{
|
||||
d = length;
|
||||
isLastTick = true;
|
||||
}
|
||||
double timeBetweenTiny = sinceLastTick;
|
||||
while (timeBetweenTiny > 100)
|
||||
timeBetweenTiny /= 2;
|
||||
|
||||
var timeProgress = d / length;
|
||||
var distanceProgress = reversed ? 1 - timeProgress : timeProgress;
|
||||
|
||||
double time = spanStartTime + timeProgress * spanDuration;
|
||||
|
||||
if (LegacyLastTickOffset != null)
|
||||
{
|
||||
// If we're the last tick, apply the legacy offset
|
||||
if (span == this.SpanCount() - 1 && isLastTick)
|
||||
time = Math.Max(StartTime + Duration / 2, time - LegacyLastTickOffset.Value);
|
||||
}
|
||||
|
||||
int tinyTickCount = 1;
|
||||
double tinyTickInterval = time - lastTickTime;
|
||||
while (tinyTickInterval > 100 && tinyTickCount < 10000)
|
||||
{
|
||||
tinyTickInterval /= 2;
|
||||
tinyTickCount *= 2;
|
||||
}
|
||||
|
||||
for (int tinyTickIndex = 0; tinyTickIndex < tinyTickCount - 1; tinyTickIndex++)
|
||||
{
|
||||
var t = lastTickTime + (tinyTickIndex + 1) * tinyTickInterval;
|
||||
double progress = reversed ? 1 - (t - spanStartTime) / spanDuration : (t - spanStartTime) / spanDuration;
|
||||
|
||||
AddNested(new TinyDroplet
|
||||
for (double t = timeBetweenTiny; t < sinceLastTick; t += timeBetweenTiny)
|
||||
{
|
||||
StartTime = t,
|
||||
X = X + Path.PositionAt(progress).X / CatchPlayfield.BASE_WIDTH,
|
||||
Samples = tickSamples
|
||||
});
|
||||
AddNested(new TinyDroplet
|
||||
{
|
||||
Samples = tickSamples,
|
||||
StartTime = t + lastEvent.Value.Time,
|
||||
X = X + Path.PositionAt(
|
||||
lastEvent.Value.PathProgress + (t / sinceLastTick) * (e.PathProgress - lastEvent.Value.PathProgress)).X / CatchPlayfield.BASE_WIDTH,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
lastTickTime = time;
|
||||
|
||||
if (isLastTick)
|
||||
break;
|
||||
|
||||
AddNested(new Droplet
|
||||
{
|
||||
StartTime = time,
|
||||
X = X + Path.PositionAt(distanceProgress).X / CatchPlayfield.BASE_WIDTH,
|
||||
Samples = tickSamples
|
||||
});
|
||||
}
|
||||
|
||||
AddNested(new Fruit
|
||||
// this also includes LegacyLastTick and this is used for TinyDroplet generation above.
|
||||
// this means that the final segment of TinyDroplets are increasingly mistimed where LegacyLastTickOffset is being applied.
|
||||
lastEvent = e;
|
||||
|
||||
switch (e.Type)
|
||||
{
|
||||
Samples = Samples,
|
||||
StartTime = spanStartTime + spanDuration,
|
||||
X = X + Path.PositionAt(reversed ? 0 : 1).X / CatchPlayfield.BASE_WIDTH
|
||||
});
|
||||
case SliderEventType.Tick:
|
||||
AddNested(new Droplet
|
||||
{
|
||||
Samples = tickSamples,
|
||||
StartTime = e.Time,
|
||||
X = X + Path.PositionAt(e.PathProgress).X / CatchPlayfield.BASE_WIDTH,
|
||||
});
|
||||
break;
|
||||
case SliderEventType.Head:
|
||||
case SliderEventType.Tail:
|
||||
case SliderEventType.Repeat:
|
||||
AddNested(new Fruit
|
||||
{
|
||||
Samples = Samples,
|
||||
StartTime = e.Time,
|
||||
X = X + Path.PositionAt(e.PathProgress).X / CatchPlayfield.BASE_WIDTH,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,22 +22,15 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
JudgementText.Font = JudgementText.Font.With(size: 25);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
protected override double FadeInDuration => 50;
|
||||
|
||||
protected override void ApplyHitAnimations()
|
||||
{
|
||||
base.LoadComplete();
|
||||
JudgementBody.ScaleTo(0.8f);
|
||||
JudgementBody.ScaleTo(1, 250, Easing.OutElastic);
|
||||
|
||||
this.FadeInFromZero(50, Easing.OutQuint);
|
||||
|
||||
if (Result.IsHit)
|
||||
{
|
||||
JudgementBody.ScaleTo(0.8f);
|
||||
JudgementBody.ScaleTo(1, 250, Easing.OutElastic);
|
||||
|
||||
JudgementBody.Delay(50).ScaleTo(0.75f, 250);
|
||||
this.Delay(50).FadeOut(200);
|
||||
}
|
||||
|
||||
Expire();
|
||||
JudgementBody.Delay(FadeInDuration).ScaleTo(0.75f, 250);
|
||||
this.Delay(FadeInDuration).FadeOut(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
16
osu.Game.Rulesets.Osu.Tests/TestCaseOsuPlayer.cs
Normal file
16
osu.Game.Rulesets.Osu.Tests/TestCaseOsuPlayer.cs
Normal file
@ -0,0 +1,16 @@
|
||||
// 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;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestCaseOsuPlayer : Game.Tests.Visual.TestCasePlayer
|
||||
{
|
||||
public TestCaseOsuPlayer()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@ using osu.Framework.Graphics;
|
||||
using osuTK;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
@ -16,12 +15,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
protected override void ApplyHitAnimations()
|
||||
{
|
||||
if (Result.Type != HitResult.Miss)
|
||||
JudgementText?.TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);
|
||||
|
||||
base.LoadComplete();
|
||||
JudgementText?.TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);
|
||||
base.ApplyHitAnimations();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,6 +132,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
base.ClearTransformsAfter(time, false, targetMember);
|
||||
}
|
||||
|
||||
public override void ApplyTransformsAt(double time, bool propagateChildren = false)
|
||||
{
|
||||
// For the same reasons as above w.r.t rewinding, we shouldn't propagate to children here either.
|
||||
base.ApplyTransformsAt(time, false);
|
||||
}
|
||||
|
||||
private bool tracking;
|
||||
|
||||
public bool Tracking
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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 osuTK;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using System.Collections.Generic;
|
||||
@ -155,116 +154,76 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
{
|
||||
base.CreateNestedHitObjects();
|
||||
|
||||
createSliderEnds();
|
||||
createTicks();
|
||||
createRepeatPoints();
|
||||
|
||||
if (LegacyLastTickOffset != null)
|
||||
TailCircle.StartTime = Math.Max(StartTime + Duration / 2, TailCircle.StartTime - LegacyLastTickOffset.Value);
|
||||
}
|
||||
|
||||
private void createSliderEnds()
|
||||
{
|
||||
HeadCircle = new SliderCircle
|
||||
foreach (var e in
|
||||
SliderEventGenerator.Generate(StartTime, SpanDuration, Velocity, TickDistance, Path.Distance, this.SpanCount(), LegacyLastTickOffset))
|
||||
{
|
||||
StartTime = StartTime,
|
||||
Position = Position,
|
||||
Samples = getNodeSamples(0),
|
||||
SampleControlPoint = SampleControlPoint,
|
||||
IndexInCurrentCombo = IndexInCurrentCombo,
|
||||
ComboIndex = ComboIndex,
|
||||
};
|
||||
var firstSample = Samples.Find(s => s.Name == SampleInfo.HIT_NORMAL)
|
||||
?? Samples.FirstOrDefault(); // TODO: remove this when guaranteed sort is present for samples (https://github.com/ppy/osu/issues/1933)
|
||||
var sampleList = new List<SampleInfo>();
|
||||
|
||||
TailCircle = new SliderTailCircle(this)
|
||||
{
|
||||
StartTime = EndTime,
|
||||
Position = EndPosition,
|
||||
IndexInCurrentCombo = IndexInCurrentCombo,
|
||||
ComboIndex = ComboIndex,
|
||||
};
|
||||
|
||||
AddNested(HeadCircle);
|
||||
AddNested(TailCircle);
|
||||
}
|
||||
|
||||
private void createTicks()
|
||||
{
|
||||
// A very lenient maximum length of a slider for ticks to be generated.
|
||||
// This exists for edge cases such as /b/1573664 where the beatmap has been edited by the user, and should never be reached in normal usage.
|
||||
const double max_length = 100000;
|
||||
|
||||
var length = Math.Min(max_length, Path.Distance);
|
||||
var tickDistance = MathHelper.Clamp(TickDistance, 0, length);
|
||||
|
||||
if (tickDistance == 0) return;
|
||||
|
||||
var minDistanceFromEnd = Velocity * 10;
|
||||
|
||||
var spanCount = this.SpanCount();
|
||||
|
||||
for (var span = 0; span < spanCount; span++)
|
||||
{
|
||||
var spanStartTime = StartTime + span * SpanDuration;
|
||||
var reversed = span % 2 == 1;
|
||||
|
||||
for (var d = tickDistance; d <= length; d += tickDistance)
|
||||
{
|
||||
if (d > length - minDistanceFromEnd)
|
||||
break;
|
||||
|
||||
var distanceProgress = d / length;
|
||||
var timeProgress = reversed ? 1 - distanceProgress : distanceProgress;
|
||||
|
||||
var firstSample = Samples.Find(s => s.Name == SampleInfo.HIT_NORMAL)
|
||||
?? Samples.FirstOrDefault(); // TODO: remove this when guaranteed sort is present for samples (https://github.com/ppy/osu/issues/1933)
|
||||
var sampleList = new List<SampleInfo>();
|
||||
|
||||
if (firstSample != null)
|
||||
sampleList.Add(new SampleInfo
|
||||
{
|
||||
Bank = firstSample.Bank,
|
||||
Volume = firstSample.Volume,
|
||||
Name = @"slidertick",
|
||||
});
|
||||
|
||||
AddNested(new SliderTick
|
||||
if (firstSample != null)
|
||||
sampleList.Add(new SampleInfo
|
||||
{
|
||||
SpanIndex = span,
|
||||
SpanStartTime = spanStartTime,
|
||||
StartTime = spanStartTime + timeProgress * SpanDuration,
|
||||
Position = Position + Path.PositionAt(distanceProgress),
|
||||
StackHeight = StackHeight,
|
||||
Scale = Scale,
|
||||
Samples = sampleList
|
||||
Bank = firstSample.Bank,
|
||||
Volume = firstSample.Volume,
|
||||
Name = @"slidertick",
|
||||
});
|
||||
|
||||
switch (e.Type)
|
||||
{
|
||||
case SliderEventType.Tick:
|
||||
AddNested(new SliderTick
|
||||
{
|
||||
SpanIndex = e.SpanIndex,
|
||||
SpanStartTime = e.SpanStartTime,
|
||||
StartTime = e.Time,
|
||||
Position = Position + Path.PositionAt(e.PathProgress),
|
||||
StackHeight = StackHeight,
|
||||
Scale = Scale,
|
||||
Samples = sampleList
|
||||
});
|
||||
break;
|
||||
case SliderEventType.Head:
|
||||
AddNested(HeadCircle = new SliderCircle
|
||||
{
|
||||
StartTime = e.Time,
|
||||
Position = Position,
|
||||
Samples = getNodeSamples(0),
|
||||
SampleControlPoint = SampleControlPoint,
|
||||
IndexInCurrentCombo = IndexInCurrentCombo,
|
||||
ComboIndex = ComboIndex,
|
||||
});
|
||||
break;
|
||||
case SliderEventType.LegacyLastTick:
|
||||
// we need to use the LegacyLastTick here for compatibility reasons (difficulty).
|
||||
// it is *okay* to use this because the TailCircle is not used for any meaningful purpose in gameplay.
|
||||
// if this is to change, we should revisit this.
|
||||
AddNested(TailCircle = new SliderTailCircle(this)
|
||||
{
|
||||
StartTime = e.Time,
|
||||
Position = EndPosition,
|
||||
IndexInCurrentCombo = IndexInCurrentCombo,
|
||||
ComboIndex = ComboIndex,
|
||||
});
|
||||
break;
|
||||
case SliderEventType.Repeat:
|
||||
AddNested(new RepeatPoint
|
||||
{
|
||||
RepeatIndex = e.SpanIndex,
|
||||
SpanDuration = SpanDuration,
|
||||
StartTime = StartTime + (e.SpanIndex + 1) * SpanDuration,
|
||||
Position = Position + Path.PositionAt(e.PathProgress),
|
||||
StackHeight = StackHeight,
|
||||
Scale = Scale,
|
||||
Samples = getNodeSamples(e.SpanIndex + 1)
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createRepeatPoints()
|
||||
{
|
||||
for (int repeatIndex = 0, repeat = 1; repeatIndex < RepeatCount; repeatIndex++, repeat++)
|
||||
{
|
||||
AddNested(new RepeatPoint
|
||||
{
|
||||
RepeatIndex = repeatIndex,
|
||||
SpanDuration = SpanDuration,
|
||||
StartTime = StartTime + repeat * SpanDuration,
|
||||
Position = Position + Path.PositionAt(repeat % 2),
|
||||
StackHeight = StackHeight,
|
||||
Scale = Scale,
|
||||
Samples = getNodeSamples(1 + repeatIndex)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private List<SampleInfo> getNodeSamples(int nodeIndex)
|
||||
{
|
||||
if (nodeIndex < NodeSamples.Count)
|
||||
return NodeSamples[nodeIndex];
|
||||
|
||||
return Samples;
|
||||
}
|
||||
private List<SampleInfo> getNodeSamples(int nodeIndex) =>
|
||||
nodeIndex < NodeSamples.Count ? NodeSamples[nodeIndex] : Samples;
|
||||
|
||||
public override Judgement CreateJudgement() => new OsuJudgement();
|
||||
}
|
||||
|
@ -8,6 +8,10 @@ using osu.Game.Rulesets.Osu.Judgements;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects
|
||||
{
|
||||
/// <summary>
|
||||
/// Note that this should not be used for timing correctness.
|
||||
/// See <see cref="SliderEventType.LegacyLastTick"/> usage in <see cref="Slider"/> for more information.
|
||||
/// </summary>
|
||||
public class SliderTailCircle : SliderCircle
|
||||
{
|
||||
private readonly IBindable<SliderPath> pathBindable = new Bindable<SliderPath>();
|
||||
|
@ -39,12 +39,10 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
protected override void ApplyHitAnimations()
|
||||
{
|
||||
if (Result.IsHit)
|
||||
this.MoveToY(-100, 500);
|
||||
|
||||
base.LoadComplete();
|
||||
this.MoveToY(-100, 500);
|
||||
base.ApplyHitAnimations();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
72
osu.Game.Tests/Beatmaps/Formats/ParsingTest.cs
Normal file
72
osu.Game.Tests/Beatmaps/Formats/ParsingTest.cs
Normal file
@ -0,0 +1,72 @@
|
||||
// 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.Globalization;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
|
||||
namespace osu.Game.Tests.Beatmaps.Formats
|
||||
{
|
||||
[TestFixture]
|
||||
public class ParsingTest
|
||||
{
|
||||
[Test]
|
||||
public void TestNaNHandling() => allThrow<FormatException>("NaN");
|
||||
|
||||
[Test]
|
||||
public void TestBadStringHandling() => allThrow<FormatException>("Random string 123");
|
||||
|
||||
[TestCase(Parsing.MAX_PARSE_VALUE)]
|
||||
[TestCase(-1)]
|
||||
[TestCase(0)]
|
||||
[TestCase(1)]
|
||||
[TestCase(-Parsing.MAX_PARSE_VALUE)]
|
||||
[TestCase(10, 10)]
|
||||
[TestCase(-10, 10)]
|
||||
public void TestValidRanges(double input, double limit = Parsing.MAX_PARSE_VALUE)
|
||||
{
|
||||
Assert.AreEqual(Parsing.ParseInt((input).ToString(CultureInfo.InvariantCulture), (int)limit), (int)input);
|
||||
Assert.AreEqual(Parsing.ParseFloat((input).ToString(CultureInfo.InvariantCulture), (float)limit), (float)input);
|
||||
Assert.AreEqual(Parsing.ParseDouble((input).ToString(CultureInfo.InvariantCulture), limit), input);
|
||||
}
|
||||
|
||||
[TestCase(double.PositiveInfinity)]
|
||||
[TestCase(double.NegativeInfinity)]
|
||||
[TestCase(999999999999)]
|
||||
[TestCase(Parsing.MAX_PARSE_VALUE * 1.1)]
|
||||
[TestCase(-Parsing.MAX_PARSE_VALUE * 1.1)]
|
||||
[TestCase(11, 10)]
|
||||
[TestCase(-11, 10)]
|
||||
public void TestOutOfRangeHandling(double input, double limit = Parsing.MAX_PARSE_VALUE)
|
||||
=> allThrow<OverflowException>(input.ToString(CultureInfo.InvariantCulture), limit);
|
||||
|
||||
private void allThrow<T>(string input, double limit = Parsing.MAX_PARSE_VALUE)
|
||||
where T : Exception
|
||||
{
|
||||
Assert.Throws(getIntParseException(input) ?? typeof(T), () => Parsing.ParseInt(input, (int)limit));
|
||||
Assert.Throws<T>(() => Parsing.ParseFloat(input, (float)limit));
|
||||
Assert.Throws<T>(() => Parsing.ParseDouble(input, limit));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="int"/> may not be able to parse some inputs.
|
||||
/// In this case we expect to receive the raw parsing exception.
|
||||
/// </summary>
|
||||
/// <param name="input">The input attempting to be parsed.</param>
|
||||
/// <returns>The type of exception thrown by <see cref="int.Parse(string)"/>. Null if no exception is thrown.</returns>
|
||||
private Type getIntParseException(string input)
|
||||
{
|
||||
try
|
||||
{
|
||||
var _ = int.Parse(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return e.GetType();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -207,6 +207,41 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(true)]
|
||||
[TestCase(false)]
|
||||
public void TestImportThenDeleteThenImportWithOnlineIDMismatch(bool set)
|
||||
{
|
||||
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
|
||||
using (HeadlessGameHost host = new CleanRunHeadlessGameHost($"TestImportThenDeleteThenImport-{set}"))
|
||||
{
|
||||
try
|
||||
{
|
||||
var osu = loadOsu(host);
|
||||
|
||||
var imported = LoadOszIntoOsu(osu);
|
||||
|
||||
if (set)
|
||||
imported.OnlineBeatmapSetID = 1234;
|
||||
else
|
||||
imported.Beatmaps.First().OnlineBeatmapID = 1234;
|
||||
|
||||
osu.Dependencies.Get<BeatmapManager>().Update(imported);
|
||||
|
||||
deleteBeatmapSet(imported, osu);
|
||||
|
||||
var importedSecondTime = LoadOszIntoOsu(osu);
|
||||
|
||||
// check the newly "imported" beatmap has been reimported due to mismatch (even though hashes matched)
|
||||
Assert.IsTrue(imported.ID != importedSecondTime.ID);
|
||||
Assert.IsTrue(imported.Beatmaps.First().ID != importedSecondTime.Beatmaps.First().ID);
|
||||
}
|
||||
finally
|
||||
{
|
||||
host.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[NonParallelizable]
|
||||
[Ignore("Binding IPC on Appveyor isn't working (port in use). Need to figure out why")]
|
||||
|
@ -1,8 +1,12 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Screens.Select;
|
||||
using osuTK;
|
||||
|
||||
@ -12,14 +16,145 @@ namespace osu.Game.Tests.Visual
|
||||
[System.ComponentModel.Description("PlaySongSelect leaderboard/details area")]
|
||||
public class TestCaseBeatmapDetailArea : OsuTestCase
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(BeatmapDetails) };
|
||||
|
||||
public TestCaseBeatmapDetailArea()
|
||||
{
|
||||
Add(new BeatmapDetailArea
|
||||
BeatmapDetailArea detailsArea;
|
||||
Add(detailsArea = new BeatmapDetailArea
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(550f, 450f),
|
||||
});
|
||||
|
||||
AddStep("all metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Version = "All Metrics",
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Source = "osu!lazer",
|
||||
Tags = "this beatmap has all the metrics",
|
||||
},
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 7,
|
||||
DrainRate = 1,
|
||||
OverallDifficulty = 5.7f,
|
||||
ApproachRate = 3.5f,
|
||||
},
|
||||
StarDifficulty = 5.3f,
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
},
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
AddStep("all except source", () => detailsArea.Beatmap = new DummyWorkingBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Version = "All Metrics",
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Tags = "this beatmap has all the metrics",
|
||||
},
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 7,
|
||||
DrainRate = 1,
|
||||
OverallDifficulty = 5.7f,
|
||||
ApproachRate = 3.5f,
|
||||
},
|
||||
StarDifficulty = 5.3f,
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
AddStep("ratings", () => detailsArea.Beatmap = new DummyWorkingBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Version = "Only Ratings",
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Source = "osu!lazer",
|
||||
Tags = "this beatmap has ratings metrics but not retries or fails",
|
||||
},
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 6,
|
||||
DrainRate = 9,
|
||||
OverallDifficulty = 6,
|
||||
ApproachRate = 6,
|
||||
},
|
||||
StarDifficulty = 4.8f,
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = Enumerable.Range(0, 11),
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
AddStep("fails+retries", () => detailsArea.Beatmap = new DummyWorkingBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Version = "Only Retries and Fails",
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Source = "osu!lazer",
|
||||
Tags = "this beatmap has retries and fails but no ratings",
|
||||
},
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 3.7f,
|
||||
DrainRate = 6,
|
||||
OverallDifficulty = 6,
|
||||
ApproachRate = 7,
|
||||
},
|
||||
StarDifficulty = 2.91f,
|
||||
Metrics = new BeatmapMetrics
|
||||
{
|
||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
AddStep("null metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Version = "No Metrics",
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Source = "osu!lazer",
|
||||
Tags = "this beatmap has no metrics",
|
||||
},
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 5,
|
||||
DrainRate = 5,
|
||||
OverallDifficulty = 5.5f,
|
||||
ApproachRate = 6.5f,
|
||||
},
|
||||
StarDifficulty = 1.97f,
|
||||
}
|
||||
});
|
||||
|
||||
AddStep("null beatmap", () => detailsArea.Beatmap = null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,11 +102,14 @@ namespace osu.Game.Beatmaps
|
||||
b.BeatmapSet = beatmapSet;
|
||||
}
|
||||
|
||||
validateOnlineIds(beatmapSet.Beatmaps);
|
||||
validateOnlineIds(beatmapSet);
|
||||
|
||||
foreach (BeatmapInfo b in beatmapSet.Beatmaps)
|
||||
fetchAndPopulateOnlineValues(b, beatmapSet.Beatmaps);
|
||||
}
|
||||
|
||||
protected override void PreImport(BeatmapSetInfo beatmapSet)
|
||||
{
|
||||
// check if a set already exists with the same online id, delete if it does.
|
||||
if (beatmapSet.OnlineBeatmapSetID != null)
|
||||
{
|
||||
@ -120,14 +123,30 @@ namespace osu.Game.Beatmaps
|
||||
}
|
||||
}
|
||||
|
||||
private void validateOnlineIds(List<BeatmapInfo> beatmaps)
|
||||
private void validateOnlineIds(BeatmapSetInfo beatmapSet)
|
||||
{
|
||||
var beatmapIds = beatmaps.Where(b => b.OnlineBeatmapID.HasValue).Select(b => b.OnlineBeatmapID).ToList();
|
||||
var beatmapIds = beatmapSet.Beatmaps.Where(b => b.OnlineBeatmapID.HasValue).Select(b => b.OnlineBeatmapID).ToList();
|
||||
|
||||
// ensure all IDs are unique in this set and none match existing IDs in the local beatmap store.
|
||||
if (beatmapIds.GroupBy(b => b).Any(g => g.Count() > 1) || QueryBeatmaps(b => beatmapIds.Contains(b.OnlineBeatmapID)).Any())
|
||||
// remove all online IDs if any problems were found.
|
||||
beatmaps.ForEach(b => b.OnlineBeatmapID = null);
|
||||
// ensure all IDs are unique
|
||||
if (beatmapIds.GroupBy(b => b).Any(g => g.Count() > 1))
|
||||
{
|
||||
resetIds();
|
||||
return;
|
||||
}
|
||||
|
||||
// find any existing beatmaps in the database that have matching online ids
|
||||
var existingBeatmaps = QueryBeatmaps(b => beatmapIds.Contains(b.OnlineBeatmapID)).ToList();
|
||||
|
||||
if (existingBeatmaps.Count > 0)
|
||||
{
|
||||
// reset the import ids (to force a re-fetch) *unless* they match the candidate CheckForExisting set.
|
||||
// we can ignore the case where the new ids are contained by the CheckForExisting set as it will either be used (import skipped) or deleted.
|
||||
var existing = CheckForExisting(beatmapSet);
|
||||
if (existing == null || existingBeatmaps.Any(b => !existing.Beatmaps.Contains(b)))
|
||||
resetIds();
|
||||
}
|
||||
|
||||
void resetIds() => beatmapSet.Beatmaps.ForEach(b => b.OnlineBeatmapID = null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -254,6 +273,18 @@ namespace osu.Game.Beatmaps
|
||||
/// <returns>The first result for the provided query, or null if no results were found.</returns>
|
||||
public BeatmapSetInfo QueryBeatmapSet(Expression<Func<BeatmapSetInfo, bool>> query) => beatmaps.ConsumableItems.AsNoTracking().FirstOrDefault(query);
|
||||
|
||||
protected override bool CanUndelete(BeatmapSetInfo existing, BeatmapSetInfo import)
|
||||
{
|
||||
if (!base.CanUndelete(existing, import))
|
||||
return false;
|
||||
|
||||
var existingIds = existing.Beatmaps.Select(b => b.OnlineBeatmapID).OrderBy(i => i);
|
||||
var importIds = import.Beatmaps.Select(b => b.OnlineBeatmapID).OrderBy(i => i);
|
||||
|
||||
// force re-import if we are not in a sane state.
|
||||
return existing.OnlineBeatmapSetID == import.OnlineBeatmapSetID && existingIds.SequenceEqual(importIds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of all usable <see cref="BeatmapSetInfo"/>s.
|
||||
/// </summary>
|
||||
|
@ -45,24 +45,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
protected override Drawable CreateDrawable(BeatmapInfo model)
|
||||
{
|
||||
Drawable drawable;
|
||||
|
||||
var localBeatmap = beatmaps.GetWorkingBeatmap(model);
|
||||
|
||||
if (model?.BeatmapSet?.OnlineInfo != null)
|
||||
{
|
||||
drawable = new BeatmapSetCover(model.BeatmapSet, beatmapSetCoverType);
|
||||
}
|
||||
else if (localBeatmap.BeatmapInfo.ID != 0)
|
||||
{
|
||||
// Fall back to local background if one exists
|
||||
drawable = new BeatmapBackgroundSprite(localBeatmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the default background if somehow an online set does not exist and we don't have a local copy.
|
||||
drawable = new BeatmapBackgroundSprite(beatmaps.DefaultBeatmap);
|
||||
}
|
||||
Drawable drawable = getDrawableForModel(model);
|
||||
|
||||
drawable.RelativeSizeAxes = Axes.Both;
|
||||
drawable.Anchor = Anchor.Centre;
|
||||
@ -72,5 +55,16 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
return drawable;
|
||||
}
|
||||
|
||||
private Drawable getDrawableForModel(BeatmapInfo model)
|
||||
{
|
||||
// prefer online cover where available.
|
||||
if (model?.BeatmapSet?.OnlineInfo != null)
|
||||
return new BeatmapSetCover(model.BeatmapSet, beatmapSetCoverType);
|
||||
|
||||
return model?.ID > 0
|
||||
? new BeatmapBackgroundSprite(beatmaps.GetWorkingBeatmap(model))
|
||||
: new BeatmapBackgroundSprite(beatmaps.DefaultBeatmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,12 @@ namespace osu.Game.Beatmaps
|
||||
Title = "no beatmaps available!"
|
||||
},
|
||||
BeatmapSet = new BeatmapSetInfo(),
|
||||
BaseDifficulty = new BeatmapDifficulty(),
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
DrainRate = 0,
|
||||
CircleSize = 0,
|
||||
OverallDifficulty = 0,
|
||||
},
|
||||
Ruleset = new DummyRulesetInfo()
|
||||
})
|
||||
{
|
||||
|
@ -2,10 +2,10 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using osu.Framework.IO.File;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using osu.Game.Rulesets.Objects.Legacy;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
@ -25,7 +25,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
public static void Register()
|
||||
{
|
||||
AddDecoder<Beatmap>(@"osu file format v", m => new LegacyBeatmapDecoder(int.Parse(m.Split('v').Last())));
|
||||
AddDecoder<Beatmap>(@"osu file format v", m => new LegacyBeatmapDecoder(Parsing.ParseInt(m.Split('v').Last())));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -104,25 +104,25 @@ namespace osu.Game.Beatmaps.Formats
|
||||
metadata.AudioFile = FileSafety.PathStandardise(pair.Value);
|
||||
break;
|
||||
case @"AudioLeadIn":
|
||||
beatmap.BeatmapInfo.AudioLeadIn = int.Parse(pair.Value);
|
||||
beatmap.BeatmapInfo.AudioLeadIn = Parsing.ParseInt(pair.Value);
|
||||
break;
|
||||
case @"PreviewTime":
|
||||
metadata.PreviewTime = getOffsetTime(int.Parse(pair.Value));
|
||||
metadata.PreviewTime = getOffsetTime(Parsing.ParseInt(pair.Value));
|
||||
break;
|
||||
case @"Countdown":
|
||||
beatmap.BeatmapInfo.Countdown = int.Parse(pair.Value) == 1;
|
||||
beatmap.BeatmapInfo.Countdown = Parsing.ParseInt(pair.Value) == 1;
|
||||
break;
|
||||
case @"SampleSet":
|
||||
defaultSampleBank = (LegacySampleBank)Enum.Parse(typeof(LegacySampleBank), pair.Value);
|
||||
break;
|
||||
case @"SampleVolume":
|
||||
defaultSampleVolume = int.Parse(pair.Value);
|
||||
defaultSampleVolume = Parsing.ParseInt(pair.Value);
|
||||
break;
|
||||
case @"StackLeniency":
|
||||
beatmap.BeatmapInfo.StackLeniency = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
||||
beatmap.BeatmapInfo.StackLeniency = Parsing.ParseFloat(pair.Value);
|
||||
break;
|
||||
case @"Mode":
|
||||
beatmap.BeatmapInfo.RulesetID = int.Parse(pair.Value);
|
||||
beatmap.BeatmapInfo.RulesetID = Parsing.ParseInt(pair.Value);
|
||||
|
||||
switch (beatmap.BeatmapInfo.RulesetID)
|
||||
{
|
||||
@ -142,13 +142,13 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
break;
|
||||
case @"LetterboxInBreaks":
|
||||
beatmap.BeatmapInfo.LetterboxInBreaks = int.Parse(pair.Value) == 1;
|
||||
beatmap.BeatmapInfo.LetterboxInBreaks = Parsing.ParseInt(pair.Value) == 1;
|
||||
break;
|
||||
case @"SpecialStyle":
|
||||
beatmap.BeatmapInfo.SpecialStyle = int.Parse(pair.Value) == 1;
|
||||
beatmap.BeatmapInfo.SpecialStyle = Parsing.ParseInt(pair.Value) == 1;
|
||||
break;
|
||||
case @"WidescreenStoryboard":
|
||||
beatmap.BeatmapInfo.WidescreenStoryboard = int.Parse(pair.Value) == 1;
|
||||
beatmap.BeatmapInfo.WidescreenStoryboard = Parsing.ParseInt(pair.Value) == 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -163,16 +163,16 @@ namespace osu.Game.Beatmaps.Formats
|
||||
beatmap.BeatmapInfo.StoredBookmarks = pair.Value;
|
||||
break;
|
||||
case @"DistanceSpacing":
|
||||
beatmap.BeatmapInfo.DistanceSpacing = double.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
||||
beatmap.BeatmapInfo.DistanceSpacing = Math.Max(0, Parsing.ParseDouble(pair.Value));
|
||||
break;
|
||||
case @"BeatDivisor":
|
||||
beatmap.BeatmapInfo.BeatDivisor = int.Parse(pair.Value);
|
||||
beatmap.BeatmapInfo.BeatDivisor = Parsing.ParseInt(pair.Value);
|
||||
break;
|
||||
case @"GridSize":
|
||||
beatmap.BeatmapInfo.GridSize = int.Parse(pair.Value);
|
||||
beatmap.BeatmapInfo.GridSize = Parsing.ParseInt(pair.Value);
|
||||
break;
|
||||
case @"TimelineZoom":
|
||||
beatmap.BeatmapInfo.TimelineZoom = double.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
||||
beatmap.BeatmapInfo.TimelineZoom = Math.Max(0, Parsing.ParseDouble(pair.Value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -209,10 +209,10 @@ namespace osu.Game.Beatmaps.Formats
|
||||
beatmap.BeatmapInfo.Metadata.Tags = pair.Value;
|
||||
break;
|
||||
case @"BeatmapID":
|
||||
beatmap.BeatmapInfo.OnlineBeatmapID = int.Parse(pair.Value);
|
||||
beatmap.BeatmapInfo.OnlineBeatmapID = Parsing.ParseInt(pair.Value);
|
||||
break;
|
||||
case @"BeatmapSetID":
|
||||
beatmap.BeatmapInfo.BeatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = int.Parse(pair.Value) };
|
||||
beatmap.BeatmapInfo.BeatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = Parsing.ParseInt(pair.Value) };
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -225,22 +225,22 @@ namespace osu.Game.Beatmaps.Formats
|
||||
switch (pair.Key)
|
||||
{
|
||||
case @"HPDrainRate":
|
||||
difficulty.DrainRate = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
||||
difficulty.DrainRate = Parsing.ParseFloat(pair.Value);
|
||||
break;
|
||||
case @"CircleSize":
|
||||
difficulty.CircleSize = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
||||
difficulty.CircleSize = Parsing.ParseFloat(pair.Value);
|
||||
break;
|
||||
case @"OverallDifficulty":
|
||||
difficulty.OverallDifficulty = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
||||
difficulty.OverallDifficulty = Parsing.ParseFloat(pair.Value);
|
||||
break;
|
||||
case @"ApproachRate":
|
||||
difficulty.ApproachRate = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
||||
difficulty.ApproachRate = Parsing.ParseFloat(pair.Value);
|
||||
break;
|
||||
case @"SliderMultiplier":
|
||||
difficulty.SliderMultiplier = double.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
||||
difficulty.SliderMultiplier = Parsing.ParseDouble(pair.Value);
|
||||
break;
|
||||
case @"SliderTickRate":
|
||||
difficulty.SliderTickRate = double.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
||||
difficulty.SliderTickRate = Parsing.ParseDouble(pair.Value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -260,10 +260,12 @@ namespace osu.Game.Beatmaps.Formats
|
||||
beatmap.BeatmapInfo.Metadata.BackgroundFile = FileSafety.PathStandardise(filename);
|
||||
break;
|
||||
case EventType.Break:
|
||||
double start = getOffsetTime(Parsing.ParseDouble(split[1]));
|
||||
|
||||
var breakEvent = new BreakPeriod
|
||||
{
|
||||
StartTime = getOffsetTime(double.Parse(split[1], NumberFormatInfo.InvariantInfo)),
|
||||
EndTime = getOffsetTime(double.Parse(split[2], NumberFormatInfo.InvariantInfo))
|
||||
StartTime = start,
|
||||
EndTime = Math.Max(start, getOffsetTime(Parsing.ParseDouble(split[2])))
|
||||
};
|
||||
|
||||
if (!breakEvent.HasEffect)
|
||||
@ -280,25 +282,25 @@ namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
string[] split = line.Split(',');
|
||||
|
||||
double time = getOffsetTime(double.Parse(split[0].Trim(), NumberFormatInfo.InvariantInfo));
|
||||
double beatLength = double.Parse(split[1].Trim(), NumberFormatInfo.InvariantInfo);
|
||||
double time = getOffsetTime(Parsing.ParseDouble(split[0].Trim()));
|
||||
double beatLength = Parsing.ParseDouble(split[1].Trim());
|
||||
double speedMultiplier = beatLength < 0 ? 100.0 / -beatLength : 1;
|
||||
|
||||
TimeSignatures timeSignature = TimeSignatures.SimpleQuadruple;
|
||||
if (split.Length >= 3)
|
||||
timeSignature = split[2][0] == '0' ? TimeSignatures.SimpleQuadruple : (TimeSignatures)int.Parse(split[2]);
|
||||
timeSignature = split[2][0] == '0' ? TimeSignatures.SimpleQuadruple : (TimeSignatures)Parsing.ParseInt(split[2]);
|
||||
|
||||
LegacySampleBank sampleSet = defaultSampleBank;
|
||||
if (split.Length >= 4)
|
||||
sampleSet = (LegacySampleBank)int.Parse(split[3]);
|
||||
sampleSet = (LegacySampleBank)Parsing.ParseInt(split[3]);
|
||||
|
||||
int customSampleBank = 0;
|
||||
if (split.Length >= 5)
|
||||
customSampleBank = int.Parse(split[4]);
|
||||
customSampleBank = Parsing.ParseInt(split[4]);
|
||||
|
||||
int sampleVolume = defaultSampleVolume;
|
||||
if (split.Length >= 6)
|
||||
sampleVolume = int.Parse(split[5]);
|
||||
sampleVolume = Parsing.ParseInt(split[5]);
|
||||
|
||||
bool timingChange = true;
|
||||
if (split.Length >= 7)
|
||||
@ -308,7 +310,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
bool omitFirstBarSignature = false;
|
||||
if (split.Length >= 8)
|
||||
{
|
||||
EffectFlags effectFlags = (EffectFlags)int.Parse(split[7]);
|
||||
EffectFlags effectFlags = (EffectFlags)Parsing.ParseInt(split[7]);
|
||||
kiaiMode = effectFlags.HasFlag(EffectFlags.Kiai);
|
||||
omitFirstBarSignature = effectFlags.HasFlag(EffectFlags.OmitFirstBarLine);
|
||||
}
|
||||
@ -348,8 +350,13 @@ namespace osu.Game.Beatmaps.Formats
|
||||
CustomSampleBank = customSampleBank
|
||||
});
|
||||
}
|
||||
catch (FormatException e)
|
||||
catch (FormatException)
|
||||
{
|
||||
Logger.Log("A timing point could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
|
||||
}
|
||||
catch (OverflowException)
|
||||
{
|
||||
Logger.Log("A timing point could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
|
||||
}
|
||||
}
|
||||
|
||||
|
52
osu.Game/Beatmaps/Formats/Parsing.cs
Normal file
52
osu.Game/Beatmaps/Formats/Parsing.cs
Normal file
@ -0,0 +1,52 @@
|
||||
// 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.Globalization;
|
||||
|
||||
namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper methods to parse from string to number and perform very basic validation.
|
||||
/// </summary>
|
||||
public static class Parsing
|
||||
{
|
||||
public const int MAX_COORDINATE_VALUE = 65536;
|
||||
|
||||
public const double MAX_PARSE_VALUE = int.MaxValue;
|
||||
|
||||
public static float ParseFloat(string input, float parseLimit = (float)MAX_PARSE_VALUE)
|
||||
{
|
||||
var output = float.Parse(input, CultureInfo.InvariantCulture);
|
||||
|
||||
if (output < -parseLimit) throw new OverflowException("Value is too low");
|
||||
if (output > parseLimit) throw new OverflowException("Value is too high");
|
||||
|
||||
if (float.IsNaN(output)) throw new FormatException("Not a number");
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public static double ParseDouble(string input, double parseLimit = MAX_PARSE_VALUE)
|
||||
{
|
||||
var output = double.Parse(input, CultureInfo.InvariantCulture);
|
||||
|
||||
if (output < -parseLimit) throw new OverflowException("Value is too low");
|
||||
if (output > parseLimit) throw new OverflowException("Value is too high");
|
||||
|
||||
if (double.IsNaN(output)) throw new FormatException("Not a number");
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public static int ParseInt(string input, int parseLimit = (int)MAX_PARSE_VALUE)
|
||||
{
|
||||
var output = int.Parse(input, CultureInfo.InvariantCulture);
|
||||
|
||||
if (output < -parseLimit) throw new OverflowException("Value is too low");
|
||||
if (output > parseLimit) throw new OverflowException("Value is too high");
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
@ -300,21 +300,31 @@ namespace osu.Game.Database
|
||||
{
|
||||
if (!write.IsTransactionLeader) throw new InvalidOperationException($"Ensure there is no parent transaction so errors can correctly be handled by {this}");
|
||||
|
||||
var existing = CheckForExisting(item);
|
||||
|
||||
if (existing != null)
|
||||
{
|
||||
Undelete(existing);
|
||||
Logger.Log($"Found existing {typeof(TModel)} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database);
|
||||
handleEvent(() => ItemAdded?.Invoke(existing, true));
|
||||
return existing;
|
||||
}
|
||||
|
||||
if (archive != null)
|
||||
item.Files = createFileInfos(archive, Files);
|
||||
|
||||
Populate(item, archive);
|
||||
|
||||
var existing = CheckForExisting(item);
|
||||
|
||||
if (existing != null)
|
||||
{
|
||||
if (CanUndelete(existing, item))
|
||||
{
|
||||
Undelete(existing);
|
||||
Logger.Log($"Found existing {typeof(TModel)} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database);
|
||||
handleEvent(() => ItemAdded?.Invoke(existing, true));
|
||||
return existing;
|
||||
}
|
||||
else
|
||||
{
|
||||
Delete(existing);
|
||||
ModelStore.PurgeDeletable(s => s.ID == existing.ID);
|
||||
}
|
||||
}
|
||||
|
||||
PreImport(item);
|
||||
|
||||
// import to store
|
||||
ModelStore.Add(item);
|
||||
}
|
||||
@ -542,12 +552,29 @@ namespace osu.Game.Database
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform any final actions before the import to database executes.
|
||||
/// </summary>
|
||||
/// <param name="model">The model prepared for import.</param>
|
||||
protected virtual void PreImport(TModel model)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check whether an existing model already exists for a new import item.
|
||||
/// </summary>
|
||||
/// <param name="model">The new model proposed for import. Note that <see cref="Populate"/> has not yet been run on this model.</param>
|
||||
/// <param name="model">The new model proposed for import.
|
||||
/// <returns>An existing model which matches the criteria to skip importing, else null.</returns>
|
||||
protected virtual TModel CheckForExisting(TModel model) => model.Hash == null ? null : ModelStore.ConsumableItems.FirstOrDefault(b => b.Hash == model.Hash);
|
||||
protected TModel CheckForExisting(TModel model) => model.Hash == null ? null : ModelStore.ConsumableItems.FirstOrDefault(b => b.Hash == model.Hash);
|
||||
|
||||
/// <summary>
|
||||
/// After an existing <see cref="TModel"/> is found during an import process, the default behaviour is to restore the existing
|
||||
/// item and skip the import. This method allows changing that behaviour.
|
||||
/// </summary>
|
||||
/// <param name="existing">The existing model.</param>
|
||||
/// <param name="import">The newly imported model.</param>
|
||||
/// <returns>Whether the existing model should be restored and used. Returning false will delete the existing a force a re-import.</returns>
|
||||
protected virtual bool CanUndelete(TModel existing, TModel import) => true;
|
||||
|
||||
private DbSet<TModel> queryModel() => ContextFactory.Get().Set<TModel>();
|
||||
|
||||
|
@ -13,7 +13,6 @@ namespace osu.Game.Migrations
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -320,6 +320,8 @@ namespace osu.Game.Overlays
|
||||
this.MoveToY(Height, transition_length, Easing.InSine);
|
||||
this.FadeOut(transition_length, Easing.InSine);
|
||||
|
||||
channelSelectionOverlay.State = Visibility.Hidden;
|
||||
|
||||
textbox.HoldFocus = false;
|
||||
base.PopOut();
|
||||
}
|
||||
|
@ -185,10 +185,7 @@ namespace osu.Game.Overlays.Direct
|
||||
Margin = new MarginPadding { Top = vertical_padding, Right = vertical_padding },
|
||||
Children = new[]
|
||||
{
|
||||
new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0)
|
||||
{
|
||||
Margin = new MarginPadding { Right = 1 },
|
||||
},
|
||||
new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0),
|
||||
new Statistic(FontAwesome.fa_heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0),
|
||||
},
|
||||
},
|
||||
|
@ -160,10 +160,7 @@ namespace osu.Game.Overlays.Direct
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0)
|
||||
{
|
||||
Margin = new MarginPadding { Right = 1 },
|
||||
},
|
||||
new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0),
|
||||
new Statistic(FontAwesome.fa_heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0),
|
||||
new FillFlowContainer
|
||||
{
|
||||
|
@ -134,9 +134,9 @@ namespace osu.Game.Overlays
|
||||
Filter.Tabs.Current.Value = DirectSortCriteria.Ranked;
|
||||
}
|
||||
};
|
||||
((FilterControl)Filter).Ruleset.ValueChanged += _ => Scheduler.AddOnce(updateSearch);
|
||||
((FilterControl)Filter).Ruleset.ValueChanged += _ => queueUpdateSearch();
|
||||
Filter.DisplayStyleControl.DisplayStyle.ValueChanged += style => recreatePanels(style.NewValue);
|
||||
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch);
|
||||
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => queueUpdateSearch();
|
||||
|
||||
Header.Tabs.Current.ValueChanged += tab =>
|
||||
{
|
||||
@ -144,24 +144,11 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
currentQuery.Value = string.Empty;
|
||||
Filter.Tabs.Current.Value = (DirectSortCriteria)Header.Tabs.Current.Value;
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
queueUpdateSearch();
|
||||
}
|
||||
};
|
||||
|
||||
currentQuery.ValueChanged += text =>
|
||||
{
|
||||
queryChangedDebounce?.Cancel();
|
||||
|
||||
if (string.IsNullOrEmpty(text.NewValue))
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
else
|
||||
{
|
||||
BeatmapSets = null;
|
||||
ResultAmounts = null;
|
||||
|
||||
queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500);
|
||||
}
|
||||
};
|
||||
currentQuery.ValueChanged += text => queueUpdateSearch(!string.IsNullOrEmpty(text.NewValue));
|
||||
|
||||
currentQuery.BindTo(Filter.Search.Current);
|
||||
|
||||
@ -170,7 +157,7 @@ namespace osu.Game.Overlays
|
||||
if (Header.Tabs.Current.Value != DirectTab.Search && tab.NewValue != (DirectSortCriteria)Header.Tabs.Current.Value)
|
||||
Header.Tabs.Current.Value = DirectTab.Search;
|
||||
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
queueUpdateSearch();
|
||||
};
|
||||
|
||||
updateResultCounts();
|
||||
@ -242,37 +229,42 @@ namespace osu.Game.Overlays
|
||||
|
||||
// Queries are allowed to be run only on the first pop-in
|
||||
if (getSetsRequest == null)
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
queueUpdateSearch();
|
||||
}
|
||||
|
||||
private SearchBeatmapSetsRequest getSetsRequest;
|
||||
|
||||
private readonly Bindable<string> currentQuery = new Bindable<string>();
|
||||
private readonly Bindable<string> currentQuery = new Bindable<string>(string.Empty);
|
||||
|
||||
private ScheduledDelegate queryChangedDebounce;
|
||||
private PreviewTrackManager previewTrackManager;
|
||||
|
||||
private void queueUpdateSearch(bool queryTextChanged = false)
|
||||
{
|
||||
BeatmapSets = null;
|
||||
ResultAmounts = null;
|
||||
|
||||
getSetsRequest?.Cancel();
|
||||
|
||||
queryChangedDebounce?.Cancel();
|
||||
queryChangedDebounce = Scheduler.AddDelayed(updateSearch, queryTextChanged ? 500 : 100);
|
||||
}
|
||||
|
||||
private void updateSearch()
|
||||
{
|
||||
queryChangedDebounce?.Cancel();
|
||||
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
if (State == Visibility.Hidden)
|
||||
return;
|
||||
|
||||
BeatmapSets = null;
|
||||
ResultAmounts = null;
|
||||
|
||||
getSetsRequest?.Cancel();
|
||||
|
||||
if (api == null)
|
||||
return;
|
||||
|
||||
previewTrackManager.StopAnyPlaying(this);
|
||||
|
||||
getSetsRequest = new SearchBeatmapSetsRequest(currentQuery.Value ?? string.Empty,
|
||||
getSetsRequest = new SearchBeatmapSetsRequest(
|
||||
currentQuery.Value,
|
||||
((FilterControl)Filter).Ruleset.Value,
|
||||
Filter.DisplayStyleControl.Dropdown.Current.Value,
|
||||
Filter.Tabs.Current.Value); //todo: sort direction (?)
|
||||
|
@ -32,6 +32,12 @@ namespace osu.Game.Rulesets.Judgements
|
||||
protected Container JudgementBody;
|
||||
protected SpriteText JudgementText;
|
||||
|
||||
/// <summary>
|
||||
/// Duration of initial fade in.
|
||||
/// Default fade out will start immediately after this duration.
|
||||
/// </summary>
|
||||
protected virtual double FadeInDuration => 100;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a drawable which visualises a <see cref="Judgements.Judgement"/>.
|
||||
/// </summary>
|
||||
@ -65,11 +71,19 @@ namespace osu.Game.Rulesets.Judgements
|
||||
};
|
||||
}
|
||||
|
||||
protected virtual void ApplyHitAnimations()
|
||||
{
|
||||
JudgementBody.ScaleTo(0.9f);
|
||||
JudgementBody.ScaleTo(1, 500, Easing.OutElastic);
|
||||
|
||||
this.Delay(FadeInDuration).FadeOut(400);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
this.FadeInFromZero(100, Easing.OutQuint);
|
||||
this.FadeInFromZero(FadeInDuration, Easing.OutQuint);
|
||||
|
||||
switch (Result.Type)
|
||||
{
|
||||
@ -85,10 +99,7 @@ namespace osu.Game.Rulesets.Judgements
|
||||
this.Delay(600).FadeOut(200);
|
||||
break;
|
||||
default:
|
||||
JudgementBody.ScaleTo(0.9f);
|
||||
JudgementBody.ScaleTo(1, 500, Easing.OutElastic);
|
||||
|
||||
this.Delay(100).FadeOut(400);
|
||||
ApplyHitAnimations();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override void ApplyToClock(IAdjustableClock clock)
|
||||
{
|
||||
if (clock is IHasPitchAdjust pitchAdjust)
|
||||
pitchAdjust.PitchAdjust = 0.75;
|
||||
pitchAdjust.PitchAdjust *= RateAdjust;
|
||||
else
|
||||
base.ApplyToClock(clock);
|
||||
}
|
||||
|
@ -2,12 +2,12 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Timing;
|
||||
using System.Linq;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public abstract class ModDoubleTime : Mod, IApplicableToClock
|
||||
public abstract class ModDoubleTime : ModTimeAdjust, IApplicableToClock
|
||||
{
|
||||
public override string Name => "Double Time";
|
||||
public override string Acronym => "DT";
|
||||
@ -15,11 +15,9 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override string Description => "Zoooooooooom...";
|
||||
public override bool Ranked => true;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime), typeof(ModTimeRamp) };
|
||||
|
||||
public virtual void ApplyToClock(IAdjustableClock clock)
|
||||
{
|
||||
clock.Rate = 1.5;
|
||||
}
|
||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModHalfTime)).ToArray();
|
||||
|
||||
protected override double RateAdjust => 1.5;
|
||||
}
|
||||
}
|
||||
|
@ -2,12 +2,12 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Timing;
|
||||
using System.Linq;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public abstract class ModHalfTime : Mod, IApplicableToClock
|
||||
public abstract class ModHalfTime : ModTimeAdjust, IApplicableToClock
|
||||
{
|
||||
public override string Name => "Half Time";
|
||||
public override string Acronym => "HT";
|
||||
@ -15,11 +15,9 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override ModType Type => ModType.DifficultyReduction;
|
||||
public override string Description => "Less zoom...";
|
||||
public override bool Ranked => true;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModTimeRamp) };
|
||||
|
||||
public virtual void ApplyToClock(IAdjustableClock clock)
|
||||
{
|
||||
clock.Rate = 0.75;
|
||||
}
|
||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModDoubleTime)).ToArray();
|
||||
|
||||
protected override double RateAdjust => 0.75;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override void ApplyToClock(IAdjustableClock clock)
|
||||
{
|
||||
if (clock is IHasPitchAdjust pitchAdjust)
|
||||
pitchAdjust.PitchAdjust = 1.5;
|
||||
pitchAdjust.PitchAdjust *= RateAdjust;
|
||||
else
|
||||
base.ApplyToClock(clock);
|
||||
}
|
||||
|
24
osu.Game/Rulesets/Mods/ModTimeAdjust.cs
Normal file
24
osu.Game/Rulesets/Mods/ModTimeAdjust.cs
Normal file
@ -0,0 +1,24 @@
|
||||
// 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.Audio;
|
||||
using osu.Framework.Timing;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public abstract class ModTimeAdjust : Mod
|
||||
{
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModTimeRamp) };
|
||||
|
||||
protected abstract double RateAdjust { get; }
|
||||
|
||||
public virtual void ApplyToClock(IAdjustableClock clock)
|
||||
{
|
||||
if (clock is IHasTempoAdjust tempo)
|
||||
tempo.TempoAdjust *= RateAdjust;
|
||||
else
|
||||
clock.Rate *= RateAdjust;
|
||||
}
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public abstract class ModTimeRamp : Mod
|
||||
{
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModHalfTime) };
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModTimeAdjust) };
|
||||
|
||||
protected abstract double FinalRateAdjustment { get; }
|
||||
}
|
||||
@ -29,8 +29,6 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
private IAdjustableClock clock;
|
||||
|
||||
private IHasPitchAdjust pitchAdjust;
|
||||
|
||||
/// <summary>
|
||||
/// The point in the beatmap at which the final ramping rate should be reached.
|
||||
/// </summary>
|
||||
@ -39,10 +37,11 @@ namespace osu.Game.Rulesets.Mods
|
||||
public virtual void ApplyToClock(IAdjustableClock clock)
|
||||
{
|
||||
this.clock = clock;
|
||||
pitchAdjust = (IHasPitchAdjust)clock;
|
||||
|
||||
// for preview purposes
|
||||
pitchAdjust.PitchAdjust = 1.0 + FinalRateAdjustment;
|
||||
lastAdjust = 1;
|
||||
|
||||
// for preview purposes. during gameplay, Update will overwrite this setting.
|
||||
applyAdjustment(1);
|
||||
}
|
||||
|
||||
public virtual void ApplyToBeatmap(Beatmap<T> beatmap)
|
||||
@ -55,10 +54,36 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
public virtual void Update(Playfield playfield)
|
||||
{
|
||||
var absRate = Math.Abs(FinalRateAdjustment);
|
||||
var adjustment = MathHelper.Clamp(absRate * ((clock.CurrentTime - beginRampTime) / finalRateTime), 0, absRate);
|
||||
applyAdjustment((clock.CurrentTime - beginRampTime) / finalRateTime);
|
||||
}
|
||||
|
||||
pitchAdjust.PitchAdjust = 1 + Math.Sign(FinalRateAdjustment) * adjustment;
|
||||
private double lastAdjust = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Adjust the rate along the specified ramp
|
||||
/// </summary>
|
||||
/// <param name="amount">The amount of adjustment to apply (from 0..1).</param>
|
||||
private void applyAdjustment(double amount)
|
||||
{
|
||||
double adjust = 1 + (Math.Sign(FinalRateAdjustment) * MathHelper.Clamp(amount, 0, 1) * Math.Abs(FinalRateAdjustment));
|
||||
|
||||
switch (clock)
|
||||
{
|
||||
case IHasPitchAdjust pitch:
|
||||
pitch.PitchAdjust /= lastAdjust;
|
||||
pitch.PitchAdjust *= adjust;
|
||||
break;
|
||||
case IHasTempoAdjust tempo:
|
||||
tempo.TempoAdjust /= lastAdjust;
|
||||
tempo.TempoAdjust *= adjust;
|
||||
break;
|
||||
default:
|
||||
clock.Rate /= lastAdjust;
|
||||
clock.Rate *= adjust;
|
||||
break;
|
||||
}
|
||||
|
||||
lastAdjust = adjust;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
@ -14,6 +16,9 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override string Description => "Sloooow doooown...";
|
||||
public override FontAwesome Icon => FontAwesome.fa_chevron_circle_down;
|
||||
public override double ScoreMultiplier => 1.0;
|
||||
|
||||
protected override double FinalRateAdjustment => -0.25;
|
||||
|
||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindUp<T>)).ToArray();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
@ -14,6 +16,9 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override string Description => "Can you keep up?";
|
||||
public override FontAwesome Icon => FontAwesome.fa_chevron_circle_up;
|
||||
public override double ScoreMultiplier => 1.0;
|
||||
|
||||
protected override double FinalRateAdjustment => 0.5;
|
||||
|
||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindDown<T>)).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ using osuTK;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Audio;
|
||||
@ -46,9 +45,11 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
{
|
||||
string[] split = text.Split(',');
|
||||
|
||||
Vector2 pos = new Vector2((int)Convert.ToSingle(split[0], CultureInfo.InvariantCulture), (int)Convert.ToSingle(split[1], CultureInfo.InvariantCulture));
|
||||
Vector2 pos = new Vector2((int)Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE));
|
||||
|
||||
ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]);
|
||||
double startTime = Parsing.ParseDouble(split[2]) + Offset;
|
||||
|
||||
ConvertHitObjectType type = (ConvertHitObjectType)Parsing.ParseInt(split[3]);
|
||||
|
||||
int comboOffset = (int)(type & ConvertHitObjectType.ComboOffset) >> 4;
|
||||
type &= ~ConvertHitObjectType.ComboOffset;
|
||||
@ -56,7 +57,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
bool combo = type.HasFlag(ConvertHitObjectType.NewCombo);
|
||||
type &= ~ConvertHitObjectType.NewCombo;
|
||||
|
||||
var soundType = (LegacySoundType)int.Parse(split[4]);
|
||||
var soundType = (LegacySoundType)Parsing.ParseInt(split[4]);
|
||||
var bankInfo = new SampleBankInfo();
|
||||
|
||||
HitObject result = null;
|
||||
@ -107,7 +108,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
}
|
||||
|
||||
string[] temp = t.Split(':');
|
||||
points[pointIndex++] = new Vector2((int)Convert.ToDouble(temp[0], CultureInfo.InvariantCulture), (int)Convert.ToDouble(temp[1], CultureInfo.InvariantCulture)) - pos;
|
||||
points[pointIndex++] = new Vector2((int)Parsing.ParseDouble(temp[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseDouble(temp[1], Parsing.MAX_COORDINATE_VALUE)) - pos;
|
||||
}
|
||||
|
||||
// osu-stable special-cased colinear perfect curves to a CurveType.Linear
|
||||
@ -116,7 +117,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
if (points.Length == 3 && pathType == PathType.PerfectCurve && isLinear(points))
|
||||
pathType = PathType.Linear;
|
||||
|
||||
int repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture);
|
||||
int repeatCount = Parsing.ParseInt(split[6]);
|
||||
|
||||
if (repeatCount > 9000)
|
||||
throw new ArgumentOutOfRangeException(nameof(repeatCount), @"Repeat count is way too high");
|
||||
@ -125,7 +126,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
repeatCount = Math.Max(0, repeatCount - 1);
|
||||
|
||||
if (split.Length > 7)
|
||||
length = Convert.ToDouble(split[7], CultureInfo.InvariantCulture);
|
||||
length = Math.Max(0, Parsing.ParseDouble(split[7]));
|
||||
|
||||
if (split.Length > 10)
|
||||
readCustomSampleBanks(split[10], bankInfo);
|
||||
@ -184,7 +185,9 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
}
|
||||
else if (type.HasFlag(ConvertHitObjectType.Spinner))
|
||||
{
|
||||
result = CreateSpinner(new Vector2(512, 384) / 2, combo, comboOffset, Convert.ToDouble(split[5], CultureInfo.InvariantCulture) + Offset);
|
||||
double endTime = Math.Max(startTime, Parsing.ParseDouble(split[5]) + Offset);
|
||||
|
||||
result = CreateSpinner(new Vector2(512, 384) / 2, combo, comboOffset, endTime);
|
||||
|
||||
if (split.Length > 6)
|
||||
readCustomSampleBanks(split[6], bankInfo);
|
||||
@ -193,12 +196,12 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
{
|
||||
// Note: Hold is generated by BMS converts
|
||||
|
||||
double endTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture);
|
||||
double endTime = Math.Max(startTime, Parsing.ParseDouble(split[2]));
|
||||
|
||||
if (split.Length > 5 && !string.IsNullOrEmpty(split[5]))
|
||||
{
|
||||
string[] ss = split[5].Split(':');
|
||||
endTime = Convert.ToDouble(ss[0], CultureInfo.InvariantCulture);
|
||||
endTime = Math.Max(startTime, Parsing.ParseDouble(ss[0]));
|
||||
readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo);
|
||||
}
|
||||
|
||||
@ -211,7 +214,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
return null;
|
||||
}
|
||||
|
||||
result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture) + Offset;
|
||||
result.StartTime = startTime;
|
||||
|
||||
if (result.Samples.Count == 0)
|
||||
result.Samples = convertSoundType(soundType, bankInfo);
|
||||
@ -222,8 +225,14 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
throw new FormatException("One or more hit objects were malformed.");
|
||||
Logger.Log("A hitobject could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
|
||||
}
|
||||
catch (OverflowException)
|
||||
{
|
||||
Logger.Log("A hitobject could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void readCustomSampleBanks(string str, SampleBankInfo bankInfo)
|
||||
@ -233,8 +242,8 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
|
||||
string[] split = str.Split(':');
|
||||
|
||||
var bank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[0]);
|
||||
var addbank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[1]);
|
||||
var bank = (LegacyBeatmapDecoder.LegacySampleBank)Parsing.ParseInt(split[0]);
|
||||
var addbank = (LegacyBeatmapDecoder.LegacySampleBank)Parsing.ParseInt(split[1]);
|
||||
|
||||
string stringBank = bank.ToString().ToLowerInvariant();
|
||||
if (stringBank == @"none")
|
||||
@ -247,10 +256,10 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
bankInfo.Add = string.IsNullOrEmpty(stringAddBank) ? stringBank : stringAddBank;
|
||||
|
||||
if (split.Length > 2)
|
||||
bankInfo.CustomSampleBank = int.Parse(split[2]);
|
||||
bankInfo.CustomSampleBank = Parsing.ParseInt(split[2]);
|
||||
|
||||
if (split.Length > 3)
|
||||
bankInfo.Volume = int.Parse(split[3]);
|
||||
bankInfo.Volume = Math.Max(0, Parsing.ParseInt(split[3]));
|
||||
|
||||
bankInfo.Filename = split.Length > 4 ? split[4] : null;
|
||||
}
|
||||
|
148
osu.Game/Rulesets/Objects/SliderEventGenerator.cs
Normal file
148
osu.Game/Rulesets/Objects/SliderEventGenerator.cs
Normal file
@ -0,0 +1,148 @@
|
||||
// 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 osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects
|
||||
{
|
||||
public static class SliderEventGenerator
|
||||
{
|
||||
public static IEnumerable<SliderEventDescriptor> Generate(double startTime, double spanDuration, double velocity, double tickDistance, double totalDistance, int spanCount, double? legacyLastTickOffset)
|
||||
{
|
||||
// A very lenient maximum length of a slider for ticks to be generated.
|
||||
// This exists for edge cases such as /b/1573664 where the beatmap has been edited by the user, and should never be reached in normal usage.
|
||||
const double max_length = 100000;
|
||||
|
||||
var length = Math.Min(max_length, totalDistance);
|
||||
tickDistance = MathHelper.Clamp(tickDistance, 0, length);
|
||||
|
||||
var minDistanceFromEnd = velocity * 10;
|
||||
|
||||
yield return new SliderEventDescriptor
|
||||
{
|
||||
Type = SliderEventType.Head,
|
||||
SpanIndex = 0,
|
||||
SpanStartTime = startTime,
|
||||
Time = startTime,
|
||||
PathProgress = 0,
|
||||
};
|
||||
|
||||
if (tickDistance != 0)
|
||||
{
|
||||
for (var span = 0; span < spanCount; span++)
|
||||
{
|
||||
var spanStartTime = startTime + span * spanDuration;
|
||||
var reversed = span % 2 == 1;
|
||||
|
||||
for (var d = tickDistance; d <= length; d += tickDistance)
|
||||
{
|
||||
if (d >= length - minDistanceFromEnd)
|
||||
break;
|
||||
|
||||
var pathProgress = d / length;
|
||||
var timeProgress = reversed ? 1 - pathProgress : pathProgress;
|
||||
|
||||
yield return new SliderEventDescriptor
|
||||
{
|
||||
Type = SliderEventType.Tick,
|
||||
SpanIndex = span,
|
||||
SpanStartTime = spanStartTime,
|
||||
Time = spanStartTime + timeProgress * spanDuration,
|
||||
PathProgress = pathProgress,
|
||||
};
|
||||
}
|
||||
|
||||
if (span < spanCount - 1)
|
||||
{
|
||||
yield return new SliderEventDescriptor
|
||||
{
|
||||
Type = SliderEventType.Repeat,
|
||||
SpanIndex = span,
|
||||
SpanStartTime = startTime + span * spanDuration,
|
||||
Time = spanStartTime + spanDuration,
|
||||
PathProgress = (span + 1) % 2,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double totalDuration = spanCount * spanDuration;
|
||||
|
||||
// Okay, I'll level with you. I made a mistake. It was 2007.
|
||||
// Times were simpler. osu! was but in its infancy and sliders were a new concept.
|
||||
// A hack was made, which has unfortunately lived through until this day.
|
||||
//
|
||||
// This legacy tick is used for some calculations and judgements where audio output is not required.
|
||||
// Generally we are keeping this around just for difficulty compatibility.
|
||||
// Optimistically we do not want to ever use this for anything user-facing going forwards.
|
||||
|
||||
int finalSpanIndex = spanCount - 1;
|
||||
double finalSpanStartTime = startTime + finalSpanIndex * spanDuration;
|
||||
double finalSpanEndTime = Math.Max(startTime + totalDuration / 2, (finalSpanStartTime + spanDuration) - (legacyLastTickOffset ?? 0));
|
||||
double finalProgress = (finalSpanEndTime - finalSpanStartTime) / spanDuration;
|
||||
|
||||
if (spanCount % 2 == 0) finalProgress = 1 - finalProgress;
|
||||
|
||||
yield return new SliderEventDescriptor
|
||||
{
|
||||
Type = SliderEventType.LegacyLastTick,
|
||||
SpanIndex = finalSpanIndex,
|
||||
SpanStartTime = finalSpanStartTime,
|
||||
Time = finalSpanEndTime,
|
||||
PathProgress = finalProgress,
|
||||
};
|
||||
|
||||
yield return new SliderEventDescriptor
|
||||
{
|
||||
Type = SliderEventType.Tail,
|
||||
SpanIndex = finalSpanIndex,
|
||||
SpanStartTime = startTime + (spanCount - 1) * spanDuration,
|
||||
Time = startTime + totalDuration,
|
||||
PathProgress = spanCount % 2,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a point in time on a slider given special meaning.
|
||||
/// Should be used by rulesets to visualise the slider.
|
||||
/// </summary>
|
||||
public struct SliderEventDescriptor
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of event.
|
||||
/// </summary>
|
||||
public SliderEventType Type;
|
||||
|
||||
/// <summary>
|
||||
/// The time of this event.
|
||||
/// </summary>
|
||||
public double Time;
|
||||
|
||||
/// <summary>
|
||||
/// The zero-based index of the span. In the case of repeat sliders, this will increase after each <see cref="SliderEventType.Repeat"/>.
|
||||
/// </summary>
|
||||
public int SpanIndex;
|
||||
|
||||
/// <summary>
|
||||
/// The time at which the contained <see cref="SpanIndex"/> begins.
|
||||
/// </summary>
|
||||
public double SpanStartTime;
|
||||
|
||||
/// <summary>
|
||||
/// The progress along the slider's <see cref="SliderPath"/> at which this event occurs.
|
||||
/// </summary>
|
||||
public double PathProgress;
|
||||
}
|
||||
|
||||
public enum SliderEventType
|
||||
{
|
||||
Tick,
|
||||
LegacyLastTick,
|
||||
Head,
|
||||
Tail,
|
||||
Repeat
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -141,11 +142,15 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
if (sourceClock == null) return;
|
||||
|
||||
sourceClock.Rate = 1;
|
||||
sourceClock.ResetSpeedAdjustments();
|
||||
|
||||
if (sourceClock is IHasTempoAdjust tempo)
|
||||
tempo.TempoAdjust = UserPlaybackRate.Value;
|
||||
else
|
||||
sourceClock.Rate = UserPlaybackRate.Value;
|
||||
|
||||
foreach (var mod in beatmap.Mods.Value.OfType<IApplicableToClock>())
|
||||
mod.ApplyToClock(sourceClock);
|
||||
|
||||
sourceClock.Rate *= UserPlaybackRate.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,30 +92,6 @@ namespace osu.Game.Screens.Play.HUD
|
||||
public Action HoverGained;
|
||||
public Action HoverLost;
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.Back:
|
||||
BeginConfirm();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.Back:
|
||||
AbortConfirm();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
@ -178,7 +154,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
// avoid starting a new confirm call until we finish animating.
|
||||
pendingAnimation = true;
|
||||
|
||||
Progress.Value = 0;
|
||||
AbortConfirm();
|
||||
|
||||
overlayCircle.ScaleTo(0, 100)
|
||||
.Then().FadeOut().ScaleTo(1).FadeIn(500)
|
||||
@ -207,6 +183,31 @@ namespace osu.Game.Screens.Play.HUD
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.Back:
|
||||
if (!pendingAnimation)
|
||||
BeginConfirm();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.Back:
|
||||
AbortConfirm();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
if (!pendingAnimation && e.CurrentState.Mouse.Buttons.Count() == 1)
|
||||
|
@ -175,21 +175,22 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private void updateStatistics()
|
||||
{
|
||||
if (Beatmap == null)
|
||||
advanced.Beatmap = Beatmap;
|
||||
description.Text = Beatmap?.Version;
|
||||
source.Text = Beatmap?.Metadata?.Source;
|
||||
tags.Text = Beatmap?.Metadata?.Tags;
|
||||
|
||||
// metrics may have been previously fetched
|
||||
if (Beatmap?.Metrics != null)
|
||||
{
|
||||
clearStats();
|
||||
updateMetrics(Beatmap.Metrics);
|
||||
return;
|
||||
}
|
||||
|
||||
ratingsContainer.FadeIn(transition_duration);
|
||||
advanced.Beatmap = Beatmap;
|
||||
description.Text = Beatmap.Version;
|
||||
source.Text = Beatmap.Metadata.Source;
|
||||
tags.Text = Beatmap.Metadata.Tags;
|
||||
|
||||
var requestedBeatmap = Beatmap;
|
||||
if (requestedBeatmap.Metrics == null)
|
||||
// metrics may not be fetched but can be
|
||||
if (Beatmap?.OnlineBeatmapID != null)
|
||||
{
|
||||
var requestedBeatmap = Beatmap;
|
||||
var lookup = new GetBeatmapDetailsRequest(requestedBeatmap);
|
||||
lookup.Success += res =>
|
||||
{
|
||||
@ -198,39 +199,34 @@ namespace osu.Game.Screens.Select
|
||||
return;
|
||||
|
||||
requestedBeatmap.Metrics = res;
|
||||
Schedule(() => displayMetrics(res));
|
||||
Schedule(() => updateMetrics(res));
|
||||
};
|
||||
lookup.Failure += e => Schedule(() => displayMetrics(null));
|
||||
|
||||
lookup.Failure += e => Schedule(() => updateMetrics());
|
||||
api.Queue(lookup);
|
||||
loading.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
displayMetrics(requestedBeatmap.Metrics, false);
|
||||
updateMetrics();
|
||||
}
|
||||
|
||||
private void displayMetrics(BeatmapMetrics metrics, bool failOnMissing = true)
|
||||
private void updateMetrics(BeatmapMetrics metrics = null)
|
||||
{
|
||||
var hasRatings = metrics?.Ratings?.Any() ?? false;
|
||||
var hasRetriesFails = (metrics?.Retries?.Any() ?? false) && (metrics.Fails?.Any() ?? false);
|
||||
|
||||
if (failOnMissing) loading.Hide();
|
||||
|
||||
if (hasRatings)
|
||||
{
|
||||
ratings.Metrics = metrics;
|
||||
ratings.FadeIn(transition_duration);
|
||||
ratingsContainer.FadeIn(transition_duration);
|
||||
}
|
||||
else if (failOnMissing)
|
||||
else
|
||||
{
|
||||
ratings.Metrics = new BeatmapMetrics
|
||||
{
|
||||
Ratings = new int[10],
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
ratings.FadeTo(0.25f, transition_duration);
|
||||
ratingsContainer.FadeTo(0.25f, transition_duration);
|
||||
}
|
||||
|
||||
if (hasRetriesFails)
|
||||
@ -238,41 +234,17 @@ namespace osu.Game.Screens.Select
|
||||
failRetryGraph.Metrics = metrics;
|
||||
failRetryContainer.FadeIn(transition_duration);
|
||||
}
|
||||
else if (failOnMissing)
|
||||
else
|
||||
{
|
||||
failRetryGraph.Metrics = new BeatmapMetrics
|
||||
{
|
||||
Fails = new int[100],
|
||||
Retries = new int[100],
|
||||
};
|
||||
failRetryContainer.FadeOut(transition_duration);
|
||||
}
|
||||
else
|
||||
{
|
||||
failRetryContainer.FadeTo(0.25f, transition_duration);
|
||||
}
|
||||
}
|
||||
|
||||
private void clearStats()
|
||||
{
|
||||
description.Text = null;
|
||||
source.Text = null;
|
||||
tags.Text = null;
|
||||
|
||||
advanced.Beatmap = new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 0,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 0,
|
||||
DrainRate = 0,
|
||||
OverallDifficulty = 0,
|
||||
ApproachRate = 0,
|
||||
},
|
||||
};
|
||||
|
||||
loading.Hide();
|
||||
ratingsContainer.FadeOut(transition_duration);
|
||||
failRetryContainer.FadeOut(transition_duration);
|
||||
}
|
||||
|
||||
private class DetailBox : Container
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Tests.Visual
|
||||
base.Update();
|
||||
|
||||
// note that this will override any mod rate application
|
||||
Beatmap.Value.Track.Rate = Clock.Rate;
|
||||
Beatmap.Value.Track.TempoAdjust = Clock.Rate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.308.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.313.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
@ -105,8 +105,8 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.308.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.308.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.313.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.313.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
@ -13,4 +13,3 @@ namespace osu.iOS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,6 +111,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PossibleMultipleEnumeration/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PrivateVariableCanBeMadeReadonly/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PublicConstructorInAbstractClass/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantArgumentDefaultValue/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantArrayCreationExpression/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantAttributeParentheses/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantAttributeUsageProperty/@EntryIndexedValue">WARNING</s:String>
|
||||
|
Loading…
Reference in New Issue
Block a user