-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2248 from andy840119/upgrade-package
Upgrade package.
- Loading branch information
Showing
21 changed files
with
78 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
// 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 System.Linq; | ||
using osu.Framework.Extensions.IEnumerableExtensions; | ||
using osu.Game.Beatmaps; | ||
|
@@ -10,24 +11,37 @@ | |
using osu.Game.Rulesets.Karaoke.Stages; | ||
using osu.Game.Rulesets.Karaoke.Stages.Preview; | ||
using osu.Game.Rulesets.Karaoke.Stages.Types; | ||
using osu.Game.Screens.Edit; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Beatmaps; | ||
|
||
public class KaraokeBeatmapProcessor : BeatmapProcessor | ||
{ | ||
public new KaraokeBeatmap Beatmap => (KaraokeBeatmap)base.Beatmap; | ||
|
||
public KaraokeBeatmapProcessor(IBeatmap beatmap) | ||
: base(beatmap) | ||
{ | ||
} | ||
|
||
public override void PreProcess() | ||
{ | ||
applyStage(Beatmap); | ||
var karaokeBeatmap = getKaraokeBeatmap(Beatmap); | ||
applyStage(karaokeBeatmap); | ||
|
||
base.PreProcess(); | ||
applyInvalidProperty(Beatmap); | ||
applyInvalidProperty(karaokeBeatmap); | ||
|
||
static KaraokeBeatmap getKaraokeBeatmap(IBeatmap beatmap) | ||
{ | ||
// goes to there while parsing the beatmap. | ||
if (beatmap is KaraokeBeatmap karaokeBeatmap) | ||
return karaokeBeatmap; | ||
|
||
// goes to there while editing the beatmap. | ||
if (beatmap is EditorBeatmap editorBeatmap) | ||
return getKaraokeBeatmap(editorBeatmap.PlayableBeatmap); | ||
|
||
throw new InvalidCastException($"The beatmap is not a {nameof(KaraokeBeatmap)}"); | ||
} | ||
} | ||
|
||
private void applyStage(KaraokeBeatmap beatmap) | ||
|
@@ -36,7 +50,7 @@ private void applyStage(KaraokeBeatmap beatmap) | |
// trying to load the first stage or create a default one. | ||
if (beatmap.CurrentStageInfo == null) | ||
{ | ||
beatmap.CurrentStageInfo = getWorkingStage() ?? createDefaultWorkingStage(); | ||
beatmap.CurrentStageInfo = getWorkingStage(beatmap) ?? createDefaultWorkingStage(); | ||
|
||
// should invalidate the working property here because the stage info is changed. | ||
beatmap.HitObjects.OfType<Lyric>().ForEach(x => | ||
|
@@ -50,10 +64,10 @@ private void applyStage(KaraokeBeatmap beatmap) | |
if (beatmap.CurrentStageInfo is IHasCalculatedProperty calculatedProperty) | ||
calculatedProperty.ValidateCalculatedProperty(beatmap); | ||
|
||
StageInfo? getWorkingStage() | ||
=> Beatmap.StageInfos.FirstOrDefault(); | ||
static StageInfo? getWorkingStage(KaraokeBeatmap beatmap) | ||
=> beatmap.StageInfos.FirstOrDefault(); | ||
|
||
StageInfo createDefaultWorkingStage() => new PreviewStageInfo(); | ||
static StageInfo createDefaultWorkingStage() => new PreviewStageInfo(); | ||
} | ||
|
||
private void applyInvalidProperty(KaraokeBeatmap beatmap) | ||
|
4 changes: 2 additions & 2 deletions
4
osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/LabelledRealTimeSliderBar.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
// 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.Graphics; | ||
using osu.Game.Graphics.UserInterfaceV2; | ||
using osu.Game.Overlays.Settings; | ||
using System.Numerics; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Graphics.UserInterfaceV2; | ||
|
||
public partial class LabelledRealTimeSliderBar<TNumber> : LabelledSliderBar<TNumber> | ||
where TNumber : struct, IEquatable<TNumber>, IComparable<TNumber>, IConvertible | ||
where TNumber : struct, INumber<TNumber>, IMinMaxValue<TNumber> | ||
{ | ||
protected override SettingsSlider<TNumber> CreateComponent() | ||
=> base.CreateComponent().With(x => x.TransferValueOnCommit = false); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.