mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
DI the scrolling info rather than pass by ctor
This commit is contained in:
@ -1,40 +1,15 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
{
|
||||
public abstract class DrawableManiaHitObject : DrawableHitObject<ManiaHitObject>
|
||||
{
|
||||
protected DrawableManiaHitObject(ManiaHitObject hitObject)
|
||||
: base(hitObject)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the scrolling direction.
|
||||
/// </summary>
|
||||
public virtual ScrollingDirection Direction
|
||||
{
|
||||
set
|
||||
{
|
||||
Anchor = value == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
||||
Origin = Anchor;
|
||||
|
||||
if (!HasNestedHitObjects)
|
||||
return;
|
||||
|
||||
foreach (var obj in NestedHitObjects.OfType<DrawableManiaHitObject>())
|
||||
obj.Direction = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class DrawableManiaHitObject<TObject> : DrawableManiaHitObject
|
||||
public abstract class DrawableManiaHitObject<TObject> : DrawableHitObject<ManiaHitObject>
|
||||
where TObject : ManiaHitObject
|
||||
{
|
||||
/// <summary>
|
||||
@ -47,15 +22,19 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
protected DrawableManiaHitObject(TObject hitObject, ManiaAction? action = null)
|
||||
: base(hitObject)
|
||||
{
|
||||
Anchor = Anchor.TopCentre;
|
||||
Origin = Anchor.TopCentre;
|
||||
|
||||
HitObject = hitObject;
|
||||
|
||||
if (action != null)
|
||||
Action = action.Value;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ScrollingInfo scrollingInfo)
|
||||
{
|
||||
Anchor = scrollingInfo.Direction == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
||||
Origin = Anchor;
|
||||
}
|
||||
|
||||
protected override void UpdateState(ArmedState state)
|
||||
{
|
||||
switch (state)
|
||||
|
Reference in New Issue
Block a user