Skip to content

Commit

Permalink
Upgrade the package and fix the compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Aug 16, 2024
1 parent 4a5305a commit 62a1e8c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,24 @@ public TestSceneDrawableJudgement()
{
foreach (var result in Enum.GetValues<HitResult>().Skip(1))
{
AddStep("Show " + result.GetDescription(), () => SetContents(_ =>
new DrawableNoteJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, new DrawableNote())
AddStep("Show " + result.GetDescription(), () =>
{
SetContents(_ =>
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}));
var drawableManiaJudgement = new DrawableNoteJudgement
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};

drawableManiaJudgement.Apply(new JudgementResult(new HitObject { StartTime = Time.Current }, new Judgement())
{
Type = result,
}, null);

return drawableManiaJudgement;
});
});
}
}
}
10 changes: 0 additions & 10 deletions osu.Game.Rulesets.Karaoke/UI/DrawableNoteJudgement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,12 @@

using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;

namespace osu.Game.Rulesets.Karaoke.UI;

public partial class DrawableNoteJudgement : DrawableJudgement
{
public DrawableNoteJudgement(JudgementResult result, DrawableHitObject judgedObject)
: base(result, judgedObject)
{
}

public DrawableNoteJudgement()
{
}

protected override Drawable CreateDefaultJudgement(HitResult result) => new DefaultKaraokeJudgementPiece(result);

private partial class DefaultKaraokeJudgementPiece : DefaultJudgementPiece
Expand Down
19 changes: 14 additions & 5 deletions osu.Game.Rulesets.Karaoke/UI/NotePlayfield.cs
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.Allocation;
using osu.Framework.Bindables;
Expand All @@ -14,10 +15,12 @@
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.Objects.Drawables;
using osu.Game.Rulesets.Karaoke.Replays;
using osu.Game.Rulesets.Karaoke.Scoring;
using osu.Game.Rulesets.Karaoke.UI.Components;
using osu.Game.Rulesets.Karaoke.UI.Position;
using osu.Game.Rulesets.Karaoke.UI.Scrolling;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Skinning;
using osuTK;
Expand All @@ -33,6 +36,7 @@ public partial class NotePlayfield : ScrollingNotePlayfield, IKeyBindingHandler<

private readonly Container judgementArea;
private readonly JudgementContainer<DrawableNoteJudgement> judgements;
private readonly JudgementPooler<DrawableNoteJudgement> judgementPooler;
private readonly Drawable judgementLine;
private readonly ScoringMarker scoringMarker;

Expand Down Expand Up @@ -121,6 +125,9 @@ public NotePlayfield(int columns)
});

AddInternal(scoringStatus = new ScoringStatus(ScoringStatusMode.NotInitialized));

var hitWindows = new KaraokeNoteHitWindows();
AddInternal(judgementPooler = new JudgementPooler<DrawableNoteJudgement>(Enum.GetValues<HitResult>().Where(r => hitWindows.IsHitResultAllowed(r))));
}

protected override void OnDirectionChanged(KaraokeScrollingDirection direction, float judgementAreaPercentage)
Expand Down Expand Up @@ -186,12 +193,14 @@ internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result
return;

judgements.Clear();
judgements.Add(new DrawableNoteJudgement(result, judgedObject)
judgements.Add(judgementPooler.Get(result.Type, j =>
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Y = notePositionInfo.Calculator.YPositionAt(note.HitObject.Tone + 2),
});
j.Apply(result, judgedObject);

j.Y = notePositionInfo.Calculator.YPositionAt(note.HitObject.Tone + 2);
j.Anchor = Anchor.Centre;
j.Origin = Anchor.Centre;
})!);

// Add hit explosion
if (!result.IsHit)
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ppy.osu.Game" Version="2024.731.0" />
<PackageReference Include="ppy.osu.Game" Version="2024.816.0" />
<PackageReference Include="Lucene.Net" Version="4.8.0-beta00016" />
<PackageReference Include="Lucene.Net.Analysis.Kuromoji" Version="4.8.0-beta00016" />
<PackageReference Include="SixLabors.Fonts" Version="2.0.4" />
Expand Down

0 comments on commit 62a1e8c

Please sign in to comment.