mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 14:12:55 +08:00
apply suggestions
This commit is contained in:
parent
f0f7b15edc
commit
80bd98bb9d
@ -40,9 +40,9 @@ namespace osu.Game.Rulesets.Catch.Mods
|
||||
{
|
||||
base.Update();
|
||||
|
||||
var catcher = playfield.CatcherArea.MovableCatcher;
|
||||
var catcherArea = playfield.CatcherArea;
|
||||
|
||||
FlashlightPosition = catcher.ToSpaceOfOtherDrawable(catcher.Position, this);
|
||||
FlashlightPosition = catcherArea.ToSpaceOfOtherDrawable(catcherArea.MovableCatcher.DrawPosition, this);
|
||||
}
|
||||
|
||||
private float getSizeFor(int combo)
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Caching;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
@ -20,6 +21,8 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
|
||||
private class ManiaFlashlight : Flashlight
|
||||
{
|
||||
private readonly Cached flashlightProperties = new Cached();
|
||||
|
||||
public ManiaFlashlight()
|
||||
{
|
||||
FlashlightSize = new Vector2(0, default_flashlight_size);
|
||||
@ -29,29 +32,30 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
{
|
||||
if ((invalidation & Invalidation.DrawSize) > 0)
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
FlashlightSize = new Vector2(DrawWidth, FlashlightSize.Y);
|
||||
|
||||
FlashlightPosition = DrawPosition + DrawSize / 2;
|
||||
});
|
||||
flashlightProperties.Invalidate();
|
||||
}
|
||||
|
||||
return base.Invalidate(invalidation, source, shallPropagate);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (!flashlightProperties.IsValid)
|
||||
{
|
||||
FlashlightSize = new Vector2(DrawWidth, FlashlightSize.Y);
|
||||
|
||||
FlashlightPosition = DrawPosition + DrawSize / 2;
|
||||
flashlightProperties.Validate();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnComboChange(int newCombo)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string FragmentShader => "RectangularFlashlight";
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
FlashlightSize = new Vector2(DrawWidth, FlashlightSize.Y);
|
||||
|
||||
FlashlightPosition = DrawPosition + DrawSize / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Caching;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
@ -28,6 +29,7 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
||||
|
||||
private class TaikoFlashlight : Flashlight
|
||||
{
|
||||
private readonly Cached flashlightProperties = new Cached();
|
||||
private readonly TaikoPlayfield taikoPlayfield;
|
||||
|
||||
public TaikoFlashlight(TaikoPlayfield taikoPlayfield)
|
||||
@ -57,20 +59,21 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
||||
{
|
||||
if ((invalidation & Invalidation.DrawSize) > 0)
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
FlashlightPosition = taikoPlayfield.HitTarget.ToSpaceOfOtherDrawable(taikoPlayfield.HitTarget.OriginPosition, this);
|
||||
});
|
||||
flashlightProperties.Invalidate();
|
||||
}
|
||||
|
||||
return base.Invalidate(invalidation, source, shallPropagate);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
protected override void Update()
|
||||
{
|
||||
base.LoadComplete();
|
||||
base.Update();
|
||||
|
||||
FlashlightPosition = taikoPlayfield.HitTarget.ToSpaceOfOtherDrawable(taikoPlayfield.HitTarget.OriginPosition, this);
|
||||
if (!flashlightProperties.IsValid)
|
||||
{
|
||||
FlashlightPosition = taikoPlayfield.HitTarget.ToSpaceOfOtherDrawable(taikoPlayfield.HitTarget.OriginPosition, this);
|
||||
flashlightProperties.Validate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,8 +70,8 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
flashNode.Shader = shader;
|
||||
flashNode.ScreenSpaceDrawQuad = ScreenSpaceDrawQuad;
|
||||
flashNode.MousePosWrapper.FlashlightPosition = Vector2Extensions.Transform(FlashlightPosition, DrawInfo.Matrix);
|
||||
flashNode.MousePosWrapper.FlashlightSize = Vector2Extensions.Transform(FlashlightSize, DrawInfo.Matrix);
|
||||
flashNode.FlashlightPosition = Vector2Extensions.Transform(FlashlightPosition, DrawInfo.Matrix);
|
||||
flashNode.FlashlightSize = Vector2Extensions.Transform(FlashlightSize, DrawInfo.Matrix);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -128,17 +128,12 @@ namespace osu.Game.Rulesets.Mods
|
||||
}
|
||||
}
|
||||
|
||||
public struct FlashlightUniformWrapper
|
||||
{
|
||||
public Vector2 FlashlightPosition;
|
||||
public Vector2 FlashlightSize;
|
||||
}
|
||||
|
||||
private class FlashlightDrawNode : DrawNode
|
||||
{
|
||||
public Shader Shader;
|
||||
public Quad ScreenSpaceDrawQuad;
|
||||
public FlashlightUniformWrapper MousePosWrapper;
|
||||
public Vector2 FlashlightPosition;
|
||||
public Vector2 FlashlightSize;
|
||||
|
||||
public override void Draw(Action<TexturedVertex2D> vertexAction)
|
||||
{
|
||||
@ -146,8 +141,8 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
Shader.Bind();
|
||||
|
||||
Shader.GetUniform<Vector2>("flashlightPos").UpdateValue(ref MousePosWrapper.FlashlightPosition);
|
||||
Shader.GetUniform<Vector2>("flashlightSize").UpdateValue(ref MousePosWrapper.FlashlightSize);
|
||||
Shader.GetUniform<Vector2>("flashlightPos").UpdateValue(ref FlashlightPosition);
|
||||
Shader.GetUniform<Vector2>("flashlightSize").UpdateValue(ref FlashlightSize);
|
||||
|
||||
Texture.WhitePixel.DrawQuad(ScreenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: vertexAction);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user