Merge pull request #11822 from peppy/chat-login-placeholder

Add login placeholder for chat overlay
This commit is contained in:
Dan Balasescu
2021-02-18 19:36:30 +09:00
committed by GitHub
2 changed files with 38 additions and 30 deletions

View File

@ -15,7 +15,7 @@ namespace osu.Game.Online
/// A <see cref="Container"/> for displaying online content which require a local user to be logged in. /// A <see cref="Container"/> for displaying online content which require a local user to be logged in.
/// Shows its children only when the local user is logged in and supports displaying a placeholder if not. /// Shows its children only when the local user is logged in and supports displaying a placeholder if not.
/// </summary> /// </summary>
public abstract class OnlineViewContainer : Container public class OnlineViewContainer : Container
{ {
protected LoadingSpinner LoadingSpinner { get; private set; } protected LoadingSpinner LoadingSpinner { get; private set; }
@ -30,7 +30,7 @@ namespace osu.Game.Online
[Resolved] [Resolved]
protected IAPIProvider API { get; private set; } protected IAPIProvider API { get; private set; }
protected OnlineViewContainer(string placeholderMessage) public OnlineViewContainer(string placeholderMessage)
{ {
this.placeholderMessage = placeholderMessage; this.placeholderMessage = placeholderMessage;
} }

View File

@ -24,6 +24,7 @@ using osu.Game.Overlays.Chat.Tabs;
using osuTK.Input; using osuTK.Input;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Online;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -118,40 +119,47 @@ namespace osu.Game.Overlays
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
currentChannelContainer = new Container<DrawableChannel> new OnlineViewContainer("Sign in to chat")
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding
{
Bottom = textbox_height
},
},
new Container
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
Height = textbox_height,
Padding = new MarginPadding
{
Top = padding * 2,
Bottom = padding * 2,
Left = ChatLine.LEFT_PADDING + padding * 2,
Right = padding * 2,
},
Children = new Drawable[] Children = new Drawable[]
{ {
textbox = new FocusedTextBox currentChannelContainer = new Container<DrawableChannel>
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 1, Padding = new MarginPadding
PlaceholderText = "type your message", {
ReleaseFocusOnCommit = false, Bottom = textbox_height
HoldFocus = true, },
} },
} new Container
}, {
loading = new LoadingSpinner(), Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
Height = textbox_height,
Padding = new MarginPadding
{
Top = padding * 2,
Bottom = padding * 2,
Left = ChatLine.LEFT_PADDING + padding * 2,
Right = padding * 2,
},
Children = new Drawable[]
{
textbox = new FocusedTextBox
{
RelativeSizeAxes = Axes.Both,
Height = 1,
PlaceholderText = "type your message",
ReleaseFocusOnCommit = false,
HoldFocus = true,
}
}
},
loading = new LoadingSpinner(),
},
}
} }
}, },
tabsArea = new TabsArea tabsArea = new TabsArea