2016-09-27 19:45:26 +08:00
|
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Drawables;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Online.Chat.Display
|
|
|
|
|
{
|
|
|
|
|
namespace osu.Online.Social
|
|
|
|
|
{
|
|
|
|
|
public class ChatLine : AutoSizeContainer
|
|
|
|
|
{
|
2016-09-28 15:33:20 +08:00
|
|
|
|
private readonly Message msg;
|
|
|
|
|
|
2016-09-27 19:45:26 +08:00
|
|
|
|
public ChatLine(Message msg)
|
|
|
|
|
{
|
2016-09-28 15:33:20 +08:00
|
|
|
|
this.msg = msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Load()
|
|
|
|
|
{
|
|
|
|
|
base.Load();
|
|
|
|
|
|
2016-10-01 17:40:14 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2016-09-27 19:45:26 +08:00
|
|
|
|
|
|
|
|
|
Add(new Box
|
|
|
|
|
{
|
2016-10-01 17:40:14 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2016-09-27 19:45:26 +08:00
|
|
|
|
Colour = Color4.Aqua,
|
|
|
|
|
Alpha = 0.2f
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Add(new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = msg.Timestamp.ToLocalTime().ToLongTimeString(),
|
|
|
|
|
Colour = new Color4(128, 128, 128, 255)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Add(new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = msg.User.Name,
|
|
|
|
|
Origin = Anchor.TopRight,
|
2016-10-01 17:40:14 +08:00
|
|
|
|
RelativePositionAxes = Axes.X,
|
2016-09-27 19:45:26 +08:00
|
|
|
|
Position = new Vector2(0.14f,0),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Add(new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = msg.Content,
|
2016-10-01 17:40:14 +08:00
|
|
|
|
RelativePositionAxes = Axes.X,
|
2016-09-27 19:45:26 +08:00
|
|
|
|
Position = new Vector2(0.15f, 0),
|
2016-10-01 17:40:14 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2016-09-27 19:45:26 +08:00
|
|
|
|
Size = new Vector2(0.85f, 1),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|