1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00

Merge pull request #21451 from peppy/update-framework

Update framework
This commit is contained in:
Dan Balasescu 2022-11-30 13:39:08 +09:00 committed by GitHub
commit fcd7c27bc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 48 additions and 51 deletions

View File

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

View File

@ -62,7 +62,6 @@ namespace osu.Game.Tests.Visual.Settings
section.Children.Where(f => f.IsPresent)
.OfType<ISettingsItem>()
.OfType<IFilterable>()
.Where(f => !(f is IHasFilterableChildren))
.All(f => f.FilterTerms.Any(t => t.ToString().Contains("scaling")))
));

View File

@ -7,8 +7,6 @@ using Newtonsoft.Json;
namespace osu.Game.Online.Rooms
{
// TODO: Remove disable below after merging https://github.com/ppy/osu-framework/pull/5548 and applying follow-up changes game-side.
// ReSharper disable once PartialTypeWithSinglePart
public partial class APICreatedRoom : Room
{
[JsonProperty("error")]

View File

@ -16,7 +16,7 @@ using osu.Game.Online.Rooms.RoomStatuses;
namespace osu.Game.Online.Rooms
{
[JsonObject(MemberSerialization.OptIn)]
public partial class Room
public partial class Room : IDependencyInjectionCandidate
{
[Cached]
[JsonProperty("id")]

View File

@ -233,7 +233,7 @@ namespace osu.Game.Overlays.FirstRunSetup
return parentDependencies.Get(type, info);
}
public void Inject<T>(T instance) where T : class
public void Inject<T>(T instance) where T : class, IDependencyInjectionCandidate
{
parentDependencies.Inject(instance);
}

View File

@ -177,13 +177,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
updateScreenModeWarning();
}, true);
windowModes.BindCollectionChanged((_, _) =>
{
if (windowModes.Count > 1)
windowModeDropdown.Show();
else
windowModeDropdown.Hide();
}, true);
windowModes.BindCollectionChanged((_, _) => updateDisplaySettingsVisibility());
currentDisplay.BindValueChanged(display => Schedule(() =>
{
@ -219,7 +213,11 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
scalingSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
scalingSettings.AutoSizeAxes = scalingMode.Value != ScalingMode.Off ? Axes.Y : Axes.None;
scalingSettings.ForEach(s => s.TransferValueOnCommit = scalingMode.Value == ScalingMode.Everything);
scalingSettings.ForEach(s =>
{
s.TransferValueOnCommit = scalingMode.Value == ScalingMode.Everything;
s.CanBeShown.Value = scalingMode.Value != ScalingMode.Off;
});
}
}
@ -234,20 +232,10 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
private void updateDisplaySettingsVisibility()
{
if (resolutions.Count > 1 && windowModeDropdown.Current.Value == WindowMode.Fullscreen)
resolutionDropdown.Show();
else
resolutionDropdown.Hide();
if (displayDropdown.Items.Count() > 1)
displayDropdown.Show();
else
displayDropdown.Hide();
if (host.Window?.SafeAreaPadding.Value.Total != Vector2.Zero)
safeAreaConsiderationsCheckbox.Show();
else
safeAreaConsiderationsCheckbox.Hide();
windowModeDropdown.CanBeShown.Value = windowModes.Count > 1;
resolutionDropdown.CanBeShown.Value = resolutions.Count > 1 && windowModeDropdown.Current.Value == WindowMode.Fullscreen;
displayDropdown.CanBeShown.Value = displayDropdown.Items.Count() > 1;
safeAreaConsiderationsCheckbox.CanBeShown.Value = host.Window?.SafeAreaPadding.Value.Total != Vector2.Zero;
}
private void updateScreenModeWarning()

View File

@ -143,6 +143,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
areaOffset.SetDefault();
areaSize.SetDefault();
},
CanBeShown = { BindTarget = enabled }
},
new SettingsButton
{
@ -150,25 +151,29 @@ namespace osu.Game.Overlays.Settings.Sections.Input
Action = () =>
{
forceAspectRatio((float)host.Window.ClientSize.Width / host.Window.ClientSize.Height);
}
},
CanBeShown = { BindTarget = enabled }
},
new SettingsSlider<float>
{
TransferValueOnCommit = true,
LabelText = TabletSettingsStrings.XOffset,
Current = offsetX
Current = offsetX,
CanBeShown = { BindTarget = enabled }
},
new SettingsSlider<float>
{
TransferValueOnCommit = true,
LabelText = TabletSettingsStrings.YOffset,
Current = offsetY
Current = offsetY,
CanBeShown = { BindTarget = enabled }
},
new SettingsSlider<float>
{
TransferValueOnCommit = true,
LabelText = TabletSettingsStrings.Rotation,
Current = rotation
Current = rotation,
CanBeShown = { BindTarget = enabled }
},
new RotationPresetButtons(tabletHandler)
{
@ -181,24 +186,28 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{
TransferValueOnCommit = true,
LabelText = TabletSettingsStrings.AspectRatio,
Current = aspectRatio
Current = aspectRatio,
CanBeShown = { BindTarget = enabled }
},
new SettingsCheckbox
{
LabelText = TabletSettingsStrings.LockAspectRatio,
Current = aspectLock
Current = aspectLock,
CanBeShown = { BindTarget = enabled }
},
new SettingsSlider<float>
{
TransferValueOnCommit = true,
LabelText = CommonStrings.Width,
Current = sizeX
Current = sizeX,
CanBeShown = { BindTarget = enabled }
},
new SettingsSlider<float>
{
TransferValueOnCommit = true,
LabelText = CommonStrings.Height,
Current = sizeY
Current = sizeY,
CanBeShown = { BindTarget = enabled }
},
}
},

