1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 12:47:25 +08:00

Merge pull request #629 from peppy/general-fixes

General fixes
This commit is contained in:
Dan Balasescu 2017-04-14 01:05:26 +09:00 committed by GitHub
commit 9b44ff3b8e
5 changed files with 28 additions and 24 deletions

@ -1 +1 @@
Subproject commit 34ac837eebeecd0b6f35829780f2123f6b8cc698
Subproject commit 2234013e59a99116ee9f9e56a95ff8a6667db2a7

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics.OpenGL.Buffers;
using OpenTK.Graphics.ES30;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Colour;
using osu.Framework.Timing;
namespace osu.Game.Graphics.Cursor
{
@ -58,6 +59,9 @@ namespace osu.Game.Graphics.Cursor
public CursorTrail()
{
// as we are currently very dependent on having a running clock, let's make our own clock for the time being.
Clock = new FramedClock();
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both;
@ -231,4 +235,4 @@ namespace osu.Game.Graphics.Cursor
}
}
}
}
}

View File

@ -1,31 +1,19 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using OpenTK.Input;
using osu.Game.Graphics;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using System.Linq;
namespace osu.Game.Screens.Play
{
public class FailOverlay : MenuOverlay
{
public override string Header => "failed";
public override string Description => "you're dead, try again?";
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (args.Key == Key.Escape)
{
if (State == Visibility.Hidden) return false;
OnQuit();
return true;
}
return base.OnKeyDown(state, args);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
@ -33,5 +21,16 @@ namespace osu.Game.Screens.Play
AddButton("Retry", colours.YellowDark, OnRetry);
AddButton("Quit", new Color4(170, 27, 39, 255), OnQuit);
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (!args.Repeat && args.Key == Key.Escape)
{
Buttons.Children.Last().TriggerClick();
return true;
}
return base.OnKeyDown(state, args);
}
}
}

View File

@ -13,10 +13,11 @@ using OpenTK;
using OpenTK.Graphics;
using osu.Game.Graphics;
using osu.Framework.Allocation;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Play
{
public abstract class MenuOverlay : OverlayContainer
public abstract class MenuOverlay : OverlayContainer, IRequireHighFrequencyMousePosition
{
private const int transition_duration = 200;
private const int button_height = 70;
@ -30,7 +31,7 @@ namespace osu.Game.Screens.Play
public abstract string Header { get; }
public abstract string Description { get; }
private FillFlowContainer buttons;
protected FillFlowContainer<DialogButton> Buttons;
public int Retries
{
@ -80,11 +81,13 @@ namespace osu.Game.Screens.Play
// Don't let mouse down events through the overlay or people can click circles while paused.
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => true;
protected override bool OnMouseMove(InputState state) => true;
protected void AddButton(string text, Color4 colour, Action action)
{
buttons.Add(new PauseButton
Buttons.Add(new PauseButton
{
Text = text,
ButtonColour = colour,
@ -151,7 +154,7 @@ namespace osu.Game.Screens.Play
}
}
},
buttons = new FillFlowContainer
Buttons = new FillFlowContainer<DialogButton>
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,

View File

@ -2,10 +2,10 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using osu.Framework.Input;
using osu.Game.Graphics;
using OpenTK.Input;
using osu.Framework.Graphics.Containers;
using OpenTK.Graphics;
using osu.Framework.Allocation;
@ -20,10 +20,9 @@ namespace osu.Game.Screens.Play
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (args.Key == Key.Escape)
if (!args.Repeat && args.Key == Key.Escape)
{
if (State == Visibility.Hidden) return false;
OnResume();
Buttons.Children.First().TriggerClick();
return true;
}
@ -39,4 +38,3 @@ namespace osu.Game.Screens.Play
}
}
}