mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Code quality touch-ups
This commit is contained in:
parent
86a5760ef4
commit
f6566f9157
@ -1,8 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Bindables;
|
||||
@ -26,18 +24,16 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public override string Name => "Bloom";
|
||||
public override string Acronym => "BM";
|
||||
public override ModType Type => ModType.Fun;
|
||||
public override LocalisableString Description => "The cursor blooms into a.. larger cursor!";
|
||||
public override LocalisableString Description => "The cursor blooms into.. a larger cursor!";
|
||||
public override double ScoreMultiplier => 1;
|
||||
protected const float MIN_SIZE = 1;
|
||||
protected const float TRANSITION_DURATION = 100;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModFlashlight), typeof(OsuModNoScope), typeof(OsuModObjectScaleTween), typeof(OsuModTouchDevice), typeof(OsuModAutopilot) };
|
||||
|
||||
|
||||
protected readonly BindableNumber<int> CurrentCombo = new BindableInt();
|
||||
protected readonly IBindable<bool> IsBreakTime = new Bindable<bool>();
|
||||
protected float ComboBasedSize;
|
||||
|
||||
|
||||
[SettingSource(
|
||||
"Max Size at Combo",
|
||||
"The combo count at which the cursor reaches its maximum size",
|
||||
@ -48,6 +44,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
MinValue = 5,
|
||||
MaxValue = 100,
|
||||
};
|
||||
|
||||
[SettingSource(
|
||||
"Final Size Multiplier",
|
||||
"The multiplier applied to cursor size when combo reaches maximum",
|
||||
@ -59,7 +56,9 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
MaxValue = 15f,
|
||||
Precision = 0.5f,
|
||||
};
|
||||
|
||||
public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
|
||||
|
||||
public void ApplyToPlayer(Player player)
|
||||
{
|
||||
IsBreakTime.BindTo(player.IsBreakTime);
|
||||
@ -74,20 +73,23 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
ComboBasedSize = Math.Min(MaxMulti.Value, 10 * ((float)combo.NewValue / MaxSizeComboCount.Value));
|
||||
ComboBasedSize = Math.Max(ComboBasedSize, MIN_SIZE);
|
||||
}, true
|
||||
);
|
||||
}, true);
|
||||
}
|
||||
|
||||
public void Update(Playfield playfield)
|
||||
{
|
||||
bool beBaseSize = IsBreakTime.Value;
|
||||
OsuPlayfield osuPlayfield = (OsuPlayfield)playfield;
|
||||
Debug.Assert(osuPlayfield.Cursor != null);
|
||||
|
||||
OsuCursor realCursor = (OsuCursor)osuPlayfield.Cursor.ActiveCursor;
|
||||
float currentCombSize = (float)Interpolation.Lerp(realCursor.CursorScale.Value, ComboBasedSize, Math.Clamp(osuPlayfield.Time.Elapsed / TRANSITION_DURATION, 0, 1));
|
||||
|
||||
if (beBaseSize)
|
||||
{
|
||||
realCursor.UpdateSize(1);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
realCursor.UpdateSize(currentCombSize);
|
||||
|
@ -100,6 +100,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
public void UpdateSize(float size)
|
||||
{
|
||||
cursorScale.Value = size;
|
||||
|
Loading…
Reference in New Issue
Block a user