1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-10 03:33:41 +08:00
Files
osu-lazer/osu.Game/Screens/Play/ScrollingMessage.cs
T

45 lines
1.2 KiB
C#

// 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 osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Screens.Play
{
public partial class ScrollingMessage : CompositeDrawable
{
private readonly Drawable messageContent;
public ScrollingMessage(Drawable messageContent)
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
InternalChild = this.messageContent = messageContent;
}
protected override void LoadComplete()
{
base.LoadComplete();
messageContent.FadeInFromZero(2000, Easing.OutQuint);
resetMessagePosition();
}
protected override void Update()
{
base.Update();
if (messageContent.X + messageContent.DrawWidth > 0)
messageContent.X -= (float)Clock.ElapsedFrameTime * 0.05f;
else
resetMessagePosition();
}
private void resetMessagePosition()
{
messageContent.X = DrawWidth + 10;
}
}
}