From d81956e9741b7dbfdfae35d514e1a1eba002fe5e Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 22 Aug 2017 15:43:45 +0200 Subject: [PATCH] use GameHost to check if caps lock is enabled --- osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index 3b0a1bda99..2b175b9eed 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using System; using osu.Framework.Graphics.Shapes; +using osu.Framework.Platform; namespace osu.Game.Graphics.UserInterface { @@ -65,10 +66,12 @@ namespace osu.Game.Graphics.UserInterface private class CapsWarning : SpriteIcon, IHasTooltip { - public string TooltipText => Console.CapsLock ? @"Caps lock is active" : string.Empty; + public string TooltipText => host.CapsLockEnabled ? @"Caps lock is active" : string.Empty; public override bool HandleInput => true; + private GameHost host; + public CapsWarning() { Icon = FontAwesome.fa_warning; @@ -80,9 +83,10 @@ namespace osu.Game.Graphics.UserInterface } [BackgroundDependencyLoader] - private void load(OsuColour colour) + private void load(OsuColour colour, GameHost host) { Colour = colour.YellowLight; + this.host = host; } protected override void Update() @@ -91,7 +95,7 @@ namespace osu.Game.Graphics.UserInterface updateVisibility(); } - private void updateVisibility() => this.FadeTo(Console.CapsLock ? 1 : 0, 250, Easing.OutQuint); + private void updateVisibility() => this.FadeTo(host.CapsLockEnabled ? 1 : 0, 250, Easing.OutQuint); } } }