mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 15:43:18 +08:00
Merge remote-tracking branch 'refs/remotes/ppy/master' into key_retry
This commit is contained in:
commit
7366640b95
@ -1 +1 @@
|
|||||||
Subproject commit 7ac3dbff3615fb410da1e330e6379b53a41292b6
|
Subproject commit bbfd0fc7a8f5293a0f853f51040b40808abbb459
|
@ -36,7 +36,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
filter.PinItem(GroupMode.All);
|
filter.PinItem(GroupMode.All);
|
||||||
filter.PinItem(GroupMode.RecentlyPlayed);
|
filter.PinItem(GroupMode.RecentlyPlayed);
|
||||||
|
|
||||||
filter.SelectedItem.ValueChanged += newFilter =>
|
filter.Current.ValueChanged += newFilter =>
|
||||||
{
|
{
|
||||||
text.Text = "Currently Selected: " + newFilter.ToString();
|
text.Text = "Currently Selected: " + newFilter.ToString();
|
||||||
};
|
};
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -12,18 +12,18 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public class Nub : CircularContainer, IStateful<CheckboxState>
|
public class Nub : CircularContainer, IHasCurrentValue<bool>
|
||||||
{
|
{
|
||||||
public const float COLLAPSED_SIZE = 20;
|
public const float COLLAPSED_SIZE = 20;
|
||||||
public const float EXPANDED_SIZE = 40;
|
public const float EXPANDED_SIZE = 40;
|
||||||
|
|
||||||
private readonly Box fill;
|
|
||||||
|
|
||||||
private const float border_width = 3;
|
private const float border_width = 3;
|
||||||
private Color4 glowingColour, idleColour;
|
private Color4 glowingColour, idleColour;
|
||||||
|
|
||||||
public Nub()
|
public Nub()
|
||||||
{
|
{
|
||||||
|
Box fill;
|
||||||
|
|
||||||
Size = new Vector2(COLLAPSED_SIZE, 12);
|
Size = new Vector2(COLLAPSED_SIZE, 12);
|
||||||
|
|
||||||
BorderColour = Color4.White;
|
BorderColour = Color4.White;
|
||||||
@ -40,6 +40,14 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
AlwaysPresent = true,
|
AlwaysPresent = true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Current.ValueChanged += newValue =>
|
||||||
|
{
|
||||||
|
if (newValue)
|
||||||
|
fill.FadeIn(200, EasingTypes.OutQuint);
|
||||||
|
else
|
||||||
|
fill.FadeTo(0.01f, 200, EasingTypes.OutQuint); //todo: remove once we figure why containers aren't drawing at all times
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -84,28 +92,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CheckboxState state;
|
private readonly Bindable<bool> current = new Bindable<bool>();
|
||||||
|
|
||||||
public CheckboxState State
|
public Bindable<bool> Current
|
||||||
{
|
{
|
||||||
get
|
get { return current; }
|
||||||
{
|
set { current.BindTo(value); }
|
||||||
return state;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
state = value;
|
|
||||||
|
|
||||||
switch (state)
|
|
||||||
{
|
|
||||||
case CheckboxState.Checked:
|
|
||||||
fill.FadeIn(200, EasingTypes.OutQuint);
|
|
||||||
break;
|
|
||||||
case CheckboxState.Unchecked:
|
|
||||||
fill.FadeTo(0.01f, 200, EasingTypes.OutQuint); //todo: remove once we figure why containers aren't drawing at all times
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,16 +23,10 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (bindable != null)
|
|
||||||
bindable.ValueChanged -= bindableValueChanged;
|
|
||||||
bindable = value;
|
bindable = value;
|
||||||
|
|
||||||
if (bindable != null)
|
if (bindable != null)
|
||||||
{
|
Current = bindable;
|
||||||
bool state = State == CheckboxState.Checked;
|
|
||||||
if (state != bindable.Value)
|
|
||||||
State = bindable.Value ? CheckboxState.Checked : CheckboxState.Unchecked;
|
|
||||||
bindable.ValueChanged += bindableValueChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bindable?.Disabled ?? true)
|
if (bindable?.Disabled ?? true)
|
||||||
Alpha = 0.3f;
|
Alpha = 0.3f;
|
||||||
@ -78,23 +72,20 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
labelSpriteText = new OsuSpriteText(),
|
labelSpriteText = new OsuSpriteText(),
|
||||||
nub = new Nub
|
nub = new Nub
|
||||||
{
|
{
|
||||||
|
Current = Current,
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
Margin = new MarginPadding { Right = 5 },
|
Margin = new MarginPadding { Right = 5 },
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
private void bindableValueChanged(bool isChecked)
|
Current.ValueChanged += newValue =>
|
||||||
{
|
{
|
||||||
State = isChecked ? CheckboxState.Checked : CheckboxState.Unchecked;
|
if (newValue)
|
||||||
}
|
sampleChecked?.Play();
|
||||||
|
else
|
||||||
protected override void Dispose(bool isDisposing)
|
sampleUnchecked?.Play();
|
||||||
{
|
};
|
||||||
if (bindable != null)
|
|
||||||
bindable.ValueChanged -= bindableValueChanged;
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
protected override bool OnHover(InputState state)
|
||||||
@ -117,23 +108,5 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
sampleChecked = audio.Sample.Get(@"Checkbox/check-on");
|
sampleChecked = audio.Sample.Get(@"Checkbox/check-on");
|
||||||
sampleUnchecked = audio.Sample.Get(@"Checkbox/check-off");
|
sampleUnchecked = audio.Sample.Get(@"Checkbox/check-off");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnChecked()
|
|
||||||
{
|
|
||||||
sampleChecked?.Play();
|
|
||||||
nub.State = CheckboxState.Checked;
|
|
||||||
|
|
||||||
if (bindable != null)
|
|
||||||
bindable.Value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnUnchecked()
|
|
||||||
{
|
|
||||||
sampleUnchecked?.Play();
|
|
||||||
nub.State = CheckboxState.Unchecked;
|
|
||||||
|
|
||||||
if (bindable != null)
|
|
||||||
bindable.Value = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private class OsuDropdownMenuItem : DropdownMenuItem<T>
|
private class OsuDropdownMenuItem : DropdownMenuItem<T>
|
||||||
{
|
{
|
||||||
public OsuDropdownMenuItem(string text, T value) : base(text, value)
|
public OsuDropdownMenuItem(string text, T current) : base(text, current)
|
||||||
{
|
{
|
||||||
Foreground.Padding = new MarginPadding(2);
|
Foreground.Padding = new MarginPadding(2);
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
nub = new Nub
|
nub = new Nub
|
||||||
{
|
{
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
State = CheckboxState.Unchecked,
|
|
||||||
Expanded = true,
|
Expanded = true,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -94,13 +93,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
{
|
{
|
||||||
nub.State = CheckboxState.Checked;
|
nub.Current.Value = true;
|
||||||
return base.OnMouseDown(state, args);
|
return base.OnMouseDown(state, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
||||||
{
|
{
|
||||||
nub.State = CheckboxState.Unchecked;
|
nub.Current.Value = false;
|
||||||
return base.OnMouseUp(state, args);
|
return base.OnMouseUp(state, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// 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 OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -24,8 +23,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private readonly SpriteText text;
|
private readonly SpriteText text;
|
||||||
private readonly TextAwesome icon;
|
private readonly TextAwesome icon;
|
||||||
|
|
||||||
public event EventHandler<CheckboxState> Action;
|
|
||||||
|
|
||||||
private Color4? accentColour;
|
private Color4? accentColour;
|
||||||
public Color4 AccentColour
|
public Color4 AccentColour
|
||||||
{
|
{
|
||||||
@ -34,7 +31,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
accentColour = value;
|
accentColour = value;
|
||||||
|
|
||||||
if (State != CheckboxState.Checked)
|
if (Current)
|
||||||
{
|
{
|
||||||
text.Colour = AccentColour;
|
text.Colour = AccentColour;
|
||||||
icon.Colour = AccentColour;
|
icon.Colour = AccentColour;
|
||||||
@ -48,20 +45,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
set { text.Text = value; }
|
set { text.Text = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnChecked()
|
|
||||||
{
|
|
||||||
fadeIn();
|
|
||||||
icon.Icon = FontAwesome.fa_check_circle_o;
|
|
||||||
Action?.Invoke(this, State);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnUnchecked()
|
|
||||||
{
|
|
||||||
fadeOut();
|
|
||||||
icon.Icon = FontAwesome.fa_circle_o;
|
|
||||||
Action?.Invoke(this, State);
|
|
||||||
}
|
|
||||||
|
|
||||||
private const float transition_length = 500;
|
private const float transition_length = 500;
|
||||||
|
|
||||||
private void fadeIn()
|
private void fadeIn()
|
||||||
@ -84,7 +67,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override void OnHoverLost(InputState state)
|
protected override void OnHoverLost(InputState state)
|
||||||
{
|
{
|
||||||
if (State == CheckboxState.Unchecked)
|
if (!Current)
|
||||||
fadeOut();
|
fadeOut();
|
||||||
|
|
||||||
base.OnHoverLost(state);
|
base.OnHoverLost(state);
|
||||||
@ -134,6 +117,20 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Current.ValueChanged += v =>
|
||||||
|
{
|
||||||
|
if (v)
|
||||||
|
{
|
||||||
|
fadeIn();
|
||||||
|
icon.Icon = FontAwesome.fa_check_circle_o;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fadeOut();
|
||||||
|
icon.Icon = FontAwesome.fa_circle_o;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
bindable = value;
|
bindable = value;
|
||||||
dropdown.SelectedValue.BindTo(bindable);
|
dropdown.Current = bindable;
|
||||||
if (bindable.Disabled)
|
if (bindable.Disabled)
|
||||||
Alpha = 0.3f;
|
Alpha = 0.3f;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// 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 osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
@ -15,38 +14,13 @@ namespace osu.Game.Overlays.Options
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (bindable != null)
|
|
||||||
bindable.ValueChanged -= bindableValueChanged;
|
|
||||||
bindable = value;
|
bindable = value;
|
||||||
if (bindable != null)
|
|
||||||
{
|
Current = bindable;
|
||||||
Text = bindable.Value;
|
|
||||||
bindable.ValueChanged += bindableValueChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bindable?.Disabled ?? true)
|
if (bindable?.Disabled ?? true)
|
||||||
Alpha = 0.3f;
|
Alpha = 0.3f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public OptionTextBox()
|
|
||||||
{
|
|
||||||
OnChange += onChange;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onChange(TextBox sender, bool newText)
|
|
||||||
{
|
|
||||||
if (bindable != null)
|
|
||||||
bindable.Value = Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void bindableValueChanged(string newValue) => Text = newValue;
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
if (bindable != null)
|
|
||||||
bindable.ValueChanged -= bindableValueChanged;
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,7 +8,6 @@ using osu.Framework.Extensions.Color4Extensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private void invokeOnFilter()
|
private void invokeOnFilter()
|
||||||
{
|
{
|
||||||
OnFilter?.Invoke(tabs.SelectedItem, modsCheckbox.State == CheckboxState.Checked);
|
OnFilter?.Invoke(tabs.Current, modsCheckbox.Current);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -61,10 +60,10 @@ namespace osu.Game.Screens.Select
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
tabs.SelectedItem.ValueChanged += item => invokeOnFilter();
|
tabs.Current.ValueChanged += item => invokeOnFilter();
|
||||||
modsCheckbox.Action += (sender, e) => invokeOnFilter();
|
modsCheckbox.Current.ValueChanged += item => invokeOnFilter();
|
||||||
|
|
||||||
tabs.SelectedItem.Value = BeatmapDetailTab.Global;
|
tabs.Current.Value = BeatmapDetailTab.Global;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,11 +93,6 @@ namespace osu.Game.Screens.Select
|
|||||||
searchTextBox = new SearchTextBox
|
searchTextBox = new SearchTextBox
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
OnChange = (sender, newText) =>
|
|
||||||
{
|
|
||||||
if (newText)
|
|
||||||
FilterChanged?.Invoke(CreateCriteria());
|
|
||||||
},
|
|
||||||
Exit = () => Exit?.Invoke(),
|
Exit = () => Exit?.Invoke(),
|
||||||
},
|
},
|
||||||
new Box
|
new Box
|
||||||
@ -149,10 +144,12 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
searchTextBox.Current.ValueChanged += t => FilterChanged?.Invoke(CreateCriteria());
|
||||||
|
|
||||||
groupTabs.PinItem(GroupMode.All);
|
groupTabs.PinItem(GroupMode.All);
|
||||||
groupTabs.PinItem(GroupMode.RecentlyPlayed);
|
groupTabs.PinItem(GroupMode.RecentlyPlayed);
|
||||||
groupTabs.SelectedItem.ValueChanged += val => Group = val;
|
groupTabs.Current.ValueChanged += val => Group = val;
|
||||||
sortTabs.SelectedItem.ValueChanged += val => Sort = val;
|
sortTabs.Current.ValueChanged += val => Sort = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate()
|
public void Deactivate()
|
||||||
|
Loading…
Reference in New Issue
Block a user