mirror of
https://github.com/ppy/osu.git
synced 2025-03-19 01:17:19 +08:00
Merge branch 'master' into toolbar-button-swap
This commit is contained in:
commit
69a3251f61
@ -1 +1 @@
|
||||
Subproject commit acb9bfb084b5607ff31c6269cb7942fa02624b75
|
||||
Subproject commit 5c22092e590d589927962b8d0173dae5f9b1405c
|
@ -2,18 +2,14 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Desktop.Tests.Visual
|
||||
{
|
||||
@ -27,35 +23,13 @@ namespace osu.Desktop.Tests.Visual
|
||||
{
|
||||
var rateAdjustClock = new StopwatchClock(true);
|
||||
framedClock = new FramedClock(rateAdjustClock);
|
||||
playbackSpeed.ValueChanged += delegate { rateAdjustClock.Rate = playbackSpeed.Value; };
|
||||
|
||||
playbackSpeed.TriggerChange();
|
||||
|
||||
AddStep(@"circles", () => loadHitobjects(HitObjectType.Circle));
|
||||
AddStep(@"slider", () => loadHitobjects(HitObjectType.Slider));
|
||||
AddStep(@"spinner", () => loadHitobjects(HitObjectType.Spinner));
|
||||
|
||||
AddToggleStep(@"auto", state => { auto = state; loadHitobjects(mode); });
|
||||
|
||||
BasicSliderBar<double> sliderBar;
|
||||
Add(new Container
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText { Text = "Playback Speed" },
|
||||
sliderBar = new BasicSliderBar<double>
|
||||
{
|
||||
Width = 150,
|
||||
Height = 10,
|
||||
SelectionColor = Color4.Orange,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sliderBar.Current.BindTo(playbackSpeed);
|
||||
AddToggleStep("Auto", state => { auto = state; loadHitobjects(mode); });
|
||||
AddSliderStep("Playback speed", 0.0, 2.0, 0.5, v => rateAdjustClock.Rate = v);
|
||||
|
||||
framedClock.ProcessFrame();
|
||||
|
||||
@ -75,7 +49,6 @@ namespace osu.Desktop.Tests.Visual
|
||||
|
||||
private HitObjectType mode = HitObjectType.Slider;
|
||||
|
||||
private readonly BindableNumber<double> playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 };
|
||||
private readonly Container playfieldContainer;
|
||||
private readonly Container approachContainer;
|
||||
|
||||
|
@ -1,11 +1,8 @@
|
||||
// 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.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Screens.Play;
|
||||
@ -34,34 +31,13 @@ namespace osu.Desktop.Tests.Visual
|
||||
new KeyCounterMouse(MouseButton.Right),
|
||||
},
|
||||
};
|
||||
BindableInt bindable = new BindableInt { MinValue = 0, MaxValue = 200, Default = 50 };
|
||||
bindable.ValueChanged += delegate { kc.FadeTime = bindable.Value; };
|
||||
AddStep("Add Random", () =>
|
||||
|
||||
AddStep("Add random", () =>
|
||||
{
|
||||
Key key = (Key)((int)Key.A + RNG.Next(26));
|
||||
kc.Add(new KeyCounterKeyboard(key));
|
||||
});
|
||||
|
||||
TestSliderBar<int> sliderBar;
|
||||
|
||||
Add(new Container
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText { Text = "FadeTime" },
|
||||
sliderBar = new TestSliderBar<int>
|
||||
{
|
||||
Width = 150,
|
||||
Height = 10,
|
||||
SelectionColor = Color4.Orange,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sliderBar.Current.BindTo(bindable);
|
||||
AddSliderStep("Fade time", 0, 200, 50, v => kc.FadeTime = v);
|
||||
|
||||
Add(kc);
|
||||
}
|
||||
|
@ -27,8 +27,6 @@ namespace osu.Desktop.Overlays
|
||||
private UpdateManager updateManager;
|
||||
private NotificationOverlay notificationOverlay;
|
||||
|
||||
protected override bool HideOnEscape => false;
|
||||
|
||||
public override bool HandleInput => false;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -5,7 +5,6 @@ using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Input;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
@ -37,16 +36,18 @@ namespace osu.Game.Graphics.UserInterface
|
||||
BorderThickness = 0;
|
||||
}
|
||||
|
||||
protected override void OnFocusLost(InputState state)
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
if (state.Keyboard.Keys.Any(key => key == Key.Escape))
|
||||
if (args.Key == Key.Escape)
|
||||
{
|
||||
if (Text.Length > 0)
|
||||
Text = string.Empty;
|
||||
else
|
||||
Exit?.Invoke();
|
||||
return true;
|
||||
}
|
||||
base.OnFocusLost(state);
|
||||
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
|
||||
public override bool RequestsFocus => HoldFocus;
|
||||
|
@ -15,8 +15,6 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
||||
{
|
||||
private readonly VolumeMeter volumeMeterMaster;
|
||||
|
||||
protected override bool HideOnEscape => false;
|
||||
|
||||
private void volumeChanged(double newVolume)
|
||||
{
|
||||
Show();
|
||||
|
@ -6,7 +6,6 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Input.Bindings
|
||||
@ -31,23 +30,8 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(new[] { Key.LControl, Key.D }, GlobalAction.ToggleDirect),
|
||||
};
|
||||
|
||||
protected override bool PropagateKeyDown(IEnumerable<Drawable> drawables, InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
if (handler != null)
|
||||
drawables = new[] { handler }.Concat(drawables);
|
||||
|
||||
// always handle ourselves before all children.
|
||||
return base.PropagateKeyDown(drawables, state, args);
|
||||
}
|
||||
|
||||
protected override bool PropagateKeyUp(IEnumerable<Drawable> drawables, InputState state, KeyUpEventArgs args)
|
||||
{
|
||||
if (handler != null)
|
||||
drawables = new[] { handler }.Concat(drawables);
|
||||
|
||||
// always handle ourselves before all children.
|
||||
return base.PropagateKeyUp(drawables, state, args);
|
||||
}
|
||||
protected override IEnumerable<Drawable> GetKeyboardInputQueue() =>
|
||||
handler == null ? base.GetKeyboardInputQueue() : new[] { handler }.Concat(base.GetKeyboardInputQueue());
|
||||
}
|
||||
|
||||
public enum GlobalAction
|
||||
|
@ -11,7 +11,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Input;
|
||||
@ -106,12 +105,6 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
}
|
||||
};
|
||||
|
||||
reloadBindings();
|
||||
}
|
||||
|
||||
private void reloadBindings()
|
||||
{
|
||||
buttons.Clear();
|
||||
foreach (var b in bindings)
|
||||
buttons.Add(new KeyButton(b));
|
||||
}
|
||||
@ -149,23 +142,50 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
if (HasFocus && !isModifier(args.Key))
|
||||
switch (args.Key)
|
||||
{
|
||||
bindTarget.KeyBinding.KeyCombination = args.Key == Key.Delete ? Key.Unknown : new KeyCombination(state.Keyboard.Keys);
|
||||
case Key.Escape:
|
||||
GetContainingInputManager().ChangeFocus(null);
|
||||
return true;
|
||||
case Key.Delete:
|
||||
bindTarget.UpdateKeyCombination(Key.Unknown);
|
||||
store.Update(bindTarget.KeyBinding);
|
||||
GetContainingInputManager().ChangeFocus(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
store.Update(bindTarget.KeyBinding);
|
||||
GetContainingInputManager().ChangeFocus(null);
|
||||
if (HasFocus)
|
||||
{
|
||||
bindTarget.UpdateKeyCombination(state.Keyboard.Keys.ToArray());
|
||||
if (!isModifier(args.Key))
|
||||
finalise();
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
|
||||
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args)
|
||||
{
|
||||
if (HasFocus)
|
||||
{
|
||||
finalise();
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnKeyUp(state, args);
|
||||
}
|
||||
|
||||
private void finalise()
|
||||
{
|
||||
store.Update(bindTarget.KeyBinding);
|
||||
GetContainingInputManager().ChangeFocus(null);
|
||||
}
|
||||
|
||||
protected override void OnFocusLost(InputState state)
|
||||
{
|
||||
bindTarget.IsBinding = false;
|
||||
bindTarget = null;
|
||||
reloadBindings();
|
||||
|
||||
pressAKey.FadeOut(300, Easing.OutQuint);
|
||||
pressAKey.Padding = new MarginPadding { Bottom = -pressAKey.DrawHeight };
|
||||
@ -197,19 +217,10 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
get { return isBinding; }
|
||||
set
|
||||
{
|
||||
if (value == isBinding) return;
|
||||
isBinding = value;
|
||||
|
||||
if (value)
|
||||
{
|
||||
box.FadeColour(Color4.White, transition_time, Easing.OutQuint);
|
||||
Text.FadeColour(Color4.Black, transition_time, Easing.OutQuint);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
box.FadeColour(Color4.Black, transition_time, Easing.OutQuint);
|
||||
Text.FadeColour(Color4.White, transition_time, Easing.OutQuint);
|
||||
}
|
||||
updateHoverState();
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,25 +272,35 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
if (isBinding)
|
||||
return false;
|
||||
|
||||
box.FadeColour(hoverColour, transition_time, Easing.OutQuint);
|
||||
Text.FadeColour(Color4.Black, transition_time, Easing.OutQuint);
|
||||
|
||||
updateHoverState();
|
||||
return base.OnHover(state);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
if (isBinding)
|
||||
return;
|
||||
|
||||
box.FadeColour(Color4.Black, transition_time, Easing.OutQuint);
|
||||
Text.FadeColour(Color4.White, transition_time, Easing.OutQuint);
|
||||
|
||||
updateHoverState();
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
|
||||
private void updateHoverState()
|
||||
{
|
||||
if (isBinding)
|
||||
{
|
||||
box.FadeColour(Color4.White, transition_time, Easing.OutQuint);
|
||||
Text.FadeColour(Color4.Black, transition_time, Easing.OutQuint);
|
||||
}
|
||||
else
|
||||
{
|
||||
box.FadeColour(IsHovered ? hoverColour : Color4.Black, transition_time, Easing.OutQuint);
|
||||
Text.FadeColour(IsHovered ? Color4.Black : Color4.White, transition_time, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateKeyCombination(params Key[] newCombination)
|
||||
{
|
||||
KeyBinding.KeyCombination = newCombination;
|
||||
Text.Text = KeyBinding.KeyCombination.ReadableString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2,14 +2,25 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Overlays.Settings.Sections;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class MainSettings : SettingsOverlay
|
||||
{
|
||||
private readonly KeyBindingOverlay keyBindingOverlay;
|
||||
private BackButton backButton;
|
||||
|
||||
protected override IEnumerable<SettingsSection> CreateSections() => new SettingsSection[]
|
||||
{
|
||||
new GeneralSection(),
|
||||
@ -17,7 +28,7 @@ namespace osu.Game.Overlays
|
||||
new GameplaySection(),
|
||||
new AudioSection(),
|
||||
new SkinSection(),
|
||||
new InputSection(),
|
||||
new InputSection(keyBindingOverlay),
|
||||
new OnlineSection(),
|
||||
new MaintenanceSection(),
|
||||
new DebugSection(),
|
||||
@ -26,8 +37,138 @@ namespace osu.Game.Overlays
|
||||
protected override Drawable CreateHeader() => new SettingsHeader("settings", "Change the way osu! behaves");
|
||||
protected override Drawable CreateFooter() => new SettingsFooter();
|
||||
|
||||
public MainSettings() : base(true)
|
||||
public MainSettings()
|
||||
: base(true)
|
||||
{
|
||||
keyBindingOverlay = new KeyBindingOverlay { Depth = 1 };
|
||||
keyBindingOverlay.StateChanged += keyBindingOverlay_StateChanged;
|
||||
}
|
||||
|
||||
public override bool AcceptsFocus => keyBindingOverlay.State != Visibility.Visible;
|
||||
|
||||
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);
|
||||
|
||||
backButton.Delay(100).FadeIn(100);
|
||||
break;
|
||||
case Visibility.Hidden:
|
||||
Background.FadeTo(0.6f, 500, Easing.OutQuint);
|
||||
SectionsContainer.FadeIn(500, Easing.OutQuint);
|
||||
ContentContainer.MoveToX(0, 500, Easing.OutQuint);
|
||||
|
||||
backButton.FadeOut(100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
keyBindingOverlay.State = Visibility.Hidden;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AddInternal(keyBindingOverlay);
|
||||
AddInternal(backButton = new BackButton
|
||||
{
|
||||
Alpha = 0,
|
||||
Height = 150,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
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]
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
aspect = new AspectContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
flow = new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
RelativePositionAxes = Axes.Y,
|
||||
Y = 0.4f,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
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 },
|
||||
}
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
RelativePositionAxes = Axes.Y,
|
||||
Y = 0.7f,
|
||||
TextSize = 12,
|
||||
Font = @"Exo2.0-Bold",
|
||||
Origin = Anchor.Centre,
|
||||
Text = @"back",
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
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);
|
||||
return base.OnMouseDown(state, args);
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
||||
{
|
||||
aspect.ScaleTo(1, 1000, Easing.OutElastic);
|
||||
return base.OnMouseUp(state, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -26,8 +26,11 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
audio.OnNewDevice -= onDeviceChanged;
|
||||
audio.OnLostDevice -= onDeviceChanged;
|
||||
if (audio != null)
|
||||
{
|
||||
audio.OnNewDevice -= onDeviceChanged;
|
||||
audio.OnLostDevice -= onDeviceChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateItems()
|
||||
|
@ -10,14 +10,15 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
{
|
||||
protected override string Header => "Keyboard";
|
||||
|
||||
public KeyboardSettings()
|
||||
public KeyboardSettings(KeyBindingOverlay keyConfig)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Key Configuration"
|
||||
Text = "Key Configuration",
|
||||
Action = () => keyConfig.ToggleVisibility()
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -12,12 +12,12 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
public override string Header => "Input";
|
||||
public override FontAwesome Icon => FontAwesome.fa_keyboard_o;
|
||||
|
||||
public InputSection()
|
||||
public InputSection(KeyBindingOverlay keyConfig)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new MouseSettings(),
|
||||
new KeyboardSettings(),
|
||||
new KeyboardSettings(keyConfig),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,10 @@ namespace osu.Game.Overlays
|
||||
|
||||
private const float sidebar_padding = 10;
|
||||
|
||||
protected Container<Drawable> ContentContainer;
|
||||
|
||||
protected override Container<Drawable> Content => ContentContainer;
|
||||
|
||||
private Sidebar sidebar;
|
||||
private SidebarButton selectedSidebarButton;
|
||||
|
||||
@ -40,6 +44,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
private readonly bool showSidebar;
|
||||
|
||||
protected Box Background;
|
||||
|
||||
protected SettingsOverlay(bool showSidebar)
|
||||
{
|
||||
this.showSidebar = showSidebar;
|
||||
@ -52,40 +58,43 @@ namespace osu.Game.Overlays
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuGame game)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
InternalChild = ContentContainer = new Container
|
||||
{
|
||||
new Box
|
||||
Width = width,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.6f,
|
||||
},
|
||||
SectionsContainer = new SettingsSectionsContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = width,
|
||||
Margin = new MarginPadding { Left = SIDEBAR_WIDTH },
|
||||
ExpandableHeader = CreateHeader(),
|
||||
FixedHeader = searchTextBox = new SearchTextBox
|
||||
Background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Width = 0.95f,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Top = 20,
|
||||
Bottom = 20
|
||||
},
|
||||
Exit = Hide,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.6f,
|
||||
},
|
||||
Footer = CreateFooter()
|
||||
},
|
||||
SectionsContainer = new SettingsSectionsContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ExpandableHeader = CreateHeader(),
|
||||
FixedHeader = searchTextBox = new SearchTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Width = 0.95f,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Top = 20,
|
||||
Bottom = 20
|
||||
},
|
||||
Exit = Hide,
|
||||
},
|
||||
Footer = CreateFooter()
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
if (showSidebar)
|
||||
{
|
||||
Add(sidebar = new Sidebar { Width = SIDEBAR_WIDTH });
|
||||
AddInternal(sidebar = new Sidebar { Width = SIDEBAR_WIDTH });
|
||||
|
||||
SectionsContainer.SelectedSection.ValueChanged += section =>
|
||||
{
|
||||
@ -136,7 +145,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
base.PopIn();
|
||||
|
||||
SectionsContainer.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
ContentContainer.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
sidebar?.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
this.FadeTo(1, TRANSITION_LENGTH / 2);
|
||||
|
||||
@ -147,7 +156,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
SectionsContainer.MoveToX(-width, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
ContentContainer.MoveToX(-width, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
sidebar?.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
this.FadeTo(0, TRANSITION_LENGTH / 2);
|
||||
|
||||
@ -170,8 +179,8 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
SectionsContainer.Margin = new MarginPadding { Left = sidebar?.DrawWidth ?? 0 };
|
||||
SectionsContainer.Padding = new MarginPadding { Top = getToolbarHeight() };
|
||||
ContentContainer.Margin = new MarginPadding { Left = sidebar?.DrawWidth ?? 0 };
|
||||
ContentContainer.Padding = new MarginPadding { Top = getToolbarHeight() };
|
||||
}
|
||||
|
||||
protected class SettingsSectionsContainer : SectionsContainer<SettingsSection>
|
||||
|
@ -22,8 +22,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
private readonly ToolbarUserArea userArea;
|
||||
|
||||
protected override bool HideOnEscape => false;
|
||||
|
||||
protected override bool BlockPassThroughMouse => false;
|
||||
|
||||
private const double transition_time = 500;
|
||||
|
@ -22,8 +22,6 @@ namespace osu.Game.Screens.Play
|
||||
private const int button_height = 70;
|
||||
private const float background_alpha = 0.75f;
|
||||
|
||||
protected override bool HideOnEscape => false;
|
||||
|
||||
protected override bool BlockPassThroughKeyboard => true;
|
||||
|
||||
public Action OnRetry;
|
||||
@ -95,7 +93,8 @@ namespace osu.Game.Screens.Play
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Height = button_height,
|
||||
Action = delegate {
|
||||
Action = delegate
|
||||
{
|
||||
action?.Invoke();
|
||||
Hide();
|
||||
}
|
||||
|
@ -18,8 +18,6 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
private const int bottom_bar_height = 5;
|
||||
|
||||
protected override bool HideOnEscape => false;
|
||||
|
||||
private static readonly Vector2 handle_size = new Vector2(14, 25);
|
||||
|
||||
private const float transition_duration = 200;
|
||||
|
@ -50,8 +50,6 @@ namespace osu.Game.Screens.Select
|
||||
AlwaysPresent = true;
|
||||
}
|
||||
|
||||
protected override bool HideOnEscape => false;
|
||||
|
||||
protected override bool BlockPassThroughMouse => false;
|
||||
|
||||
protected override void PopIn()
|
||||
|
Loading…
x
Reference in New Issue
Block a user