2021-08-03 09:05:43 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Input;
|
|
|
|
using osu.Framework.Input.Bindings;
|
2021-09-16 09:26:12 +00:00
|
|
|
using osu.Framework.Input.Events;
|
2021-08-03 09:05:43 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.OnlinePlay.Match.Components
|
|
|
|
{
|
|
|
|
public abstract class CreateRoomButton : PurpleTriangleButton, IKeyBindingHandler<PlatformAction>
|
|
|
|
{
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2021-08-09 07:17:51 +00:00
|
|
|
SpriteText.Font = SpriteText.Font.With(size: 14);
|
2021-08-03 09:05:43 +00:00
|
|
|
Triangles.TriangleScale = 1.5f;
|
|
|
|
}
|
|
|
|
|
2021-09-16 09:26:12 +00:00
|
|
|
public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
|
2021-08-03 09:05:43 +00:00
|
|
|
{
|
2021-11-18 03:35:47 +00:00
|
|
|
if (e.Repeat)
|
|
|
|
return false;
|
|
|
|
|
2021-08-03 09:05:43 +00:00
|
|
|
if (!Enabled.Value)
|
|
|
|
return false;
|
|
|
|
|
2021-09-16 09:26:12 +00:00
|
|
|
switch (e.Action)
|
2021-08-03 09:05:43 +00:00
|
|
|
{
|
|
|
|
case PlatformAction.DocumentNew:
|
|
|
|
// might as well also handle new tab. it's a bit of an undefined flow on this screen.
|
|
|
|
case PlatformAction.TabNew:
|
2021-08-05 04:22:59 +00:00
|
|
|
TriggerClick();
|
2021-08-03 09:05:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-09-16 09:26:12 +00:00
|
|
|
public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
|
2021-08-03 09:05:43 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|