View File

@ -3,14 +3,16 @@
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Overlays.Settings
{
public partial class SettingsButton : RoundedButton, IHasTooltip
public partial class SettingsButton : RoundedButton, IHasTooltip, IConditionalFilterable
{
public SettingsButton()
{
@ -20,6 +22,9 @@ namespace osu.Game.Overlays.Settings
public LocalisableString TooltipText { get; set; }
public BindableBool CanBeShown { get; } = new BindableBool(true);
IBindable<bool> IConditionalFilterable.CanBeShown => CanBeShown;
public override IEnumerable<LocalisableString> FilterTerms
{
get

View File

@ -22,7 +22,7 @@ using osuTK;
namespace osu.Game.Overlays.Settings
{
public abstract partial class SettingsItem<T> : Container, IFilterable, ISettingsItem, IHasCurrentValue<T>, IHasTooltip
public abstract partial class SettingsItem<T> : Container, IConditionalFilterable, ISettingsItem, IHasCurrentValue<T>, IHasTooltip
{
protected abstract Drawable CreateControl();
@ -144,6 +144,9 @@ namespace osu.Game.Overlays.Settings
public bool FilteringActive { get; set; }
public BindableBool CanBeShown { get; } = new BindableBool(true);
IBindable<bool> IConditionalFilterable.CanBeShown => CanBeShown;
public event Action SettingChanged;
private T classicDefault;

View File

@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -19,7 +18,7 @@ using osuTK;
namespace osu.Game.Overlays.Settings
{
public abstract partial class SettingsSection : Container, IHasFilterableChildren
public abstract partial class SettingsSection : Container, IFilterable
{
protected FillFlowContainer FlowContent;
protected override Container<Drawable> Content => FlowContent;
@ -33,7 +32,6 @@ namespace osu.Game.Overlays.Settings
public abstract Drawable CreateIcon();
public abstract LocalisableString Header { get; }
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
public virtual IEnumerable<LocalisableString> FilterTerms => new[] { Header };
public const int ITEM_SPACING = 14;

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Localisation;
using osu.Framework.Testing;
@ -17,7 +16,7 @@ using osu.Game.Graphics;
namespace osu.Game.Overlays.Settings
{
[ExcludeFromDynamicCompile]
public abstract partial class SettingsSubsection : FillFlowContainer, IHasFilterableChildren
public abstract partial class SettingsSubsection : FillFlowContainer, IFilterable
{
protected override Container<Drawable> Content => FlowContent;
@ -25,8 +24,6 @@ namespace osu.Game.Overlays.Settings
protected abstract LocalisableString Header { get; }
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
public virtual IEnumerable<LocalisableString> FilterTerms => new[] { Header };
public bool MatchingFilter

View File

@ -164,7 +164,7 @@ namespace osu.Game.Tests.Beatmaps
return fallback.Get(type, info);
}
public void Inject<T>(T instance) where T : class
public void Inject<T>(T instance) where T : class, IDependencyInjectionCandidate
{
// Never used directly
}

View File

@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay
=> OnlinePlayDependencies?.Get(type, info) ?? parent.Get(type, info);
public void Inject<T>(T instance)
where T : class
where T : class, IDependencyInjectionCandidate
=> injectableDependencies.Inject(instance);
}
}

View File

@ -65,7 +65,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay
=> dependencies.Get(type, info);
public void Inject<T>(T instance)
where T : class
where T : class, IDependencyInjectionCandidate
=> dependencies.Inject(instance);
protected void Cache(object instance)

View File

@ -35,7 +35,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Realm" Version="10.18.0" />
<PackageReference Include="ppy.osu.Framework" Version="2022.1126.0" />
<PackageReference Include="ppy.osu.Framework" Version="2022.1130.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1127.0" />
<PackageReference Include="Sentry" Version="3.23.1" />
<PackageReference Include="SharpCompress" Version="0.32.2" />

View File

@ -62,7 +62,7 @@
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1127.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.1126.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.1130.0" />
</ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net6.0) -->
<PropertyGroup>
@ -82,7 +82,7 @@
<PackageReference Include="DiffPlex" Version="1.7.1" />
<PackageReference Include="Humanizer" Version="2.14.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ppy.osu.Framework" Version="2022.1126.0" />
<PackageReference Include="ppy.osu.Framework" Version="2022.1130.0" />
<PackageReference Include="SharpCompress" Version="0.32.2" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />