mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +08:00
Trigger touch on click key area
This commit is contained in:
parent
59b4aea5f9
commit
62d6bb8c2e
@ -136,24 +136,6 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
{
|
||||
}
|
||||
|
||||
private ManiaInputManager.RulesetKeyBindingContainer rulesetKeyBindingContainer { get; set; }
|
||||
|
||||
private ManiaInputManager.RulesetKeyBindingContainer getRulesetKeyBindingContainer()
|
||||
{
|
||||
return rulesetKeyBindingContainer ??= ((ManiaInputManager)GetContainingInputManager()).GetKeyBindingContainer();
|
||||
}
|
||||
|
||||
protected override bool OnTouchDown(TouchDownEvent e)
|
||||
{
|
||||
getRulesetKeyBindingContainer().TriggerPressed(Action.Value);
|
||||
return base.OnTouchDown(e);
|
||||
}
|
||||
|
||||
protected override void OnTouchUp(TouchUpEvent e)
|
||||
{
|
||||
getRulesetKeyBindingContainer().TriggerReleased(Action.Value);
|
||||
}
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
|
||||
// This probably shouldn't exist as is, but the columns in the stage are separated by a 1px border
|
||||
=> DrawRectangle.Inflate(new Vector2(Stage.COLUMN_SPACING / 2, 0)).Contains(ToLocalSpace(screenSpacePos));
|
||||
|
@ -36,10 +36,31 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
public class ChildContainer : Container
|
||||
{
|
||||
private ManiaInputManager.RulesetKeyBindingContainer keyBindingContainer { get; set; }
|
||||
|
||||
private ManiaInputManager.RulesetKeyBindingContainer getKeyBindingContainer()
|
||||
{
|
||||
return keyBindingContainer ??= ((ManiaInputManager)GetContainingInputManager()).GetKeyBindingContainer();
|
||||
}
|
||||
|
||||
protected override bool OnTouchDown(TouchDownEvent e)
|
||||
{
|
||||
getKeyBindingContainer().TriggerPressed(((DefaultKeyArea)Parent).column.Action.Value);
|
||||
return base.OnTouchDown(e);
|
||||
}
|
||||
|
||||
protected override void OnTouchUp(TouchUpEvent e)
|
||||
{
|
||||
getKeyBindingContainer().TriggerReleased(((DefaultKeyArea)Parent).column.Action.Value);
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IScrollingInfo scrollingInfo)
|
||||
{
|
||||
InternalChild = directionContainer = new Container
|
||||
InternalChild = directionContainer = new ChildContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = Stage.HIT_TARGET_POSITION,
|
||||
@ -69,7 +90,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
||||
AlwaysPresent = true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user