1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-10 03:17:19 +08:00

Hide scrollbars in tournament chat display

This commit is contained in:
Dean Herbert 2020-03-23 12:03:33 +09:00
parent 4fbf94f963
commit 1b6342438f
3 changed files with 36 additions and 7 deletions

View File

@ -70,6 +70,17 @@ namespace osu.Game.Tournament.Components
protected override ChatLine CreateMessage(Message message) => new MatchMessage(message); protected override ChatLine CreateMessage(Message message) => new MatchMessage(message);
protected override StandAloneDrawableChannel CreateDrawableChannel(Channel channel) => new MatchChannel(channel);
public class MatchChannel : StandAloneDrawableChannel
{
public MatchChannel(Channel channel)
: base(channel)
{
ScrollbarVisible = false;
}
}
protected class MatchMessage : StandAloneMessage protected class MatchMessage : StandAloneMessage
{ {
public MatchMessage(Message message) public MatchMessage(Message message)

View File

@ -26,7 +26,7 @@ namespace osu.Game.Online.Chat
protected ChannelManager ChannelManager; protected ChannelManager ChannelManager;
private DrawableChannel drawableChannel; private StandAloneDrawableChannel drawableChannel;
private readonly bool postingTextbox; private readonly bool postingTextbox;
@ -77,6 +77,9 @@ namespace osu.Game.Online.Chat
ChannelManager = manager; ChannelManager = manager;
} }
protected virtual StandAloneDrawableChannel CreateDrawableChannel(Channel channel) =>
new StandAloneDrawableChannel(channel);
private void postMessage(TextBox sender, bool newtext) private void postMessage(TextBox sender, bool newtext)
{ {
var text = textbox.Text.Trim(); var text = textbox.Text.Trim();
@ -100,14 +103,14 @@ namespace osu.Game.Online.Chat
if (e.NewValue == null) return; if (e.NewValue == null) return;
AddInternal(drawableChannel = new StandAloneDrawableChannel(e.NewValue) drawableChannel = CreateDrawableChannel(e.NewValue);
{ drawableChannel.CreateChatLineAction = CreateMessage;
CreateChatLineAction = CreateMessage, drawableChannel.Padding = new MarginPadding { Bottom = postingTextbox ? textbox_height : 0 };
Padding = new MarginPadding { Bottom = postingTextbox ? textbox_height : 0 }
}); AddInternal(drawableChannel);
} }
protected class StandAloneDrawableChannel : DrawableChannel public class StandAloneDrawableChannel : DrawableChannel
{ {
public Func<Message, ChatLine> CreateChatLineAction; public Func<Message, ChatLine> CreateChatLineAction;

View File

@ -26,6 +26,20 @@ namespace osu.Game.Overlays.Chat
protected FillFlowContainer ChatLineFlow; protected FillFlowContainer ChatLineFlow;
private OsuScrollContainer scroll; private OsuScrollContainer scroll;
private bool scrollbarVisible = true;
public bool ScrollbarVisible
{
set
{
if (scrollbarVisible == value) return;
scrollbarVisible = value;
if (scroll != null)
scroll.ScrollbarVisible = value;
}
}
[Resolved] [Resolved]
private OsuColour colours { get; set; } private OsuColour colours { get; set; }
@ -44,6 +58,7 @@ namespace osu.Game.Overlays.Chat
Masking = true, Masking = true,
Child = scroll = new OsuScrollContainer Child = scroll = new OsuScrollContainer
{ {
ScrollbarVisible = scrollbarVisible,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
// Some chat lines have effects that slightly protrude to the bottom, // Some chat lines have effects that slightly protrude to the bottom,
// which we do not want to mask away, hence the padding. // which we do not want to mask away, hence the padding.