1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:47:29 +08:00

Fix padding, fonts and alignment of chat display.

This commit is contained in:
Dean Herbert 2017-02-19 17:06:41 +09:00
parent 5721e7f2d2
commit 0da0ef5a1b
4 changed files with 13 additions and 10 deletions

View File

@ -4,7 +4,6 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
@ -15,7 +14,7 @@ namespace osu.Game.Online.Chat.Drawables
{
public readonly Message Message;
const float padding = 200;
const float padding = 250;
const float text_size = 20;
public ChatLine(Message message)
@ -25,6 +24,8 @@ namespace osu.Game.Online.Chat.Drawables
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Padding = new MarginPadding { Left = 15, Right = 15 };
Children = new Drawable[]
{
new Container
@ -34,13 +35,15 @@ namespace osu.Game.Online.Chat.Drawables
{
new OsuSpriteText
{
Text = Message.Timestamp.LocalDateTime.ToLongTimeString(),
Text = $@"{Message.Timestamp.LocalDateTime:hh:mm:ss}",
FixedWidth = true,
TextSize = text_size,
Colour = Color4.Gray
},
new OsuSpriteText
{
Text = Message.User.Name,
Font = @"Exo2.0-BoldItalic",
Text = $@"{Message.User.Name}:",
TextSize = text_size,
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
@ -51,7 +54,7 @@ namespace osu.Game.Online.Chat.Drawables
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = padding + 10 },
Padding = new MarginPadding { Left = padding + 15 },
Children = new Drawable[]
{
new OsuSpriteText

View File

@ -13,12 +13,12 @@ using OpenTK;
namespace osu.Game.Online.Chat.Drawables
{
public class ChannelDisplay : Container
public class DrawableChannel : Container
{
private readonly Channel channel;
private FlowContainer flow;
public ChannelDisplay(Channel channel)
public DrawableChannel(Channel channel)
{
this.channel = channel;
newMessages(channel.Messages);

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays
{
public class ChatOverlay : OverlayContainer, IOnlineComponent
{
private ChannelDisplay channelDisplay;
private DrawableChannel channelDisplay;
private ScheduledDelegate messageRequest;
@ -69,7 +69,7 @@ namespace osu.Game.Overlays
private void addChannel(Channel channel)
{
Add(channelDisplay = new ChannelDisplay(channel));
Add(channelDisplay = new DrawableChannel(channel));
careChannels.Add(channel);
}

View File

@ -189,7 +189,7 @@
<Compile Include="Online\API\SecurePassword.cs" />
<Compile Include="Online\API\Requests\ListChannels.cs" />
<Compile Include="Online\Chat\Channel.cs" />
<Compile Include="Online\Chat\Drawables\ChannelDisplay.cs" />
<Compile Include="Online\Chat\Drawables\DrawableChannel.cs" />
<Compile Include="Online\Chat\Drawables\ChatLine.cs" />
<Compile Include="Online\Chat\Message.cs" />
<Compile Include="Online\User.cs" />