mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:03:08 +08:00
Merge remote-tracking branch 'upstream/master' into instant-hide-screenshot
This commit is contained in:
commit
c9615f837a
@ -1 +1 @@
|
||||
Subproject commit 02d7a0fa4798d197cd08570ee48951edbb7c7860
|
||||
Subproject commit eb6362eaf1317b0fa27b2c9e559bd9a0f1ce357c
|
@ -11,7 +11,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="NuGet.CommandLine" Version="4.5.1" />
|
||||
<PackageReference Include="NUnit" Version="3.8.1" />
|
||||
<PackageReference Include="NUnit" Version="3.10.1" />
|
||||
<PackageReference Include="squirrel.windows" Version="1.7.8" Condition="'$(TargetFramework)' == 'net461'" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.0" />
|
||||
</ItemGroup>
|
||||
|
54
osu.Game.Tests/Visual/TestCaseWaveContainer.cs
Normal file
54
osu.Game.Tests/Visual/TestCaseWaveContainer.cs
Normal file
@ -0,0 +1,54 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestCaseWaveContainer : OsuTestCase
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
WaveContainer container;
|
||||
Add(container = new WaveContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(400),
|
||||
FirstWaveColour = colours.Red,
|
||||
SecondWaveColour = colours.Green,
|
||||
ThirdWaveColour = colours.Blue,
|
||||
FourthWaveColour = colours.Pink,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
TextSize = 20,
|
||||
Text = @"Wave Container",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
AddStep(@"show", container.Show);
|
||||
AddStep(@"hide", container.Hide);
|
||||
}
|
||||
}
|
||||
}
|
167
osu.Game/Graphics/Containers/WaveContainer.cs
Normal file
167
osu.Game/Graphics/Containers/WaveContainer.cs
Normal file
@ -0,0 +1,167 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
public class WaveContainer : VisibilityContainer
|
||||
{
|
||||
public const float APPEAR_DURATION = 800;
|
||||
public const float DISAPPEAR_DURATION = 500;
|
||||
|
||||
private const Easing easing_show = Easing.OutSine;
|
||||
private const Easing easing_hide = Easing.InSine;
|
||||
|
||||
private readonly Wave firstWave;
|
||||
private readonly Wave secondWave;
|
||||
private readonly Wave thirdWave;
|
||||
private readonly Wave fourthWave;
|
||||
|
||||
private readonly Container<Wave> wavesContainer;
|
||||
private readonly Container contentContainer;
|
||||
|
||||
protected override Container<Drawable> Content => contentContainer;
|
||||
|
||||
public Color4 FirstWaveColour
|
||||
{
|
||||
get => firstWave.Colour;
|
||||
set => firstWave.Colour = value;
|
||||
}
|
||||
|
||||
public Color4 SecondWaveColour
|
||||
{
|
||||
get => secondWave.Colour;
|
||||
set => secondWave.Colour = value;
|
||||
}
|
||||
|
||||
public Color4 ThirdWaveColour
|
||||
{
|
||||
get => thirdWave.Colour;
|
||||
set => thirdWave.Colour = value;
|
||||
}
|
||||
|
||||
public Color4 FourthWaveColour
|
||||
{
|
||||
get => fourthWave.Colour;
|
||||
set => fourthWave.Colour = value;
|
||||
}
|
||||
|
||||
public WaveContainer()
|
||||
{
|
||||
Masking = true;
|
||||
|
||||
AddInternal(wavesContainer = new Container<Wave>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Masking = true,
|
||||
Children = new[]
|
||||
{
|
||||
firstWave = new Wave
|
||||
{
|
||||
Rotation = 13,
|
||||
FinalPosition = -930,
|
||||
},
|
||||
secondWave = new Wave
|
||||
{
|
||||
Origin = Anchor.TopRight,
|
||||
Anchor = Anchor.TopRight,
|
||||
Rotation = -7,
|
||||
FinalPosition = -560,
|
||||
},
|
||||
thirdWave = new Wave
|
||||
{
|
||||
Rotation = 4,
|
||||
FinalPosition = -390,
|
||||
},
|
||||
fourthWave = new Wave
|
||||
{
|
||||
Origin = Anchor.TopRight,
|
||||
Anchor = Anchor.TopRight,
|
||||
Rotation = -2,
|
||||
FinalPosition = -220,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
AddInternal(contentContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
});
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
foreach (var w in wavesContainer.Children)
|
||||
w.State = Visibility.Visible;
|
||||
|
||||
this.FadeIn(100, Easing.OutQuint);
|
||||
contentContainer.MoveToY(0, APPEAR_DURATION, Easing.OutQuint);
|
||||
|
||||
this.FadeIn(100, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
this.FadeOut(DISAPPEAR_DURATION, Easing.InQuint);
|
||||
contentContainer.MoveToY(DrawHeight * 2f, DISAPPEAR_DURATION, Easing.In);
|
||||
|
||||
foreach (var w in wavesContainer.Children)
|
||||
w.State = Visibility.Hidden;
|
||||
|
||||
this.FadeOut(DISAPPEAR_DURATION, Easing.InQuint);
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
// This is done as an optimization, such that invisible parts of the waves
|
||||
// are masked away, and thus do not consume fill rate.
|
||||
wavesContainer.Height = Math.Max(0, DrawHeight - (contentContainer.DrawHeight - contentContainer.Y));
|
||||
}
|
||||
|
||||
private class Wave : VisibilityContainer
|
||||
{
|
||||
public float FinalPosition;
|
||||
|
||||
protected override bool StartHidden => true;
|
||||
|
||||
public Wave()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Width = 1.5f;
|
||||
Masking = true;
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = Color4.Black.Opacity(50),
|
||||
Radius = 20f,
|
||||
};
|
||||
|
||||
Child = new Box { RelativeSizeAxes = Axes.Both };
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
// We can not use RelativeSizeAxes for Height, because the height
|
||||
// of our parent diminishes as the content moves up.
|
||||
Height = Parent.Parent.DrawSize.Y * 1.5f;
|
||||
}
|
||||
|
||||
protected override void PopIn() => this.MoveToY(FinalPosition, APPEAR_DURATION, easing_show);
|
||||
protected override void PopOut() => this.MoveToY(Parent.Parent.DrawSize.Y, DISAPPEAR_DURATION, easing_hide);
|
||||
}
|
||||
}
|
||||
}
|
@ -443,7 +443,7 @@ namespace osu.Game
|
||||
sensitivity.Value = 1;
|
||||
sensitivity.Disabled = true;
|
||||
|
||||
frameworkConfig.Set(FrameworkSetting.ActiveInputHandlers, string.Empty);
|
||||
frameworkConfig.Set(FrameworkSetting.IgnoredInputHandlers, string.Empty);
|
||||
frameworkConfig.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode).SetDefault();
|
||||
return true;
|
||||
case GlobalAction.ToggleToolbar:
|
||||
|
@ -40,10 +40,10 @@ namespace osu.Game.Overlays
|
||||
|
||||
public BeatmapSetOverlay()
|
||||
{
|
||||
FirstWaveColour = OsuColour.Gray(0.4f);
|
||||
SecondWaveColour = OsuColour.Gray(0.3f);
|
||||
ThirdWaveColour = OsuColour.Gray(0.2f);
|
||||
FourthWaveColour = OsuColour.Gray(0.1f);
|
||||
Waves.FirstWaveColour = OsuColour.Gray(0.4f);
|
||||
Waves.SecondWaveColour = OsuColour.Gray(0.3f);
|
||||
Waves.ThirdWaveColour = OsuColour.Gray(0.2f);
|
||||
Waves.FourthWaveColour = OsuColour.Gray(0.1f);
|
||||
|
||||
Anchor = Anchor.TopCentre;
|
||||
Origin = Anchor.TopCentre;
|
||||
@ -123,14 +123,14 @@ namespace osu.Game.Overlays
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
FadeEdgeEffectTo(0.25f, APPEAR_DURATION, Easing.In);
|
||||
FadeEdgeEffectTo(0.25f, WaveContainer.APPEAR_DURATION, Easing.In);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
header.Details.StopPreview();
|
||||
FadeEdgeEffectTo(0, DISAPPEAR_DURATION, Easing.Out);
|
||||
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out);
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
|
@ -173,8 +173,9 @@ namespace osu.Game.Overlays.Direct
|
||||
if (trackLoader != d) return;
|
||||
|
||||
Preview = d?.Preview;
|
||||
Playing.TriggerChange();
|
||||
updatePreviewTrack(Playing);
|
||||
loading = false;
|
||||
|
||||
Add(trackLoader);
|
||||
});
|
||||
}
|
||||
|
@ -89,10 +89,10 @@ namespace osu.Game.Overlays
|
||||
|
||||
// osu!direct colours are not part of the standard palette
|
||||
|
||||
FirstWaveColour = OsuColour.FromHex(@"19b0e2");
|
||||
SecondWaveColour = OsuColour.FromHex(@"2280a2");
|
||||
ThirdWaveColour = OsuColour.FromHex(@"005774");
|
||||
FourthWaveColour = OsuColour.FromHex(@"003a4e");
|
||||
Waves.FirstWaveColour = OsuColour.FromHex(@"19b0e2");
|
||||
Waves.SecondWaveColour = OsuColour.FromHex(@"2280a2");
|
||||
Waves.ThirdWaveColour = OsuColour.FromHex(@"005774");
|
||||
Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e");
|
||||
|
||||
ScrollFlow.Children = new Drawable[]
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ using System.Linq;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
@ -113,14 +114,14 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
footerContainer.MoveToX(footerContainer.DrawSize.X, DISAPPEAR_DURATION, Easing.InSine);
|
||||
footerContainer.FadeOut(DISAPPEAR_DURATION, Easing.InSine);
|
||||
footerContainer.MoveToX(footerContainer.DrawSize.X, WaveContainer.DISAPPEAR_DURATION, Easing.InSine);
|
||||
footerContainer.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.InSine);
|
||||
|
||||
foreach (ModSection section in ModSectionsContainer.Children)
|
||||
{
|
||||
section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), DISAPPEAR_DURATION, Easing.InSine);
|
||||
section.ButtonsContainer.MoveToX(100f, DISAPPEAR_DURATION, Easing.InSine);
|
||||
section.ButtonsContainer.FadeOut(DISAPPEAR_DURATION, Easing.InSine);
|
||||
section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), WaveContainer.DISAPPEAR_DURATION, Easing.InSine);
|
||||
section.ButtonsContainer.MoveToX(100f, WaveContainer.DISAPPEAR_DURATION, Easing.InSine);
|
||||
section.ButtonsContainer.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.InSine);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,14 +129,14 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
base.PopIn();
|
||||
|
||||
footerContainer.MoveToX(0, APPEAR_DURATION, Easing.OutQuint);
|
||||
footerContainer.FadeIn(APPEAR_DURATION, Easing.OutQuint);
|
||||
footerContainer.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
footerContainer.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
|
||||
foreach (ModSection section in ModSectionsContainer.Children)
|
||||
{
|
||||
section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), APPEAR_DURATION, Easing.OutQuint);
|
||||
section.ButtonsContainer.MoveToX(0, APPEAR_DURATION, Easing.OutQuint);
|
||||
section.ButtonsContainer.FadeIn(APPEAR_DURATION, Easing.OutQuint);
|
||||
section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
section.ButtonsContainer.MoveToX(0, WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
section.ButtonsContainer.FadeIn(WaveContainer.APPEAR_DURATION, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,14 +182,12 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
public ModSelectOverlay()
|
||||
{
|
||||
FirstWaveColour = OsuColour.FromHex(@"19b0e2");
|
||||
SecondWaveColour = OsuColour.FromHex(@"2280a2");
|
||||
ThirdWaveColour = OsuColour.FromHex(@"005774");
|
||||
FourthWaveColour = OsuColour.FromHex(@"003a4e");
|
||||
Waves.FirstWaveColour = OsuColour.FromHex(@"19b0e2");
|
||||
Waves.SecondWaveColour = OsuColour.FromHex(@"2280a2");
|
||||
Waves.ThirdWaveColour = OsuColour.FromHex(@"005774");
|
||||
Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e");
|
||||
|
||||
Height = 510;
|
||||
Content.RelativeSizeAxes = Axes.X;
|
||||
Content.AutoSizeAxes = Axes.Y;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using OpenTK;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
@ -19,6 +20,8 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||
|
||||
private DirectPanel currentlyPlaying;
|
||||
|
||||
public event Action<PaginatedBeatmapContainer> BeganPlayingPreview;
|
||||
|
||||
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, string header, string missing = "None... yet.")
|
||||
: base(user, header, missing)
|
||||
{
|
||||
@ -56,17 +59,25 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||
|
||||
panel.PreviewPlaying.ValueChanged += isPlaying =>
|
||||
{
|
||||
if (!isPlaying) return;
|
||||
StopPlayingPreview();
|
||||
|
||||
if (currentlyPlaying != null && currentlyPlaying != panel)
|
||||
currentlyPlaying.PreviewPlaying.Value = false;
|
||||
|
||||
currentlyPlaying = panel;
|
||||
if (isPlaying)
|
||||
{
|
||||
BeganPlayingPreview?.Invoke(this);
|
||||
currentlyPlaying = panel;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Api.Queue(req);
|
||||
}
|
||||
|
||||
public void StopPlayingPreview()
|
||||
{
|
||||
if (currentlyPlaying == null) return;
|
||||
currentlyPlaying.PreviewPlaying.Value = false;
|
||||
currentlyPlaying = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Linq;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.Profile.Sections.Beatmaps;
|
||||
|
||||
@ -21,6 +22,15 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Unranked, User, "Pending Beatmaps"),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, "Graveyarded Beatmaps"),
|
||||
};
|
||||
|
||||
foreach (var paginatedBeatmapContainer in Children.OfType<PaginatedBeatmapContainer>())
|
||||
{
|
||||
paginatedBeatmapContainer.BeganPlayingPreview += _ =>
|
||||
{
|
||||
foreach (var bc in Children.OfType<PaginatedBeatmapContainer>())
|
||||
bc.StopPlayingPreview();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
protected override string Header => "Mouse";
|
||||
|
||||
private readonly BindableBool rawInputToggle = new BindableBool();
|
||||
private Bindable<string> activeInputHandlers;
|
||||
private Bindable<string> ignoredInputHandler;
|
||||
private SensitivitySetting sensitivity;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -61,20 +61,18 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
const string raw_mouse_handler = @"OpenTKRawMouseHandler";
|
||||
const string standard_mouse_handler = @"OpenTKMouseHandler";
|
||||
|
||||
activeInputHandlers.Value = enabled ?
|
||||
activeInputHandlers.Value.Replace(standard_mouse_handler, raw_mouse_handler) :
|
||||
activeInputHandlers.Value.Replace(raw_mouse_handler, standard_mouse_handler);
|
||||
ignoredInputHandler.Value = enabled ? standard_mouse_handler : raw_mouse_handler;
|
||||
};
|
||||
|
||||
activeInputHandlers = config.GetBindable<string>(FrameworkSetting.ActiveInputHandlers);
|
||||
activeInputHandlers.ValueChanged += handlers =>
|
||||
ignoredInputHandler = config.GetBindable<string>(FrameworkSetting.IgnoredInputHandlers);
|
||||
ignoredInputHandler.ValueChanged += handler =>
|
||||
{
|
||||
bool raw = handlers.Contains("Raw");
|
||||
bool raw = !handler.Contains("Raw");
|
||||
rawInputToggle.Value = raw;
|
||||
sensitivity.Bindable.Disabled = !raw;
|
||||
};
|
||||
|
||||
activeInputHandlers.TriggerChange();
|
||||
ignoredInputHandler.TriggerChange();
|
||||
}
|
||||
|
||||
private class SensitivitySetting : SettingsSlider<double, SensitivitySlider>
|
||||
|
@ -48,10 +48,10 @@ namespace osu.Game.Overlays
|
||||
|
||||
public SocialOverlay()
|
||||
{
|
||||
FirstWaveColour = OsuColour.FromHex(@"cb5fa0");
|
||||
SecondWaveColour = OsuColour.FromHex(@"b04384");
|
||||
ThirdWaveColour = OsuColour.FromHex(@"9b2b6e");
|
||||
FourthWaveColour = OsuColour.FromHex(@"6d214d");
|
||||
Waves.FirstWaveColour = OsuColour.FromHex(@"cb5fa0");
|
||||
Waves.SecondWaveColour = OsuColour.FromHex(@"b04384");
|
||||
Waves.ThirdWaveColour = OsuColour.FromHex(@"9b2b6e");
|
||||
Waves.FourthWaveColour = OsuColour.FromHex(@"6d214d");
|
||||
|
||||
Add(loading = new LoadingAnimation());
|
||||
|
||||
|
@ -35,10 +35,10 @@ namespace osu.Game.Overlays
|
||||
|
||||
public UserProfileOverlay()
|
||||
{
|
||||
FirstWaveColour = OsuColour.Gray(0.4f);
|
||||
SecondWaveColour = OsuColour.Gray(0.3f);
|
||||
ThirdWaveColour = OsuColour.Gray(0.2f);
|
||||
FourthWaveColour = OsuColour.Gray(0.1f);
|
||||
Waves.FirstWaveColour = OsuColour.Gray(0.4f);
|
||||
Waves.SecondWaveColour = OsuColour.Gray(0.3f);
|
||||
Waves.ThirdWaveColour = OsuColour.Gray(0.2f);
|
||||
Waves.FourthWaveColour = OsuColour.Gray(0.1f);
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
RelativePositionAxes = Axes.Both;
|
||||
@ -64,13 +64,13 @@ namespace osu.Game.Overlays
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
FadeEdgeEffectTo(0.5f, APPEAR_DURATION, Easing.In);
|
||||
FadeEdgeEffectTo(0.5f, WaveContainer.APPEAR_DURATION, Easing.In);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
FadeEdgeEffectTo(0, DISAPPEAR_DURATION, Easing.Out);
|
||||
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out);
|
||||
}
|
||||
|
||||
public void ShowUser(long userId)
|
||||
|
@ -1,203 +1,37 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using System;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public abstract class WaveOverlayContainer : OsuFocusedOverlayContainer
|
||||
{
|
||||
protected const float APPEAR_DURATION = 800;
|
||||
protected const float DISAPPEAR_DURATION = 500;
|
||||
|
||||
private const Easing easing_show = Easing.OutSine;
|
||||
private const Easing easing_hide = Easing.InSine;
|
||||
|
||||
private readonly Wave firstWave;
|
||||
private readonly Wave secondWave;
|
||||
private readonly Wave thirdWave;
|
||||
private readonly Wave fourthWave;
|
||||
|
||||
private readonly Container<Wave> wavesContainer;
|
||||
|
||||
private readonly Container contentContainer;
|
||||
protected readonly WaveContainer Waves;
|
||||
|
||||
protected override bool BlockPassThroughKeyboard => true;
|
||||
|
||||
protected override Container<Drawable> Content => contentContainer;
|
||||
|
||||
protected Color4 FirstWaveColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return firstWave.Colour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (firstWave.Colour == value) return;
|
||||
firstWave.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected Color4 SecondWaveColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return secondWave.Colour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (secondWave.Colour == value) return;
|
||||
secondWave.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected Color4 ThirdWaveColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return thirdWave.Colour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (thirdWave.Colour == value) return;
|
||||
thirdWave.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected Color4 FourthWaveColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return fourthWave.Colour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (fourthWave.Colour == value) return;
|
||||
fourthWave.Colour = value;
|
||||
}
|
||||
}
|
||||
protected override Container<Drawable> Content => Waves;
|
||||
|
||||
protected WaveOverlayContainer()
|
||||
{
|
||||
Masking = true;
|
||||
|
||||
AddInternal(wavesContainer = new Container<Wave>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Masking = true,
|
||||
Children = new[]
|
||||
{
|
||||
firstWave = new Wave
|
||||
{
|
||||
Rotation = 13,
|
||||
FinalPosition = -930,
|
||||
},
|
||||
secondWave = new Wave
|
||||
{
|
||||
Origin = Anchor.TopRight,
|
||||
Anchor = Anchor.TopRight,
|
||||
Rotation = -7,
|
||||
FinalPosition = -560,
|
||||
},
|
||||
thirdWave = new Wave
|
||||
{
|
||||
Rotation = 4,
|
||||
FinalPosition = -390,
|
||||
},
|
||||
fourthWave = new Wave
|
||||
{
|
||||
Origin = Anchor.TopRight,
|
||||
Anchor = Anchor.TopRight,
|
||||
Rotation = -2,
|
||||
FinalPosition = -220,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
AddInternal(contentContainer = new Container
|
||||
AddInternal(Waves = new WaveContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
});
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
|
||||
foreach (var w in wavesContainer.Children)
|
||||
w.State = Visibility.Visible;
|
||||
|
||||
this.FadeIn(100, Easing.OutQuint);
|
||||
contentContainer.MoveToY(0, APPEAR_DURATION, Easing.OutQuint);
|
||||
|
||||
this.FadeIn(100, Easing.OutQuint);
|
||||
Waves.Show();
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
this.FadeOut(DISAPPEAR_DURATION, Easing.InQuint);
|
||||
contentContainer.MoveToY(DrawHeight * 2f, DISAPPEAR_DURATION, Easing.In);
|
||||
|
||||
foreach (var w in wavesContainer.Children)
|
||||
w.State = Visibility.Hidden;
|
||||
|
||||
this.FadeOut(DISAPPEAR_DURATION, Easing.InQuint);
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
// This is done as an optimization, such that invisible parts of the waves
|
||||
// are masked away, and thus do not consume fill rate.
|
||||
wavesContainer.Height = Math.Max(0, DrawHeight - (contentContainer.DrawHeight - contentContainer.Y));
|
||||
}
|
||||
|
||||
private class Wave : VisibilityContainer
|
||||
{
|
||||
public float FinalPosition;
|
||||
|
||||
protected override bool StartHidden => true;
|
||||
|
||||
public Wave()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Width = 1.5f;
|
||||
Masking = true;
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = Color4.Black.Opacity(50),
|
||||
Radius = 20f,
|
||||
};
|
||||
|
||||
Child = new Box { RelativeSizeAxes = Axes.Both };
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
// We can not use RelativeSizeAxes for Height, because the height
|
||||
// of our parent diminishes as the content moves up.
|
||||
Height = Parent.Parent.DrawSize.Y * 1.5f;
|
||||
}
|
||||
|
||||
protected override void PopIn() => this.MoveToY(FinalPosition, APPEAR_DURATION, easing_show);
|
||||
protected override void PopOut() => this.MoveToY(Parent.Parent.DrawSize.Y, DISAPPEAR_DURATION, easing_hide);
|
||||
Waves.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
|
||||
<PackageReference Include="SharpCompress" Version="0.18.1" />
|
||||
<PackageReference Include="NUnit" Version="3.8.1" />
|
||||
<PackageReference Include="NUnit" Version="3.10.1" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.4.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -15,7 +15,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.0.1" />
|
||||
<PackageReference Include="DeepEqual" Version="1.6.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.1" />
|
||||
<PackageReference Include="NUnit" Version="3.8.1" />
|
||||
<PackageReference Include="NUnit" Version="3.10.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user