1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:42:57 +08:00

Merge branch 'master' into use-class-rename

This commit is contained in:
Bartłomiej Dach 2021-11-07 15:41:00 +01:00 committed by GitHub
commit 6d30248cef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 95 additions and 69 deletions

View File

@ -52,7 +52,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.1026.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2021.1026.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.1104.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2021.1106.0" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Transitive Dependencies"> <ItemGroup Label="Transitive Dependencies">
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. --> <!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->

View File

@ -86,20 +86,18 @@ namespace osu.Game.Rulesets.Mania.Skinning.Default
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
InternalChild = foregroundBuffer = new BufferedContainer InternalChild = foregroundBuffer = new BufferedContainer(cachedFrameBuffer: true)
{ {
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
CacheDrawnFrameBuffer = true,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box { RelativeSizeAxes = Axes.Both }, new Box { RelativeSizeAxes = Axes.Both },
subtractionBuffer = new BufferedContainer subtractionBuffer = new BufferedContainer(cachedFrameBuffer: true)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
// This is needed because we're blending with another object // This is needed because we're blending with another object
BackgroundColour = Color4.White.Opacity(0), BackgroundColour = Color4.White.Opacity(0),
CacheDrawnFrameBuffer = true,
// The 'hole' is achieved by subtracting the result of this container with the parent // The 'hole' is achieved by subtracting the result of this container with the parent
Blending = new BlendingParameters { AlphaEquation = BlendingEquation.ReverseSubtract }, Blending = new BlendingParameters { AlphaEquation = BlendingEquation.ReverseSubtract },
Child = subtractionLayer = new CircularContainer Child = subtractionLayer = new CircularContainer

View File

@ -136,10 +136,9 @@ namespace osu.Game.Rulesets.Osu.Statistics
} }
} }
}, },
bufferedGrid = new BufferedContainer bufferedGrid = new BufferedContainer(cachedFrameBuffer: true)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
CacheDrawnFrameBuffer = true,
BackgroundColour = Color4Extensions.FromHex("#202624").Opacity(0), BackgroundColour = Color4Extensions.FromHex("#202624").Opacity(0),
Child = pointGrid = new GridContainer Child = pointGrid = new GridContainer
{ {

View File

@ -105,6 +105,9 @@ namespace osu.Game.Tests.Mods
testMod.ResetSettingsToDefaults(); testMod.ResetSettingsToDefaults();
Assert.That(testMod.DrainRate.Value, Is.Null); Assert.That(testMod.DrainRate.Value, Is.Null);
// ReSharper disable once HeuristicUnreachableCode
// see https://youtrack.jetbrains.com/issue/RIDER-70159.
Assert.That(testMod.OverallDifficulty.Value, Is.Null); Assert.That(testMod.OverallDifficulty.Value, Is.Null);
var applied = applyDifficulty(new BeatmapDifficulty var applied = applyDifficulty(new BeatmapDifficulty

View File

@ -79,8 +79,17 @@ namespace osu.Game.Tests.NonVisual
public List<HitObject> HitObjects; public List<HitObject> HitObjects;
public override IEnumerable<HitObject> Objects => HitObjects; public override IEnumerable<HitObject> Objects => HitObjects;
public override event Action<JudgementResult> NewResult; public override event Action<JudgementResult> NewResult
public override event Action<JudgementResult> RevertResult; {
add => throw new InvalidOperationException();
remove => throw new InvalidOperationException();
}
public override event Action<JudgementResult> RevertResult
{
add => throw new InvalidOperationException();
remove => throw new InvalidOperationException();
}
public override Playfield Playfield { get; } public override Playfield Playfield { get; }
public override Container Overlays { get; } public override Container Overlays { get; }
@ -95,9 +104,6 @@ namespace osu.Game.Tests.NonVisual
public TestDrawableRuleset() public TestDrawableRuleset()
: base(new OsuRuleset()) : base(new OsuRuleset())
{ {
// won't compile without this.
NewResult?.Invoke(null);
RevertResult?.Invoke(null);
} }
public override void SetReplayScore(Score replayScore) => throw new NotImplementedException(); public override void SetReplayScore(Score replayScore) => throw new NotImplementedException();

View File

@ -235,8 +235,17 @@ namespace osu.Game.Tests.Visual.Gameplay
public override IEnumerable<HitObject> Objects => new[] { new HitCircle { HitWindows = HitWindows } }; public override IEnumerable<HitObject> Objects => new[] { new HitCircle { HitWindows = HitWindows } };
public override event Action<JudgementResult> NewResult; public override event Action<JudgementResult> NewResult
public override event Action<JudgementResult> RevertResult; {
add => throw new InvalidOperationException();
remove => throw new InvalidOperationException();
}
public override event Action<JudgementResult> RevertResult
{
add => throw new InvalidOperationException();
remove => throw new InvalidOperationException();
}
public override Playfield Playfield { get; } public override Playfield Playfield { get; }
public override Container Overlays { get; } public override Container Overlays { get; }
@ -251,9 +260,6 @@ namespace osu.Game.Tests.Visual.Gameplay
public TestDrawableRuleset() public TestDrawableRuleset()
: base(new OsuRuleset()) : base(new OsuRuleset())
{ {
// won't compile without this.
NewResult?.Invoke(null);
RevertResult?.Invoke(null);
} }
public override void SetReplayScore(Score replayScore) => throw new NotImplementedException(); public override void SetReplayScore(Score replayScore) => throw new NotImplementedException();

View File

@ -58,10 +58,9 @@ namespace osu.Game.Graphics.Backgrounds
{ {
RemoveInternal(Sprite); RemoveInternal(Sprite);
AddInternal(bufferedContainer = new BufferedContainer AddInternal(bufferedContainer = new BufferedContainer(cachedFrameBuffer: true)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
CacheDrawnFrameBuffer = true,
RedrawOnScale = false, RedrawOnScale = false,
Child = Sprite Child = Sprite
}); });

View File

@ -69,12 +69,11 @@ namespace osu.Game.Graphics.Sprites
Children = new Drawable[] Children = new Drawable[]
{ {
new BufferedContainer new BufferedContainer(cachedFrameBuffer: true)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
BlurSigma = new Vector2(4), BlurSigma = new Vector2(4),
CacheDrawnFrameBuffer = true,
RedrawOnScale = false, RedrawOnScale = false,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,

View File

@ -1,7 +1,9 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osuTK; using osuTK;
@ -22,15 +24,9 @@ namespace osu.Game.Graphics.UserInterface
Enabled.Value = !isLoading; Enabled.Value = !isLoading;
if (value) if (value)
{
loading.Show(); loading.Show();
OnLoadStarted();
}
else else
{
loading.Hide(); loading.Hide();
OnLoadFinished();
}
} }
} }
@ -44,18 +40,34 @@ namespace osu.Game.Graphics.UserInterface
protected LoadingButton() protected LoadingButton()
{ {
AddRange(new[] Add(loading = new LoadingSpinner
{ {
CreateContent(), Anchor = Anchor.Centre,
loading = new LoadingSpinner Origin = Anchor.Centre,
{ Size = new Vector2(12),
Anchor = Anchor.Centre, Depth = -1,
Origin = Anchor.Centre,
Size = new Vector2(12)
}
}); });
} }
[BackgroundDependencyLoader]
private void load()
{
Add(CreateContent());
}
protected override void LoadComplete()
{
base.LoadComplete();
loading.State.BindValueChanged(s =>
{
if (s.NewValue == Visibility.Visible)
OnLoadStarted();
else
OnLoadFinished();
}, true);
}
protected override bool OnClick(ClickEvent e) protected override bool OnClick(ClickEvent e)
{ {
if (!Enabled.Value) if (!Enabled.Value)

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -22,6 +23,11 @@ namespace osu.Game.Overlays.BeatmapListing
public BeatmapSearchMultipleSelectionFilterRow(LocalisableString header) public BeatmapSearchMultipleSelectionFilterRow(LocalisableString header)
: base(header) : base(header)
{
}
[BackgroundDependencyLoader]
private void load()
{ {
Current.BindTo(filter.Current); Current.BindTo(filter.Current);
} }
@ -31,6 +37,7 @@ namespace osu.Game.Overlays.BeatmapListing
/// <summary> /// <summary>
/// Creates a filter control that can be used to simultaneously select multiple values of type <typeparamref name="T"/>. /// Creates a filter control that can be used to simultaneously select multiple values of type <typeparamref name="T"/>.
/// </summary> /// </summary>
[NotNull]
protected virtual MultipleSelectionFilter CreateMultipleSelectionFilter() => new MultipleSelectionFilter(); protected virtual MultipleSelectionFilter CreateMultipleSelectionFilter() => new MultipleSelectionFilter();
protected class MultipleSelectionFilter : FillFlowContainer<MultipleSelectionFilterTabItem> protected class MultipleSelectionFilter : FillFlowContainer<MultipleSelectionFilterTabItem>

View File

@ -26,6 +26,8 @@ namespace osu.Game.Overlays.Changelog
public static LocalisableString ListingString => LayoutStrings.HeaderChangelogIndex; public static LocalisableString ListingString => LayoutStrings.HeaderChangelogIndex;
private readonly Bindable<APIUpdateStream> currentStream = new Bindable<APIUpdateStream>();
private Box streamsBackground; private Box streamsBackground;
public ChangelogHeader() public ChangelogHeader()
@ -39,7 +41,7 @@ namespace osu.Game.Overlays.Changelog
Build.ValueChanged += showBuild; Build.ValueChanged += showBuild;
Streams.Current.ValueChanged += e => currentStream.ValueChanged += e =>
{ {
if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Build.Value?.UpdateStream)) if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Build.Value?.UpdateStream))
Build.Value = e.NewValue.LatestBuild; Build.Value = e.NewValue.LatestBuild;
@ -67,7 +69,7 @@ namespace osu.Game.Overlays.Changelog
else else
{ {
Current.Value = ListingString; Current.Value = ListingString;
Streams.Current.Value = null; currentStream.Value = null;
} }
} }
@ -92,7 +94,7 @@ namespace osu.Game.Overlays.Changelog
Horizontal = 65, Horizontal = 65,
Vertical = 20 Vertical = 20
}, },
Child = Streams = new ChangelogUpdateStreamControl() Child = Streams = new ChangelogUpdateStreamControl { Current = currentStream },
} }
} }
}; };
@ -110,7 +112,7 @@ namespace osu.Game.Overlays.Changelog
if (Build.Value == null) if (Build.Value == null)
return; return;
Streams.Current.Value = Streams.Items.FirstOrDefault(s => s.Name == Build.Value.UpdateStream.Name); currentStream.Value = Streams.Items.FirstOrDefault(s => s.Name == Build.Value.UpdateStream.Name);
} }
private class ChangelogHeaderTitle : OverlayTitle private class ChangelogHeaderTitle : OverlayTitle

