1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 20:25:39 +08:00

Tidy code

This commit is contained in:
Dean Herbert 2018-06-28 14:08:15 +09:00
parent 01b90aaffe
commit 3b0c4ff16b

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -51,13 +52,11 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible ? 1 : 0, 200, Easing.OutQuint); WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible ? 1 : 0, 200, Easing.OutQuint);
Beatmap.BindTo(beatmap); Beatmap.BindTo(beatmap);
} Beatmap.BindValueChanged(b =>
{
protected override void LoadComplete() waveform.Waveform = b.Waveform;
{ track = b.Track;
base.LoadComplete(); }, true);
Beatmap.BindValueChanged(b => waveform.Waveform = b.Waveform);
waveform.Waveform = Beatmap.Value.Waveform;
} }
/// <summary> /// <summary>
@ -80,6 +79,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
/// </summary> /// </summary>
private bool trackWasPlaying; private bool trackWasPlaying;
private Track track;
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
@ -117,18 +118,18 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
private void seekTrackToCurrent() private void seekTrackToCurrent()
{ {
if (!Beatmap.Value.TrackLoaded || !Beatmap.Value.Track.IsLoaded) if (!track.IsLoaded)
return; return;
adjustableClock.Seek(Current / Content.DrawWidth * Beatmap.Value.Track.Length); adjustableClock.Seek(Current / Content.DrawWidth * track.Length);
} }
private void scrollToTrackTime() private void scrollToTrackTime()
{ {
if (!Beatmap.Value.TrackLoaded || !Beatmap.Value.Track.IsLoaded) if (!track.IsLoaded)
return; return;
ScrollTo((float)(adjustableClock.CurrentTime / Beatmap.Value.Track.Length) * Content.DrawWidth, false); ScrollTo((float)(adjustableClock.CurrentTime / track.Length) * Content.DrawWidth, false);
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)