1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 18:52:55 +08:00

Update textbox usages

This commit is contained in:
Dean Herbert 2019-03-23 01:44:05 +09:00
parent 97675f6495
commit 9a11a08acc
6 changed files with 37 additions and 22 deletions

View File

@ -16,9 +16,6 @@ namespace osu.Game.Graphics.UserInterface
/// </summary> /// </summary>
public class FocusedTextBox : OsuTextBox public class FocusedTextBox : OsuTextBox
{ {
protected override Color4 BackgroundUnfocused => new Color4(10, 10, 10, 255);
protected override Color4 BackgroundFocused => new Color4(10, 10, 10, 255);
public Action Exit; public Action Exit;
private bool focus; private bool focus;
@ -47,6 +44,9 @@ namespace osu.Game.Graphics.UserInterface
private void load(GameHost host) private void load(GameHost host)
{ {
this.host = host; this.host = host;
BackgroundUnfocused = new Color4(10, 10, 10, 255);
BackgroundFocused = new Color4(10, 10, 10, 255);
} }
// We may not be focused yet, but we need to handle keyboard input to be able to request focus // We may not be focused yet, but we need to handle keyboard input to be able to request focus

View File

@ -16,10 +16,6 @@ namespace osu.Game.Graphics.UserInterface
{ {
public class OsuTextBox : TextBox, IKeyBindingHandler<GlobalAction> public class OsuTextBox : TextBox, IKeyBindingHandler<GlobalAction>
{ {
protected override Color4 BackgroundUnfocused => Color4.Black.Opacity(0.5f);
protected override Color4 BackgroundFocused => OsuColour.Gray(0.3f).Opacity(0.8f);
protected override Color4 BackgroundCommit => BorderColour;
protected override float LeftRightPadding => 10; protected override float LeftRightPadding => 10;
protected override SpriteText CreatePlaceholder() => new OsuSpriteText protected override SpriteText CreatePlaceholder() => new OsuSpriteText
@ -41,7 +37,9 @@ namespace osu.Game.Graphics.UserInterface
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colour) private void load(OsuColour colour)
{ {
BorderColour = colour.Yellow; BackgroundUnfocused = Color4.Black.Opacity(0.5f);
BackgroundFocused = OsuColour.Gray(0.3f).Opacity(0.8f);
BackgroundCommit = BorderColour = colour.Yellow;
} }
protected override void OnFocus(FocusEvent e) protected override void OnFocus(FocusEvent e)

View File

@ -190,8 +190,12 @@ namespace osu.Game.Overlays.Chat.Selection
private class HeaderSearchTextBox : SearchTextBox private class HeaderSearchTextBox : SearchTextBox
{ {
protected override Color4 BackgroundFocused => Color4.Black.Opacity(0.2f); [BackgroundDependencyLoader]
protected override Color4 BackgroundUnfocused => Color4.Black.Opacity(0.2f); private void load()
{
BackgroundFocused = Color4.Black.Opacity(0.2f);
BackgroundUnfocused = Color4.Black.Opacity(0.2f);
}
} }
} }
} }

View File

@ -6,8 +6,8 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osuTK; using osuTK;
using osuTK.Graphics;
using System; using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
namespace osu.Game.Overlays.Music namespace osu.Game.Overlays.Music
@ -53,15 +53,16 @@ namespace osu.Game.Overlays.Music
public class FilterTextBox : SearchTextBox public class FilterTextBox : SearchTextBox
{ {
protected override Color4 BackgroundUnfocused => OsuColour.Gray(0.06f);
protected override Color4 BackgroundFocused => OsuColour.Gray(0.12f);
protected override bool AllowCommit => true; protected override bool AllowCommit => true;
public FilterTextBox() [BackgroundDependencyLoader]
private void load()
{ {
Masking = true; Masking = true;
CornerRadius = 5; CornerRadius = 5;
BackgroundUnfocused = OsuColour.Gray(0.06f);
BackgroundFocused = OsuColour.Gray(0.12f);
} }
} }
} }

View File

@ -127,10 +127,14 @@ namespace osu.Game.Overlays.SearchableList
private class FilterSearchTextBox : SearchTextBox private class FilterSearchTextBox : SearchTextBox
{ {
protected override Color4 BackgroundUnfocused => OsuColour.Gray(0.06f);
protected override Color4 BackgroundFocused => OsuColour.Gray(0.12f);
protected override bool AllowCommit => true; protected override bool AllowCommit => true;
[BackgroundDependencyLoader]
private void load()
{
BackgroundUnfocused = OsuColour.Gray(0.06f);
BackgroundFocused = OsuColour.Gray(0.12f);
}
} }
} }
} }

View File

@ -316,8 +316,12 @@ namespace osu.Game.Screens.Multi.Match.Components
private class SettingsTextBox : OsuTextBox private class SettingsTextBox : OsuTextBox
{ {
protected override Color4 BackgroundUnfocused => Color4.Black; [BackgroundDependencyLoader]
protected override Color4 BackgroundFocused => Color4.Black; private void load()
{
BackgroundUnfocused = Color4.Black;
BackgroundFocused = Color4.Black;
}
} }
private class SettingsNumberTextBox : SettingsTextBox private class SettingsNumberTextBox : SettingsTextBox
@ -327,8 +331,12 @@ namespace osu.Game.Screens.Multi.Match.Components
private class SettingsPasswordTextBox : OsuPasswordTextBox private class SettingsPasswordTextBox : OsuPasswordTextBox
{ {
protected override Color4 BackgroundUnfocused => Color4.Black; [BackgroundDependencyLoader]
protected override Color4 BackgroundFocused => Color4.Black; private void load()
{
BackgroundUnfocused = Color4.Black;
BackgroundFocused = Color4.Black;
}
} }
private class SectionContainer : FillFlowContainer<Section> private class SectionContainer : FillFlowContainer<Section>