1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:07:25 +08:00

Add outline to selected fruit

This commit is contained in:
ekrctb 2021-06-22 12:04:24 +09:00
parent c28cd5dd75
commit 0078d7dc18
2 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,39 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Skinning.Default;
using osu.Game.Rulesets.UI.Scrolling;
using osuTK;
namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
{
public class FruitOutline : CompositeDrawable
{
public FruitOutline()
{
Anchor = Anchor.BottomLeft;
Origin = Anchor.Centre;
Size = new Vector2(2 * CatchHitObject.OBJECT_RADIUS);
// TODO: use skinned component?
InternalChild = new BorderPiece();
}
[BackgroundDependencyLoader]
private void load(OsuColour osuColour)
{
Colour = osuColour.Yellow;
}
public void UpdateFrom(ScrollingHitObjectContainer hitObjectContainer, CatchHitObject hitObject)
{
X = hitObject.EffectiveX;
Y = hitObjectContainer.PositionAtTime(hitObject.StartTime);
Scale = new Vector2(hitObject.Scale);
}
}
}

View File

@ -1,15 +1,27 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Catch.Edit.Blueprints.Components;
using osu.Game.Rulesets.Catch.Objects;
namespace osu.Game.Rulesets.Catch.Edit.Blueprints
{
public class FruitSelectionBlueprint : CatchSelectionBlueprint<Fruit>
{
private readonly FruitOutline outline;
public FruitSelectionBlueprint(Fruit hitObject)
: base(hitObject)
{
InternalChild = outline = new FruitOutline();
}
protected override void Update()
{
base.Update();
if (IsSelected)
outline.UpdateFrom(HitObjectContainer, HitObject);
}
}
}