mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 07:32:55 +08:00
Merge branch 'master' into toolbar-button-swap
This commit is contained in:
commit
02aa38d1c2
@ -10,16 +10,20 @@ using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using OpenTK;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Desktop.Tests.Visual
|
||||
{
|
||||
internal class TestCaseHitObjects : OsuTestCase
|
||||
{
|
||||
private readonly FramedClock framedClock;
|
||||
private FramedClock framedClock;
|
||||
|
||||
private bool auto;
|
||||
|
||||
public TestCaseHitObjects()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetStore rulesets)
|
||||
{
|
||||
var rateAdjustClock = new StopwatchClock(true);
|
||||
framedClock = new FramedClock(rateAdjustClock);
|
||||
@ -39,7 +43,7 @@ namespace osu.Desktop.Tests.Visual
|
||||
Clock = framedClock,
|
||||
Children = new[]
|
||||
{
|
||||
playfieldContainer = new Container { RelativeSizeAxes = Axes.Both },
|
||||
playfieldContainer = new OsuInputManager(rulesets.GetRuleset(0)) { RelativeSizeAxes = Axes.Both },
|
||||
approachContainer = new Container { RelativeSizeAxes = Axes.Both }
|
||||
}
|
||||
};
|
||||
@ -49,8 +53,8 @@ namespace osu.Desktop.Tests.Visual
|
||||
|
||||
private HitObjectType mode = HitObjectType.Slider;
|
||||
|
||||
private readonly Container playfieldContainer;
|
||||
private readonly Container approachContainer;
|
||||
private Container playfieldContainer;
|
||||
private Container approachContainer;
|
||||
|
||||
private void loadHitobjects(HitObjectType mode)
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Catch
|
||||
public class CatchInputManager : DatabasedKeyBindingInputManager<CatchAction>
|
||||
{
|
||||
public CatchInputManager(RulesetInfo ruleset)
|
||||
: base(ruleset, simultaneousMode: SimultaneousBindingMode.Unique)
|
||||
: base(ruleset, 0, SimultaneousBindingMode.Unique)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Osu
|
||||
{
|
||||
public class OsuInputManager : DatabasedKeyBindingInputManager<OsuAction>
|
||||
{
|
||||
public OsuInputManager(RulesetInfo ruleset) : base(ruleset, simultaneousMode: SimultaneousBindingMode.Unique)
|
||||
public OsuInputManager(RulesetInfo ruleset) : base(ruleset, 0, SimultaneousBindingMode.Unique)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
@ -16,7 +17,7 @@ using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class OsuButton : Button
|
||||
public class OsuButton : Button, IFilterable
|
||||
{
|
||||
private Box hover;
|
||||
|
||||
@ -108,5 +109,15 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Content.ScaleTo(1, 1000, Easing.OutElastic);
|
||||
return base.OnMouseUp(state, args);
|
||||
}
|
||||
|
||||
public string[] FilterTerms => new[] { Text };
|
||||
|
||||
public bool MatchingFilter
|
||||
{
|
||||
set
|
||||
{
|
||||
this.FadeTo(value ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Input.Bindings;
|
||||
@ -34,6 +35,9 @@ namespace osu.Game.Input.Bindings
|
||||
{
|
||||
this.ruleset = ruleset;
|
||||
this.variant = variant;
|
||||
|
||||
if (ruleset != null && variant == null)
|
||||
throw new InvalidOperationException($"{nameof(variant)} can not be null when a non-null {nameof(ruleset)} is provided.");
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -182,7 +182,11 @@ namespace osu.Game
|
||||
LoadComponentAsync(direct = new DirectOverlay { Depth = -1 }, mainContent.Add);
|
||||
LoadComponentAsync(social = new SocialOverlay { Depth = -1 }, mainContent.Add);
|
||||
LoadComponentAsync(chat = new ChatOverlay { Depth = -1 }, mainContent.Add);
|
||||
LoadComponentAsync(settings = new MainSettings { Depth = -1 }, overlayContent.Add);
|
||||
LoadComponentAsync(settings = new MainSettings
|
||||
{
|
||||
GetToolbarHeight = () => ToolbarOffset,
|
||||
Depth = -1
|
||||
}, overlayContent.Add);
|
||||
LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -2 }, mainContent.Add);
|
||||
LoadComponentAsync(musicController = new MusicController
|
||||
{
|
||||
|
@ -13,6 +13,7 @@ using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Overlays.Settings.Sections;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
@ -40,27 +41,35 @@ namespace osu.Game.Overlays
|
||||
public MainSettings()
|
||||
: base(true)
|
||||
{
|
||||
keyBindingOverlay = new KeyBindingOverlay { Depth = 1 };
|
||||
keyBindingOverlay = new KeyBindingOverlay
|
||||
{
|
||||
Depth = 1,
|
||||
Anchor = Anchor.TopRight,
|
||||
};
|
||||
keyBindingOverlay.StateChanged += keyBindingOverlay_StateChanged;
|
||||
}
|
||||
|
||||
public override bool AcceptsFocus => keyBindingOverlay.State != Visibility.Visible;
|
||||
|
||||
private const float hidden_width = 120;
|
||||
|
||||
private void keyBindingOverlay_StateChanged(VisibilityContainer container, Visibility visibility)
|
||||
{
|
||||
const float hidden_width = 120;
|
||||
|
||||
switch (visibility)
|
||||
{
|
||||
case Visibility.Visible:
|
||||
Background.FadeTo(0.9f, 500, Easing.OutQuint);
|
||||
SectionsContainer.FadeOut(100);
|
||||
ContentContainer.MoveToX(hidden_width - ContentContainer.DrawWidth, 500, Easing.OutQuint);
|
||||
Background.FadeTo(0.9f, 300, Easing.OutQuint);
|
||||
Sidebar?.FadeColour(Color4.DarkGray, 300, Easing.OutQuint);
|
||||
|
||||
SectionsContainer.FadeOut(300, Easing.OutQuint);
|
||||
ContentContainer.MoveToX(hidden_width - WIDTH, 500, Easing.OutQuint);
|
||||
|
||||
backButton.Delay(100).FadeIn(100);
|
||||
break;
|
||||
case Visibility.Hidden:
|
||||
Background.FadeTo(0.6f, 500, Easing.OutQuint);
|
||||
Sidebar?.FadeColour(Color4.White, 300, Easing.OutQuint);
|
||||
|
||||
SectionsContainer.FadeIn(500, Easing.OutQuint);
|
||||
ContentContainer.MoveToX(0, 500, Easing.OutQuint);
|
||||
|
||||
@ -69,39 +78,26 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
keyBindingOverlay.State = Visibility.Hidden;
|
||||
}
|
||||
protected override float ExpandedPosition => keyBindingOverlay.State == Visibility.Visible ? hidden_width - WIDTH : base.ExpandedPosition;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AddInternal(keyBindingOverlay);
|
||||
AddInternal(backButton = new BackButton
|
||||
ContentContainer.Add(keyBindingOverlay);
|
||||
|
||||
ContentContainer.Add(backButton = new BackButton
|
||||
{
|
||||
Alpha = 0,
|
||||
Height = 150,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Width = hidden_width,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Action = () => keyBindingOverlay.Hide()
|
||||
});
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
keyBindingOverlay.Margin = new MarginPadding { Left = ContentContainer.Margin.Left + ContentContainer.DrawWidth + ContentContainer.X };
|
||||
|
||||
backButton.Margin = new MarginPadding { Left = ContentContainer.Margin.Left };
|
||||
backButton.Width = ContentContainer.DrawWidth + ContentContainer.X;
|
||||
}
|
||||
|
||||
private class BackButton : OsuClickableContainer
|
||||
{
|
||||
private FillFlowContainer flow;
|
||||
private AspectContainer aspect;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -116,29 +112,22 @@ namespace osu.Game.Overlays
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
flow = new FillFlowContainer
|
||||
new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
RelativePositionAxes = Axes.Y,
|
||||
Y = 0.4f,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new[]
|
||||
{
|
||||
new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.fa_chevron_left },
|
||||
new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.fa_chevron_left },
|
||||
new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.fa_chevron_left },
|
||||
}
|
||||
Y = -15,
|
||||
Size = new Vector2(15),
|
||||
Shadow = true,
|
||||
Icon = FontAwesome.fa_chevron_left
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
RelativePositionAxes = Axes.Y,
|
||||
Y = 0.7f,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Y = 15,
|
||||
TextSize = 12,
|
||||
Font = @"Exo2.0-Bold",
|
||||
Origin = Anchor.Centre,
|
||||
Text = @"back",
|
||||
},
|
||||
}
|
||||
@ -146,18 +135,6 @@ namespace osu.Game.Overlays
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
flow.TransformSpacingTo(new Vector2(5), 500, Easing.OutQuint);
|
||||
return base.OnHover(state);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
flow.TransformSpacingTo(new Vector2(0), 500, Easing.OutQuint);
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
aspect.ScaleTo(0.75f, 2000, Easing.OutQuint);
|
||||
@ -171,4 +148,4 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +258,10 @@ namespace osu.Game.Overlays
|
||||
Type = EdgeEffectType.Glow,
|
||||
Radius = 8,
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
updateGlow();
|
||||
FinishTransforms(true);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
@ -25,7 +26,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
public const float SIDEBAR_WIDTH = Sidebar.DEFAULT_WIDTH;
|
||||
|
||||
private const float width = 400;
|
||||
protected const float WIDTH = 400;
|
||||
|
||||
private const float sidebar_padding = 10;
|
||||
|
||||
@ -33,14 +34,17 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override Container<Drawable> Content => ContentContainer;
|
||||
|
||||
private Sidebar sidebar;
|
||||
protected Sidebar Sidebar;
|
||||
private SidebarButton selectedSidebarButton;
|
||||
|
||||
protected SettingsSectionsContainer SectionsContainer;
|
||||
|
||||
private SearchTextBox searchTextBox;
|
||||
|
||||
private Func<float> getToolbarHeight;
|
||||
/// <summary>
|
||||
/// Provide a source for the toolbar height.
|
||||
/// </summary>
|
||||
public Func<float> GetToolbarHeight;
|
||||
|
||||
private readonly bool showSidebar;
|
||||
|
||||
@ -55,17 +59,20 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected virtual IEnumerable<SettingsSection> CreateSections() => null;
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuGame game)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = ContentContainer = new Container
|
||||
{
|
||||
Width = width,
|
||||
Width = WIDTH,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Background = new Box
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Scale = new Vector2(2, 1), // over-extend to the left for transitions
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.6f,
|
||||
@ -94,20 +101,18 @@ namespace osu.Game.Overlays
|
||||
|
||||
if (showSidebar)
|
||||
{
|
||||
AddInternal(sidebar = new Sidebar { Width = SIDEBAR_WIDTH });
|
||||
AddInternal(Sidebar = new Sidebar { Width = SIDEBAR_WIDTH });
|
||||
|
||||
SectionsContainer.SelectedSection.ValueChanged += section =>
|
||||
{
|
||||
selectedSidebarButton.Selected = false;
|
||||
selectedSidebarButton = sidebar.Children.Single(b => b.Section == section);
|
||||
selectedSidebarButton = Sidebar.Children.Single(b => b.Section == section);
|
||||
selectedSidebarButton.Selected = true;
|
||||
};
|
||||
}
|
||||
|
||||
searchTextBox.Current.ValueChanged += newValue => SectionsContainer.SearchContainer.SearchTerm = newValue;
|
||||
|
||||
getToolbarHeight = () => game?.ToolbarOffset ?? 0;
|
||||
|
||||
CreateSections()?.ForEach(AddSection);
|
||||
}
|
||||
|
||||
@ -115,7 +120,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
SectionsContainer.Add(section);
|
||||
|
||||
if (sidebar != null)
|
||||
if (Sidebar != null)
|
||||
{
|
||||
var button = new SidebarButton
|
||||
{
|
||||
@ -123,15 +128,15 @@ namespace osu.Game.Overlays
|
||||
Action = s =>
|
||||
{
|
||||
SectionsContainer.ScrollTo(s);
|
||||
sidebar.State = ExpandedState.Contracted;
|
||||
Sidebar.State = ExpandedState.Contracted;
|
||||
},
|
||||
};
|
||||
|
||||
sidebar.Add(button);
|
||||
Sidebar.Add(button);
|
||||
|
||||
if (selectedSidebarButton == null)
|
||||
{
|
||||
selectedSidebarButton = sidebar.Children.First();
|
||||
selectedSidebarButton = Sidebar.Children.First();
|
||||
selectedSidebarButton.Selected = true;
|
||||
}
|
||||
}
|
||||
@ -145,20 +150,24 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
base.PopIn();
|
||||
|
||||
ContentContainer.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
sidebar?.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
this.FadeTo(1, TRANSITION_LENGTH / 2);
|
||||
ContentContainer.MoveToX(ExpandedPosition, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
|
||||
Sidebar?.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
this.FadeTo(1, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
|
||||
searchTextBox.HoldFocus = true;
|
||||
}
|
||||
|
||||
protected virtual float ExpandedPosition => 0;
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
ContentContainer.MoveToX(-width, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
sidebar?.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
this.FadeTo(0, TRANSITION_LENGTH / 2);
|
||||
ContentContainer.MoveToX(-WIDTH, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
|
||||
Sidebar?.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
|
||||
searchTextBox.HoldFocus = false;
|
||||
if (searchTextBox.HasFocus)
|
||||
@ -179,8 +188,8 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
ContentContainer.Margin = new MarginPadding { Left = sidebar?.DrawWidth ?? 0 };
|
||||
ContentContainer.Padding = new MarginPadding { Top = getToolbarHeight() };
|
||||
ContentContainer.Margin = new MarginPadding { Left = Sidebar?.DrawWidth ?? 0 };
|
||||
ContentContainer.Padding = new MarginPadding { Top = GetToolbarHeight?.Invoke() ?? 0 };
|
||||
}
|
||||
|
||||
protected class SettingsSectionsContainer : SectionsContainer<SettingsSection>
|
||||
|
Loading…
Reference in New Issue
Block a user