mirror of
https://github.com/ppy/osu.git
synced 2024-09-22 03:27:24 +08:00
Better updateGlow methods.
This commit is contained in:
parent
590a34dc28
commit
3b5e847a31
@ -70,6 +70,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.TopCentre
|
Origin = Anchor.TopCentre
|
||||||
},
|
},
|
||||||
|
// The hit object itself cannot be used for the glow because the tail overshoots it
|
||||||
|
// So a specialized container that is updated to contain the tail height is used
|
||||||
glowContainer = new Container
|
glowContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -98,6 +100,13 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
AddNested(tail);
|
AddNested(tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
updateGlow();
|
||||||
|
}
|
||||||
|
|
||||||
public override Color4 AccentColour
|
public override Color4 AccentColour
|
||||||
{
|
{
|
||||||
get { return base.AccentColour; }
|
get { return base.AccentColour; }
|
||||||
@ -112,9 +121,25 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
bodyPiece.AccentColour = value;
|
bodyPiece.AccentColour = value;
|
||||||
head.AccentColour = value;
|
head.AccentColour = value;
|
||||||
tail.AccentColour = value;
|
tail.AccentColour = value;
|
||||||
|
|
||||||
|
updateGlow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateGlow()
|
||||||
|
{
|
||||||
|
if (!IsLoaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
glowContainer.EdgeEffect = new EdgeEffectParameters
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Glow,
|
||||||
|
Colour = AccentColour.Opacity(0.5f),
|
||||||
|
Radius = 10,
|
||||||
|
Hollow = true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
protected override void UpdateState(ArmedState state)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -123,17 +148,13 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
|
// Make the body piece not lie under the head note
|
||||||
bodyPiece.Y = head.Height;
|
bodyPiece.Y = head.Height;
|
||||||
bodyPiece.Height = DrawHeight - head.Height;
|
bodyPiece.Height = DrawHeight - head.Height;
|
||||||
|
|
||||||
|
// Make the glowContainer "contain" the height of the tail note, keeping in mind
|
||||||
|
// that the tail note overshoots the height of this hit object
|
||||||
glowContainer.Height = DrawHeight + tail.Height;
|
glowContainer.Height = DrawHeight + tail.Height;
|
||||||
glowContainer.EdgeEffect = new EdgeEffectParameters
|
|
||||||
{
|
|
||||||
Type = EdgeEffectType.Glow,
|
|
||||||
Colour = AccentColour.Opacity(0.5f),
|
|
||||||
Radius = 10,
|
|
||||||
Hollow = true,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnPressed(ManiaAction action)
|
public bool OnPressed(ManiaAction action)
|
||||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
UpdateGlow();
|
updateGlow();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Color4 AccentColour
|
public override Color4 AccentColour
|
||||||
@ -57,10 +57,27 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
|
|
||||||
headPiece.AccentColour = value;
|
headPiece.AccentColour = value;
|
||||||
|
|
||||||
UpdateGlow();
|
updateGlow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateGlow()
|
||||||
|
{
|
||||||
|
if (!IsLoaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!HasOwnGlow)
|
||||||
|
return;
|
||||||
|
|
||||||
|
EdgeEffect = new EdgeEffectParameters
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Glow,
|
||||||
|
Colour = AccentColour.Opacity(0.5f),
|
||||||
|
Radius = 10,
|
||||||
|
Hollow = true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
protected override void CheckJudgement(bool userTriggered)
|
protected override void CheckJudgement(bool userTriggered)
|
||||||
{
|
{
|
||||||
if (!userTriggered)
|
if (!userTriggered)
|
||||||
@ -96,23 +113,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void UpdateGlow()
|
|
||||||
{
|
|
||||||
if (!IsLoaded)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!HasOwnGlow)
|
|
||||||
return;
|
|
||||||
|
|
||||||
EdgeEffect = new EdgeEffectParameters
|
|
||||||
{
|
|
||||||
Type = EdgeEffectType.Glow,
|
|
||||||
Colour = AccentColour.Opacity(0.5f),
|
|
||||||
Radius = 10,
|
|
||||||
Hollow = true
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool OnPressed(ManiaAction action)
|
public virtual bool OnPressed(ManiaAction action)
|
||||||
{
|
{
|
||||||
if (action != Action)
|
if (action != Action)
|
||||||
|
Loading…
Reference in New Issue
Block a user