mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 20:32:55 +08:00
Allow BeatSyncedContainer
to prefer EditorBeatmap
when available
This commit is contained in:
parent
82eb5fd2c9
commit
c3bfbe8880
@ -258,24 +258,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
private List<TimingControlPoint> timingPoints => Beatmap.ControlPointInfo.TimingPoints.ToList();
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
Beatmap.BindValueChanged(_ =>
|
|
||||||
{
|
|
||||||
timingPointCount.Value = 0;
|
|
||||||
currentTimingPoint.Value = 0;
|
|
||||||
beatCount.Value = 0;
|
|
||||||
currentBeat.Value = 0;
|
|
||||||
beatsPerMinute.Value = 0;
|
|
||||||
adjustedBeatLength.Value = 0;
|
|
||||||
timeUntilNextBeat.Value = 0;
|
|
||||||
timeSinceLastBeat.Value = 0;
|
|
||||||
}, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<TimingControlPoint> timingPoints => Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints.ToList();
|
|
||||||
|
|
||||||
private TimingControlPoint getNextTimingPoint(TimingControlPoint current)
|
private TimingControlPoint getNextTimingPoint(TimingControlPoint current)
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Containers
|
namespace osu.Game.Graphics.Containers
|
||||||
@ -79,20 +80,31 @@ namespace osu.Game.Graphics.Containers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
protected IBindable<WorkingBeatmap> Beatmap { get; private set; }
|
private IBindable<WorkingBeatmap> beatmap { get; set; }
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
protected GameplayClock GameplayClock { get; private set; }
|
protected GameplayClock GameplayClock { get; private set; }
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
protected EditorBeatmap EditorBeatmap { get; private set; }
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
protected EditorClock EditorClock { get; private set; }
|
||||||
|
|
||||||
|
protected IBeatmap Beatmap => EditorBeatmap ?? beatmap?.Value.Beatmap;
|
||||||
|
|
||||||
protected IClock BeatSyncClock
|
protected IClock BeatSyncClock
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (EditorClock != null)
|
||||||
|
return EditorClock;
|
||||||
|
|
||||||
if (GameplayClock != null)
|
if (GameplayClock != null)
|
||||||
return GameplayClock;
|
return GameplayClock;
|
||||||
|
|
||||||
if (Beatmap.Value.TrackLoaded)
|
if (beatmap.Value.TrackLoaded)
|
||||||
return Beatmap.Value.Track;
|
return beatmap.Value.Track;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -101,7 +113,6 @@ namespace osu.Game.Graphics.Containers
|
|||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
ITrack track = null;
|
ITrack track = null;
|
||||||
IBeatmap beatmap = null;
|
|
||||||
|
|
||||||
TimingControlPoint timingPoint;
|
TimingControlPoint timingPoint;
|
||||||
EffectControlPoint effectPoint;
|
EffectControlPoint effectPoint;
|
||||||
@ -113,10 +124,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
double currentTrackTime = clock.CurrentTime + EarlyActivationMilliseconds;
|
double currentTrackTime = clock.CurrentTime + EarlyActivationMilliseconds;
|
||||||
|
|
||||||
if (Beatmap.Value.TrackLoaded && Beatmap.Value.BeatmapLoaded)
|
if (this.beatmap.Value.TrackLoaded && this.beatmap.Value.BeatmapLoaded)
|
||||||
{
|
{
|
||||||
track = Beatmap.Value.Track;
|
track = this.beatmap.Value.Track;
|
||||||
beatmap = Beatmap.Value.Beatmap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IsBeatSyncedWithTrack = beatmap != null && clock.IsRunning && track?.Length > 0;
|
IsBeatSyncedWithTrack = beatmap != null && clock.IsRunning && track?.Length > 0;
|
||||||
@ -125,8 +135,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
{
|
{
|
||||||
Debug.Assert(beatmap != null);
|
Debug.Assert(beatmap != null);
|
||||||
|
|
||||||
timingPoint = beatmap.ControlPointInfo.TimingPointAt(currentTrackTime);
|
timingPoint = Beatmap.ControlPointInfo.TimingPointAt(currentTrackTime);
|
||||||
effectPoint = beatmap.ControlPointInfo.EffectPointAt(currentTrackTime);
|
effectPoint = Beatmap.ControlPointInfo.EffectPointAt(currentTrackTime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user