mirror of
https://github.com/ppy/osu.git
synced 2025-01-08 00:02:54 +08:00
Improve formatting of chat lines.
This commit is contained in:
parent
754d9c78bd
commit
67652a6d8e
@ -15,6 +15,7 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.Chat.Display.osu.Online.Social;
|
||||||
|
|
||||||
namespace osu.Desktop.Tests
|
namespace osu.Desktop.Tests
|
||||||
{
|
{
|
||||||
@ -105,10 +106,7 @@ namespace osu.Desktop.Tests
|
|||||||
// osu.Messages[0].Drawable.Expire();
|
// osu.Messages[0].Drawable.Expire();
|
||||||
// osu.Messages.RemoveAt(0);
|
// osu.Messages.RemoveAt(0);
|
||||||
//}
|
//}
|
||||||
flow.Add(new SpriteText
|
flow.Add(new ChatLine(m));
|
||||||
{
|
|
||||||
Text = $@"{m.User.Name}: {m.Content}"
|
|
||||||
});
|
|
||||||
channel.Messages.Add(m);
|
channel.Messages.Add(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
53
osu.Game/Online/Chat/Display/ChatLine.cs
Normal file
53
osu.Game/Online/Chat/Display/ChatLine.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
//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
|
||||||
|
{
|
||||||
|
public ChatLine(Message msg)
|
||||||
|
{
|
||||||
|
SizeMode = InheritMode.X;
|
||||||
|
|
||||||
|
Add(new Box
|
||||||
|
{
|
||||||
|
SizeMode = InheritMode.XY,
|
||||||
|
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,
|
||||||
|
PositionMode = InheritMode.X,
|
||||||
|
Position = new Vector2(0.14f,0),
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(new SpriteText
|
||||||
|
{
|
||||||
|
Text = msg.Content,
|
||||||
|
PositionMode = InheritMode.X,
|
||||||
|
Position = new Vector2(0.15f, 0),
|
||||||
|
SizeMode = InheritMode.X,
|
||||||
|
Size = new Vector2(0.85f, 1),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -61,6 +61,7 @@
|
|||||||
<Compile Include="Online\API\SecurePassword.cs" />
|
<Compile Include="Online\API\SecurePassword.cs" />
|
||||||
<Compile Include="Online\API\Requests\ListChannels.cs" />
|
<Compile Include="Online\API\Requests\ListChannels.cs" />
|
||||||
<Compile Include="Online\Chat\Channel.cs" />
|
<Compile Include="Online\Chat\Channel.cs" />
|
||||||
|
<Compile Include="Online\Chat\Display\ChatLine.cs" />
|
||||||
<Compile Include="Online\Chat\Message.cs" />
|
<Compile Include="Online\Chat\Message.cs" />
|
||||||
<Compile Include="Online\User.cs" />
|
<Compile Include="Online\User.cs" />
|
||||||
<Compile Include="OsuGame.cs" />
|
<Compile Include="OsuGame.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user