Merge pull request #455 from 2yangk23/master

Add FilterControl implementation
This commit is contained in:
Dean Herbert 2017-03-16 22:41:47 +09:00 committed by GitHub
commit 3d1556c7f2
29 changed files with 241 additions and 297 deletions

@ -1 +1 @@
Subproject commit 67dd51e27c1a4cbbc17f29fee5dee3a125eed78e
Subproject commit 53dfe2a110d732cca0e7df58c33eca368bc7ff61

View File

@ -1,14 +1,12 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Diagnostics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using OpenTK;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Screens.Testing;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Select.Filter;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Select.Filter;
namespace osu.Desktop.VisualTests.Tests
{
@ -22,24 +20,17 @@ public override void Reset()
OsuSpriteText text;
OsuTabControl<GroupMode> filter;
Add(new FillFlowContainer
Add(filter = new OsuTabControl<GroupMode>
{
Direction = FillDirection.Horizontal,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
filter = new OsuTabControl<GroupMode>
{
Width = 229,
AutoSort = true
},
text = new OsuSpriteText
{
Text = "None",
Margin = new MarginPadding(4)
}
}
Margin = new MarginPadding(4),
Size = new Vector2(229, 24),
AutoSort = true
});
Add(text = new OsuSpriteText
{
Text = "None",
Margin = new MarginPadding(4),
Position = new Vector2(275, 5)
});
filter.PinTab(GroupMode.All);
@ -47,8 +38,7 @@ public override void Reset()
filter.ValueChanged += (sender, mode) =>
{
Debug.WriteLine($"Selected {mode}");
text.Text = mode.ToString();
text.Text = "Currently Selected: " + mode.ToString();
};
}
}

View File

@ -28,6 +28,10 @@ public class DrawableSlider : DrawableOsuHitObject, IDrawableHitObjectWithProxie
public DrawableSlider(Slider s) : base(s)
{
// Since the DrawableSlider itself is just a container without a size we need to
// pass all input through.
AlwaysReceiveInput = true;
SliderBouncer bouncer1;
slider = s;
@ -91,10 +95,6 @@ public DrawableSlider(Slider s) : base(s)
}
}
// Since the DrawableSlider itself is just a container without a size we need to
// pass all input through.
public override bool Contains(Vector2 screenSpacePos) => true;
private int currentRepeat;
protected override void Update()

View File

