mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 20:33:09 +08:00
Made QuarterCircle property loading less clapped
This commit is contained in:
parent
927fccb7be
commit
f2ec0b2176
@ -45,6 +45,23 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuColour colours { get; set; } = null!;
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
|
private class DrumSegmentProperties
|
||||||
|
{
|
||||||
|
public TaikoAction TaikoAction { get; set; }
|
||||||
|
public Color4 Color { get; set; }
|
||||||
|
|
||||||
|
public DrumSegmentProperties(TaikoAction taikoAction, Color4 color)
|
||||||
|
{
|
||||||
|
TaikoAction = taikoAction;
|
||||||
|
Color = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private DrumSegmentProperties getDrumSegmentProperties(int drumSegment)
|
||||||
|
{
|
||||||
|
var taikoAction = getTaikoActionFromDrumSegment(drumSegment);
|
||||||
|
return new DrumSegmentProperties(taikoAction, getColourFromTaikoAction(taikoAction));
|
||||||
|
}
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config)
|
private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config)
|
||||||
{
|
{
|
||||||
@ -82,27 +99,27 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
leftRim = new QuarterCircle(getTaikoActionFromDrumSegment(0), getColourFromTaikoAction(getTaikoActionFromDrumSegment(0)))
|
leftRim = new QuarterCircle(getDrumSegmentProperties(0))
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
X = -2,
|
X = -2,
|
||||||
},
|
},
|
||||||
leftCentre = new QuarterCircle(getTaikoActionFromDrumSegment(1), getColourFromTaikoAction(getTaikoActionFromDrumSegment(1)))
|
leftCentre = new QuarterCircle(getDrumSegmentProperties(1))
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
X = -2,
|
X = -2,
|
||||||
Scale = new Vector2(centre_region),
|
Scale = new Vector2(centre_region),
|
||||||
},
|
},
|
||||||
rightRim = new QuarterCircle(getTaikoActionFromDrumSegment(3), getColourFromTaikoAction(getTaikoActionFromDrumSegment(3)))
|
rightRim = new QuarterCircle(getDrumSegmentProperties(3))
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
X = 2,
|
X = 2,
|
||||||
Rotation = 90,
|
Rotation = 90,
|
||||||
},
|
},
|
||||||
rightCentre = new QuarterCircle(getTaikoActionFromDrumSegment(2), getColourFromTaikoAction(getTaikoActionFromDrumSegment(2)))
|
rightCentre = new QuarterCircle(getDrumSegmentProperties(2))
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
@ -236,13 +253,16 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos);
|
public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos);
|
||||||
|
|
||||||
public QuarterCircle(TaikoAction handledAction, Color4 colour)
|
public QuarterCircle(DrumSegmentProperties properties)
|
||||||
{
|
{
|
||||||
this.handledAction = handledAction;
|
handledAction = properties.TaikoAction;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
FillMode = FillMode.Fit;
|
FillMode = FillMode.Fit;
|
||||||
|
|
||||||
|
var colour = properties.Color;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -284,9 +304,11 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
overlay.FadeOut(1000, Easing.OutQuint);
|
overlay.FadeOut(1000, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadDrumSegmentProperties(TaikoAction handledAction, Color4 colour)
|
public void SetProperties(DrumSegmentProperties properties)
|
||||||
{
|
{
|
||||||
this.handledAction = handledAction;
|
handledAction = properties.TaikoAction;
|
||||||
|
|
||||||
|
var colour = properties.Color;
|
||||||
|
|
||||||
circle.Colour = colour.Multiply(1.4f).Darken(2.8f);
|
circle.Colour = colour.Multiply(1.4f).Darken(2.8f);
|
||||||
overlay.Colour = colour;
|
overlay.Colour = colour;
|
||||||
@ -295,10 +317,10 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
private void reloadTouchDrums(object _)
|
private void reloadTouchDrums(object _)
|
||||||
{
|
{
|
||||||
leftRim.ReloadDrumSegmentProperties(getTaikoActionFromDrumSegment(0), getColourFromTaikoAction(getTaikoActionFromDrumSegment(0)));
|
leftRim.SetProperties(getDrumSegmentProperties(0));
|
||||||
leftCentre.ReloadDrumSegmentProperties(getTaikoActionFromDrumSegment(1), getColourFromTaikoAction(getTaikoActionFromDrumSegment(1)));
|
leftCentre.SetProperties(getDrumSegmentProperties(1));
|
||||||
rightRim.ReloadDrumSegmentProperties(getTaikoActionFromDrumSegment(3), getColourFromTaikoAction(getTaikoActionFromDrumSegment(3)));
|
rightRim.SetProperties(getDrumSegmentProperties(3));
|
||||||
rightCentre.ReloadDrumSegmentProperties(getTaikoActionFromDrumSegment(2), getColourFromTaikoAction(getTaikoActionFromDrumSegment(2)));
|
rightCentre.SetProperties(getDrumSegmentProperties(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user