mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:02:55 +08:00
Make DrawableHitObjects have generic JudgementInfos.
This commit is contained in:
parent
1c87d998a6
commit
36e8618370
@ -123,7 +123,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
private int depth;
|
private int depth;
|
||||||
|
|
||||||
private void add(DrawableHitObject h)
|
private void add(DrawableHitObject<OsuJudgementInfo> h)
|
||||||
{
|
{
|
||||||
h.Anchor = Anchor.Centre;
|
h.Anchor = Anchor.Centre;
|
||||||
h.Depth = depth++;
|
h.Depth = depth++;
|
||||||
|
13
osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs
Normal file
13
osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using osu.Game.Modes.Judgements;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
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)
|
||||||
@ -18,8 +19,8 @@ namespace osu.Game.Modes.Catch.UI
|
|||||||
|
|
||||||
protected override IBeatmapConverter<CatchBaseHit> CreateBeatmapConverter() => new CatchBeatmapConverter();
|
protected override IBeatmapConverter<CatchBaseHit> CreateBeatmapConverter() => new CatchBeatmapConverter();
|
||||||
|
|
||||||
protected override Playfield<CatchBaseHit> CreatePlayfield() => new CatchPlayfield();
|
protected override Playfield<CatchBaseHit, CatchJudgementInfo> CreatePlayfield() => new CatchPlayfield();
|
||||||
|
|
||||||
protected override DrawableHitObject<CatchBaseHit> GetVisualRepresentation(CatchBaseHit h) => null;// new DrawableFruit(h);
|
protected override DrawableHitObject<CatchBaseHit, CatchJudgementInfo> GetVisualRepresentation(CatchBaseHit h) => null;// new DrawableFruit(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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()
|
||||||
{
|
{
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Beatmaps\CatchBeatmapConverter.cs" />
|
<Compile Include="Beatmaps\CatchBeatmapConverter.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" />
|
||||||
|
13
osu.Game.Modes.Mania/Judgements/ManiaJudgementInfo.cs
Normal file
13
osu.Game.Modes.Mania/Judgements/ManiaJudgementInfo.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using osu.Game.Modes.Judgements;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
@ -21,9 +22,9 @@ namespace osu.Game.Modes.Mania.UI
|
|||||||
|
|
||||||
protected override IBeatmapConverter<ManiaBaseHit> CreateBeatmapConverter() => new ManiaBeatmapConverter();
|
protected override IBeatmapConverter<ManiaBaseHit> CreateBeatmapConverter() => new ManiaBeatmapConverter();
|
||||||
|
|
||||||
protected override Playfield<ManiaBaseHit> CreatePlayfield() => new ManiaPlayfield(columns);
|
protected override Playfield<ManiaBaseHit, ManiaJudgementInfo> CreatePlayfield() => new ManiaPlayfield(columns);
|
||||||
|
|
||||||
protected override DrawableHitObject<ManiaBaseHit> GetVisualRepresentation(ManiaBaseHit h)
|
protected override DrawableHitObject<ManiaBaseHit, ManiaJudgementInfo> GetVisualRepresentation(ManiaBaseHit h)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
//return new DrawableNote(h)
|
//return new DrawableNote(h)
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Beatmaps\ManiaBeatmapConverter.cs" />
|
<Compile Include="Beatmaps\ManiaBeatmapConverter.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" />
|
||||||
|
@ -7,7 +7,7 @@ using osu.Game.Modes.Objects.Drawables;
|
|||||||
|
|
||||||
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;
|
||||||
@ -18,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)
|
||||||
{
|
{
|
||||||
|
@ -27,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)
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,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)
|
||||||
@ -20,11 +20,11 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
|
|
||||||
protected override IBeatmapConverter<OsuHitObject> CreateBeatmapConverter() => new OsuBeatmapConverter();
|
protected override IBeatmapConverter<OsuHitObject> CreateBeatmapConverter() => new OsuBeatmapConverter();
|
||||||
|
|
||||||
protected override Playfield<OsuHitObject> CreatePlayfield() => new OsuPlayfield();
|
protected override Playfield<OsuHitObject, OsuJudgementInfo> 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)
|
||||||
|
@ -13,10 +13,11 @@ using System.Linq;
|
|||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Modes.Judgements;
|
using osu.Game.Modes.Judgements;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using System;
|
||||||
|
|
||||||
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;
|
||||||
@ -66,16 +67,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);
|
||||||
}
|
}
|
||||||
@ -87,9 +85,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);
|
||||||
}
|
}
|
||||||
|
13
osu.Game.Modes.Taiko/Judgements/TaikoJudgementInfo.cs
Normal file
13
osu.Game.Modes.Taiko/Judgements/TaikoJudgementInfo.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using osu.Game.Modes.Judgements;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
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)
|
||||||
@ -18,8 +19,8 @@ namespace osu.Game.Modes.Taiko.UI
|
|||||||
|
|
||||||
protected override IBeatmapConverter<TaikoBaseHit> CreateBeatmapConverter() => new TaikoBeatmapConverter();
|
protected override IBeatmapConverter<TaikoBaseHit> CreateBeatmapConverter() => new TaikoBeatmapConverter();
|
||||||
|
|
||||||
protected override Playfield<TaikoBaseHit> CreatePlayfield() => new TaikoPlayfield();
|
protected override Playfield<TaikoBaseHit, TaikoJudgementInfo> CreatePlayfield() => new TaikoPlayfield();
|
||||||
|
|
||||||
protected override DrawableHitObject<TaikoBaseHit> GetVisualRepresentation(TaikoBaseHit h) => null;// new DrawableTaikoHit(h);
|
protected override DrawableHitObject<TaikoBaseHit, TaikoJudgementInfo> GetVisualRepresentation(TaikoBaseHit h) => null;// new DrawableTaikoHit(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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()
|
||||||
{
|
{
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Beatmaps\TaikoBeatmapConverter.cs" />
|
<Compile Include="Beatmaps\TaikoBeatmapConverter.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" />
|
||||||
|
@ -14,11 +14,16 @@ using Container = osu.Framework.Graphics.Containers.Container;
|
|||||||
|
|
||||||
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 JudgementInfo Judgement;
|
public override bool HandleInput => Interactive;
|
||||||
|
|
||||||
protected abstract JudgementInfo CreateJudgementInfo();
|
public bool Interactive = true;
|
||||||
|
|
||||||
|
public TJudgement Judgement;
|
||||||
|
|
||||||
|
protected abstract TJudgement CreateJudgementInfo();
|
||||||
|
|
||||||
protected abstract void UpdateState(ArmedState state);
|
protected abstract void UpdateState(ArmedState state);
|
||||||
|
|
||||||
@ -63,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;
|
||||||
|
|
||||||
@ -101,7 +107,7 @@ namespace osu.Game.Modes.Objects.Drawables
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
OnJudgement?.Invoke(this, Judgement);
|
OnJudgement?.Invoke(this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -134,16 +140,16 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,13 +52,6 @@ namespace osu.Game.Modes.UI
|
|||||||
{
|
{
|
||||||
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)
|
||||||
{
|
{
|
||||||
Beatmap = CreateBeatmapConverter().Convert(beatmap.Beatmap);
|
Beatmap = CreateBeatmapConverter().Convert(beatmap.Beatmap);
|
||||||
@ -66,7 +59,34 @@ namespace osu.Game.Modes.UI
|
|||||||
applyMods(beatmap.Mods.Value);
|
applyMods(beatmap.Mods.Value);
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyMods(IEnumerable<Mod> mods)
|
||||||
|
{
|
||||||
|
if (mods == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var mod in mods.OfType<IApplicableMod<TObject>>())
|
||||||
|
mod.Apply(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract IBeatmapConverter<TObject> CreateBeatmapConverter();
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
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
|
||||||
@ -91,7 +111,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;
|
||||||
@ -104,19 +124,13 @@ namespace osu.Game.Modes.UI
|
|||||||
Playfield.PostProcess();
|
Playfield.PostProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyMods(IEnumerable<Mod> mods)
|
private void onJudgement(DrawableHitObject<TObject, TJudgement> j)
|
||||||
{
|
{
|
||||||
if (mods == null)
|
TriggerOnJudgement(j.Judgement);
|
||||||
return;
|
Playfield.OnJudgement(j);
|
||||||
|
|
||||||
foreach (var mod in mods.OfType<IApplicableMod<TObject>>())
|
|
||||||
mod.Apply(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onJudgement(DrawableHitObject<TObject> o, JudgementInfo j) => TriggerOnJudgement(j);
|
protected abstract DrawableHitObject<TObject, TJudgement> GetVisualRepresentation(TObject h);
|
||||||
|
protected abstract Playfield<TObject, TJudgement> CreatePlayfield();
|
||||||
protected abstract DrawableHitObject<TObject> GetVisualRepresentation(TObject h);
|
|
||||||
protected abstract Playfield<TObject> CreatePlayfield();
|
|
||||||
protected abstract IBeatmapConverter<TObject> CreateBeatmapConverter();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,17 @@ 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;
|
public HitObjectContainer<DrawableHitObject<TObject, TJudgement>> HitObjects;
|
||||||
|
|
||||||
public virtual void Add(DrawableHitObject<T> h) => HitObjects.Add(h);
|
public virtual void Add(DrawableHitObject<TObject, TJudgement> h) => HitObjects.Add(h);
|
||||||
|
|
||||||
internal Container<Drawable> ScaledContent;
|
internal Container<Drawable> ScaledContent;
|
||||||
|
|
||||||
@ -43,7 +45,7 @@ namespace osu.Game.Modes.UI
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(HitObjects = new HitObjectContainer<DrawableHitObject<T>>
|
Add(HitObjects = new HitObjectContainer<DrawableHitObject<TObject, TJudgement>>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
});
|
});
|
||||||
@ -70,5 +72,7 @@ namespace osu.Game.Modes.UI
|
|||||||
{
|
{
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void OnJudgement(DrawableHitObject<TObject, TJudgement> judgedObject) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user