mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:23:21 +08:00
Merge branch 'master' into menu-bar
This commit is contained in:
commit
cabf671811
@ -1,9 +1,9 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -14,35 +14,43 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class OsuDropdown<T> : Dropdown<T>
|
||||
public class OsuDropdown<T> : Dropdown<T>, IHasAccentColour
|
||||
{
|
||||
public readonly Bindable<Color4?> AccentColour = new Bindable<Color4?>();
|
||||
private Color4 accentColour;
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour; }
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
updateAccentColour();
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
if (AccentColour.Value == null)
|
||||
AccentColour.Value = colours.PinkDarker;
|
||||
if (accentColour == default(Color4))
|
||||
accentColour = colours.PinkDarker;
|
||||
updateAccentColour();
|
||||
|
||||
}
|
||||
|
||||
protected override DropdownHeader CreateHeader()
|
||||
private void updateAccentColour()
|
||||
{
|
||||
var newHeader = new OsuDropdownHeader();
|
||||
newHeader.AccentColour.BindTo(AccentColour);
|
||||
var header = Header as IHasAccentColour;
|
||||
if (header != null) header.AccentColour = accentColour;
|
||||
|
||||
return newHeader;
|
||||
var menu = Menu as IHasAccentColour;
|
||||
if (menu != null) menu.AccentColour = accentColour;
|
||||
}
|
||||
|
||||
protected override DropdownMenu CreateMenu()
|
||||
{
|
||||
var newMenu = new OsuDropdownMenu();
|
||||
newMenu.AccentColour.BindTo(AccentColour);
|
||||
protected override DropdownHeader CreateHeader() => new OsuDropdownHeader();
|
||||
|
||||
return newMenu;
|
||||
}
|
||||
protected override DropdownMenu CreateMenu() => new OsuDropdownMenu();
|
||||
|
||||
#region OsuDropdownMenu
|
||||
protected class OsuDropdownMenu : DropdownMenu
|
||||
protected class OsuDropdownMenu : DropdownMenu, IHasAccentColour
|
||||
{
|
||||
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring
|
||||
public OsuDropdownMenu()
|
||||
@ -65,23 +73,41 @@ namespace osu.Game.Graphics.UserInterface
|
||||
this.ResizeHeightTo(State == MenuState.Opened ? actualHeight : 0, 300, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public readonly Bindable<Color4?> AccentColour = new Bindable<Color4?>();
|
||||
|
||||
|
||||
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item)
|
||||
private Color4 accentColour;
|
||||
public Color4 AccentColour
|
||||
{
|
||||
var newItem = new DrawableOsuDropdownMenuItem(item);
|
||||
newItem.AccentColour.BindTo(AccentColour);
|
||||
|
||||
return newItem;
|
||||
get { return accentColour; }
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
foreach (var c in Children.OfType<IHasAccentColour>())
|
||||
c.AccentColour = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region DrawableOsuDropdownMenuItem
|
||||
protected class DrawableOsuDropdownMenuItem : DrawableDropdownMenuItem
|
||||
{
|
||||
public readonly Bindable<Color4?> AccentColour = new Bindable<Color4?>();
|
||||
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableOsuDropdownMenuItem(item) { AccentColour = accentColour };
|
||||
|
||||
private TextContainer textContainer;
|
||||
#region DrawableOsuDropdownMenuItem
|
||||
protected class DrawableOsuDropdownMenuItem : DrawableDropdownMenuItem, IHasAccentColour
|
||||
{
|
||||
private Color4? accentColour;
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour ?? nonAccentSelectedColour; }
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
updateColours();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateColours()
|
||||
{
|
||||
BackgroundColourHover = accentColour ?? nonAccentHoverColour;
|
||||
BackgroundColourSelected = accentColour ?? nonAccentSelectedColour;
|
||||
UpdateBackgroundColour();
|
||||
UpdateForegroundColour();
|
||||
}
|
||||
|
||||
private Color4 nonAccentHoverColour;
|
||||
private Color4 nonAccentSelectedColour;
|
||||
@ -93,36 +119,29 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
Masking = true;
|
||||
CornerRadius = 6;
|
||||
|
||||
AccentColour.ValueChanged += updateAccent;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
BackgroundColour = Color4.Transparent;
|
||||
|
||||
nonAccentHoverColour = colours.PinkDarker;
|
||||
nonAccentSelectedColour = Color4.Black.Opacity(0.5f);
|
||||
}
|
||||
|
||||
private void updateAccent(Color4? newValue)
|
||||
{
|
||||
BackgroundColourHover = newValue ?? nonAccentHoverColour;
|
||||
BackgroundColourSelected = newValue ?? nonAccentSelectedColour;
|
||||
UpdateBackgroundColour();
|
||||
UpdateForegroundColour();
|
||||
updateColours();
|
||||
}
|
||||
|
||||
protected override void UpdateForegroundColour()
|
||||
{
|
||||
base.UpdateForegroundColour();
|
||||
|
||||
textContainer.Chevron.Alpha = IsHovered ? 1 : 0;
|
||||
var content = Foreground.Children.FirstOrDefault() as Content;
|
||||
if (content != null) content.Chevron.Alpha = IsHovered ? 1 : 0;
|
||||
}
|
||||
|
||||
protected override Drawable CreateContent() => textContainer = new TextContainer();
|
||||
protected override Drawable CreateContent() => new Content();
|
||||
|
||||
protected class TextContainer : FillFlowContainer, IHasText
|
||||
protected class Content : FillFlowContainer, IHasText
|
||||
{
|
||||
public string Text
|
||||
{
|
||||
@ -133,7 +152,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
public readonly OsuSpriteText Label;
|
||||
public readonly SpriteIcon Chevron;
|
||||
|
||||
public TextContainer()
|
||||
public Content()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
@ -165,7 +184,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
#endregion
|
||||
|
||||
public class OsuDropdownHeader : DropdownHeader
|
||||
public class OsuDropdownHeader : DropdownHeader, IHasAccentColour
|
||||
{
|
||||
protected readonly SpriteText Text;
|
||||
protected override string Label
|
||||
@ -176,7 +195,16 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected readonly SpriteIcon Icon;
|
||||
|
||||
public readonly Bindable<Color4?> AccentColour = new Bindable<Color4?>();
|
||||
private Color4 accentColour;
|
||||
public virtual Color4 AccentColour
|
||||
{
|
||||
get { return accentColour; }
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
BackgroundColourHover = accentColour;
|
||||
}
|
||||
}
|
||||
|
||||
public OsuDropdownHeader()
|
||||
{
|
||||
@ -203,20 +231,13 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Size = new Vector2(20),
|
||||
}
|
||||
};
|
||||
|
||||
AccentColour.ValueChanged += accentColourChanged;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
BackgroundColour = Color4.Black.Opacity(0.5f);
|
||||
BackgroundColourHover = AccentColour?.Value ?? colours.PinkDarker;
|
||||
}
|
||||
|
||||
private void accentColourChanged(Color4? newValue)
|
||||
{
|
||||
BackgroundColourHover = newValue ?? Color4.White;
|
||||
BackgroundColourHover = colours.PinkDarker;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
|
@ -1,11 +1,16 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Platform;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
@ -15,6 +20,49 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public override bool AllowClipboardExport => false;
|
||||
|
||||
private readonly CapsWarning warning;
|
||||
|
||||
private GameHost host;
|
||||
|
||||
public OsuPasswordTextBox()
|
||||
{
|
||||
Add(warning = new CapsWarning
|
||||
{
|
||||
Size = new Vector2(20),
|
||||
Origin = Anchor.CentreRight,
|
||||
Anchor = Anchor.CentreRight,
|
||||
Margin = new MarginPadding { Right = 10 },
|
||||
Alpha = 0,
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host)
|
||||
{
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
if (args.Key == Key.CapsLock)
|
||||
updateCapsWarning(host.CapsLockEnabled);
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
|
||||
protected override void OnFocus(InputState state)
|
||||
{
|
||||
updateCapsWarning(host.CapsLockEnabled);
|
||||
base.OnFocus(state);
|
||||
}
|
||||
|
||||
protected override void OnFocusLost(InputState state)
|
||||
{
|
||||
updateCapsWarning(false);
|
||||
base.OnFocusLost(state);
|
||||
}
|
||||
|
||||
private void updateCapsWarning(bool visible) => warning.FadeTo(visible ? 1 : 0, 250, Easing.OutQuint);
|
||||
|
||||
public class PasswordMaskChar : Container
|
||||
{
|
||||
private readonly CircularContainer circle;
|
||||
@ -51,5 +99,21 @@ namespace osu.Game.Graphics.UserInterface
|
||||
circle.ResizeTo(new Vector2(0.8f), 500, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
|
||||
private class CapsWarning : SpriteIcon, IHasTooltip
|
||||
{
|
||||
public string TooltipText => @"Caps lock is active";
|
||||
|
||||
public CapsWarning()
|
||||
{
|
||||
Icon = FontAwesome.fa_warning;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
||||
{
|
||||
Colour = colour.YellowLight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,34 +37,34 @@ namespace osu.Game.Graphics.UserInterface
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
if (accentColour == null)
|
||||
if (accentColour == default(Color4))
|
||||
AccentColour = colours.Blue;
|
||||
}
|
||||
|
||||
private Color4? accentColour;
|
||||
private Color4 accentColour;
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour.GetValueOrDefault(); }
|
||||
get { return accentColour; }
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
var dropdown = Dropdown as OsuTabDropdown;
|
||||
var dropdown = Dropdown as IHasAccentColour;
|
||||
if (dropdown != null)
|
||||
dropdown.AccentColour.Value = value;
|
||||
foreach (var item in TabContainer.Children.OfType<OsuTabItem>())
|
||||
item.AccentColour = value;
|
||||
dropdown.AccentColour = value;
|
||||
foreach (var i in TabContainer.Children.OfType<IHasAccentColour>())
|
||||
i.AccentColour = value;
|
||||
}
|
||||
}
|
||||
|
||||
public class OsuTabItem : TabItem<T>
|
||||
public class OsuTabItem : TabItem<T>, IHasAccentColour
|
||||
{
|
||||
protected readonly SpriteText Text;
|
||||
private readonly Box box;
|
||||
|
||||
private Color4? accentColour;
|
||||
private Color4 accentColour;
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour.GetValueOrDefault(); }
|
||||
get { return accentColour; }
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
@ -103,7 +103,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
if (accentColour == null)
|
||||
if (accentColour == default(Color4))
|
||||
AccentColour = colours.Blue;
|
||||
}
|
||||
|
||||
@ -148,25 +148,13 @@ namespace osu.Game.Graphics.UserInterface
|
||||
RelativeSizeAxes = Axes.X;
|
||||
}
|
||||
|
||||
protected override DropdownMenu CreateMenu()
|
||||
protected override DropdownMenu CreateMenu() => new OsuTabDropdownMenu();
|
||||
|
||||
protected override DropdownHeader CreateHeader() => new OsuTabDropdownHeader
|
||||
{
|
||||
var menu = new OsuTabDropdownMenu();
|
||||
menu.AccentColour.BindTo(AccentColour);
|
||||
return menu;
|
||||
}
|
||||
|
||||
protected override DropdownHeader CreateHeader()
|
||||
{
|
||||
var newHeader = new OsuTabDropdownHeader
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight
|
||||
};
|
||||
|
||||
newHeader.AccentColour.BindTo(AccentColour);
|
||||
|
||||
return newHeader;
|
||||
}
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight
|
||||
};
|
||||
|
||||
private class OsuTabDropdownMenu : OsuDropdownMenu
|
||||
{
|
||||
@ -179,12 +167,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
MaxHeight = 400;
|
||||
}
|
||||
|
||||
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item)
|
||||
{
|
||||
var result = new DrawableOsuTabDropdownMenuItem(item);
|
||||
result.AccentColour.BindTo(AccentColour);
|
||||
return result;
|
||||
}
|
||||
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableOsuTabDropdownMenuItem(item) { AccentColour = AccentColour };
|
||||
|
||||
private class DrawableOsuTabDropdownMenuItem : DrawableOsuDropdownMenuItem
|
||||
{
|
||||
@ -199,6 +182,20 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected class OsuTabDropdownHeader : OsuDropdownHeader
|
||||
{
|
||||
public override Color4 AccentColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.AccentColour;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
base.AccentColour = value;
|
||||
Foreground.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
public OsuTabDropdownHeader()
|
||||
{
|
||||
RelativeSizeAxes = Axes.None;
|
||||
@ -227,13 +224,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
};
|
||||
|
||||
Padding = new MarginPadding { Left = 5, Right = 5 };
|
||||
|
||||
AccentColour.ValueChanged += accentColourChanged;
|
||||
}
|
||||
|
||||
private void accentColourChanged(Color4? newValue)
|
||||
{
|
||||
Foreground.Colour = newValue ?? Color4.White;
|
||||
}
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
|
@ -226,9 +226,21 @@ namespace osu.Game
|
||||
dependencies.Cache(notificationOverlay);
|
||||
dependencies.Cache(dialogOverlay);
|
||||
|
||||
// ensure both overlays aren't presented at the same time
|
||||
chat.StateChanged += (container, state) => social.State = state == Visibility.Visible ? Visibility.Hidden : social.State;
|
||||
social.StateChanged += (container, state) => chat.State = state == Visibility.Visible ? Visibility.Hidden : chat.State;
|
||||
// ensure only one of these overlays are open at once.
|
||||
var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct };
|
||||
foreach (var overlay in singleDisplayOverlays)
|
||||
{
|
||||
overlay.StateChanged += (container, state) =>
|
||||
{
|
||||
if (state == Visibility.Hidden) return;
|
||||
|
||||
foreach (var c in singleDisplayOverlays)
|
||||
{
|
||||
if (c == container) continue;
|
||||
c.State = Visibility.Hidden;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
LoadComponentAsync(Toolbar = new Toolbar
|
||||
{
|
||||
|
@ -152,14 +152,10 @@ namespace osu.Game
|
||||
|
||||
Beatmap.ValueChanged += b =>
|
||||
{
|
||||
// compare to last baetmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo)
|
||||
// compare to last beatmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo)
|
||||
if (lastBeatmap?.Track != b.Track)
|
||||
{
|
||||
// this disposal is done to stop the audio track.
|
||||
// it may not be exactly what we want for cases beatmaps are reused, as it will
|
||||
// trigger a fresh load of contained resources.
|
||||
lastBeatmap?.Dispose();
|
||||
|
||||
lastBeatmap?.Track?.Dispose();
|
||||
Audio.Track.AddItem(b.Track);
|
||||
}
|
||||
|
||||
|
@ -11,14 +11,12 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Framework.Logging;
|
||||
@ -49,6 +47,23 @@ namespace osu.Game.Overlays.Direct
|
||||
SetInfo = setInfo;
|
||||
}
|
||||
|
||||
private readonly EdgeEffectParameters edgeEffectNormal = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Offset = new Vector2(0f, 1f),
|
||||
Radius = 2f,
|
||||
Colour = Color4.Black.Opacity(0.25f),
|
||||
};
|
||||
|
||||
private readonly EdgeEffectParameters edgeEffectHovered = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Offset = new Vector2(0f, 5f),
|
||||
Radius = 10f,
|
||||
Colour = Color4.Black.Opacity(0.3f),
|
||||
};
|
||||
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(APIAccess api, BeatmapManager beatmaps, OsuColour colours, NotificationOverlay notifications)
|
||||
{
|
||||
@ -60,13 +75,7 @@ namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Offset = new Vector2(0f, 1f),
|
||||
Radius = 2f,
|
||||
Colour = Color4.Black.Opacity(0.25f),
|
||||
},
|
||||
EdgeEffect = edgeEffectNormal,
|
||||
Children = new[]
|
||||
{
|
||||
// temporary blackness until the actual background loads.
|
||||
@ -92,8 +101,7 @@ namespace osu.Game.Overlays.Direct
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
content.FadeEdgeEffectTo(1f, hover_transition_time, Easing.OutQuint);
|
||||
content.TransformTo(content.PopulateTransform(new TransformEdgeEffectRadius(), 14, hover_transition_time, Easing.OutQuint));
|
||||
content.TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint);
|
||||
content.MoveToY(-4, hover_transition_time, Easing.OutQuint);
|
||||
|
||||
return base.OnHover(state);
|
||||
@ -101,8 +109,7 @@ namespace osu.Game.Overlays.Direct
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
content.FadeEdgeEffectTo(0.25f, hover_transition_time, Easing.OutQuint);
|
||||
content.TransformTo(content.PopulateTransform(new TransformEdgeEffectRadius(), 2, hover_transition_time, Easing.OutQuint));
|
||||
content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint);
|
||||
content.MoveToY(0, hover_transition_time, Easing.OutQuint);
|
||||
|
||||
base.OnHoverLost(state);
|
||||
@ -278,30 +285,5 @@ namespace osu.Game.Overlays.Direct
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
private class TransformEdgeEffectRadius : Transform<float, Container>
|
||||
{
|
||||
/// <summary>
|
||||
/// Current value of the transformed colour in linear colour space.
|
||||
/// </summary>
|
||||
private float valueAt(double time)
|
||||
{
|
||||
if (time < StartTime) return StartValue;
|
||||
if (time >= EndTime) return EndValue;
|
||||
|
||||
return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
|
||||
}
|
||||
|
||||
public override string TargetMember => "EdgeEffect.Colour";
|
||||
|
||||
protected override void Apply(Container c, double time)
|
||||
{
|
||||
EdgeEffectParameters e = c.EdgeEffect;
|
||||
e.Radius = valueAt(time);
|
||||
c.EdgeEffect = e;
|
||||
}
|
||||
|
||||
protected override void ReadIntoStartValue(Container d) => StartValue = d.EdgeEffect.Radius;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Overlays.Direct
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuGame game, RulesetStore rulesets, OsuColour colours)
|
||||
{
|
||||
DisplayStyleControl.Dropdown.AccentColour.Value = colours.BlueDark;
|
||||
DisplayStyleControl.Dropdown.AccentColour = colours.BlueDark;
|
||||
|
||||
Ruleset.BindTo(game?.Ruleset ?? new Bindable<RulesetInfo> { Value = rulesets.GetRuleset(0) });
|
||||
foreach (var r in rulesets.AllRulesets)
|
||||
|
@ -122,14 +122,14 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
this.FadeEdgeEffectTo<Container>(1, transition_time, Easing.OutQuint);
|
||||
FadeEdgeEffectTo(1, transition_time, Easing.OutQuint);
|
||||
|
||||
return base.OnHover(state);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
this.FadeEdgeEffectTo<Container>(0, transition_time, Easing.OutQuint);
|
||||
FadeEdgeEffectTo(0, transition_time, Easing.OutQuint);
|
||||
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
|
@ -18,16 +18,10 @@ namespace osu.Game.Overlays.Music
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AccentColour.Value = colours.Gray6;
|
||||
AccentColour = colours.Gray6;
|
||||
}
|
||||
|
||||
protected override DropdownHeader CreateHeader()
|
||||
{
|
||||
var newHeader = new CollectionsHeader();
|
||||
newHeader.AccentColour.BindTo(AccentColour);
|
||||
|
||||
return newHeader;
|
||||
}
|
||||
protected override DropdownHeader CreateHeader() => new CollectionsHeader();
|
||||
|
||||
protected override DropdownMenu CreateMenu() => new CollectionsMenu();
|
||||
|
||||
|
@ -348,23 +348,23 @@ namespace osu.Game.Overlays
|
||||
|
||||
playerContainer.Add(new AsyncLoadWrapper(new Background(beatmap)
|
||||
{
|
||||
OnLoadComplete = d =>
|
||||
OnLoadComplete = newBackground =>
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case TransformDirection.Next:
|
||||
d.Position = new Vector2(400, 0);
|
||||
d.MoveToX(0, 500, Easing.OutCubic);
|
||||
newBackground.Position = new Vector2(400, 0);
|
||||
newBackground.MoveToX(0, 500, Easing.OutCubic);
|
||||
currentBackground.MoveToX(-400, 500, Easing.OutCubic);
|
||||
break;
|
||||
case TransformDirection.Prev:
|
||||
d.Position = new Vector2(-400, 0);
|
||||
d.MoveToX(0, 500, Easing.OutCubic);
|
||||
newBackground.Position = new Vector2(-400, 0);
|
||||
newBackground.MoveToX(0, 500, Easing.OutCubic);
|
||||
currentBackground.MoveToX(400, 500, Easing.OutCubic);
|
||||
break;
|
||||
}
|
||||
currentBackground.Expire();
|
||||
currentBackground = d;
|
||||
currentBackground = newBackground;
|
||||
}
|
||||
})
|
||||
{
|
||||
|
@ -12,13 +12,7 @@ namespace osu.Game.Overlays.SearchableList
|
||||
{
|
||||
public class SlimEnumDropdown<T> : OsuEnumDropdown<T>
|
||||
{
|
||||
protected override DropdownHeader CreateHeader()
|
||||
{
|
||||
var newHeader = new SlimDropdownHeader();
|
||||
newHeader.AccentColour.BindTo(AccentColour);
|
||||
|
||||
return newHeader;
|
||||
}
|
||||
protected override DropdownHeader CreateHeader() => new SlimDropdownHeader();
|
||||
|
||||
protected override DropdownMenu CreateMenu() => new SlimMenu();
|
||||
|
||||
|
@ -257,13 +257,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
|
||||
private class UserDropdown : OsuEnumDropdown<UserAction>
|
||||
{
|
||||
protected override DropdownHeader CreateHeader()
|
||||
{
|
||||
var newHeader = new UserDropdownHeader();
|
||||
newHeader.AccentColour.BindTo(AccentColour);
|
||||
|
||||
return newHeader;
|
||||
}
|
||||
protected override DropdownHeader CreateHeader() => new UserDropdownHeader();
|
||||
|
||||
protected override DropdownMenu CreateMenu() => new UserDropdownMenu();
|
||||
|
||||
@ -280,7 +274,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AccentColour.Value = colours.Gray5;
|
||||
AccentColour = colours.Gray5;
|
||||
}
|
||||
|
||||
private class UserDropdownMenu : OsuDropdownMenu
|
||||
@ -319,7 +313,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
CornerRadius = 5;
|
||||
}
|
||||
|
||||
protected override Drawable CreateContent() => new TextContainer
|
||||
protected override Drawable CreateContent() => new Content
|
||||
{
|
||||
Label = { Margin = new MarginPadding { Left = UserDropdownHeader.LABEL_LEFT_MARGIN - 11 } }
|
||||
};
|
||||
|
@ -248,8 +248,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
if (beatmap == null)
|
||||
{
|
||||
if (!Beatmap.IsDefault)
|
||||
performLoad();
|
||||
performLoad();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user