mirror of
https://github.com/ppy/osu
synced 2024-12-14 10:57:41 +00:00
Merge pull request #14784 from smoogipoo/fix-taiko-fl
Fix taiko flashlight positioning/sizing incorrectly
This commit is contained in:
commit
b0957b8b6e
@ -36,24 +36,27 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
||||
public TaikoFlashlight(TaikoPlayfield taikoPlayfield)
|
||||
{
|
||||
this.taikoPlayfield = taikoPlayfield;
|
||||
FlashlightSize = new Vector2(0, getSizeFor(0));
|
||||
FlashlightSize = getSizeFor(0);
|
||||
|
||||
AddLayout(flashlightProperties);
|
||||
}
|
||||
|
||||
private float getSizeFor(int combo)
|
||||
private Vector2 getSizeFor(int combo)
|
||||
{
|
||||
float size = default_flashlight_size;
|
||||
|
||||
if (combo > 200)
|
||||
return default_flashlight_size * 0.8f;
|
||||
size *= 0.8f;
|
||||
else if (combo > 100)
|
||||
return default_flashlight_size * 0.9f;
|
||||
else
|
||||
return default_flashlight_size;
|
||||
size *= 0.9f;
|
||||
|
||||
// Preserve flashlight size through the playfield's aspect adjustment.
|
||||
return new Vector2(0, size * taikoPlayfield.DrawHeight / TaikoPlayfield.DEFAULT_HEIGHT);
|
||||
}
|
||||
|
||||
protected override void OnComboChange(ValueChangedEvent<int> e)
|
||||
{
|
||||
this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION);
|
||||
this.TransformTo(nameof(FlashlightSize), getSizeFor(e.NewValue), FLASHLIGHT_FADE_DURATION);
|
||||
}
|
||||
|
||||
protected override string FragmentShader => "CircularFlashlight";
|
||||
@ -64,7 +67,11 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
||||
|
||||
if (!flashlightProperties.IsValid)
|
||||
{
|
||||
FlashlightPosition = taikoPlayfield.HitTarget.ToSpaceOfOtherDrawable(taikoPlayfield.HitTarget.OriginPosition, this);
|
||||
FlashlightPosition = ToLocalSpace(taikoPlayfield.HitTarget.ScreenSpaceDrawQuad.Centre);
|
||||
|
||||
ClearTransforms(targetMember: nameof(FlashlightSize));
|
||||
FlashlightSize = getSizeFor(Combo.Value);
|
||||
|
||||
flashlightProperties.Validate();
|
||||
}
|
||||
}
|
||||
|
@ -69,9 +69,11 @@ namespace osu.Game.Rulesets.Mods
|
||||
public virtual void ApplyToDrawableRuleset(DrawableRuleset<T> drawableRuleset)
|
||||
{
|
||||
var flashlight = CreateFlashlight();
|
||||
flashlight.Combo = Combo;
|
||||
|
||||
flashlight.RelativeSizeAxes = Axes.Both;
|
||||
flashlight.Colour = Color4.Black;
|
||||
|
||||
flashlight.Combo.BindTo(Combo);
|
||||
drawableRuleset.KeyBindingInputManager.Add(flashlight);
|
||||
|
||||
flashlight.Breaks = drawableRuleset.Beatmap.Breaks;
|
||||
@ -81,7 +83,8 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
public abstract class Flashlight : Drawable
|
||||
{
|
||||
internal BindableInt Combo;
|
||||
public readonly BindableInt Combo = new BindableInt();
|
||||
|
||||
private IShader shader;
|
||||
|
||||
protected override DrawNode CreateDrawNode() => new FlashlightDrawNode(this);
|
||||
|
Loading…
Reference in New Issue
Block a user