@ -24,6 +24,8 @@ public class DrawableSpinner : DrawableOsuHitObject
public DrawableSpinner(Spinner s) : base(s)
{
AlwaysReceiveInput = true;
Origin = Anchor.Centre;
Position = s.Position;
@ -69,8 +71,6 @@ public DrawableSpinner(Spinner s) : base(s)
disc.Scale = scaleToCircle;
}
public override bool Contains(Vector2 screenSpacePos) => true;
protected override void CheckJudgement(bool userTriggered)
{
if (Time.Current < HitObject.StartTime) return;

View File

@ -19,8 +19,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{
public class SpinnerDisc : CircularContainer
{
public override bool Contains(Vector2 screenSpacePos) => true;
protected Sprite Disc;
public SRGBColour DiscColour
@ -101,6 +99,8 @@ protected override void Update()
public SpinnerDisc()
{
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both;
Children = new Drawable[]

View File

@ -18,10 +18,10 @@ internal class ParallaxContainer : Container
private Bindable<bool> parallaxEnabled;
public override bool Contains(Vector2 screenSpacePos) => true;
public ParallaxContainer()
{
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both;
AddInternal(content = new Container
{

View File

@ -18,7 +18,6 @@ namespace osu.Game.Graphics.Cursor
{
internal class CursorTrail : Drawable
{
public override bool Contains(Vector2 screenSpacePos) => true;
public override bool HandleInput => true;
private int currentIndex;
@ -59,6 +58,7 @@ protected override void ApplyDrawNode(DrawNode node)
public CursorTrail()
{
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both;
for (int i = 0; i < max_sprites; i++)

View File

@ -10,10 +10,9 @@ namespace osu.Game.Graphics.Processing
{
internal class RatioAdjust : Container
{
public override bool Contains(Vector2 screenSpacePos) => true;
public RatioAdjust()
{
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both;
}

View File

@ -88,7 +88,7 @@ internal float TextSize
private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking
public override bool Contains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos);
protected override bool InternalContains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos);
protected override bool OnClick(Framework.Input.InputState state)
{

View File

@ -21,6 +21,17 @@ protected override string Label
set { label.Text = value; }
}
private Color4? accentColour;
public virtual Color4 AccentColour
{
get { return accentColour.GetValueOrDefault(); }
set
{
accentColour = value;
BackgroundColourHover = value;
}
}
public OsuDropDownHeader()
{
Foreground.Padding = new MarginPadding(4);
@ -30,7 +41,7 @@ public OsuDropDownHeader()
CornerRadius = 4;
Height = 40;
Children = new[]
Foreground.Children = new Drawable[]
{
label = new OsuSpriteText
{
@ -51,7 +62,7 @@ public OsuDropDownHeader()
private void load(OsuColour colours)
{
BackgroundColour = Color4.Black.Opacity(0.5f);
BackgroundColourHover = colours.PinkDarker;
BackgroundColourHover = accentColour ?? colours.PinkDarker;
}
}
}

View File

@ -1,39 +1,61 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Framework.Allocation;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Graphics.UserInterface
{
public class OsuDropDownMenu<U> : DropDownMenu<U>
public class OsuDropDownMenu<T> : DropDownMenu<T>
{
protected override DropDownHeader CreateHeader() => new OsuDropDownHeader();
protected override DropDownHeader CreateHeader() => new OsuDropDownHeader { AccentColour = AccentColour };
private Color4? accentColour;
public virtual Color4 AccentColour
{
get { return accentColour.GetValueOrDefault(); }
set
{
accentColour = value;
if (Header != null)
((OsuDropDownHeader)Header).AccentColour = value;
foreach (var item in ItemList.OfType<OsuDropDownMenuItem<T>>())
item.AccentColour = value;
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
if (accentColour == null)
AccentColour = colours.PinkDarker;
}
public OsuDropDownMenu()
{
ContentContainer.CornerRadius = 4;
ContentBackground.Colour = Color4.Black.Opacity(0.5f);
DropDownItemsContainer.Padding = new MarginPadding(5);
}
protected override void AnimateOpen()
{
ContentContainer.FadeIn(300, EasingTypes.OutQuint);
}
protected override void AnimateOpen() => ContentContainer.FadeIn(300, EasingTypes.OutQuint);
protected override void AnimateClose()
{
ContentContainer.FadeOut(300, EasingTypes.OutQuint);
}
protected override void AnimateClose() => ContentContainer.FadeOut(300, EasingTypes.OutQuint);
protected override void UpdateContentHeight()
{
ContentContainer.ResizeTo(State == DropDownMenuState.Opened ? new Vector2(1, ContentHeight) : new Vector2(1, 0), 300, EasingTypes.OutQuint);
var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight;
ContentContainer.ResizeTo(new Vector2(1, State == DropDownMenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint);
}
protected override DropDownMenuItem<U> CreateDropDownItem(string key, U value) => new OsuDropDownMenuItem<U>(key, value);
protected override DropDownMenuItem<T> CreateDropDownItem(string key, T value) => new OsuDropDownMenuItem<T>(key, value) { AccentColour = AccentColour };
}
}

View File

@ -18,6 +18,9 @@ public OsuDropDownMenuItem(string text, U value) : base(text, value)
{
Foreground.Padding = new MarginPadding(2);
Masking = true;
CornerRadius = 6;
Children = new[]
{
new FillFlowContainer
@ -27,12 +30,15 @@ public OsuDropDownMenuItem(string text, U value) : base(text, value)
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
new TextAwesome
chevron = new TextAwesome
{
AlwaysPresent = true,
Icon = FontAwesome.fa_chevron_right,
UseFullGlyphHeight = false,
Colour = Color4.Black,
TextSize = 12,
Margin = new MarginPadding { Right = 3 },
Alpha = 0.5f,
TextSize = 8,
Margin = new MarginPadding { Left = 3, Right = 3 },
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
},
@ -46,11 +52,33 @@ public OsuDropDownMenuItem(string text, U value) : base(text, value)
};
}
private Color4? accentColour;
private TextAwesome chevron;
protected override void FormatForeground(bool hover = false)
{
base.FormatForeground(hover);
chevron.Alpha = hover ? 1 : 0;
}
public Color4 AccentColour
{
get { return accentColour.GetValueOrDefault(); }
set
{
accentColour = value;
BackgroundColourHover = BackgroundColourSelected = value;
FormatBackground();
FormatForeground();
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BackgroundColour = Color4.Black.Opacity(0.5f);
BackgroundColourHover = colours.PinkDarker;
BackgroundColour = Color4.Transparent;
BackgroundColourHover = accentColour ?? colours.PinkDarker;
BackgroundColourSelected = Color4.Black.Opacity(0.5f);
}
}

View File

@ -3,18 +3,25 @@
using System;
using System.Linq;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics.UserInterface.Tab;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
namespace osu.Game.Graphics.UserInterface
{
public class OsuTabControl<T> : TabControl<T>
{
protected override TabDropDownMenu<T> CreateDropDownMenu() => new OsuTabDropDownMenu<T>();
protected override DropDownMenu<T> CreateDropDownMenu() => new OsuTabDropDownMenu<T>();
protected override TabItem<T> CreateTabItem(T value) => new OsuTabItem<T> { Value = value };
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || DropDown.Contains(screenSpacePos);
public OsuTabControl()
{
if (!typeof(T).IsEnum)
@ -46,11 +53,87 @@ public Color4 AccentColour
}
}
protected override void Update()
public class OsuTabDropDownMenu<T1> : OsuDropDownMenu<T1>
{
base.Update();
protected override DropDownHeader CreateHeader() => new OsuTabDropDownHeader
{
AccentColour = AccentColour,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
};
DropDown.Header.Height = DrawHeight;
protected override DropDownMenuItem<T1> CreateDropDownItem(string key, T1 value)
{
var item = base.CreateDropDownItem(key, value);
item.ForegroundColourHover = Color4.Black;
return item;
}
public OsuTabDropDownMenu()
{
ContentContainer.Anchor = Anchor.TopRight;
ContentContainer.Origin = Anchor.TopRight;
RelativeSizeAxes = Axes.X;
ContentBackground.Colour = Color4.Black.Opacity(0.7f);
MaxDropDownHeight = 400;
}
public class OsuTabDropDownHeader : OsuDropDownHeader
{
public override Color4 AccentColour
{
get { return base.AccentColour; }
set
{
base.AccentColour = value;
Foreground.Colour = value;
}
}
protected override bool OnHover(InputState state)
{
Foreground.Colour = BackgroundColour;
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
Foreground.Colour = BackgroundColourHover;
base.OnHoverLost(state);
}
public OsuTabDropDownHeader()
{
RelativeSizeAxes = Axes.None;
AutoSizeAxes = Axes.X;
BackgroundColour = Color4.Black.Opacity(0.5f);
Background.Height = 0.5f;
Background.CornerRadius = 5;
Background.Masking = true;
Foreground.RelativeSizeAxes = Axes.None;
Foreground.AutoSizeAxes = Axes.X;
Foreground.RelativeSizeAxes = Axes.Y;
Foreground.Margin = new MarginPadding(5);
Foreground.Children = new Drawable[]
{
new TextAwesome
{
Icon = FontAwesome.fa_ellipsis_h,
TextSize = 14,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
}
};
Padding = new MarginPadding { Left = 5, Right = 5 };
}
}
}
}
}

View File

@ -1,130 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Graphics.UserInterface.Tab;
using osu.Framework.Input;
namespace osu.Game.Graphics.UserInterface
{
public class OsuTabDropDownMenu<T> : TabDropDownMenu<T>
{
private Color4? accentColour;
public Color4 AccentColour
{
get { return accentColour.GetValueOrDefault(); }
set
{
accentColour = value;
((OsuTabDropDownHeader)Header).AccentColour = value;
foreach (var item in ItemList.OfType<OsuTabDropDownMenuItem<T>>())
item.AccentColour = value;
}
}
protected override DropDownHeader CreateHeader() => new OsuTabDropDownHeader
{
AccentColour = AccentColour
};
protected override DropDownMenuItem<T> CreateDropDownItem(string key, T value) =>
new OsuTabDropDownMenuItem<T>(key, value) { AccentColour = AccentColour };
public OsuTabDropDownMenu()
{
MaxDropDownHeight = int.MaxValue;
ContentContainer.CornerRadius = 4;
ContentBackground.Colour = Color4.Black.Opacity(0.9f);
ScrollContainer.ScrollDraggerVisible = false;
DropDownItemsContainer.Padding = new MarginPadding { Left = 5, Bottom = 7, Right = 5, Top = 7 };
}
protected override void AnimateOpen()
{
ContentContainer.FadeIn(300, EasingTypes.OutQuint);
}
protected override void AnimateClose()
{
ContentContainer.FadeOut(300, EasingTypes.OutQuint);
}
protected override void UpdateContentHeight()
{
ContentContainer.ResizeTo(new Vector2(1, State == DropDownMenuState.Opened ? ContentHeight : 0), 300, EasingTypes.OutQuint);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
if (accentColour == null)
AccentColour = colours.Blue;
}
public class OsuTabDropDownHeader : DropDownHeader
{
protected override string Label { get; set; }
private Color4? accentColour;
public Color4 AccentColour
{
get { return accentColour.GetValueOrDefault(); }
set
{
accentColour = value;
BackgroundColourHover = value;
Foreground.Colour = value;
}
}
protected override bool OnHover(InputState state)
{
Foreground.Colour = BackgroundColour;
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
Foreground.Colour = BackgroundColourHover;
base.OnHoverLost(state);
}
public OsuTabDropDownHeader()
{
RelativeSizeAxes = Axes.None;
AutoSizeAxes = Axes.X;
BackgroundColour = Color4.Black;
Background.Height = 0.5f;
Background.CornerRadius = 3;
Background.Masking = true;
Foreground.RelativeSizeAxes = Axes.None;
Foreground.AutoSizeAxes = Axes.X;
Foreground.RelativeSizeAxes = Axes.Y;
Foreground.Margin = new MarginPadding(5);
Foreground.Children = new Drawable[]
{
new TextAwesome
{
Icon = FontAwesome.fa_ellipsis_h,
TextSize = 14,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
}
};
Padding = new MarginPadding { Left = 5, Right = 5 };
}
}
}
}

View File

@ -1,54 +0,0 @@
// Copyright (c) 2007-2017 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.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.UserInterface;
using OpenTK.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Graphics.UserInterface
{
public class OsuTabDropDownMenuItem<T> : DropDownMenuItem<T>
{
public OsuTabDropDownMenuItem(string text, T value) : base(text, value)
{
Foreground.Padding = new MarginPadding { Top = 4, Bottom = 4 };
Foreground.Margin = new MarginPadding { Left = 7 };
Masking = true;
CornerRadius = 6;
Foreground.Add(new OsuSpriteText
{
Text = text,
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
});
}
private Color4? accentColour;
public Color4 AccentColour
{
get { return accentColour.GetValueOrDefault(); }
set
{
accentColour = value;
BackgroundColourHover = BackgroundColourSelected = value;
FormatBackground();
FormatForeground();
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BackgroundColour = Color4.Black.Opacity(0f);
ForegroundColourHover = Color4.Black;
ForegroundColourSelected = Color4.Black;
if (accentColour == null)
AccentColour = colours.Blue;
}
}
}

View File

@ -8,7 +8,8 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface.Tab;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Game.Graphics.Sprites;
@ -46,6 +47,8 @@ public override bool Active
get { return base.Active; }
set
{
if (Active == value) return;
if (value)
fadeActive();
else
@ -54,16 +57,18 @@ public override bool Active
}
}
private const float transition_length = 500;
private void fadeActive()
{
box.FadeIn(300);
text.FadeColour(Color4.White, 300);
box.FadeIn(transition_length, EasingTypes.OutQuint);
text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint);
}
private void fadeInactive()
{
box.FadeOut(300);
text.FadeColour(AccentColour, 300);
box.FadeOut(transition_length, EasingTypes.OutQuint);
text.FadeColour(AccentColour, transition_length, EasingTypes.OutQuint);
}
protected override bool OnHover(InputState state)

View File

@ -158,7 +158,7 @@ public string Text
}
}
public override bool Contains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos);
protected override bool InternalContains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos);
protected override bool OnHover(InputState state)
{

View File

@ -18,7 +18,6 @@ public abstract class Playfield<TObject, TJudgement> : Container
/// The HitObjects contained in this Playfield.
/// </summary>
public HitObjectContainer<DrawableHitObject<TObject, TJudgement>> HitObjects;
public override bool Contains(Vector2 screenSpacePos) => true;
internal Container<Drawable> ScaledContent;
@ -31,6 +30,8 @@ public abstract class Playfield<TObject, TJudgement> : Container
/// <param name="customWidth">Whether we want our internal coordinate system to be scaled to a specified width.</param>
protected Playfield(float? customWidth = null)
{
AlwaysReceiveInput = true;
AddInternal(ScaledContent = new ScaledContainer
{
CustomWidth = customWidth,
@ -77,12 +78,18 @@ private class ScaledContainer : Container
//dividing by the customwidth will effectively scale our content to the required container size.
protected override Vector2 DrawScale => CustomWidth.HasValue ? new Vector2(DrawSize.X / CustomWidth.Value) : base.DrawScale;
public override bool Contains(Vector2 screenSpacePos) => true;
public ScaledContainer()
{
AlwaysReceiveInput = true;
}
}
public class HitObjectContainer<U> : Container<U> where U : Drawable
{
public override bool Contains(Vector2 screenSpacePos) => true;
public HitObjectContainer()
{
AlwaysReceiveInput = true;
}
}
}
}

View File

@ -35,10 +35,10 @@ public class Toolbar : OverlayContainer
private const float alpha_hovering = 0.8f;
private const float alpha_normal = 0.6f;
public override bool Contains(Vector2 screenSpacePos) => true;
public Toolbar()
{
AlwaysReceiveInput = true;
Children = new Drawable[]
{
new ToolbarBackground(),
@ -63,8 +63,9 @@ public Toolbar()
}
}
},
new PassThroughFlowContainer
new FillFlowContainer
{
AlwaysReceiveInput = true,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Direction = FillDirection.Horizontal,
@ -144,11 +145,5 @@ protected override void PopOut()
MoveToY(-DrawSize.Y, transition_time, EasingTypes.OutQuint);
FadeOut(transition_time);
}
private class PassThroughFlowContainer : FillFlowContainer
{
//needed to get input to the login overlay.
public override bool Contains(Vector2 screenSpacePos) => true;
}
}
}

View File

@ -15,10 +15,10 @@ internal class ToolbarUserArea : Container
public override RectangleF BoundingBox => button.BoundingBox;
public override bool Contains(Vector2 screenSpacePos) => true;
public ToolbarUserArea()
{
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Y;
AutoSizeAxes = Axes.X;

View File

@ -35,10 +35,7 @@ public class Button : Container, IStateful<ButtonState>
private Key triggerKey;
private SampleChannel sampleClick;
public override bool Contains(Vector2 screenSpacePos)
{
return box.Contains(screenSpacePos);
}
protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown)
{

View File

@ -50,10 +50,7 @@ public bool Triangles
}
}
public override bool Contains(Vector2 screenSpacePos)
{
return logoContainer.Contains(screenSpacePos);
}
protected override bool InternalContains(Vector2 screenSpacePos) => logoContainer.Contains(screenSpacePos);
public bool Ripple
{

View File

@ -4,7 +4,6 @@
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Input;
@ -14,6 +13,8 @@ public class KeyCounterCollection : FillFlowContainer<KeyCounter>
{
public KeyCounterCollection()
{
AlwaysReceiveInput = true;
Direction = FillDirection.Horizontal;
AutoSizeAxes = Axes.Both;
}
@ -33,8 +34,6 @@ public void ResetCount()
counter.ResetCount();
}
public override bool Contains(Vector2 screenSpacePos) => true;
//further: change default values here and in KeyCounter if needed, instead of passing them in every constructor
private bool isCounting;
public bool IsCounting
@ -111,12 +110,11 @@ public class Receptor : Drawable
public Receptor(KeyCounterCollection target)
{
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both;
this.target = target;
}
public override bool Contains(Vector2 screenSpacePos) => true;
public override bool HandleInput => true;
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => target.Children.Any(c => c.TriggerKeyDown(state, args));

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Input;
using OpenTK;
using OpenTK.Input;
namespace osu.Game.Screens.Play
@ -13,6 +12,7 @@ public class KeyCounterMouse : KeyCounter
public KeyCounterMouse(MouseButton button) : base(getStringRepresentation(button))
{
AlwaysReceiveInput = true;
Button = button;
}
@ -29,8 +29,6 @@ private static string getStringRepresentation(MouseButton button)
}
}
public override bool Contains(Vector2 screenSpacePos) => true;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
if (args.Button == Button) IsLit = true;

View File

@ -70,7 +70,6 @@ public int Retries
private FillFlowContainer retryCounterContainer;
public override bool Contains(Vector2 screenSpacePos) => true;
public override bool HandleInput => State == Visibility.Visible;
protected override void PopIn() => FadeIn(transition_duration, EasingTypes.In);
@ -217,6 +216,7 @@ private void resume()
public PauseOverlay()
{
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both;
}
}

View File

@ -9,12 +9,11 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Select.Filter;
using Container = osu.Framework.Graphics.Containers.Container;
using osu.Framework.Graphics.UserInterface.Tab;
using osu.Framework.Input;
namespace osu.Game.Screens.Select
@ -27,7 +26,7 @@ public class FilterControl : Container
private OsuTabControl<SortMode> sortTabs;
TabControl<GroupMode> groupTabs;
private TabControl<GroupMode> groupTabs;
private SortMode sort = SortMode.Title;
public SortMode Sort
@ -61,7 +60,7 @@ public GroupMode Group
private SearchTextBox searchTextBox;
public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos);
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos);
public FilterControl()
{
@ -76,9 +75,9 @@ public FilterControl()
new Container
{
Padding = new MarginPadding(20),
BypassContainsCheck = true,
RelativeSizeAxes = Axes.Y,
Width = 500,
AlwaysReceiveInput = true,
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Children = new Drawable[]
@ -97,7 +96,6 @@ public FilterControl()
{
RelativeSizeAxes = Axes.X,
Height = 1,
Y = 24,
Colour = OsuColour.Gray(80),
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
@ -109,12 +107,13 @@ public FilterControl()
Direction = FillDirection.Horizontal,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
BypassContainsCheck = true,
AlwaysReceiveInput = true,
Children = new Drawable[]
{
groupTabs = new OsuTabControl<GroupMode>
{
RelativeSizeAxes = Axes.X,
Height = 24,
Width = 0.5f,
AutoSort = true
},
@ -133,6 +132,7 @@ public FilterControl()
{
RelativeSizeAxes = Axes.X,
Width = 0.5f,
Height = 24,
AutoSort = true,
}
}

View File

@ -26,8 +26,6 @@ public class Footer : Container
private const float padding = 80;
public override bool Contains(Vector2 screenSpacePos) => true;
public Action OnBack;
public Action OnStart;
@ -69,6 +67,8 @@ private void updateModeLight(FooterButton button = null)
public Footer()
{
AlwaysReceiveInput = true;
const float bottom_tool_height = 50;
RelativeSizeAxes = Axes.X;

View File

@ -83,7 +83,7 @@ protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
return false;
}
public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
public BeatmapOptionsButton()
{

View File

@ -350,8 +350,6 @@
<Compile Include="Screens\Select\Options\BeatmapOptionsButton.cs" />
<Compile Include="Screens\Select\Options\BeatmapOptionsOverlay.cs" />
<Compile Include="Graphics\UserInterface\OsuTabControl.cs" />
<Compile Include="Graphics\UserInterface\OsuTabDropDownMenu.cs" />
<Compile Include="Graphics\UserInterface\OsuTabDropDownMenuItem.cs" />
<Compile Include="Graphics\UserInterface\OsuTabItem.cs" />
</ItemGroup>
<ItemGroup>