mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Load keyBindingContainer once on LoadComplete() & make touch area height to const
This commit is contained in:
parent
74b15ec30c
commit
b0d61a18b0
@ -28,6 +28,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
{
|
{
|
||||||
public const float COLUMN_WIDTH = 80;
|
public const float COLUMN_WIDTH = 80;
|
||||||
public const float SPECIAL_COLUMN_WIDTH = 70;
|
public const float SPECIAL_COLUMN_WIDTH = 70;
|
||||||
|
public const float TOUCH_AREA_HEIGHT = 100;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The index of this column as part of the whole playfield.
|
/// The index of this column as part of the whole playfield.
|
||||||
@ -44,60 +45,34 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
private readonly GameplaySampleTriggerSource sampleTriggerSource;
|
private readonly GameplaySampleTriggerSource sampleTriggerSource;
|
||||||
|
|
||||||
public class ColumnTouchInputArea : Container
|
public class ColumnTouchInputArea : Drawable
|
||||||
{
|
{
|
||||||
private Column column => (Column)Parent;
|
|
||||||
|
|
||||||
private Container hintContainer;
|
|
||||||
|
|
||||||
public ColumnTouchInputArea()
|
public ColumnTouchInputArea()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Anchor = Anchor.BottomCentre;
|
Anchor = Anchor.BottomCentre;
|
||||||
Origin = Anchor.BottomCentre;
|
Origin = Anchor.BottomCentre;
|
||||||
Height = 100;
|
Height = TOUCH_AREA_HEIGHT;
|
||||||
InternalChild = hintContainer = new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
BorderColour = Color4.Red,
|
|
||||||
BorderThickness = 5,
|
|
||||||
Masking = true,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Column column => (Column)Parent;
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
hintContainer.Delay(1000).FadeOutFromOne(500, Easing.OutSine);
|
keyBindingContainer = (ManiaInputManager.RulesetKeyBindingContainer)((ManiaInputManager)GetContainingInputManager()).KeyBindingContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ManiaInputManager.RulesetKeyBindingContainer keyBindingContainer { get; set; }
|
private ManiaInputManager.RulesetKeyBindingContainer keyBindingContainer { get; set; }
|
||||||
|
|
||||||
private ManiaInputManager.RulesetKeyBindingContainer getKeyBindingContainer()
|
|
||||||
{
|
|
||||||
return keyBindingContainer ??= (ManiaInputManager.RulesetKeyBindingContainer)((ManiaInputManager)GetContainingInputManager()).KeyBindingContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnTouchDown(TouchDownEvent e)
|
protected override bool OnTouchDown(TouchDownEvent e)
|
||||||
{
|
{
|
||||||
getKeyBindingContainer().TriggerPressed(column.Action.Value);
|
keyBindingContainer.TriggerPressed(column.Action.Value);
|
||||||
return base.OnTouchDown(e);
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
|
||||||
{
|
|
||||||
getKeyBindingContainer().TriggerPressed(column.Action.Value);
|
|
||||||
|
|
||||||
return base.OnMouseDown(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnMouseUp(MouseUpEvent e)
|
|
||||||
{
|
|
||||||
getKeyBindingContainer().TriggerReleased(column.Action.Value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnTouchUp(TouchUpEvent e)
|
protected override void OnTouchUp(TouchUpEvent e)
|
||||||
{
|
{
|
||||||
getKeyBindingContainer().TriggerReleased(column.Action.Value);
|
keyBindingContainer.TriggerReleased(column.Action.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user