mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Cache and resolve editor clock as EditorClock in all cases
This commit is contained in:
@ -13,7 +13,6 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -26,7 +25,7 @@ namespace osu.Game.Screens.Edit.Components
|
||||
private IconButton playButton;
|
||||
|
||||
[Resolved]
|
||||
private IAdjustableClock adjustableClock { get; set; }
|
||||
private EditorClock editorClock { get; set; }
|
||||
|
||||
private readonly BindableNumber<double> tempo = new BindableDouble(1);
|
||||
|
||||
@ -87,17 +86,17 @@ namespace osu.Game.Screens.Edit.Components
|
||||
|
||||
private void togglePause()
|
||||
{
|
||||
if (adjustableClock.IsRunning)
|
||||
adjustableClock.Stop();
|
||||
if (editorClock.IsRunning)
|
||||
editorClock.Stop();
|
||||
else
|
||||
adjustableClock.Start();
|
||||
editorClock.Start();
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
playButton.Icon = adjustableClock.IsRunning ? FontAwesome.Regular.PauseCircle : FontAwesome.Regular.PlayCircle;
|
||||
playButton.Icon = editorClock.IsRunning ? FontAwesome.Regular.PauseCircle : FontAwesome.Regular.PlayCircle;
|
||||
}
|
||||
|
||||
private class PlaybackTabControl : OsuTabControl<double>
|
||||
|
@ -5,7 +5,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Components
|
||||
@ -15,7 +14,7 @@ namespace osu.Game.Screens.Edit.Components
|
||||
private readonly OsuSpriteText trackTimer;
|
||||
|
||||
[Resolved]
|
||||
private IAdjustableClock adjustableClock { get; set; }
|
||||
private EditorClock editorClock { get; set; }
|
||||
|
||||
public TimeInfoContainer()
|
||||
{
|
||||
@ -35,7 +34,7 @@ namespace osu.Game.Screens.Edit.Components
|
||||
{
|
||||
base.Update();
|
||||
|
||||
trackTimer.Text = TimeSpan.FromMilliseconds(adjustableClock.CurrentTime).ToString(@"mm\:ss\:fff");
|
||||
trackTimer.Text = TimeSpan.FromMilliseconds(editorClock.CurrentTime).ToString(@"mm\:ss\:fff");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
@ -20,14 +19,14 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||
/// </summary>
|
||||
public class MarkerPart : TimelinePart
|
||||
{
|
||||
private readonly Drawable marker;
|
||||
private Drawable marker;
|
||||
|
||||
private readonly IAdjustableClock adjustableClock;
|
||||
[Resolved]
|
||||
private EditorClock editorClock { get; set; }
|
||||
|
||||
public MarkerPart(IAdjustableClock adjustableClock)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
this.adjustableClock = adjustableClock;
|
||||
|
||||
Add(marker = new MarkerVisualisation());
|
||||
}
|
||||
|
||||
@ -59,14 +58,14 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||
return;
|
||||
|
||||
float markerPos = Math.Clamp(ToLocalSpace(screenPosition).X, 0, DrawWidth);
|
||||
adjustableClock.Seek(markerPos / DrawWidth * Beatmap.Value.Track.Length);
|
||||
editorClock.Seek(markerPos / DrawWidth * editorClock.TrackLength);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
marker.X = (float)adjustableClock.CurrentTime;
|
||||
marker.X = (float)editorClock.CurrentTime;
|
||||
}
|
||||
|
||||
protected override void LoadBeatmap(WorkingBeatmap beatmap)
|
||||
|
@ -6,7 +6,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
|
||||
|
||||
@ -18,11 +17,11 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
|
||||
public class SummaryTimeline : BottomBarContainer
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, IAdjustableClock adjustableClock)
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new MarkerPart(adjustableClock) { RelativeSizeAxes = Axes.Both },
|
||||
new MarkerPart { RelativeSizeAxes = Axes.Both },
|
||||
new ControlPointPart
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
|
Reference in New Issue
Block a user