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