1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-18 12:40:18 +08:00

Compare commits

...

11 Commits

11 changed files with 43 additions and 33 deletions
+1 -1
View File
@@ -96,7 +96,7 @@ jobs:
build-only-android:
name: Build only (Android)
runs-on: windows-latest
runs-on: windows-2019
timeout-minutes: 60
steps:
- name: Checkout
+1 -1
View File
@@ -82,7 +82,7 @@ namespace osu.Desktop
};
client.OnReady += onReady;
client.OnError += (_, e) => Logger.Log($"An error occurred with Discord RPC Client: {e.Message} ({e.Code})", LoggingTarget.Network, LogLevel.Error);
client.OnError += (_, e) => Logger.Log($"An error occurred with Discord RPC Client: {e.Message} ({e.Code})", LoggingTarget.Network);
try
{
@@ -120,6 +120,7 @@ namespace osu.Game.Tests.Visual.Gameplay
public double FramesPerSecond => throw new NotImplementedException();
public FrameTimeInfo TimeInfo => throw new NotImplementedException();
public double StartTime => throw new NotImplementedException();
public double GameplayStartTime => throw new NotImplementedException();
public IAdjustableAudioComponent AdjustmentsFromMods => adjustableAudioComponent;
@@ -5,8 +5,6 @@ namespace osu.Game.Graphics.UserInterface
{
public partial class OsuNumberBox : OsuTextBox
{
protected override bool AllowIme => false;
public OsuNumberBox()
{
SelectAllOnFocus = true;
@@ -66,8 +66,6 @@ namespace osu.Game.Overlays.Settings
private partial class OutlinedNumberBox : OutlinedTextBox
{
protected override bool AllowIme => false;
protected override bool CanAddCharacter(char character) => char.IsAsciiDigit(character);
public new void NotifyInputError() => base.NotifyInputError();
@@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.UI
private readonly Bindable<bool> waitingOnFrames = new Bindable<bool>();
private readonly double gameplayStartTime;
public double GameplayStartTime { get; }
private IGameplayClock? parentGameplayClock;
@@ -85,7 +85,7 @@ namespace osu.Game.Rulesets.UI
framedClock = new FramedClock(manualClock = new ManualClock());
this.gameplayStartTime = gameplayStartTime;
GameplayStartTime = gameplayStartTime;
}
[BackgroundDependencyLoader(true)]
@@ -257,8 +257,8 @@ namespace osu.Game.Rulesets.UI
return;
}
if (manualClock.CurrentTime < gameplayStartTime)
manualClock.CurrentTime = proposedTime = Math.Min(gameplayStartTime, proposedTime);
if (manualClock.CurrentTime < GameplayStartTime)
manualClock.CurrentTime = proposedTime = Math.Min(GameplayStartTime, proposedTime);
else if (Math.Abs(manualClock.CurrentTime - proposedTime) > sixty_frame_time * 1.2f)
{
proposedTime = proposedTime > manualClock.CurrentTime
@@ -149,7 +149,7 @@ namespace osu.Game.Screens.Edit.Components.TernaryButtons
{
Enabled.Value = SelectedHitObject.Value != null;
if (SelectedHitObject.Value == null || SelectedHitObject.Value.ComboOffset == 0)
if (SelectedHitObject.Value == null || SelectedHitObject.Value.ComboOffset == 0 || ComboColours.Count <= 1)
{
BackgroundColour = colourProvider.Background3;
icon.Colour = BackgroundColour.Darken(0.5f);
@@ -39,6 +39,8 @@ namespace osu.Game.Screens.Play
/// </remarks>
public double StartTime { get; protected set; }
public double GameplayStartTime { get; protected set; }
public IAdjustableAudioComponent AdjustmentsFromMods { get; } = new AudioAdjustments();
private readonly BindableBool isPaused = new BindableBool(true);
+5
View File
@@ -18,6 +18,11 @@ namespace osu.Game.Screens.Play
/// </remarks>
double StartTime { get; }
/// <summary>
/// The time from which actual gameplay should start. When intro time is skipped, this will be the seeked location.
/// </summary>
double GameplayStartTime { get; }
/// <summary>
/// All adjustments applied to this clock which come from mods.
/// </summary>
@@ -57,8 +57,6 @@ namespace osu.Game.Screens.Play
private Track track;
private readonly double skipTargetTime;
[Resolved]
private MusicController musicController { get; set; } = null!;
@@ -66,25 +64,25 @@ namespace osu.Game.Screens.Play
/// Create a new master gameplay clock container.
/// </summary>
/// <param name="beatmap">The beatmap to be used for time and metadata references.</param>
/// <param name="skipTargetTime">The latest time which should be used when introducing gameplay. Will be used when skipping forward.</param>
public MasterGameplayClockContainer(WorkingBeatmap beatmap, double skipTargetTime)
/// <param name="gameplayStartTime">The latest time which should be used when introducing gameplay. Will be used when skipping forward.</param>
public MasterGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStartTime)
: base(beatmap.Track, applyOffsets: true, requireDecoupling: true)
{
this.beatmap = beatmap;
this.skipTargetTime = skipTargetTime;
track = beatmap.Track;
StartTime = findEarliestStartTime();
GameplayStartTime = gameplayStartTime;
StartTime = findEarliestStartTime(gameplayStartTime, beatmap);
}
private double findEarliestStartTime()
private static double findEarliestStartTime(double gameplayStartTime, WorkingBeatmap beatmap)
{
// here we are trying to find the time to start playback from the "zero" point.
// generally this is either zero, or some point earlier than zero in the case of storyboards, lead-ins etc.
// start with the originally provided latest time (if before zero).
double time = Math.Min(0, skipTargetTime);
double time = Math.Min(0, gameplayStartTime);
// if a storyboard is present, it may dictate the appropriate start time by having events in negative time space.
// this is commonly used to display an intro before the audio track start.
@@ -119,10 +117,10 @@ namespace osu.Game.Screens.Play
/// </summary>
public void Skip()
{
if (GameplayClock.CurrentTime > skipTargetTime - MINIMUM_SKIP_TIME)
if (GameplayClock.CurrentTime > GameplayStartTime - MINIMUM_SKIP_TIME)
return;
double skipTarget = skipTargetTime - MINIMUM_SKIP_TIME;
double skipTarget = GameplayStartTime - MINIMUM_SKIP_TIME;
if (StartTime < -10000 && GameplayClock.CurrentTime < 0 && skipTarget > 6000)
// double skip exception for storyboards with very long intros
@@ -187,7 +185,8 @@ namespace osu.Game.Screens.Play
}
else
{
Logger.Log($"Playback discrepancy detected ({playbackDiscrepancyCount} of allowed {allowed_playback_discrepancies}): {elapsedGameplayClockTime:N1} vs {elapsedValidationTime:N1}");
Logger.Log(
$"Playback discrepancy detected ({playbackDiscrepancyCount} of allowed {allowed_playback_discrepancies}): {elapsedGameplayClockTime:N1} vs {elapsedValidationTime:N1}");
}
elapsedValidationTime = null;
@@ -121,7 +121,11 @@ namespace osu.Game.Screens.Play.PlayerSettings
// At the point we reach here, it's not guaranteed that all realm writes have taken place (there may be some in-flight).
// We are only aware of writes that originated from our own flow, so if we do see one that's active we can avoid handling the feedback value arriving.
if (realmWriteTask == null)
{
Current.Disabled = false;
Current.Value = val;
Current.Disabled = allowOffsetAdjust;
}
if (realmWriteTask?.IsCompleted == true)
{
@@ -134,15 +138,15 @@ namespace osu.Game.Screens.Play.PlayerSettings
ReferenceScore.BindValueChanged(scoreChanged, true);
}
// the last play graph is relative to the offset at the point of the last play, so we need to factor that out for some usages.
private double adjustmentSinceLastPlay => lastPlayBeatmapOffset - Current.Value;
private void currentChanged(ValueChangedEvent<double> offset)
{
Scheduler.AddOnce(updateOffset);
void updateOffset()
{
// the last play graph is relative to the offset at the point of the last play, so we need to factor that out.
double adjustmentSinceLastPlay = lastPlayBeatmapOffset - Current.Value;
// Negative is applied here because the play graph is considering a hit offset, not track (as we currently use for clocks).
lastPlayGraph?.UpdateOffset(-adjustmentSinceLastPlay);
@@ -153,11 +157,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
return;
}
if (useAverageButton != null)
{
useAverageButton.Enabled.Value = !Precision.AlmostEquals(lastPlayAverage, adjustmentSinceLastPlay, Current.Precision / 2);
}
realmWriteTask = realm.WriteAsync(r =>
{
var setInfo = r.Find<BeatmapSetInfo>(beatmap.Value.BeatmapSetInfo.ID);
@@ -245,10 +244,12 @@ namespace osu.Game.Screens.Play.PlayerSettings
Text = BeatmapOffsetControlStrings.CalibrateUsingLastPlay,
Action = () =>
{
if (Current.Disabled)
return;
Current.Value = lastPlayBeatmapOffset - lastPlayAverage;
lastAppliedScore.Value = ReferenceScore.Value;
},
Enabled = { Value = !Precision.AlmostEquals(lastPlayAverage, 0, Current.Precision / 2) }
},
globalOffsetText = new LinkFlowContainer
{
@@ -277,7 +278,13 @@ namespace osu.Game.Screens.Play.PlayerSettings
protected override void Update()
{
base.Update();
Current.Disabled = !allowOffsetAdjust;
bool allow = allowOffsetAdjust;
if (useAverageButton != null)
useAverageButton.Enabled.Value = allow && !Precision.AlmostEquals(lastPlayAverage, adjustmentSinceLastPlay, Current.Precision / 2);
Current.Disabled = !allow;
}
private bool allowOffsetAdjust
@@ -291,7 +298,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
Debug.Assert(gameplayClock != null);
// TODO: the blocking conditions should probably display a message.
if (!player.IsBreakTime.Value && gameplayClock.CurrentTime - gameplayClock.StartTime > 10000)
if (!player.IsBreakTime.Value && gameplayClock.CurrentTime - gameplayClock.GameplayStartTime > 10000)
return false;
if (gameplayClock.IsPaused.Value)