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