View File

@ -175,6 +175,8 @@ namespace osu.Game.Overlays.Comments
protected override IEnumerable<Drawable> EffectTargets => new[] { background }; protected override IEnumerable<Drawable> EffectTargets => new[] { background };
private readonly string text;
[Resolved] [Resolved]
private OverlayColourProvider colourProvider { get; set; } private OverlayColourProvider colourProvider { get; set; }
@ -184,10 +186,10 @@ namespace osu.Game.Overlays.Comments
public CommitButton(string text) public CommitButton(string text)
{ {
this.text = text;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
LoadingAnimationSize = new Vector2(10); LoadingAnimationSize = new Vector2(10);
drawableText.Text = text;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -232,7 +234,8 @@ namespace osu.Game.Overlays.Comments
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
Margin = new MarginPadding { Horizontal = 20 } Margin = new MarginPadding { Horizontal = 20 },
Text = text,
} }
} }
}; };

View File

@ -366,14 +366,13 @@ namespace osu.Game.Overlays
private readonly WorkingBeatmap beatmap; private readonly WorkingBeatmap beatmap;
public Background(WorkingBeatmap beatmap = null) public Background(WorkingBeatmap beatmap = null)
: base(cachedFrameBuffer: true)
{ {
this.beatmap = beatmap; this.beatmap = beatmap;
Depth = float.MaxValue; Depth = float.MaxValue;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
CacheDrawnFrameBuffer = true;
Children = new Drawable[] Children = new Drawable[]
{ {
sprite = new Sprite sprite = new Sprite

View File

@ -37,11 +37,7 @@ namespace osu.Game.Overlays
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight, Origin = Anchor.BottomRight,
Margin = new MarginPadding(20), Margin = new MarginPadding(20),
Action = () => Action = scrollToTop
{
ScrollToStart();
Button.State = Visibility.Hidden;
}
}); });
} }
@ -58,6 +54,12 @@ namespace osu.Game.Overlays
Button.State = Target > button_scroll_position ? Visibility.Visible : Visibility.Hidden; Button.State = Target > button_scroll_position ? Visibility.Visible : Visibility.Hidden;
} }
private void scrollToTop()
{
ScrollToStart();
Button.State = Visibility.Hidden;
}
public class ScrollToTopButton : OsuHoverContainer public class ScrollToTopButton : OsuHoverContainer
{ {
private const int fade_duration = 500; private const int fade_duration = 500;

View File

@ -30,11 +30,6 @@ namespace osu.Game.Rulesets.Mods
public override bool HasImplementation => GetType().GenericTypeArguments.Length == 0; public override bool HasImplementation => GetType().GenericTypeArguments.Length == 0;
[Obsolete("Use the mod-supporting override")] // can be removed 20210731 public virtual Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList<Mod> mods) => new Score { Replay = new Replay() };
public virtual Score CreateReplayScore(IBeatmap beatmap) => new Score { Replay = new Replay() };
#pragma warning disable 618
public virtual Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList<Mod> mods) => CreateReplayScore(beatmap);
#pragma warning restore 618
} }
} }

