Skip to content

Commit

Permalink
Merge pull request #2263 from andy840119/upgrade-package-to-latest
Browse files Browse the repository at this point in the history
Upgrade package to latest.
  • Loading branch information
andy840119 authored Jul 20, 2024
2 parents 25a3e3d + 6dedffa commit d91553d
Show file tree
Hide file tree
Showing 15 changed files with 286 additions and 87 deletions.
1 change: 0 additions & 1 deletion CodeAnalysis/BannedSymbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ M:osu.Framework.Bindables.IBindableList`1.GetBoundCopy();Fails on iOS. Use manua
T:Microsoft.EntityFrameworkCore.Internal.EnumerableExtensions;Don't use internal extension methods.
T:Microsoft.EntityFrameworkCore.Internal.TypeExtensions;Don't use internal extension methods.
T:NuGet.Packaging.CollectionExtensions;Don't use internal extension methods.
M:System.Enum.HasFlag(System.Enum);Use osu.Framework.Extensions.EnumExtensions.HasFlagFast<T>() instead.
M:Realms.IRealmCollection`1.SubscribeForNotifications`1(Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IRealmCollection<T>,NotificationCallbackDelegate<T>) instead.
M:System.Guid.#ctor;Probably meaning to use Guid.NewGuid() instead. If actually wanting empty, use Guid.Empty.
M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Linq.IQueryable{``0},Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IQueryable<T>,NotificationCallbackDelegate<T>) instead.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
Expand Down Expand Up @@ -92,7 +91,7 @@ public void TestDisplayProperty([Values] LyricDisplayProperty property)
}
});

if (property.HasFlagFast(LyricDisplayProperty.TopText))
if (property.HasFlag(LyricDisplayProperty.TopText))
{
AssertTopTextChanged();
}
Expand All @@ -103,7 +102,7 @@ public void TestDisplayProperty([Values] LyricDisplayProperty property)

AssertCenterTextChanged();

if (property.HasFlagFast(LyricDisplayProperty.BottomText))
if (property.HasFlag(LyricDisplayProperty.BottomText))
{
AssertBottomTextChanged();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
Expand Down Expand Up @@ -111,10 +110,10 @@ private void updateLayout()
float verticalMargin = Layout.VerticalMargin * scale + padding;
previewLyric.Margin = new MarginPadding
{
Left = Layout.Alignment.HasFlagFast(Anchor.x0) ? horizontalMargin : 0,
Right = Layout.Alignment.HasFlagFast(Anchor.x2) ? horizontalMargin : 0,
Top = Layout.Alignment.HasFlagFast(Anchor.y0) ? verticalMargin : 0,
Bottom = Layout.Alignment.HasFlagFast(Anchor.y2) ? verticalMargin : 0,
Left = Layout.Alignment.HasFlag(Anchor.x0) ? horizontalMargin : 0,
Right = Layout.Alignment.HasFlag(Anchor.x2) ? horizontalMargin : 0,
Top = Layout.Alignment.HasFlag(Anchor.y0) ? verticalMargin : 0,
Bottom = Layout.Alignment.HasFlag(Anchor.y2) ? verticalMargin : 0,
};
}
}
Expand Down
43 changes: 43 additions & 0 deletions osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeNoteSection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Rulesets.Karaoke.Beatmaps;
using osu.Game.Screens.Edit.Setup;

namespace osu.Game.Rulesets.Karaoke.Edit.Setup;

public partial class KaraokeNoteSection : SetupSection
{
public override LocalisableString Title => "Note";

private LabelledSwitchButton scorable = null!;

[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[]
{
scorable = new LabelledSwitchButton
{
Label = "Scorable",
Description = "Will not show score playfield if the option is unchecked.",
Current = { Value = true },
},
};

scorable.Current.BindValueChanged(_ => updateValues());
}

private void updateValues()
{
if (Beatmap.PlayableBeatmap is not KaraokeBeatmap karaokeBeatmap)
throw new InvalidOperationException();

karaokeBeatmap.Scorable = scorable.Current.Value;
}
}
59 changes: 0 additions & 59 deletions osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeSetupSection.cs

This file was deleted.

32 changes: 32 additions & 0 deletions osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeSingerSection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Karaoke.Edit.Setup.Components;
using osu.Game.Screens.Edit.Setup;

namespace osu.Game.Rulesets.Karaoke.Edit.Setup;

public partial class KaraokeSingerSection : SetupSection
{
public override LocalisableString Title => "Singers";

private LabelledSingerList singerList = null!;

[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[]
{
singerList = new LabelledSingerList
{
Label = "Singer list",
Description = "All the singers in beatmap.",
FixedLabelWidth = LABEL_WIDTH,
SingerNamePrefix = "#",
},
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Collections.Generic;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Karaoke.Graphics.Sprites.Processor;
using osu.Game.Rulesets.Karaoke.Objects;
Expand Down Expand Up @@ -90,13 +89,13 @@ public void UpdateAll()
processor.UpdateAll();

// should trigger top text update even not display.
if (!displayProperty.HasFlagFast(LyricDisplayProperty.TopText))
if (!displayProperty.HasFlag(LyricDisplayProperty.TopText))
{
TopTextChanged?.Invoke(Array.Empty<PositionText>());
}

// should trigger bottom text update even not display.
if (!displayProperty.HasFlagFast(LyricDisplayProperty.BottomText))
if (!displayProperty.HasFlag(LyricDisplayProperty.BottomText))
{
BottomTextChanged?.Invoke(Array.Empty<PositionText>());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Karaoke.Objects;

Expand Down Expand Up @@ -44,7 +43,7 @@ public void UpdateAll()

protected void UpdateTopText()
{
if (!displayProperty.HasFlagFast(LyricDisplayProperty.TopText))
if (!displayProperty.HasFlag(LyricDisplayProperty.TopText))
return;

TopTextChanged?.Invoke(CalculateTopTexts(lyric).ToArray());
Expand All @@ -57,7 +56,7 @@ protected void UpdateCenterText()

protected void UpdateBottomText()
{
if (!displayProperty.HasFlagFast(LyricDisplayProperty.BottomText))
if (!displayProperty.HasFlag(LyricDisplayProperty.BottomText))
return;

BottomTextChanged?.Invoke(CalculateBottomTexts(lyric).ToArray());
Expand Down
6 changes: 5 additions & 1 deletion osu.Game.Rulesets.Karaoke/KaraokeRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,11 @@ public override StatisticItem[] CreateStatisticsForScore(ScoreInfo score, IBeatm
return statistic.ToArray();
}

public override RulesetSetupSection CreateEditorSetupSection() => new KaraokeSetupSection();
public override IEnumerable<SetupSection> CreateEditorSetupSections() => new SetupSection[]
{
new KaraokeSingerSection(),
new KaraokeNoteSection(),
};

public KaraokeRuleset()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
Expand Down Expand Up @@ -163,7 +162,7 @@ private void load(KaraokeRulesetLyricEditorConfigManager lyricEditorConfigManage

protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source)
{
if (invalidation.HasFlagFast(Invalidation.DrawSize) && source == InvalidationSource.Parent)
if (invalidation.HasFlag(Invalidation.DrawSize) && source == InvalidationSource.Parent)
calculatePanelPosition();

return base.OnInvalidate(invalidation, source);
Expand Down
Loading

0 comments on commit d91553d

Please sign in to comment.