mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Simplify fade out gradient code.
This commit is contained in:
parent
f785af1222
commit
09bf014ded
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Colour;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select.Leaderboards
|
namespace osu.Game.Screens.Select.Leaderboards
|
||||||
{
|
{
|
||||||
@ -80,22 +81,25 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
var fadeStart = scrollContainer.DrawHeight - 10;
|
var fadeStart = scrollContainer.Current + scrollContainer.DrawHeight;
|
||||||
fadeStart += scrollContainer.IsScrolledToEnd() ? LeaderboardScore.HEIGHT : 0;
|
|
||||||
|
|
||||||
foreach (var s in scrollFlow.Children)
|
if (!scrollContainer.IsScrolledToEnd())
|
||||||
|
fadeStart -= LeaderboardScore.HEIGHT;
|
||||||
|
|
||||||
|
foreach (var c in scrollFlow.Children)
|
||||||
{
|
{
|
||||||
var topY = scrollContainer.ScrollContent.DrawPosition.Y + s.DrawPosition.Y;
|
var topY = c.ToSpaceOfOtherDrawable(Vector2.Zero, scrollFlow).Y;
|
||||||
var bottomY = topY + LeaderboardScore.HEIGHT;
|
var bottomY = topY + LeaderboardScore.HEIGHT;
|
||||||
|
|
||||||
if (topY < fadeStart - LeaderboardScore.HEIGHT * 2)
|
if (bottomY < fadeStart)
|
||||||
{
|
c.Colour = Color4.White;
|
||||||
s.Colour = Color4.White;
|
else if (topY > fadeStart + LeaderboardScore.HEIGHT)
|
||||||
}
|
c.Colour = Color4.Transparent;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s.ColourInfo = ColourInfo.GradientVertical(Color4.White.Opacity(System.Math.Min((fadeStart - topY) / LeaderboardScore.HEIGHT, 1)),
|
c.ColourInfo = ColourInfo.GradientVertical(
|
||||||
Color4.White.Opacity(System.Math.Min((fadeStart - bottomY) / LeaderboardScore.HEIGHT, 1)));
|
Color4.White.Opacity(Math.Min(1 - (topY - fadeStart) / LeaderboardScore.HEIGHT, 1)),
|
||||||
|
Color4.White.Opacity(Math.Min(1 - (bottomY - fadeStart) / LeaderboardScore.HEIGHT, 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user