mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 18:07:25 +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)
|
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
|
// 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));
|
=> 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;
|
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]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IScrollingInfo scrollingInfo)
|
private void load(IScrollingInfo scrollingInfo)
|
||||||
{
|
{
|
||||||
InternalChild = directionContainer = new Container
|
InternalChild = directionContainer = new ChildContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = Stage.HIT_TARGET_POSITION,
|
Height = Stage.HIT_TARGET_POSITION,
|
||||||
@ -69,7 +90,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
|||||||
AlwaysPresent = true
|
AlwaysPresent = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user