View File

@ -393,6 +393,7 @@ namespace osu.Game.Screens.Menu
public class OutlineTriangle : BufferedContainer public class OutlineTriangle : BufferedContainer
{ {
public OutlineTriangle(bool outlineOnly, float size) public OutlineTriangle(bool outlineOnly, float size)
: base(cachedFrameBuffer: true)
{ {
Size = new Vector2(size); Size = new Vector2(size);
@ -414,7 +415,6 @@ namespace osu.Game.Screens.Menu
} }
Blending = BlendingParameters.Additive; Blending = BlendingParameters.Additive;
CacheDrawnFrameBuffer = true;
} }
} }
} }

View File

@ -32,9 +32,9 @@ namespace osu.Game.Screens.Play.Break
} }
public BlurredIcon() public BlurredIcon()
: base(cachedFrameBuffer: true)
{ {
RelativePositionAxes = Axes.X; RelativePositionAxes = Axes.X;
CacheDrawnFrameBuffer = true;
Child = icon = new SpriteIcon Child = icon = new SpriteIcon
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -98,9 +98,8 @@ namespace osu.Game.Screens.Play
/// </summary> /// </summary>
protected virtual void RecreateGraph() protected virtual void RecreateGraph()
{ {
var newColumns = new BufferedContainer<Column> var newColumns = new BufferedContainer<Column>(cachedFrameBuffer: true)
{ {
CacheDrawnFrameBuffer = true,
RedrawOnScale = false, RedrawOnScale = false,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}; };

View File

@ -51,13 +51,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
Font = OsuFont.Numeric.With(size: 76), Font = OsuFont.Numeric.With(size: 76),
UseFullGlyphHeight = false UseFullGlyphHeight = false
}, },
superFlash = new BufferedContainer superFlash = new BufferedContainer(cachedFrameBuffer: true)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
BlurSigma = new Vector2(85), BlurSigma = new Vector2(85),
Size = new Vector2(600), Size = new Vector2(600),
CacheDrawnFrameBuffer = true,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
Alpha = 0, Alpha = 0,
Children = new[] Children = new[]
@ -71,14 +70,13 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
}, },
}, },
}, },
flash = new BufferedContainer flash = new BufferedContainer(cachedFrameBuffer: true)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
BlurSigma = new Vector2(35), BlurSigma = new Vector2(35),
BypassAutoSizeAxes = Axes.Both, BypassAutoSizeAxes = Axes.Both,
Size = new Vector2(200), Size = new Vector2(200),
CacheDrawnFrameBuffer = true,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
Alpha = 0, Alpha = 0,
Scale = new Vector2(1.8f), Scale = new Vector2(1.8f),

