mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:22:55 +08:00
Make SongProgress
a skinnable component
This commit is contained in:
parent
1f3ae901ce
commit
da0913ca2d
@ -63,7 +63,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
private void seekToBreak(int breakIndex)
|
private void seekToBreak(int breakIndex)
|
||||||
{
|
{
|
||||||
AddStep($"seek to break {breakIndex}", () => Player.GameplayClockContainer.Seek(destBreak().StartTime));
|
AddStep($"seek to break {breakIndex}", () => Player.GameplayClockContainer.Seek(destBreak().StartTime));
|
||||||
AddUntilStep("wait for seek to complete", () => Player.HUDOverlay.Progress.ReferenceClock.CurrentTime >= destBreak().StartTime);
|
AddUntilStep("wait for seek to complete", () => Player.DrawableRuleset.FrameStableClock.CurrentTime >= destBreak().StartTime);
|
||||||
|
|
||||||
BreakPeriod destBreak() => Beatmap.Value.Beatmap.Breaks.ElementAt(breakIndex);
|
BreakPeriod destBreak() => Beatmap.Value.Beatmap.Breaks.ElementAt(breakIndex);
|
||||||
}
|
}
|
||||||
|
@ -358,11 +358,6 @@ namespace osu.Game.Screens.Play
|
|||||||
AlwaysVisible = { BindTarget = DrawableRuleset.HasReplayLoaded },
|
AlwaysVisible = { BindTarget = DrawableRuleset.HasReplayLoaded },
|
||||||
IsCounting = false
|
IsCounting = false
|
||||||
},
|
},
|
||||||
RequestSeek = time =>
|
|
||||||
{
|
|
||||||
GameplayClockContainer.Seek(time);
|
|
||||||
GameplayClockContainer.Start();
|
|
||||||
},
|
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
},
|
},
|
||||||
|
@ -14,10 +14,11 @@ using osu.Framework.Timing;
|
|||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class SongProgress : OverlayContainer
|
public class SongProgress : OverlayContainer, ISkinnableDrawable
|
||||||
{
|
{
|
||||||
private const int info_height = 20;
|
private const int info_height = 20;
|
||||||
private const int bottom_bar_height = 5;
|
private const int bottom_bar_height = 5;
|
||||||
@ -39,9 +40,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public readonly Bindable<bool> ShowGraph = new Bindable<bool>();
|
public readonly Bindable<bool> ShowGraph = new Bindable<bool>();
|
||||||
|
|
||||||
//TODO: this isn't always correct (consider mania where a non-last object may last for longer than the last in the list).
|
|
||||||
private double lastHitTime => objects.Last().GetEndTime() + 1;
|
|
||||||
|
|
||||||
public override bool HandleNonPositionalInput => AllowSeeking.Value;
|
public override bool HandleNonPositionalInput => AllowSeeking.Value;
|
||||||
public override bool HandlePositionalInput => AllowSeeking.Value;
|
public override bool HandlePositionalInput => AllowSeeking.Value;
|
||||||
|
|
||||||
@ -49,6 +47,9 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private double firstHitTime => objects.First().StartTime;
|
private double firstHitTime => objects.First().StartTime;
|
||||||
|
|
||||||
|
//TODO: this isn't always correct (consider mania where a non-last object may last for longer than the last in the list).
|
||||||
|
private double lastHitTime => objects.Last().GetEndTime() + 1;
|
||||||
|
|
||||||
private IEnumerable<HitObject> objects;
|
private IEnumerable<HitObject> objects;
|
||||||
|
|
||||||
public IEnumerable<HitObject> Objects
|
public IEnumerable<HitObject> Objects
|
||||||
@ -67,10 +68,12 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public IClock ReferenceClock;
|
public IClock ReferenceClock;
|
||||||
|
|
||||||
private IClock gameplayClock;
|
|
||||||
|
|
||||||
public SongProgress()
|
public SongProgress()
|
||||||
{
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Anchor = Anchor.BottomRight;
|
||||||
|
Origin = Anchor.BottomRight;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SongProgressDisplay
|
new SongProgressDisplay
|
||||||
@ -96,20 +99,34 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
OnSeek = time => RequestSeek?.Invoke(time),
|
OnSeek = seek,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void seek(double time)
|
||||||
|
{
|
||||||
|
if (gameplayClock == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
private GameplayClock gameplayClock { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuColour colours, GameplayClock clock, OsuConfigManager config)
|
private void load(OsuColour colours, OsuConfigManager config, DrawableRuleset drawableRuleset)
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
if (clock != null)
|
if (drawableRuleset != null)
|
||||||
gameplayClock = clock;
|
{
|
||||||
|
AllowSeeking.BindTo(drawableRuleset.HasReplayLoaded);
|
||||||
|
Objects = drawableRuleset.Objects;
|
||||||
|
}
|
||||||
|
|
||||||
config.BindWith(OsuSetting.ShowProgressGraph, ShowGraph);
|
config.BindWith(OsuSetting.ShowProgressGraph, ShowGraph);
|
||||||
|
|
||||||
@ -124,11 +141,6 @@ namespace osu.Game.Screens.Play
|
|||||||
ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true);
|
ShowGraph.BindValueChanged(_ => updateGraphVisibility(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BindDrawableRuleset(DrawableRuleset drawableRuleset)
|
|
||||||
{
|
|
||||||
AllowSeeking.BindTo(drawableRuleset.HasReplayLoaded);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
this.FadeIn(500, Easing.OutQuint);
|
this.FadeIn(500, Easing.OutQuint);
|
||||||
|
@ -12,6 +12,7 @@ using osu.Framework.Graphics.Textures;
|
|||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -86,6 +87,7 @@ namespace osu.Game.Skinning
|
|||||||
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.ScoreCounter)),
|
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.ScoreCounter)),
|
||||||
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.AccuracyCounter)),
|
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.AccuracyCounter)),
|
||||||
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.HealthDisplay)),
|
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.HealthDisplay)),
|
||||||
|
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.SongProgress)),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -109,6 +111,9 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
case HUDSkinComponents.HealthDisplay:
|
case HUDSkinComponents.HealthDisplay:
|
||||||
return new DefaultHealthDisplay();
|
return new DefaultHealthDisplay();
|
||||||
|
|
||||||
|
case HUDSkinComponents.SongProgress:
|
||||||
|
return new SongProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -9,5 +9,6 @@ namespace osu.Game.Skinning
|
|||||||
ScoreCounter,
|
ScoreCounter,
|
||||||
AccuracyCounter,
|
AccuracyCounter,
|
||||||
HealthDisplay,
|
HealthDisplay,
|
||||||
|
SongProgress,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ using osu.Game.Audio;
|
|||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -350,6 +351,7 @@ namespace osu.Game.Skinning
|
|||||||
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.ScoreCounter)) ?? new DefaultScoreCounter(),
|
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.ScoreCounter)) ?? new DefaultScoreCounter(),
|
||||||
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.AccuracyCounter)) ?? new DefaultAccuracyCounter(),
|
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.AccuracyCounter)) ?? new DefaultAccuracyCounter(),
|
||||||
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.HealthDisplay)) ?? new DefaultHealthDisplay(),
|
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.HealthDisplay)) ?? new DefaultHealthDisplay(),
|
||||||
|
GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.SongProgress)) ?? new SongProgress(),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user