mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:03:08 +08:00
Add setting to adjust replay analysis display length
This commit is contained in:
parent
0f01a855af
commit
a1cf67be62
@ -27,6 +27,7 @@ namespace osu.Game.Rulesets.Osu.Configuration
|
|||||||
SetDefault(OsuRulesetSetting.ReplayFrameMarkersEnabled, false);
|
SetDefault(OsuRulesetSetting.ReplayFrameMarkersEnabled, false);
|
||||||
SetDefault(OsuRulesetSetting.ReplayCursorPathEnabled, false);
|
SetDefault(OsuRulesetSetting.ReplayCursorPathEnabled, false);
|
||||||
SetDefault(OsuRulesetSetting.ReplayCursorHideEnabled, false);
|
SetDefault(OsuRulesetSetting.ReplayCursorHideEnabled, false);
|
||||||
|
SetDefault(OsuRulesetSetting.ReplayAnalysisDisplayLength, 750);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,5 +44,6 @@ namespace osu.Game.Rulesets.Osu.Configuration
|
|||||||
ReplayFrameMarkersEnabled,
|
ReplayFrameMarkersEnabled,
|
||||||
ReplayCursorPathEnabled,
|
ReplayCursorPathEnabled,
|
||||||
ReplayCursorHideEnabled,
|
ReplayCursorHideEnabled,
|
||||||
|
ReplayAnalysisDisplayLength,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,10 @@ namespace osu.Game.Rulesets.Osu.UI.ReplayAnalysis
|
|||||||
|
|
||||||
public Vector2 Position { get; }
|
public Vector2 Position { get; }
|
||||||
|
|
||||||
public AnalysisFrameEntry(double time, Vector2 position, params OsuAction[] action)
|
public AnalysisFrameEntry(double time, double displayLength, Vector2 position, params OsuAction[] action)
|
||||||
{
|
{
|
||||||
LifetimeStart = time;
|
LifetimeStart = time;
|
||||||
LifetimeEnd = time + 1_000;
|
LifetimeEnd = time + displayLength;
|
||||||
Position = position;
|
Position = position;
|
||||||
Action = action;
|
Action = action;
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,11 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
private BindableBool showClickMarkers { get; } = new BindableBool();
|
private BindableBool showClickMarkers { get; } = new BindableBool();
|
||||||
private BindableBool showFrameMarkers { get; } = new BindableBool();
|
private BindableBool showFrameMarkers { get; } = new BindableBool();
|
||||||
private BindableBool showCursorPath { get; } = new BindableBool();
|
private BindableBool showCursorPath { get; } = new BindableBool();
|
||||||
|
private BindableInt displayLength { get; } = new BindableInt();
|
||||||
|
|
||||||
protected readonly ClickMarkerContainer ClickMarkers;
|
protected ClickMarkerContainer ClickMarkers = null!;
|
||||||
protected readonly FrameMarkerContainer FrameMarkers;
|
protected FrameMarkerContainer FrameMarkers = null!;
|
||||||
protected readonly CursorPathContainer CursorPath;
|
protected CursorPathContainer CursorPath = null!;
|
||||||
|
|
||||||
private readonly Replay replay;
|
private readonly Replay replay;
|
||||||
|
|
||||||
@ -29,36 +30,65 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
this.replay = replay;
|
this.replay = replay;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
|
||||||
CursorPath = new CursorPathContainer(),
|
|
||||||
ClickMarkers = new ClickMarkerContainer(),
|
|
||||||
FrameMarkers = new FrameMarkerContainer(),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool requireDisplay => showClickMarkers.Value || showFrameMarkers.Value || showCursorPath.Value;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuRulesetConfigManager config)
|
private void load(OsuRulesetConfigManager config)
|
||||||
{
|
{
|
||||||
loadReplay();
|
|
||||||
|
|
||||||
config.BindWith(OsuRulesetSetting.ReplayClickMarkersEnabled, showClickMarkers);
|
config.BindWith(OsuRulesetSetting.ReplayClickMarkersEnabled, showClickMarkers);
|
||||||
config.BindWith(OsuRulesetSetting.ReplayFrameMarkersEnabled, showFrameMarkers);
|
config.BindWith(OsuRulesetSetting.ReplayFrameMarkersEnabled, showFrameMarkers);
|
||||||
config.BindWith(OsuRulesetSetting.ReplayCursorPathEnabled, showCursorPath);
|
config.BindWith(OsuRulesetSetting.ReplayCursorPathEnabled, showCursorPath);
|
||||||
|
config.BindWith(OsuRulesetSetting.ReplayAnalysisDisplayLength, displayLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
showClickMarkers.BindValueChanged(enabled => ClickMarkers.FadeTo(enabled.NewValue ? 1 : 0), true);
|
showClickMarkers.BindValueChanged(enabled =>
|
||||||
showFrameMarkers.BindValueChanged(enabled => FrameMarkers.FadeTo(enabled.NewValue ? 1 : 0), true);
|
{
|
||||||
showCursorPath.BindValueChanged(enabled => CursorPath.FadeTo(enabled.NewValue ? 1 : 0), true);
|
initialise();
|
||||||
|
ClickMarkers.FadeTo(enabled.NewValue ? 1 : 0);
|
||||||
|
}, true);
|
||||||
|
showFrameMarkers.BindValueChanged(enabled =>
|
||||||
|
{
|
||||||
|
initialise();
|
||||||
|
FrameMarkers.FadeTo(enabled.NewValue ? 1 : 0);
|
||||||
|
}, true);
|
||||||
|
showCursorPath.BindValueChanged(enabled =>
|
||||||
|
{
|
||||||
|
initialise();
|
||||||
|
CursorPath.FadeTo(enabled.NewValue ? 1 : 0);
|
||||||
|
}, true);
|
||||||
|
displayLength.BindValueChanged(_ =>
|
||||||
|
{
|
||||||
|
isLoaded = false;
|
||||||
|
initialise();
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadReplay()
|
private bool isLoaded;
|
||||||
|
|
||||||
|
private void initialise()
|
||||||
{
|
{
|
||||||
|
if (!requireDisplay)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (isLoaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
isLoaded = true;
|
||||||
|
|
||||||
|
// It's faster to reinitialise the whole drawable stack than use `Clear` on `PooledDrawableWithLifetimeContainer`
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
CursorPath = new CursorPathContainer(),
|
||||||
|
ClickMarkers = new ClickMarkerContainer(),
|
||||||
|
FrameMarkers = new FrameMarkerContainer(),
|
||||||
|
};
|
||||||
|
|
||||||
bool leftHeld = false;
|
bool leftHeld = false;
|
||||||
bool rightHeld = false;
|
bool rightHeld = false;
|
||||||
|
|
||||||
@ -74,7 +104,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
else if (!leftHeld && leftButton)
|
else if (!leftHeld && leftButton)
|
||||||
{
|
{
|
||||||
leftHeld = true;
|
leftHeld = true;
|
||||||
ClickMarkers.Add(new AnalysisFrameEntry(osuFrame.Time, osuFrame.Position, OsuAction.LeftButton));
|
ClickMarkers.Add(new AnalysisFrameEntry(osuFrame.Time, displayLength.Value, osuFrame.Position, OsuAction.LeftButton));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rightHeld && !rightButton)
|
if (rightHeld && !rightButton)
|
||||||
@ -82,11 +112,11 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
else if (!rightHeld && rightButton)
|
else if (!rightHeld && rightButton)
|
||||||
{
|
{
|
||||||
rightHeld = true;
|
rightHeld = true;
|
||||||
ClickMarkers.Add(new AnalysisFrameEntry(osuFrame.Time, osuFrame.Position, OsuAction.RightButton));
|
ClickMarkers.Add(new AnalysisFrameEntry(osuFrame.Time, displayLength.Value, osuFrame.Position, OsuAction.RightButton));
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameMarkers.Add(new AnalysisFrameEntry(osuFrame.Time, osuFrame.Position, osuFrame.Actions.ToArray()));
|
FrameMarkers.Add(new AnalysisFrameEntry(osuFrame.Time, displayLength.Value, osuFrame.Position, osuFrame.Actions.ToArray()));
|
||||||
CursorPath.Add(new AnalysisFrameEntry(osuFrame.Time, osuFrame.Position));
|
CursorPath.Add(new AnalysisFrameEntry(osuFrame.Time, displayLength.Value, osuFrame.Position));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,15 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
[SettingSource("Hide gameplay cursor", SettingControlType = typeof(PlayerCheckbox))]
|
[SettingSource("Hide gameplay cursor", SettingControlType = typeof(PlayerCheckbox))]
|
||||||
public BindableBool HideSkinCursor { get; } = new BindableBool();
|
public BindableBool HideSkinCursor { get; } = new BindableBool();
|
||||||
|
|
||||||
|
[SettingSource("Display length", SettingControlType = typeof(PlayerSliderBar<int>))]
|
||||||
|
public BindableInt DisplayLength { get; } = new BindableInt
|
||||||
|
{
|
||||||
|
MinValue = 100,
|
||||||
|
Default = 800,
|
||||||
|
MaxValue = 2000,
|
||||||
|
Precision = 100,
|
||||||
|
};
|
||||||
|
|
||||||
public ReplayAnalysisSettings(OsuRulesetConfigManager config)
|
public ReplayAnalysisSettings(OsuRulesetConfigManager config)
|
||||||
: base("Analysis Settings")
|
: base("Analysis Settings")
|
||||||
{
|
{
|
||||||
@ -40,6 +49,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
config.BindWith(OsuRulesetSetting.ReplayFrameMarkersEnabled, ShowAimMarkers);
|
config.BindWith(OsuRulesetSetting.ReplayFrameMarkersEnabled, ShowAimMarkers);
|
||||||
config.BindWith(OsuRulesetSetting.ReplayCursorPathEnabled, ShowCursorPath);
|
config.BindWith(OsuRulesetSetting.ReplayCursorPathEnabled, ShowCursorPath);
|
||||||
config.BindWith(OsuRulesetSetting.ReplayCursorHideEnabled, HideSkinCursor);
|
config.BindWith(OsuRulesetSetting.ReplayCursorHideEnabled, HideSkinCursor);
|
||||||
|
config.BindWith(OsuRulesetSetting.ReplayAnalysisDisplayLength, DisplayLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user