mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Basic implementation of hold notes (not finalized yet).
This commit is contained in:
parent
f945c636c2
commit
4ad3e3d64e
@ -12,6 +12,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
@ -21,19 +22,48 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
base.Reset();
|
base.Reset();
|
||||||
|
|
||||||
Add(new Container
|
Add(new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Width = 50,
|
Direction = FillDirection.Horizontal,
|
||||||
Children = new[]
|
Spacing = new Vector2(10, 0),
|
||||||
|
// Imagine that the containers containing the drawable notes are the "columns"
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new DrawableNote(new Note())
|
new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
AccentColour = Color4.Red
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = 50,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new DrawableNote(new Note())
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AccentColour = Color4.Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = 50,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new DrawableHoldNote(new HoldNote())
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AccentColour = Color4.Red,
|
||||||
|
Length = 0.4f
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -0,0 +1,72 @@
|
|||||||
|
// 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;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||||
|
{
|
||||||
|
public class DrawableHoldNote : DrawableManiaHitObject<HoldNote>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Length of this hold note, relative to its parent.
|
||||||
|
/// </summary>
|
||||||
|
public float Length;
|
||||||
|
|
||||||
|
private NotePiece headPiece;
|
||||||
|
private BodyPiece bodyPiece;
|
||||||
|
private NotePiece tailPiece;
|
||||||
|
|
||||||
|
public DrawableHoldNote(HoldNote hitObject)
|
||||||
|
: base(hitObject)
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
headPiece = new NotePiece
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre
|
||||||
|
},
|
||||||
|
bodyPiece = new BodyPiece
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
},
|
||||||
|
tailPiece = new NotePiece
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Color4 AccentColour
|
||||||
|
{
|
||||||
|
get { return AccentColour; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (base.AccentColour == value)
|
||||||
|
return;
|
||||||
|
base.AccentColour = value;
|
||||||
|
|
||||||
|
headPiece.AccentColour = value;
|
||||||
|
bodyPiece.AccentColour = value;
|
||||||
|
tailPiece.AccentColour = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
bodyPiece.Height = Parent.DrawSize.Y * Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateState(ArmedState state)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@
|
|||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets.Mania.Judgements;
|
using osu.Game.Rulesets.Mania.Judgements;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
|
||||||
@ -12,20 +13,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
public abstract class DrawableManiaHitObject<TObject> : DrawableHitObject<ManiaHitObject, ManiaJudgement>
|
public abstract class DrawableManiaHitObject<TObject> : DrawableHitObject<ManiaHitObject, ManiaJudgement>
|
||||||
where TObject : ManiaHitObject
|
where TObject : ManiaHitObject
|
||||||
{
|
{
|
||||||
public override Color4 AccentColour
|
|
||||||
{
|
|
||||||
get { return base.AccentColour; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
base.AccentColour = value;
|
|
||||||
UpdateAccent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public new TObject HitObject;
|
public new TObject HitObject;
|
||||||
|
|
||||||
|
private readonly Container glowContainer;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => noteFlow;
|
protected override Container<Drawable> Content => noteFlow;
|
||||||
private FlowContainer<Drawable> noteFlow;
|
private readonly FlowContainer<Drawable> noteFlow;
|
||||||
|
|
||||||
public DrawableManiaHitObject(TObject hitObject)
|
public DrawableManiaHitObject(TObject hitObject)
|
||||||
: base(hitObject)
|
: base(hitObject)
|
||||||
@ -35,18 +28,53 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
AddInternal(noteFlow = new FillFlowContainer<Drawable>
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
Name = "Main container",
|
glowContainer = new Container
|
||||||
Anchor = Anchor.BottomCentre,
|
{
|
||||||
Origin = Anchor.BottomCentre,
|
Anchor = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.X,
|
Origin = Anchor.Centre,
|
||||||
AutoSizeAxes = Axes.Y
|
RelativeSizeAxes = Axes.Both,
|
||||||
});
|
Masking = true,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
AlwaysPresent = true,
|
||||||
|
Alpha = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
noteFlow = new FillFlowContainer<Drawable>
|
||||||
|
{
|
||||||
|
Name = "Main container",
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Color4 AccentColour
|
||||||
|
{
|
||||||
|
get { return base.AccentColour; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (base.AccentColour == value)
|
||||||
|
return;
|
||||||
|
base.AccentColour = value;
|
||||||
|
|
||||||
|
glowContainer.EdgeEffect = new EdgeEffect
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Glow,
|
||||||
|
Radius = 5,
|
||||||
|
Colour = value
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override ManiaJudgement CreateJudgement() => new ManiaJudgement();
|
protected override ManiaJudgement CreateJudgement() => new ManiaJudgement();
|
||||||
|
|
||||||
protected virtual void UpdateAccent() { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,17 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
Add(headPiece = new NotePiece());
|
Add(headPiece = new NotePiece());
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
public override Color4 AccentColour
|
||||||
private void load()
|
|
||||||
{
|
{
|
||||||
headPiece.AccentColour = AccentColour;
|
get { return AccentColour; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (base.AccentColour == value)
|
||||||
|
return;
|
||||||
|
base.AccentColour = value;
|
||||||
|
|
||||||
|
headPiece.AccentColour = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
protected override void UpdateState(ArmedState state)
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
using System;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
// 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.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
|
||||||
|
{
|
||||||
|
internal class BodyPiece : Container, IHasAccentColour
|
||||||
|
{
|
||||||
|
private Box box;
|
||||||
|
|
||||||
|
public BodyPiece()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Masking = true;
|
||||||
|
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
box = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Alpha = 0.3f
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color4 accentColour;
|
||||||
|
public Color4 AccentColour
|
||||||
|
{
|
||||||
|
get { return accentColour; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (accentColour == value)
|
||||||
|
return;
|
||||||
|
accentColour = value;
|
||||||
|
|
||||||
|
box.Colour = accentColour;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -22,8 +22,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = head_height;
|
Height = head_height;
|
||||||
|
|
||||||
Masking = true;
|
|
||||||
|
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -52,13 +50,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
|
|||||||
accentColour = value;
|
accentColour = value;
|
||||||
|
|
||||||
colouredBox.Colour = AccentColour.Lighten(0.9f);
|
colouredBox.Colour = AccentColour.Lighten(0.9f);
|
||||||
|
|
||||||
EdgeEffect = new EdgeEffect
|
|
||||||
{
|
|
||||||
Type = EdgeEffectType.Glow,
|
|
||||||
Radius = 5,
|
|
||||||
Colour = AccentColour
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,10 @@
|
|||||||
<Compile Include="Judgements\HitWindows.cs" />
|
<Compile Include="Judgements\HitWindows.cs" />
|
||||||
<Compile Include="Judgements\ManiaJudgement.cs" />
|
<Compile Include="Judgements\ManiaJudgement.cs" />
|
||||||
<Compile Include="ManiaDifficultyCalculator.cs" />
|
<Compile Include="ManiaDifficultyCalculator.cs" />
|
||||||
|
<Compile Include="Objects\Drawables\DrawableHoldNote.cs" />
|
||||||
<Compile Include="Objects\Drawables\DrawableManiaHitObject.cs" />
|
<Compile Include="Objects\Drawables\DrawableManiaHitObject.cs" />
|
||||||
<Compile Include="Objects\Drawables\DrawableNote.cs" />
|
<Compile Include="Objects\Drawables\DrawableNote.cs" />
|
||||||
|
<Compile Include="Objects\Drawables\Pieces\BodyPiece.cs" />
|
||||||
<Compile Include="Objects\Drawables\Pieces\NotePiece.cs" />
|
<Compile Include="Objects\Drawables\Pieces\NotePiece.cs" />
|
||||||
<Compile Include="Objects\Types\IHasColumn.cs" />
|
<Compile Include="Objects\Types\IHasColumn.cs" />
|
||||||
<Compile Include="Scoring\ManiaScoreProcessor.cs" />
|
<Compile Include="Scoring\ManiaScoreProcessor.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user