mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 09:32:55 +08:00
Scale OsuResumeCursor with gameplay cursor
This commit is contained in:
parent
13924174c4
commit
fdc17d2adb
@ -29,9 +29,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
|
||||
private readonly Drawable cursorTrail;
|
||||
|
||||
public IBindable<float> CalculatedCursorScale => calculatedCursorScale;
|
||||
private Bindable<float> calculatedCursorScale;
|
||||
private Bindable<float> cursorScale;
|
||||
private Bindable<bool> autoCursorScale;
|
||||
private float calculatedCursorScale;
|
||||
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
public OsuCursorContainer()
|
||||
@ -57,6 +58,9 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
autoCursorScale = config.GetBindable<bool>(OsuSetting.AutoCursorSize);
|
||||
autoCursorScale.ValueChanged += _ => calculateScale();
|
||||
|
||||
calculatedCursorScale = new Bindable<float>();
|
||||
calculatedCursorScale.ValueChanged += e => ActiveCursor.Scale = cursorTrail.Scale = new Vector2(e.NewValue);
|
||||
|
||||
calculateScale();
|
||||
}
|
||||
|
||||
@ -70,8 +74,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
scale *= 1f - 0.7f * (1f + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY;
|
||||
}
|
||||
|
||||
calculatedCursorScale = scale;
|
||||
ActiveCursor.Scale = cursorTrail.Scale = new Vector2(scale);
|
||||
calculatedCursorScale.Value = scale;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -127,13 +130,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
protected override void PopIn()
|
||||
{
|
||||
fadeContainer.FadeTo(1, 300, Easing.OutQuint);
|
||||
ActiveCursor.ScaleTo(calculatedCursorScale, 400, Easing.OutQuint);
|
||||
ActiveCursor.ScaleTo(calculatedCursorScale.Value, 400, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint);
|
||||
ActiveCursor.ScaleTo(calculatedCursorScale * 0.8f, 450, Easing.OutQuint);
|
||||
ActiveCursor.ScaleTo(calculatedCursorScale.Value * 0.8f, 450, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private class DefaultCursorTrail : CursorTrail
|
||||
|
@ -38,7 +38,13 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
clickToResumeCursor.ShowAt(GameplayCursor.ActiveCursor.Position);
|
||||
|
||||
if (localCursorContainer == null)
|
||||
Add(localCursorContainer = new OsuCursorContainer());
|
||||
{
|
||||
var newContainer = new OsuCursorContainer();
|
||||
Add(localCursorContainer = newContainer);
|
||||
|
||||
clickToResumeCursor.CursorScale = newContainer.CalculatedCursorScale.Value;
|
||||
newContainer.CalculatedCursorScale.ValueChanged += e => clickToResumeCursor.CursorScale = e.NewValue;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
@ -57,6 +63,8 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
|
||||
public Action ResumeRequested;
|
||||
|
||||
public float CursorScale;
|
||||
|
||||
public OsuClickToResumeCursor()
|
||||
{
|
||||
RelativePositionAxes = Axes.Both;
|
||||
@ -82,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
case OsuAction.RightButton:
|
||||
if (!IsHovered) return false;
|
||||
|
||||
this.ScaleTo(new Vector2(2), TRANSITION_TIME, Easing.OutQuint);
|
||||
this.ScaleTo(2 * CursorScale, TRANSITION_TIME, Easing.OutQuint);
|
||||
|
||||
ResumeRequested?.Invoke();
|
||||
return true;
|
||||
@ -97,7 +105,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
{
|
||||
updateColour();
|
||||
this.MoveTo(activeCursorPosition);
|
||||
this.ScaleTo(new Vector2(4)).Then().ScaleTo(Vector2.One, 1000, Easing.OutQuint);
|
||||
this.ScaleTo(4 * CursorScale).Then().ScaleTo(CursorScale, 1000, Easing.OutQuint);
|
||||
});
|
||||
|
||||
private void updateColour()
|
||||
|
Loading…
Reference in New Issue
Block a user