mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 00:02:56 +08:00
Rename is-in-any check method to a more legible name
This commit is contained in:
parent
8d899f4e77
commit
6e76e5900a
@ -29,9 +29,9 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
var tracker = new PeriodTracker { Periods = test_single_period };
|
var tracker = new PeriodTracker { Periods = test_single_period };
|
||||||
|
|
||||||
var period = test_single_period.Single();
|
var period = test_single_period.Single();
|
||||||
Assert.IsTrue(tracker.Contains(period.Start));
|
Assert.IsTrue(tracker.IsInAny(period.Start));
|
||||||
Assert.IsTrue(tracker.Contains(getMidTime(period)));
|
Assert.IsTrue(tracker.IsInAny(getMidTime(period)));
|
||||||
Assert.IsTrue(tracker.Contains(period.End));
|
Assert.IsTrue(tracker.IsInAny(period.End));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -40,7 +40,7 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
var tracker = new PeriodTracker { Periods = test_periods };
|
var tracker = new PeriodTracker { Periods = test_periods };
|
||||||
|
|
||||||
foreach (var period in test_periods)
|
foreach (var period in test_periods)
|
||||||
Assert.IsTrue(tracker.Contains(getMidTime(period)));
|
Assert.IsTrue(tracker.IsInAny(getMidTime(period)));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -49,7 +49,7 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
var tracker = new PeriodTracker { Periods = test_periods };
|
var tracker = new PeriodTracker { Periods = test_periods };
|
||||||
|
|
||||||
foreach (var period in test_periods.OrderBy(_ => RNG.Next()))
|
foreach (var period in test_periods.OrderBy(_ => RNG.Next()))
|
||||||
Assert.IsTrue(tracker.Contains(getMidTime(period)));
|
Assert.IsTrue(tracker.IsInAny(getMidTime(period)));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -64,12 +64,12 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Assert.IsFalse(tracker.Contains(0.9), "Time before first period is being considered inside");
|
Assert.IsFalse(tracker.IsInAny(0.9), "Time before first period is being considered inside");
|
||||||
|
|
||||||
Assert.IsFalse(tracker.Contains(2.1), "Time right after first period is being considered inside");
|
Assert.IsFalse(tracker.IsInAny(2.1), "Time right after first period is being considered inside");
|
||||||
Assert.IsFalse(tracker.Contains(2.9), "Time right before second period is being considered inside");
|
Assert.IsFalse(tracker.IsInAny(2.9), "Time right before second period is being considered inside");
|
||||||
|
|
||||||
Assert.IsFalse(tracker.Contains(4.1), "Time after last period is being considered inside");
|
Assert.IsFalse(tracker.IsInAny(4.1), "Time after last period is being considered inside");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -78,10 +78,10 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
var tracker = new PeriodTracker { Periods = test_single_period };
|
var tracker = new PeriodTracker { Periods = test_single_period };
|
||||||
|
|
||||||
var period = test_single_period.Single();
|
var period = test_single_period.Single();
|
||||||
Assert.IsTrue(tracker.Contains(getMidTime(period)));
|
Assert.IsTrue(tracker.IsInAny(getMidTime(period)));
|
||||||
|
|
||||||
tracker.Periods = null;
|
tracker.Periods = null;
|
||||||
Assert.IsFalse(tracker.Contains(getMidTime(period)));
|
Assert.IsFalse(tracker.IsInAny(getMidTime(period)));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
var time = Clock.CurrentTime;
|
var time = Clock.CurrentTime;
|
||||||
|
|
||||||
isBreakTime.Value = tracker.Contains(time)
|
isBreakTime.Value = tracker.IsInAny(time)
|
||||||
|| time < gameplayStartTime
|
|| time < gameplayStartTime
|
||||||
|| scoreProcessor?.HasCompleted == true;
|
|| scoreProcessor?.HasCompleted == true;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Utils
|
|||||||
/// Whether the provided time is in any of the added periods.
|
/// Whether the provided time is in any of the added periods.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="time">The time value to check for.</param>
|
/// <param name="time">The time value to check for.</param>
|
||||||
public bool Contains(double time)
|
public bool IsInAny(double time)
|
||||||
{
|
{
|
||||||
if (periods.Count == 0)
|
if (periods.Count == 0)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user