mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Add first pass design
This commit is contained in:
@ -20,23 +20,35 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DrumTouchInputArea : Container
|
public class DrumTouchInputArea : Container
|
||||||
{
|
{
|
||||||
private readonly Circle outerCircle;
|
|
||||||
|
|
||||||
private KeyBindingContainer<TaikoAction> keyBindingContainer = null!;
|
private KeyBindingContainer<TaikoAction> keyBindingContainer = null!;
|
||||||
|
|
||||||
private readonly Dictionary<object, TaikoAction> trackedActions = new Dictionary<object, TaikoAction>();
|
private readonly Dictionary<object, TaikoAction> trackedActions = new Dictionary<object, TaikoAction>();
|
||||||
|
|
||||||
private readonly Container mainContent;
|
private Container mainContent = null!;
|
||||||
|
|
||||||
private readonly Circle centreCircle;
|
private Circle centreCircle = null!;
|
||||||
|
private Circle outerCircle = null!;
|
||||||
|
|
||||||
public DrumTouchInputArea()
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(TaikoInputManager taikoInputManager, OsuColour colours)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
Debug.Assert(taikoInputManager.KeyBindingContainer != null);
|
||||||
Height = 300;
|
keyBindingContainer = taikoInputManager.KeyBindingContainer;
|
||||||
|
|
||||||
Masking = true;
|
// Container should handle input everywhere.
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 300,
|
||||||
|
Y = 20,
|
||||||
|
Masking = true,
|
||||||
|
FillMode = FillMode.Fit,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
mainContent = new Container
|
mainContent = new Container
|
||||||
@ -48,6 +60,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
outerCircle = new Circle
|
outerCircle = new Circle
|
||||||
{
|
{
|
||||||
FillMode = FillMode.Fit,
|
FillMode = FillMode.Fit,
|
||||||
|
Colour = colours.BlueDarker,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -55,35 +68,28 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
centreCircle = new Circle
|
centreCircle = new Circle
|
||||||
{
|
{
|
||||||
FillMode = FillMode.Fit,
|
FillMode = FillMode.Fit,
|
||||||
|
Colour = colours.YellowDark,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Scale = new Vector2(0.5f),
|
Scale = new Vector2(0.8f),
|
||||||
},
|
},
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
FillMode = FillMode.Fit,
|
Colour = colours.BlueDarker,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Anchor = Anchor.Centre,
|
Height = 0.9f,
|
||||||
Origin = Anchor.Centre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Colour = Color4.Black,
|
Origin = Anchor.BottomCentre,
|
||||||
Width = 3,
|
Width = 7,
|
||||||
|
},
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(TaikoInputManager taikoInputManager, OsuColour colours)
|
|
||||||
{
|
|
||||||
Debug.Assert(taikoInputManager.KeyBindingContainer != null);
|
|
||||||
|
|
||||||
keyBindingContainer = taikoInputManager.KeyBindingContainer;
|
|
||||||
|
|
||||||
outerCircle.Colour = colours.Gray0;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
{
|
{
|
||||||
// Hide whenever the keyboard is used.
|
// Hide whenever the keyboard is used.
|
||||||
@ -121,6 +127,19 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
TaikoAction taikoAction = getTaikoActionFromInput(position);
|
TaikoAction taikoAction = getTaikoActionFromInput(position);
|
||||||
|
|
||||||
|
switch (taikoAction)
|
||||||
|
{
|
||||||
|
case TaikoAction.LeftCentre:
|
||||||
|
case TaikoAction.RightCentre:
|
||||||
|
centreCircle.FlashColour(Color4.White, 2000, Easing.OutQuint);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TaikoAction.LeftRim:
|
||||||
|
case TaikoAction.RightRim:
|
||||||
|
outerCircle.FlashColour(Color4.White, 2000, Easing.OutQuint);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
trackedActions.Add(source, taikoAction);
|
trackedActions.Add(source, taikoAction);
|
||||||
keyBindingContainer.TriggerPressed(taikoAction);
|
keyBindingContainer.TriggerPressed(taikoAction);
|
||||||
}
|
}
|
||||||
@ -133,7 +152,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
private TaikoAction getTaikoActionFromInput(Vector2 inputPosition)
|
private TaikoAction getTaikoActionFromInput(Vector2 inputPosition)
|
||||||
{
|
{
|
||||||
bool centreHit = centreCircle.ScreenSpaceDrawQuad.Contains(inputPosition);
|
bool centreHit = centreCircle.Contains(inputPosition);
|
||||||
bool leftSide = ToLocalSpace(inputPosition).X < DrawWidth / 2;
|
bool leftSide = ToLocalSpace(inputPosition).X < DrawWidth / 2;
|
||||||
|
|
||||||
if (leftSide)
|
if (leftSide)
|
||||||
|
Reference in New Issue
Block a user