mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Add custom implementation of TextBox.
This commit is contained in:
Submodule osu-framework updated: 2f03fae533...1f6a3c780f
48
osu.Game/Graphics/UserInterface/OsuTextBox.cs
Normal file
48
osu.Game/Graphics/UserInterface/OsuTextBox.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
//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.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
public class OsuTextBox : TextBox
|
||||||
|
{
|
||||||
|
public OsuTextBox()
|
||||||
|
{
|
||||||
|
Height = 40;
|
||||||
|
TextContainer.Height = 0.6f;
|
||||||
|
CornerRadius = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colour)
|
||||||
|
{
|
||||||
|
BorderColour = colour.Yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnFocus(InputState state)
|
||||||
|
{
|
||||||
|
BorderThickness = 3;
|
||||||
|
|
||||||
|
return base.OnFocus(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnFocusLost(InputState state)
|
||||||
|
{
|
||||||
|
BorderThickness = 0;
|
||||||
|
|
||||||
|
base.OnFocusLost(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OsuPasswordTextBox : OsuTextBox
|
||||||
|
{
|
||||||
|
protected virtual char MaskCharacter => '*';
|
||||||
|
|
||||||
|
protected override Drawable AddCharacterToFlow(char c) => base.AddCharacterToFlow(MaskCharacter);
|
||||||
|
}
|
||||||
|
}
|
@ -89,9 +89,9 @@ namespace osu.Game.Overlays.Options.General
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SpriteText { Text = "Username" },
|
new SpriteText { Text = "Username" },
|
||||||
username = new TextBox { Height = 20, RelativeSizeAxes = Axes.X, Text = api?.Username ?? string.Empty },
|
username = new OsuTextBox { RelativeSizeAxes = Axes.X, Text = api?.Username ?? string.Empty },
|
||||||
new SpriteText { Text = "Password" },
|
new SpriteText { Text = "Password" },
|
||||||
password = new PasswordTextBox { Height = 20, RelativeSizeAxes = Axes.X },
|
password = new OsuPasswordTextBox { RelativeSizeAxes = Axes.X },
|
||||||
new OsuButton
|
new OsuButton
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
@ -43,13 +43,11 @@ namespace osu.Game.Overlays.Options.Online
|
|||||||
},
|
},
|
||||||
new SpriteText { Text = "Chat ignore list (space-seperated list)" },
|
new SpriteText { Text = "Chat ignore list (space-seperated list)" },
|
||||||
chatIgnoreList = new TextBoxOption {
|
chatIgnoreList = new TextBoxOption {
|
||||||
Height = 20,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Bindable = config.GetBindable<string>(OsuConfig.IgnoreList)
|
Bindable = config.GetBindable<string>(OsuConfig.IgnoreList)
|
||||||
},
|
},
|
||||||
new SpriteText { Text = "Chat highlight words (space-seperated list)" },
|
new SpriteText { Text = "Chat highlight words (space-seperated list)" },
|
||||||
chatHighlightWords = new TextBoxOption {
|
chatHighlightWords = new TextBoxOption {
|
||||||
Height = 20,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Bindable = config.GetBindable<string>(OsuConfig.HighlightWords)
|
Bindable = config.GetBindable<string>(OsuConfig.HighlightWords)
|
||||||
},
|
},
|
||||||
|
@ -2,12 +2,13 @@
|
|||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
{
|
{
|
||||||
public class TextBoxOption : TextBox
|
public class TextBoxOption : OsuTextBox
|
||||||
{
|
{
|
||||||
private Bindable<string> bindable;
|
private Bindable<string> bindable;
|
||||||
|
|
||||||
|
@ -67,6 +67,7 @@
|
|||||||
<Compile Include="Graphics\Backgrounds\Triangles.cs" />
|
<Compile Include="Graphics\Backgrounds\Triangles.cs" />
|
||||||
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
|
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\BackButton.cs" />
|
<Compile Include="Graphics\UserInterface\BackButton.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\OsuTextBox.cs" />
|
||||||
<Compile Include="Modes\Objects\HitObjectParser.cs" />
|
<Compile Include="Modes\Objects\HitObjectParser.cs" />
|
||||||
<Compile Include="Modes\Score.cs" />
|
<Compile Include="Modes\Score.cs" />
|
||||||
<Compile Include="Modes\ScoreProcesssor.cs" />
|
<Compile Include="Modes\ScoreProcesssor.cs" />
|
||||||
|
Reference in New Issue
Block a user