View File

@ -27,9 +27,8 @@ namespace osu.Game.Screens.Select
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
InternalChild = new BufferedContainer InternalChild = new BufferedContainer(cachedFrameBuffer: true)
{ {
CacheDrawnFrameBuffer = true,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -15,8 +15,8 @@ namespace osu.Game.Screens.Select.Carousel
public class SetPanelBackground : BufferedContainer public class SetPanelBackground : BufferedContainer
{ {
public SetPanelBackground(WorkingBeatmap working) public SetPanelBackground(WorkingBeatmap working)
: base(cachedFrameBuffer: true)
{ {
CacheDrawnFrameBuffer = true;
RedrawOnScale = false; RedrawOnScale = false;
Children = new Drawable[] Children = new Drawable[]

View File

@ -36,7 +36,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Realm" Version="10.6.0" /> <PackageReference Include="Realm" Version="10.6.0" />
<PackageReference Include="ppy.osu.Framework" Version="2021.1104.0" /> <PackageReference Include="ppy.osu.Framework" Version="2021.1106.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.1026.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2021.1026.0" />
<PackageReference Include="Sentry" Version="3.10.0" /> <PackageReference Include="Sentry" Version="3.10.0" />
<PackageReference Include="SharpCompress" Version="0.30.0" /> <PackageReference Include="SharpCompress" Version="0.30.0" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.1104.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2021.1106.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.1026.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2021.1026.0" />
</ItemGroup> </ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) --> <!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
@ -93,7 +93,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ppy.osu.Framework" Version="2021.1104.0" /> <PackageReference Include="ppy.osu.Framework" Version="2021.1106.0" />
<PackageReference Include="SharpCompress" Version="0.30.0" /> <PackageReference Include="SharpCompress" Version="0.30.0" />
<PackageReference Include="NUnit" Version="3.13.2" /> <PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />