Add input box to ChatOverlay.

This commit is contained in:
Dean Herbert
2017-02-19 18:02:25 +09:00
parent 520e040396
commit aac4ba2baa
2 changed files with 39 additions and 5 deletions

View File

@ -19,6 +19,10 @@ using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.Chat;
using osu.Game.Online.Chat.Drawables;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Select;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays
{
@ -32,6 +36,8 @@ namespace osu.Game.Overlays
protected override Container<Drawable> Content => content;
private FocusedTextBox inputTextBox;
private APIAccess api;
public ChatOverlay()
@ -52,10 +58,38 @@ namespace osu.Game.Overlays
content = new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Bottom = 50 },
},
new Container
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
Height = 50,
Padding = new MarginPadding(5),
Children = new Drawable[]
{
inputTextBox = new FocusedTextBox
{
RelativeSizeAxes = Axes.X,
PlaceholderText = "type your message",
Exit = () => State = Visibility.Hidden,
OnCommit = postMessage,
HoldFocus = true,
}
}
}
});
}
private void postMessage(TextBox sender, bool newText)
{
var postText = sender.Text;
//todo: do something with postText.
sender.Text = string.Empty;
}
[BackgroundDependencyLoader]
private void load(APIAccess api)
{