mirror of
https://github.com/osukey/osukey.git
synced 2025-06-22 19:57:56 +09:00
Merge pull request #489 from smoogipooo/generic_judgements_2
Generic judgements part 1/?
This commit is contained in:
commit
a7ba6bbcfe
@ -12,6 +12,7 @@ using osu.Framework.Screens.Testing;
|
|||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
|
using osu.Game.Modes.Osu.Judgements;
|
||||||
using osu.Game.Modes.Osu.Objects;
|
using osu.Game.Modes.Osu.Objects;
|
||||||
using osu.Game.Modes.Osu.Objects.Drawables;
|
using osu.Game.Modes.Osu.Objects.Drawables;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -127,7 +128,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
private int depth;
|
private int depth;
|
||||||
|
|
||||||
private void add(DrawableHitObject h)
|
private void add(DrawableOsuHitObject h)
|
||||||
{
|
{
|
||||||
h.Anchor = Anchor.Centre;
|
h.Anchor = Anchor.Centre;
|
||||||
h.Depth = depth++;
|
h.Depth = depth++;
|
||||||
|
11
osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs
Normal file
11
osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Modes.Judgements;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Catch.Judgements
|
||||||
|
{
|
||||||
|
public class CatchJudgementInfo : JudgementInfo
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -3,13 +3,14 @@
|
|||||||
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Modes.Catch.Beatmaps;
|
using osu.Game.Modes.Catch.Beatmaps;
|
||||||
|
using osu.Game.Modes.Catch.Judgements;
|
||||||
using osu.Game.Modes.Catch.Objects;
|
using osu.Game.Modes.Catch.Objects;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Catch.UI
|
namespace osu.Game.Modes.Catch.UI
|
||||||
{
|
{
|
||||||
public class CatchHitRenderer : HitRenderer<CatchBaseHit>
|
public class CatchHitRenderer : HitRenderer<CatchBaseHit, CatchJudgementInfo>
|
||||||
{
|
{
|
||||||
public CatchHitRenderer(WorkingBeatmap beatmap)
|
public CatchHitRenderer(WorkingBeatmap beatmap)
|
||||||
: base(beatmap)
|
: base(beatmap)
|
||||||
@ -19,9 +20,9 @@ namespace osu.Game.Modes.Catch.UI
|
|||||||
protected override IBeatmapConverter<CatchBaseHit> CreateBeatmapConverter() => new CatchBeatmapConverter();
|
protected override IBeatmapConverter<CatchBaseHit> CreateBeatmapConverter() => new CatchBeatmapConverter();
|
||||||
|
|
||||||
protected override IBeatmapProcessor<CatchBaseHit> CreateBeatmapProcessor() => new CatchBeatmapProcessor();
|
protected override IBeatmapProcessor<CatchBaseHit> CreateBeatmapProcessor() => new CatchBeatmapProcessor();
|
||||||
|
protected override Playfield<CatchBaseHit, CatchJudgementInfo> CreatePlayfield() => new CatchPlayfield();
|
||||||
|
|
||||||
protected override Playfield<CatchBaseHit> CreatePlayfield() => new CatchPlayfield();
|
|
||||||
|
|
||||||
protected override DrawableHitObject<CatchBaseHit> GetVisualRepresentation(CatchBaseHit h) => null;// new DrawableFruit(h);
|
protected override DrawableHitObject<CatchBaseHit, CatchJudgementInfo> GetVisualRepresentation(CatchBaseHit h) => null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,11 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Game.Modes.Catch.Objects;
|
using osu.Game.Modes.Catch.Objects;
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Game.Modes.Catch.Judgements;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Catch.UI
|
namespace osu.Game.Modes.Catch.UI
|
||||||
{
|
{
|
||||||
public class CatchPlayfield : Playfield<CatchBaseHit>
|
public class CatchPlayfield : Playfield<CatchBaseHit, CatchJudgementInfo>
|
||||||
{
|
{
|
||||||
public CatchPlayfield()
|
public CatchPlayfield()
|
||||||
{
|
{
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
<Compile Include="Beatmaps\CatchBeatmapConverter.cs" />
|
<Compile Include="Beatmaps\CatchBeatmapConverter.cs" />
|
||||||
<Compile Include="Beatmaps\CatchBeatmapProcessor.cs" />
|
<Compile Include="Beatmaps\CatchBeatmapProcessor.cs" />
|
||||||
<Compile Include="CatchDifficultyCalculator.cs" />
|
<Compile Include="CatchDifficultyCalculator.cs" />
|
||||||
|
<Compile Include="Judgements\CatchJudgementInfo.cs" />
|
||||||
<Compile Include="Objects\CatchBaseHit.cs" />
|
<Compile Include="Objects\CatchBaseHit.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableFruit.cs" />
|
<Compile Include="Objects\Drawable\DrawableFruit.cs" />
|
||||||
<Compile Include="Objects\Droplet.cs" />
|
<Compile Include="Objects\Droplet.cs" />
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
11
osu.Game.Modes.Mania/Judgements/ManiaJudgementInfo.cs
Normal file
11
osu.Game.Modes.Mania/Judgements/ManiaJudgementInfo.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Modes.Judgements;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Mania.Judgements
|
||||||
|
{
|
||||||
|
public class ManiaJudgementInfo : JudgementInfo
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -3,13 +3,14 @@
|
|||||||
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Modes.Mania.Beatmaps;
|
using osu.Game.Modes.Mania.Beatmaps;
|
||||||
|
using osu.Game.Modes.Mania.Judgements;
|
||||||
using osu.Game.Modes.Mania.Objects;
|
using osu.Game.Modes.Mania.Objects;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Mania.UI
|
namespace osu.Game.Modes.Mania.UI
|
||||||
{
|
{
|
||||||
public class ManiaHitRenderer : HitRenderer<ManiaBaseHit>
|
public class ManiaHitRenderer : HitRenderer<ManiaBaseHit, ManiaJudgementInfo>
|
||||||
{
|
{
|
||||||
private readonly int columns;
|
private readonly int columns;
|
||||||
|
|
||||||
@ -22,17 +23,9 @@ namespace osu.Game.Modes.Mania.UI
|
|||||||
protected override IBeatmapConverter<ManiaBaseHit> CreateBeatmapConverter() => new ManiaBeatmapConverter();
|
protected override IBeatmapConverter<ManiaBaseHit> CreateBeatmapConverter() => new ManiaBeatmapConverter();
|
||||||
|
|
||||||
protected override IBeatmapProcessor<ManiaBaseHit> CreateBeatmapProcessor() => new ManiaBeatmapProcessor();
|
protected override IBeatmapProcessor<ManiaBaseHit> CreateBeatmapProcessor() => new ManiaBeatmapProcessor();
|
||||||
|
protected override Playfield<ManiaBaseHit, ManiaJudgementInfo> CreatePlayfield() => new ManiaPlayfield(columns);
|
||||||
|
|
||||||
protected override Playfield<ManiaBaseHit> CreatePlayfield() => new ManiaPlayfield(columns);
|
|
||||||
|
|
||||||
protected override DrawableHitObject<ManiaBaseHit> GetVisualRepresentation(ManiaBaseHit h)
|
protected override DrawableHitObject<ManiaBaseHit, ManiaJudgementInfo> GetVisualRepresentation(ManiaBaseHit h) => null;
|
||||||
{
|
|
||||||
return null;
|
|
||||||
//return new DrawableNote(h)
|
|
||||||
//{
|
|
||||||
// Position = new Vector2((float)(h.Column + 0.5) / columns, -0.1f),
|
|
||||||
// RelativePositionAxes = Axes.Both
|
|
||||||
//};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,11 @@ using osu.Game.Modes.Mania.Objects;
|
|||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Modes.Mania.Judgements;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Mania.UI
|
namespace osu.Game.Modes.Mania.UI
|
||||||
{
|
{
|
||||||
public class ManiaPlayfield : Playfield<ManiaBaseHit>
|
public class ManiaPlayfield : Playfield<ManiaBaseHit, ManiaJudgementInfo>
|
||||||
{
|
{
|
||||||
public ManiaPlayfield(int columns)
|
public ManiaPlayfield(int columns)
|
||||||
{
|
{
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Beatmaps\ManiaBeatmapConverter.cs" />
|
<Compile Include="Beatmaps\ManiaBeatmapConverter.cs" />
|
||||||
<Compile Include="Beatmaps\ManiaBeatmapProcessor.cs" />
|
<Compile Include="Beatmaps\ManiaBeatmapProcessor.cs" />
|
||||||
|
<Compile Include="Judgements\ManiaJudgementInfo.cs" />
|
||||||
<Compile Include="ManiaDifficultyCalculator.cs" />
|
<Compile Include="ManiaDifficultyCalculator.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableNote.cs" />
|
<Compile Include="Objects\Drawable\DrawableNote.cs" />
|
||||||
<Compile Include="Objects\HoldNote.cs" />
|
<Compile Include="Objects\HoldNote.cs" />
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
50
osu.Game.Modes.Osu/Judgements/OsuJudgementInfo.cs
Normal file
50
osu.Game.Modes.Osu/Judgements/OsuJudgementInfo.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK;
|
||||||
|
using osu.Game.Modes.Judgements;
|
||||||
|
using osu.Game.Modes.Osu.Objects.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Osu.Judgements
|
||||||
|
{
|
||||||
|
public class OsuJudgementInfo : JudgementInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The positional hit offset.
|
||||||
|
/// </summary>
|
||||||
|
public Vector2 PositionOffset;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The score the user achieved.
|
||||||
|
/// </summary>
|
||||||
|
public OsuScoreResult Score;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The score which would be achievable on a perfect hit.
|
||||||
|
/// </summary>
|
||||||
|
public OsuScoreResult MaxScore = OsuScoreResult.Hit300;
|
||||||
|
|
||||||
|
public int ScoreValue => scoreToInt(Score);
|
||||||
|
|
||||||
|
public int MaxScoreValue => scoreToInt(MaxScore);
|
||||||
|
|
||||||
|
private int scoreToInt(OsuScoreResult result)
|
||||||
|
{
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
case OsuScoreResult.Hit50:
|
||||||
|
return 50;
|
||||||
|
case OsuScoreResult.Hit100:
|
||||||
|
return 100;
|
||||||
|
case OsuScoreResult.Hit300:
|
||||||
|
return 300;
|
||||||
|
case OsuScoreResult.SliderTick:
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ComboResult Combo;
|
||||||
|
}
|
||||||
|
}
|
@ -45,7 +45,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
if (Judgement.Result.HasValue) return false;
|
if (Judgement.Result.HasValue) return false;
|
||||||
|
|
||||||
((PositionalJudgementInfo)Judgement).PositionOffset = Vector2.Zero; //todo: set to correct value
|
Judgement.PositionOffset = Vector2.Zero; //todo: set to correct value
|
||||||
UpdateJudgement(true);
|
UpdateJudgement(true);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@ -81,12 +81,10 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
|
|
||||||
double hitOffset = Math.Abs(Judgement.TimeOffset);
|
double hitOffset = Math.Abs(Judgement.TimeOffset);
|
||||||
|
|
||||||
OsuJudgementInfo osuJudgement = (OsuJudgementInfo)Judgement;
|
|
||||||
|
|
||||||
if (hitOffset < HitObject.HitWindowFor(OsuScoreResult.Hit50))
|
if (hitOffset < HitObject.HitWindowFor(OsuScoreResult.Hit50))
|
||||||
{
|
{
|
||||||
Judgement.Result = HitResult.Hit;
|
Judgement.Result = HitResult.Hit;
|
||||||
osuJudgement.Score = HitObject.ScoreResultForOffset(hitOffset);
|
Judgement.Score = HitObject.ScoreResultForOffset(hitOffset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Judgement.Result = HitResult.Miss;
|
Judgement.Result = HitResult.Miss;
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
|
using osu.Game.Modes.Osu.Judgements;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.Objects.Drawables
|
namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||||
{
|
{
|
||||||
public class DrawableOsuHitObject : DrawableHitObject<OsuHitObject>
|
public class DrawableOsuHitObject : DrawableHitObject<OsuHitObject, OsuJudgementInfo>
|
||||||
{
|
{
|
||||||
public const float TIME_PREEMPT = 600;
|
public const float TIME_PREEMPT = 600;
|
||||||
public const float TIME_FADEIN = 400;
|
public const float TIME_FADEIN = 400;
|
||||||
@ -17,7 +18,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.Hit300 };
|
protected override OsuJudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.Hit300 };
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
protected override void UpdateState(ArmedState state)
|
||||||
{
|
{
|
||||||
@ -45,42 +46,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OsuJudgementInfo : PositionalJudgementInfo
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The score the user achieved.
|
|
||||||
/// </summary>
|
|
||||||
public OsuScoreResult Score;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The score which would be achievable on a perfect hit.
|
|
||||||
/// </summary>
|
|
||||||
public OsuScoreResult MaxScore = OsuScoreResult.Hit300;
|
|
||||||
|
|
||||||
public int ScoreValue => scoreToInt(Score);
|
|
||||||
|
|
||||||
public int MaxScoreValue => scoreToInt(MaxScore);
|
|
||||||
|
|
||||||
private int scoreToInt(OsuScoreResult result)
|
|
||||||
{
|
|
||||||
switch (result)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
case OsuScoreResult.Hit50:
|
|
||||||
return 50;
|
|
||||||
case OsuScoreResult.Hit100:
|
|
||||||
return 100;
|
|
||||||
case OsuScoreResult.Hit300:
|
|
||||||
return 300;
|
|
||||||
case OsuScoreResult.SliderTick:
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ComboResult Combo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ComboResult
|
public enum ComboResult
|
||||||
{
|
{
|
||||||
[Description(@"")]
|
[Description(@"")]
|
||||||
|
@ -125,27 +125,24 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
|
|
||||||
protected override void CheckJudgement(bool userTriggered)
|
protected override void CheckJudgement(bool userTriggered)
|
||||||
{
|
{
|
||||||
var j = (OsuJudgementInfo)Judgement;
|
|
||||||
var sc = (OsuJudgementInfo)initialCircle.Judgement;
|
|
||||||
|
|
||||||
if (!userTriggered && Time.Current >= slider.EndTime)
|
if (!userTriggered && Time.Current >= slider.EndTime)
|
||||||
{
|
{
|
||||||
var ticksCount = ticks.Children.Count() + 1;
|
var ticksCount = ticks.Children.Count() + 1;
|
||||||
var ticksHit = ticks.Children.Count(t => t.Judgement.Result == HitResult.Hit);
|
var ticksHit = ticks.Children.Count(t => t.Judgement.Result == HitResult.Hit);
|
||||||
if (sc.Result == HitResult.Hit)
|
if (initialCircle.Judgement.Result == HitResult.Hit)
|
||||||
ticksHit++;
|
ticksHit++;
|
||||||
|
|
||||||
var hitFraction = (double)ticksHit / ticksCount;
|
var hitFraction = (double)ticksHit / ticksCount;
|
||||||
if (hitFraction == 1 && sc.Score == OsuScoreResult.Hit300)
|
if (hitFraction == 1 && initialCircle.Judgement.Score == OsuScoreResult.Hit300)
|
||||||
j.Score = OsuScoreResult.Hit300;
|
Judgement.Score = OsuScoreResult.Hit300;
|
||||||
else if (hitFraction >= 0.5 && sc.Score >= OsuScoreResult.Hit100)
|
else if (hitFraction >= 0.5 && initialCircle.Judgement.Score >= OsuScoreResult.Hit100)
|
||||||
j.Score = OsuScoreResult.Hit100;
|
Judgement.Score = OsuScoreResult.Hit100;
|
||||||
else if (hitFraction > 0)
|
else if (hitFraction > 0)
|
||||||
j.Score = OsuScoreResult.Hit50;
|
Judgement.Score = OsuScoreResult.Hit50;
|
||||||
else
|
else
|
||||||
j.Score = OsuScoreResult.Miss;
|
Judgement.Score = OsuScoreResult.Miss;
|
||||||
|
|
||||||
j.Result = j.Score != OsuScoreResult.Miss ? HitResult.Hit : HitResult.Miss;
|
Judgement.Result = Judgement.Score != OsuScoreResult.Miss ? HitResult.Hit : HitResult.Miss;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.Transforms;
|
using osu.Framework.Graphics.Transforms;
|
||||||
using osu.Game.Beatmaps.Samples;
|
using osu.Game.Beatmaps.Samples;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
|
using osu.Game.Modes.Osu.Judgements;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
|
|
||||||
public override bool RemoveWhenNotAlive => false;
|
public override bool RemoveWhenNotAlive => false;
|
||||||
|
|
||||||
protected override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.SliderTick };
|
protected override OsuJudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.SliderTick };
|
||||||
|
|
||||||
public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick)
|
public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick)
|
||||||
{
|
{
|
||||||
@ -71,12 +72,10 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
|
|
||||||
protected override void CheckJudgement(bool userTriggered)
|
protected override void CheckJudgement(bool userTriggered)
|
||||||
{
|
{
|
||||||
var j = (OsuJudgementInfo)Judgement;
|
|
||||||
|
|
||||||
if (Judgement.TimeOffset >= 0)
|
if (Judgement.TimeOffset >= 0)
|
||||||
{
|
{
|
||||||
j.Result = Tracking ? HitResult.Hit : HitResult.Miss;
|
Judgement.Result = Tracking ? HitResult.Hit : HitResult.Miss;
|
||||||
j.Score = Tracking ? OsuScoreResult.SliderTick : OsuScoreResult.Miss;
|
Judgement.Score = Tracking ? OsuScoreResult.SliderTick : OsuScoreResult.Miss;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +75,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
if (Time.Current < HitObject.StartTime) return;
|
if (Time.Current < HitObject.StartTime) return;
|
||||||
|
|
||||||
var j = (OsuJudgementInfo)Judgement;
|
|
||||||
|
|
||||||
disc.ScaleTo(Interpolation.ValueAt(Math.Sqrt(Progress), scaleToCircle, Vector2.One, 0, 1), 100);
|
disc.ScaleTo(Interpolation.ValueAt(Math.Sqrt(Progress), scaleToCircle, Vector2.One, 0, 1), 100);
|
||||||
|
|
||||||
if (Progress >= 1)
|
if (Progress >= 1)
|
||||||
@ -86,24 +84,24 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
if (Progress >= 1)
|
if (Progress >= 1)
|
||||||
{
|
{
|
||||||
j.Score = OsuScoreResult.Hit300;
|
Judgement.Score = OsuScoreResult.Hit300;
|
||||||
j.Result = HitResult.Hit;
|
Judgement.Result = HitResult.Hit;
|
||||||
}
|
}
|
||||||
else if (Progress > .9)
|
else if (Progress > .9)
|
||||||
{
|
{
|
||||||
j.Score = OsuScoreResult.Hit100;
|
Judgement.Score = OsuScoreResult.Hit100;
|
||||||
j.Result = HitResult.Hit;
|
Judgement.Result = HitResult.Hit;
|
||||||
}
|
}
|
||||||
else if (Progress > .75)
|
else if (Progress > .75)
|
||||||
{
|
{
|
||||||
j.Score = OsuScoreResult.Hit50;
|
Judgement.Score = OsuScoreResult.Hit50;
|
||||||
j.Result = HitResult.Hit;
|
Judgement.Result = HitResult.Hit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
j.Score = OsuScoreResult.Miss;
|
Judgement.Score = OsuScoreResult.Miss;
|
||||||
if (Time.Current >= spinner.EndTime)
|
if (Time.Current >= spinner.EndTime)
|
||||||
j.Result = HitResult.Miss;
|
Judgement.Result = HitResult.Miss;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.Transforms;
|
using osu.Framework.Graphics.Transforms;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
|
using osu.Game.Modes.Osu.Judgements;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Modes.Judgements;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.Osu.Objects.Drawables;
|
using osu.Game.Modes.Osu.Judgements;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu
|
namespace osu.Game.Modes.Osu
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.Osu.Beatmaps;
|
using osu.Game.Modes.Osu.Beatmaps;
|
||||||
|
using osu.Game.Modes.Osu.Judgements;
|
||||||
using osu.Game.Modes.Osu.Objects;
|
using osu.Game.Modes.Osu.Objects;
|
||||||
using osu.Game.Modes.Osu.Objects.Drawables;
|
using osu.Game.Modes.Osu.Objects.Drawables;
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
@ -11,7 +12,7 @@ using osu.Game.Screens.Play;
|
|||||||
|
|
||||||
namespace osu.Game.Modes.Osu.UI
|
namespace osu.Game.Modes.Osu.UI
|
||||||
{
|
{
|
||||||
public class OsuHitRenderer : HitRenderer<OsuHitObject>
|
public class OsuHitRenderer : HitRenderer<OsuHitObject, OsuJudgementInfo>
|
||||||
{
|
{
|
||||||
public OsuHitRenderer(WorkingBeatmap beatmap)
|
public OsuHitRenderer(WorkingBeatmap beatmap)
|
||||||
: base(beatmap)
|
: base(beatmap)
|
||||||
@ -21,12 +22,12 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
protected override IBeatmapConverter<OsuHitObject> CreateBeatmapConverter() => new OsuBeatmapConverter();
|
protected override IBeatmapConverter<OsuHitObject> CreateBeatmapConverter() => new OsuBeatmapConverter();
|
||||||
|
|
||||||
protected override IBeatmapProcessor<OsuHitObject> CreateBeatmapProcessor() => new OsuBeatmapProcessor();
|
protected override IBeatmapProcessor<OsuHitObject> CreateBeatmapProcessor() => new OsuBeatmapProcessor();
|
||||||
|
protected override Playfield<OsuHitObject, OsuJudgementInfo> CreatePlayfield() => new OsuPlayfield();
|
||||||
|
|
||||||
protected override Playfield<OsuHitObject> CreatePlayfield() => new OsuPlayfield();
|
|
||||||
|
|
||||||
protected override KeyConversionInputManager CreateKeyConversionInputManager() => new OsuKeyConversionInputManager();
|
protected override KeyConversionInputManager CreateKeyConversionInputManager() => new OsuKeyConversionInputManager();
|
||||||
|
|
||||||
protected override DrawableHitObject<OsuHitObject> GetVisualRepresentation(OsuHitObject h)
|
protected override DrawableHitObject<OsuHitObject, OsuJudgementInfo> GetVisualRepresentation(OsuHitObject h)
|
||||||
{
|
{
|
||||||
var circle = h as HitCircle;
|
var circle = h as HitCircle;
|
||||||
if (circle != null)
|
if (circle != null)
|
||||||
|
@ -11,11 +11,12 @@ using osu.Game.Modes.Osu.Objects.Drawables.Connections;
|
|||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
|
using osu.Game.Modes.Osu.Judgements;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.UI
|
namespace osu.Game.Modes.Osu.UI
|
||||||
{
|
{
|
||||||
public class OsuPlayfield : Playfield<OsuHitObject>
|
public class OsuPlayfield : Playfield<OsuHitObject, OsuJudgementInfo>
|
||||||
{
|
{
|
||||||
private Container approachCircles;
|
private Container approachCircles;
|
||||||
private Container judgementLayer;
|
private Container judgementLayer;
|
||||||
@ -65,16 +66,13 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
AddInternal(new OsuCursorContainer { Colour = Color4.LightYellow });
|
AddInternal(new OsuCursorContainer { Colour = Color4.LightYellow });
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Add(DrawableHitObject<OsuHitObject> h)
|
public override void Add(DrawableHitObject<OsuHitObject, OsuJudgementInfo> h)
|
||||||
{
|
{
|
||||||
h.Depth = (float)h.HitObject.StartTime;
|
h.Depth = (float)h.HitObject.StartTime;
|
||||||
|
|
||||||
IDrawableHitObjectWithProxiedApproach c = h as IDrawableHitObjectWithProxiedApproach;
|
IDrawableHitObjectWithProxiedApproach c = h as IDrawableHitObjectWithProxiedApproach;
|
||||||
if (c != null)
|
if (c != null)
|
||||||
{
|
|
||||||
approachCircles.Add(c.ProxiedLayer.CreateProxy());
|
approachCircles.Add(c.ProxiedLayer.CreateProxy());
|
||||||
}
|
|
||||||
|
|
||||||
h.OnJudgement += judgement;
|
|
||||||
|
|
||||||
base.Add(h);
|
base.Add(h);
|
||||||
}
|
}
|
||||||
@ -86,9 +84,9 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
.OrderBy(h => h.StartTime);
|
.OrderBy(h => h.StartTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void judgement(DrawableHitObject<OsuHitObject> h, JudgementInfo j)
|
public override void OnJudgement(DrawableHitObject<OsuHitObject, OsuJudgementInfo> judgedObject)
|
||||||
{
|
{
|
||||||
HitExplosion explosion = new HitExplosion((OsuJudgementInfo)j, h.HitObject);
|
HitExplosion explosion = new HitExplosion(judgedObject.Judgement, judgedObject.HitObject);
|
||||||
|
|
||||||
judgementLayer.Add(explosion);
|
judgementLayer.Add(explosion);
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
<Compile Include="Objects\Drawables\DrawableOsuHitObject.cs" />
|
<Compile Include="Objects\Drawables\DrawableOsuHitObject.cs" />
|
||||||
<Compile Include="Objects\Drawables\Connections\ConnectionRenderer.cs" />
|
<Compile Include="Objects\Drawables\Connections\ConnectionRenderer.cs" />
|
||||||
<Compile Include="Objects\Drawables\Connections\FollowPointRenderer.cs" />
|
<Compile Include="Objects\Drawables\Connections\FollowPointRenderer.cs" />
|
||||||
|
<Compile Include="Judgements\OsuJudgementInfo.cs" />
|
||||||
<Compile Include="Objects\Drawables\Pieces\ApproachCircle.cs" />
|
<Compile Include="Objects\Drawables\Pieces\ApproachCircle.cs" />
|
||||||
<Compile Include="Objects\Drawables\Pieces\SpinnerBackground.cs" />
|
<Compile Include="Objects\Drawables\Pieces\SpinnerBackground.cs" />
|
||||||
<Compile Include="Objects\Drawables\Pieces\CirclePiece.cs" />
|
<Compile Include="Objects\Drawables\Pieces\CirclePiece.cs" />
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
11
osu.Game.Modes.Taiko/Judgements/TaikoJudgementInfo.cs
Normal file
11
osu.Game.Modes.Taiko/Judgements/TaikoJudgementInfo.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Modes.Judgements;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Taiko.Judgements
|
||||||
|
{
|
||||||
|
public class TaikoJudgementInfo : JudgementInfo
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -4,12 +4,13 @@
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.Taiko.Beatmaps;
|
using osu.Game.Modes.Taiko.Beatmaps;
|
||||||
|
using osu.Game.Modes.Taiko.Judgements;
|
||||||
using osu.Game.Modes.Taiko.Objects;
|
using osu.Game.Modes.Taiko.Objects;
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Taiko.UI
|
namespace osu.Game.Modes.Taiko.UI
|
||||||
{
|
{
|
||||||
public class TaikoHitRenderer : HitRenderer<TaikoBaseHit>
|
public class TaikoHitRenderer : HitRenderer<TaikoBaseHit, TaikoJudgementInfo>
|
||||||
{
|
{
|
||||||
public TaikoHitRenderer(WorkingBeatmap beatmap)
|
public TaikoHitRenderer(WorkingBeatmap beatmap)
|
||||||
: base(beatmap)
|
: base(beatmap)
|
||||||
@ -19,9 +20,9 @@ namespace osu.Game.Modes.Taiko.UI
|
|||||||
protected override IBeatmapConverter<TaikoBaseHit> CreateBeatmapConverter() => new TaikoBeatmapConverter();
|
protected override IBeatmapConverter<TaikoBaseHit> CreateBeatmapConverter() => new TaikoBeatmapConverter();
|
||||||
|
|
||||||
protected override IBeatmapProcessor<TaikoBaseHit> CreateBeatmapProcessor() => new TaikoBeatmapProcessor();
|
protected override IBeatmapProcessor<TaikoBaseHit> CreateBeatmapProcessor() => new TaikoBeatmapProcessor();
|
||||||
|
protected override Playfield<TaikoBaseHit, TaikoJudgementInfo> CreatePlayfield() => new TaikoPlayfield();
|
||||||
|
|
||||||
protected override Playfield<TaikoBaseHit> CreatePlayfield() => new TaikoPlayfield();
|
|
||||||
|
|
||||||
protected override DrawableHitObject<TaikoBaseHit> GetVisualRepresentation(TaikoBaseHit h) => null;// new DrawableTaikoHit(h);
|
protected override DrawableHitObject<TaikoBaseHit, TaikoJudgementInfo> GetVisualRepresentation(TaikoBaseHit h) => null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,11 @@ using osu.Game.Modes.Taiko.Objects;
|
|||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Modes.Taiko.Judgements;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Taiko.UI
|
namespace osu.Game.Modes.Taiko.UI
|
||||||
{
|
{
|
||||||
public class TaikoPlayfield : Playfield<TaikoBaseHit>
|
public class TaikoPlayfield : Playfield<TaikoBaseHit, TaikoJudgementInfo>
|
||||||
{
|
{
|
||||||
public TaikoPlayfield()
|
public TaikoPlayfield()
|
||||||
{
|
{
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Beatmaps\TaikoBeatmapConverter.cs" />
|
<Compile Include="Beatmaps\TaikoBeatmapConverter.cs" />
|
||||||
<Compile Include="Beatmaps\TaikoBeatmapProcessor.cs" />
|
<Compile Include="Beatmaps\TaikoBeatmapProcessor.cs" />
|
||||||
|
<Compile Include="Judgements\TaikoJudgementInfo.cs" />
|
||||||
<Compile Include="TaikoDifficultyCalculator.cs" />
|
<Compile Include="TaikoDifficultyCalculator.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableTaikoHit.cs" />
|
<Compile Include="Objects\Drawable\DrawableTaikoHit.cs" />
|
||||||
<Compile Include="Objects\TaikoBaseHit.cs" />
|
<Compile Include="Objects\TaikoBaseHit.cs" />
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
14
osu.Game/Modes/Judgements/JudgementInfo.cs
Normal file
14
osu.Game/Modes/Judgements/JudgementInfo.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Judgements
|
||||||
|
{
|
||||||
|
public class JudgementInfo
|
||||||
|
{
|
||||||
|
public ulong? ComboAtHit;
|
||||||
|
public HitResult? Result;
|
||||||
|
public double TimeOffset;
|
||||||
|
}
|
||||||
|
}
|
12
osu.Game/Modes/Objects/Drawables/ArmedState.cs
Normal file
12
osu.Game/Modes/Objects/Drawables/ArmedState.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Objects.Drawables
|
||||||
|
{
|
||||||
|
public enum ArmedState
|
||||||
|
{
|
||||||
|
Idle,
|
||||||
|
Hit,
|
||||||
|
Miss
|
||||||
|
}
|
||||||
|
}
|
@ -3,27 +3,27 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Game.Beatmaps.Samples;
|
using osu.Game.Beatmaps.Samples;
|
||||||
using OpenTK;
|
using osu.Game.Modes.Judgements;
|
||||||
using Container = osu.Framework.Graphics.Containers.Container;
|
using Container = osu.Framework.Graphics.Containers.Container;
|
||||||
using osu.Game.Modes.Objects.Types;
|
using osu.Game.Modes.Objects.Types;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Objects.Drawables
|
namespace osu.Game.Modes.Objects.Drawables
|
||||||
{
|
{
|
||||||
public abstract class DrawableHitObject : Container, IStateful<ArmedState>
|
public abstract class DrawableHitObject<TJudgement> : Container, IStateful<ArmedState>
|
||||||
|
where TJudgement : JudgementInfo
|
||||||
{
|
{
|
||||||
public override bool HandleInput => Interactive;
|
public override bool HandleInput => Interactive;
|
||||||
|
|
||||||
public bool Interactive = true;
|
public bool Interactive = true;
|
||||||
|
|
||||||
public JudgementInfo Judgement;
|
public TJudgement Judgement;
|
||||||
|
|
||||||
protected abstract JudgementInfo CreateJudgementInfo();
|
protected abstract TJudgement CreateJudgementInfo();
|
||||||
|
|
||||||
protected abstract void UpdateState(ArmedState state);
|
protected abstract void UpdateState(ArmedState state);
|
||||||
|
|
||||||
@ -68,10 +68,11 @@ namespace osu.Game.Modes.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class DrawableHitObject<TObject> : DrawableHitObject
|
public abstract class DrawableHitObject<TObject, TJudgement> : DrawableHitObject<TJudgement>
|
||||||
where TObject : HitObject
|
where TObject : HitObject
|
||||||
|
where TJudgement : JudgementInfo
|
||||||
{
|
{
|
||||||
public event Action<DrawableHitObject<TObject>, JudgementInfo> OnJudgement;
|
public event Action<DrawableHitObject<TObject, TJudgement>> OnJudgement;
|
||||||
|
|
||||||
public TObject HitObject;
|
public TObject HitObject;
|
||||||
|
|
||||||
@ -108,7 +109,7 @@ namespace osu.Game.Modes.Objects.Drawables
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
OnJudgement?.Invoke(this, Judgement);
|
OnJudgement?.Invoke(this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -141,44 +142,17 @@ namespace osu.Game.Modes.Objects.Drawables
|
|||||||
Sample = audio.Sample.Get($@"Gameplay/{sampleSet.ToString().ToLower()}-hit{type.ToString().ToLower()}");
|
Sample = audio.Sample.Get($@"Gameplay/{sampleSet.ToString().ToLower()}-hit{type.ToString().ToLower()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DrawableHitObject<TObject>> nestedHitObjects;
|
private List<DrawableHitObject<TObject, TJudgement>> nestedHitObjects;
|
||||||
|
|
||||||
protected IEnumerable<DrawableHitObject<TObject>> NestedHitObjects => nestedHitObjects;
|
protected IEnumerable<DrawableHitObject<TObject, TJudgement>> NestedHitObjects => nestedHitObjects;
|
||||||
|
|
||||||
protected void AddNested(DrawableHitObject<TObject> h)
|
protected void AddNested(DrawableHitObject<TObject, TJudgement> h)
|
||||||
{
|
{
|
||||||
if (nestedHitObjects == null)
|
if (nestedHitObjects == null)
|
||||||
nestedHitObjects = new List<DrawableHitObject<TObject>>();
|
nestedHitObjects = new List<DrawableHitObject<TObject, TJudgement>>();
|
||||||
|
|
||||||
h.OnJudgement += (d, j) => { OnJudgement?.Invoke(d, j); } ;
|
h.OnJudgement += d => OnJudgement?.Invoke(d);
|
||||||
nestedHitObjects.Add(h);
|
nestedHitObjects.Add(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ArmedState
|
|
||||||
{
|
|
||||||
Idle,
|
|
||||||
Hit,
|
|
||||||
Miss
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PositionalJudgementInfo : JudgementInfo
|
|
||||||
{
|
|
||||||
public Vector2 PositionOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class JudgementInfo
|
|
||||||
{
|
|
||||||
public ulong? ComboAtHit;
|
|
||||||
public HitResult? Result;
|
|
||||||
public double TimeOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum HitResult
|
|
||||||
{
|
|
||||||
[Description(@"Miss")]
|
|
||||||
Miss,
|
|
||||||
[Description(@"Hit")]
|
|
||||||
Hit,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
15
osu.Game/Modes/Objects/Drawables/HitResult.cs
Normal file
15
osu.Game/Modes/Objects/Drawables/HitResult.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Objects.Drawables
|
||||||
|
{
|
||||||
|
public enum HitResult
|
||||||
|
{
|
||||||
|
[Description(@"Miss")]
|
||||||
|
Miss,
|
||||||
|
[Description(@"Hit")]
|
||||||
|
Hit,
|
||||||
|
}
|
||||||
|
}
|
@ -2,9 +2,9 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using osu.Game.Modes.Judgements;
|
||||||
|
|
||||||
namespace osu.Game.Modes
|
namespace osu.Game.Modes
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Modes.Judgements;
|
||||||
using osu.Game.Modes.Mods;
|
using osu.Game.Modes.Mods;
|
||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
@ -16,15 +17,39 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace osu.Game.Modes.UI
|
namespace osu.Game.Modes.UI
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Base HitRenderer. Doesn't hold objects.
|
||||||
|
/// <para>
|
||||||
|
/// Should not be derived - derive <see cref="HitRenderer{TObject, TJudgement}"/> instead.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
public abstract class HitRenderer : Container
|
public abstract class HitRenderer : Container
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The event that's fired when a hit object is judged.
|
||||||
|
/// </summary>
|
||||||
public event Action<JudgementInfo> OnJudgement;
|
public event Action<JudgementInfo> OnJudgement;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The event that's fired when all hit objects have been judged.
|
||||||
|
/// </summary>
|
||||||
public event Action OnAllJudged;
|
public event Action OnAllJudged;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The input manager for this HitRenderer.
|
||||||
|
/// </summary>
|
||||||
internal readonly PlayerInputManager InputManager = new PlayerInputManager();
|
internal readonly PlayerInputManager InputManager = new PlayerInputManager();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The key conversion input manager for this HitRenderer.
|
||||||
|
/// </summary>
|
||||||
protected readonly KeyConversionInputManager KeyConversionInputManager;
|
protected readonly KeyConversionInputManager KeyConversionInputManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether all the HitObjects have been judged.
|
||||||
|
/// </summary>
|
||||||
|
protected abstract bool AllObjectsJudged { get; }
|
||||||
|
|
||||||
protected HitRenderer()
|
protected HitRenderer()
|
||||||
{
|
{
|
||||||
KeyConversionInputManager = CreateKeyConversionInputManager();
|
KeyConversionInputManager = CreateKeyConversionInputManager();
|
||||||
@ -32,10 +57,9 @@ namespace osu.Game.Modes.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether all the HitObjects have been judged.
|
/// Triggers a judgement for further processing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected abstract bool AllObjectsJudged { get; }
|
/// <param name="j">The judgement to trigger.</param>
|
||||||
|
|
||||||
protected void TriggerOnJudgement(JudgementInfo j)
|
protected void TriggerOnJudgement(JudgementInfo j)
|
||||||
{
|
{
|
||||||
OnJudgement?.Invoke(j);
|
OnJudgement?.Invoke(j);
|
||||||
@ -44,21 +68,29 @@ namespace osu.Game.Modes.UI
|
|||||||
OnAllJudged?.Invoke();
|
OnAllJudged?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a key conversion input manager.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The input manager.</returns>
|
||||||
protected virtual KeyConversionInputManager CreateKeyConversionInputManager() => new KeyConversionInputManager();
|
protected virtual KeyConversionInputManager CreateKeyConversionInputManager() => new KeyConversionInputManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// HitRenderer that applies conversion to Beatmaps. Does not contain a Playfield
|
||||||
|
/// and does not load drawable hit objects.
|
||||||
|
/// <para>
|
||||||
|
/// Should not be derived - derive <see cref="HitRenderer{TObject, TJudgement}"/> instead.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TObject">The type of HitObject contained by this HitRenderer.</typeparam>
|
||||||
public abstract class HitRenderer<TObject> : HitRenderer
|
public abstract class HitRenderer<TObject> : HitRenderer
|
||||||
where TObject : HitObject
|
where TObject : HitObject
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The Beatmap
|
||||||
|
/// </summary>
|
||||||
public Beatmap<TObject> Beatmap;
|
public Beatmap<TObject> Beatmap;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
|
||||||
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result.HasValue);
|
|
||||||
|
|
||||||
protected Playfield<TObject> Playfield;
|
|
||||||
|
|
||||||
private Container content;
|
|
||||||
|
|
||||||
protected HitRenderer(WorkingBeatmap beatmap)
|
protected HitRenderer(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
Debug.Assert(beatmap != null, "HitRenderer initialized with a null beatmap.");
|
Debug.Assert(beatmap != null, "HitRenderer initialized with a null beatmap.");
|
||||||
@ -71,7 +103,57 @@ namespace osu.Game.Modes.UI
|
|||||||
applyMods(beatmap.Mods.Value);
|
applyMods(beatmap.Mods.Value);
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Applies the active mods to this HitRenderer.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mods"></param>
|
||||||
|
private void applyMods(IEnumerable<Mod> mods)
|
||||||
|
{
|
||||||
|
if (mods == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var mod in mods.OfType<IApplicableMod<TObject>>())
|
||||||
|
mod.Apply(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a converter to convert Beatmap to a specific mode.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The Beatmap converter.</returns>
|
||||||
|
protected abstract IBeatmapConverter<TObject> CreateBeatmapConverter();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a processor to perform post-processing operations
|
||||||
|
/// on HitObjects in converted Beatmaps.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The Beatmap processor.</returns>
|
||||||
|
protected abstract IBeatmapProcessor<TObject> CreateBeatmapProcessor();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A derivable HitRenderer that manages the Playfield and HitObjects.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TObject">The type of HitObject contained by this HitRenderer.</typeparam>
|
||||||
|
/// <typeparam name="TJudgement">The type of Judgement of DrawableHitObjects contained by this HitRenderer.</typeparam>
|
||||||
|
public abstract class HitRenderer<TObject, TJudgement> : HitRenderer<TObject>
|
||||||
|
where TObject : HitObject
|
||||||
|
where TJudgement : JudgementInfo
|
||||||
|
{
|
||||||
|
protected override Container<Drawable> Content => content;
|
||||||
|
protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result.HasValue);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The playfield.
|
||||||
|
/// </summary>
|
||||||
|
protected Playfield<TObject, TJudgement> Playfield;
|
||||||
|
|
||||||
|
private Container content;
|
||||||
|
|
||||||
|
protected HitRenderer(WorkingBeatmap beatmap)
|
||||||
|
: base(beatmap)
|
||||||
|
{
|
||||||
KeyConversionInputManager.Add(Playfield = CreatePlayfield());
|
KeyConversionInputManager.Add(Playfield = CreatePlayfield());
|
||||||
|
|
||||||
InputManager.Add(content = new Container
|
InputManager.Add(content = new Container
|
||||||
@ -96,7 +178,7 @@ namespace osu.Game.Modes.UI
|
|||||||
{
|
{
|
||||||
foreach (TObject h in Beatmap.HitObjects)
|
foreach (TObject h in Beatmap.HitObjects)
|
||||||
{
|
{
|
||||||
DrawableHitObject<TObject> drawableObject = GetVisualRepresentation(h);
|
var drawableObject = GetVisualRepresentation(h);
|
||||||
|
|
||||||
if (drawableObject == null)
|
if (drawableObject == null)
|
||||||
continue;
|
continue;
|
||||||
@ -109,21 +191,27 @@ namespace osu.Game.Modes.UI
|
|||||||
Playfield.PostProcess();
|
Playfield.PostProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyMods(IEnumerable<Mod> mods)
|
/// <summary>
|
||||||
|
/// Triggered when an object's Judgement is updated.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="judgedObject">The object that Judgement has been updated for.</param>
|
||||||
|
private void onJudgement(DrawableHitObject<TObject, TJudgement> judgedObject)
|
||||||
{
|
{
|
||||||
if (mods == null)
|
TriggerOnJudgement(judgedObject.Judgement);
|
||||||
return;
|
Playfield.OnJudgement(judgedObject);
|
||||||
|
|
||||||
foreach (var mod in mods.OfType<IApplicableMod<TObject>>())
|
|
||||||
mod.Apply(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onJudgement(DrawableHitObject<TObject> o, JudgementInfo j) => TriggerOnJudgement(j);
|
/// <summary>
|
||||||
|
/// Creates a DrawableHitObject from a HitObject.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="h">The HitObject to make drawable.</param>
|
||||||
|
/// <returns>The DrawableHitObject.</returns>
|
||||||
|
protected abstract DrawableHitObject<TObject, TJudgement> GetVisualRepresentation(TObject h);
|
||||||
|
|
||||||
protected abstract DrawableHitObject<TObject> GetVisualRepresentation(TObject h);
|
/// <summary>
|
||||||
protected abstract Playfield<TObject> CreatePlayfield();
|
/// Creates a Playfield.
|
||||||
|
/// </summary>
|
||||||
protected abstract IBeatmapConverter<TObject> CreateBeatmapConverter();
|
/// <returns>The Playfield.</returns>
|
||||||
protected abstract IBeatmapProcessor<TObject> CreateBeatmapProcessor();
|
protected abstract Playfield<TObject, TJudgement> CreatePlayfield();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,22 +6,23 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Game.Modes.Judgements;
|
||||||
|
|
||||||
namespace osu.Game.Modes.UI
|
namespace osu.Game.Modes.UI
|
||||||
{
|
{
|
||||||
public abstract class Playfield<T> : Container
|
public abstract class Playfield<TObject, TJudgement> : Container
|
||||||
where T : HitObject
|
where TObject : HitObject
|
||||||
|
where TJudgement : JudgementInfo
|
||||||
{
|
{
|
||||||
public HitObjectContainer<DrawableHitObject<T>> HitObjects;
|
/// <summary>
|
||||||
|
/// The HitObjects contained in this Playfield.
|
||||||
public virtual void Add(DrawableHitObject<T> h) => HitObjects.Add(h);
|
/// </summary>
|
||||||
|
public HitObjectContainer<DrawableHitObject<TObject, TJudgement>> HitObjects;
|
||||||
|
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||||
|
|
||||||
internal Container<Drawable> ScaledContent;
|
internal Container<Drawable> ScaledContent;
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
private Container<Drawable> content;
|
private Container<Drawable> content;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -43,15 +44,28 @@ namespace osu.Game.Modes.UI
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(HitObjects = new HitObjectContainer<DrawableHitObject<T>>
|
Add(HitObjects = new HitObjectContainer<DrawableHitObject<TObject, TJudgement>>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void PostProcess()
|
/// <summary>
|
||||||
{
|
/// Performs post-processing tasks (if any) after all DrawableHitObjects are loaded into this Playfield.
|
||||||
}
|
/// </summary>
|
||||||
|
public virtual void PostProcess() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a DrawableHitObject to this Playfield.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="h">The DrawableHitObject to add.</param>
|
||||||
|
public virtual void Add(DrawableHitObject<TObject, TJudgement> h) => HitObjects.Add(h);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Triggered when an object's Judgement is updated.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="judgedObject">The object that Judgement has been updated for.</param>
|
||||||
|
public virtual void OnJudgement(DrawableHitObject<TObject, TJudgement> judgedObject) { }
|
||||||
|
|
||||||
private class ScaledContainer : Container
|
private class ScaledContainer : Container
|
||||||
{
|
{
|
||||||
|
@ -94,6 +94,8 @@
|
|||||||
<Compile Include="Modes\LegacyReplay.cs" />
|
<Compile Include="Modes\LegacyReplay.cs" />
|
||||||
<Compile Include="Modes\Mods\IApplicableMod.cs" />
|
<Compile Include="Modes\Mods\IApplicableMod.cs" />
|
||||||
<Compile Include="Modes\Mods\ModType.cs" />
|
<Compile Include="Modes\Mods\ModType.cs" />
|
||||||
|
<Compile Include="Modes\Objects\Drawables\ArmedState.cs" />
|
||||||
|
<Compile Include="Modes\Objects\Drawables\HitResult.cs" />
|
||||||
<Compile Include="Modes\Objects\BezierApproximator.cs" />
|
<Compile Include="Modes\Objects\BezierApproximator.cs" />
|
||||||
<Compile Include="Modes\Objects\CircularArcApproximator.cs" />
|
<Compile Include="Modes\Objects\CircularArcApproximator.cs" />
|
||||||
<Compile Include="Modes\Objects\CurvedHitObject.cs" />
|
<Compile Include="Modes\Objects\CurvedHitObject.cs" />
|
||||||
@ -105,6 +107,7 @@
|
|||||||
<Compile Include="Modes\Objects\SliderCurve.cs" />
|
<Compile Include="Modes\Objects\SliderCurve.cs" />
|
||||||
<Compile Include="Modes\Objects\Types\CurveType.cs" />
|
<Compile Include="Modes\Objects\Types\CurveType.cs" />
|
||||||
<Compile Include="Modes\Objects\Drawables\IDrawableHitObjectWithProxiedApproach.cs" />
|
<Compile Include="Modes\Objects\Drawables\IDrawableHitObjectWithProxiedApproach.cs" />
|
||||||
|
<Compile Include="Modes\Judgements\JudgementInfo.cs" />
|
||||||
<Compile Include="Modes\Objects\HitObjectParser.cs" />
|
<Compile Include="Modes\Objects\HitObjectParser.cs" />
|
||||||
<Compile Include="Modes\Objects\Types\IHasCombo.cs" />
|
<Compile Include="Modes\Objects\Types\IHasCombo.cs" />
|
||||||
<Compile Include="Modes\Objects\Types\IHasEndTime.cs" />
|
<Compile Include="Modes\Objects\Types\IHasEndTime.cs" />
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user