mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Listen for track reload in timeline
This commit is contained in:
parent
66a02374da
commit
7089bb6c23
@ -15,6 +15,7 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
@ -35,14 +36,15 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
public readonly Bindable<bool> TicksVisible = new Bindable<bool>();
|
public readonly Bindable<bool> TicksVisible = new Bindable<bool>();
|
||||||
|
|
||||||
public readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorClock editorClock { get; set; }
|
private EditorClock editorClock { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorBeatmap editorBeatmap { get; set; }
|
private EditorBeatmap editorBeatmap { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private MusicController musicController { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The timeline's scroll position in the last frame.
|
/// The timeline's scroll position in the last frame.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -139,11 +141,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
|
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
|
||||||
|
|
||||||
Beatmap.BindTo(beatmap);
|
musicController.TrackChanged += onTrackReload;
|
||||||
Beatmap.BindValueChanged(b =>
|
waveform.Waveform = beatmap.Value.Waveform;
|
||||||
{
|
|
||||||
waveform.Waveform = b.NewValue.Waveform;
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
Zoom = (float)(defaultTimelineZoom * editorBeatmap.BeatmapInfo.TimelineZoom);
|
Zoom = (float)(defaultTimelineZoom * editorBeatmap.BeatmapInfo.TimelineZoom);
|
||||||
}
|
}
|
||||||
@ -181,6 +180,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
private void updateWaveformOpacity() =>
|
private void updateWaveformOpacity() =>
|
||||||
waveform.FadeTo(WaveformVisible.Value ? waveformOpacity.Value : 0, 200, Easing.OutQuint);
|
waveform.FadeTo(WaveformVisible.Value ? waveformOpacity.Value : 0, 200, Easing.OutQuint);
|
||||||
|
|
||||||
|
private void onTrackReload(WorkingBeatmap beatmap, TrackChangeDirection tcd)
|
||||||
|
{
|
||||||
|
waveform.Waveform = beatmap.Waveform;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
@ -321,5 +325,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
double time = TimeAtPosition(Content.ToLocalSpace(screenSpacePosition).X);
|
double time = TimeAtPosition(Content.ToLocalSpace(screenSpacePosition).X);
|
||||||
return new SnapResult(screenSpacePosition, beatSnapProvider.SnapTime(time));
|
return new SnapResult(screenSpacePosition, beatSnapProvider.SnapTime(time));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
musicController.TrackChanged -= onTrackReload;
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user