Make Rulesets.Catch use the new judgement result structure

This commit is contained in:
smoogipoo
2018-08-02 20:37:07 +09:00
parent 807794d512
commit 9dff5cea07
12 changed files with 50 additions and 87 deletions

View File

@ -1,7 +1,9 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Game.Rulesets.Catch.Judgements;
using osu.Game.Rulesets.Judgements;
namespace osu.Game.Rulesets.Catch.Objects
{
@ -9,6 +11,6 @@ namespace osu.Game.Rulesets.Catch.Objects
{
public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana;
public override CatchJudgement Judgement { get; } = new CatchBananaJudgement();
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new CatchBananaJudgement() };
}
}

View File

@ -1,10 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
@ -56,12 +54,6 @@ namespace osu.Game.Rulesets.Catch.Objects
}
protected override HitWindows CreateHitWindows() => null;
protected override IEnumerable<Judgement> CreateJudgements()
{
if (this is ICatchObjectWithJudgement judgeable)
yield return judgeable.Judgement;
}
}
public enum FruitVisualRepresentation

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
@ -56,10 +57,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{
if (CheckPosition == null) return;
if (timeOffset >= 0 && HitObject is ICatchObjectWithJudgement judgeable)
{
ApplyJudgement(judgeable.Judgement, j => j.Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss);
}
if (timeOffset >= 0 && Results.Count > 0)
ApplyResult(Results.Single(), r => r.Type = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss);
}
protected override void SkinChanged(ISkinSource skin, bool allowFallback)

View File

@ -1,12 +1,14 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Game.Rulesets.Catch.Judgements;
using osu.Game.Rulesets.Judgements;
namespace osu.Game.Rulesets.Catch.Objects
{
public class Droplet : CatchHitObject, ICatchObjectWithJudgement
public class Droplet : CatchHitObject
{
public virtual CatchJudgement Judgement { get; } = new CatchDropletJudgement();
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new CatchDropletJudgement() };
}
}

View File

@ -1,12 +1,14 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Game.Rulesets.Catch.Judgements;
using osu.Game.Rulesets.Judgements;
namespace osu.Game.Rulesets.Catch.Objects
{
public class Fruit : CatchHitObject, ICatchObjectWithJudgement
public class Fruit : CatchHitObject
{
public virtual CatchJudgement Judgement { get; } = new CatchJudgement();
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new CatchJudgement() };
}
}

View File

@ -1,12 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Catch.Judgements;
namespace osu.Game.Rulesets.Catch.Objects
{
public interface ICatchObjectWithJudgement
{
CatchJudgement Judgement { get; }
}
}

View File

@ -1,12 +1,14 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Game.Rulesets.Catch.Judgements;
using osu.Game.Rulesets.Judgements;
namespace osu.Game.Rulesets.Catch.Objects
{
public class TinyDroplet : Droplet
{
public override CatchJudgement Judgement { get; } = new CatchTinyDropletJudgement();
protected override IEnumerable<Judgement> CreateJudgements() => new[] { new CatchTinyDropletJudgement() };
}
}