2016-09-27 11:45:26 +00:00
|
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2016-10-07 13:51:10 +00:00
|
|
|
|
using System;
|
|
|
|
|
using osu.Framework.Configuration;
|
2016-09-27 11:45:26 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
2016-10-10 08:17:26 +00:00
|
|
|
|
using osu.Framework;
|
2016-10-12 03:22:19 +00:00
|
|
|
|
using osu.Framework.Graphics.Primitives;
|
2016-11-08 23:13:20 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2016-09-27 11:45:26 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Online.Chat.Display
|
|
|
|
|
{
|
|
|
|
|
namespace osu.Online.Social
|
|
|
|
|
{
|
2016-10-22 08:50:42 +00:00
|
|
|
|
public class ChatLine : Container
|
2016-09-27 11:45:26 +00:00
|
|
|
|
{
|
2016-10-07 13:51:10 +00:00
|
|
|
|
public readonly Message Message;
|
2016-09-28 07:33:20 +00:00
|
|
|
|
|
2016-10-08 14:25:38 +00:00
|
|
|
|
const float padding = 200;
|
|
|
|
|
const float text_size = 20;
|
|
|
|
|
|
2016-11-12 17:34:36 +00:00
|
|
|
|
public ChatLine(Message message)
|
2016-09-28 07:33:20 +00:00
|
|
|
|
{
|
2016-11-12 17:34:36 +00:00
|
|
|
|
this.Message = message;
|
|
|
|
|
|
2016-10-01 09:40:14 +00:00
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2016-10-22 08:50:42 +00:00
|
|
|
|
AutoSizeAxes = Axes.Y;
|
2016-09-27 11:45:26 +00:00
|
|
|
|
|
2016-10-08 14:25:38 +00:00
|
|
|
|
Children = new Drawable[]
|
2016-09-27 11:45:26 +00:00
|
|
|
|
{
|
2016-10-08 14:25:38 +00:00
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Size = new Vector2(padding, text_size),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new SpriteText
|
|
|
|
|
{
|
2016-10-13 13:42:51 +00:00
|
|
|
|
Text = Message.Timestamp.LocalDateTime.ToLongTimeString(),
|
2016-10-08 14:25:38 +00:00
|
|
|
|
TextSize = text_size,
|
|
|
|
|
Colour = new Color4(128, 128, 128, 255)
|
|
|
|
|
},
|
|
|
|
|
new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = Message.User.Name,
|
|
|
|
|
TextSize = text_size,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2016-10-22 08:50:42 +00:00
|
|
|
|
new Container
|
2016-10-08 14:25:38 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2016-10-22 08:50:42 +00:00
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2016-10-12 03:22:19 +00:00
|
|
|
|
Padding = new MarginPadding { Left = padding + 10 },
|
2016-10-08 14:25:38 +00:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = Message.Content,
|
|
|
|
|
TextSize = text_size,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2016-09-27 11:45:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|