mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:07:44 +08:00
wip
This commit is contained in:
parent
f3e9da609e
commit
5787b43586
53
osu.Game/Graphics/UserInterface/SkipButton.cs
Normal file
53
osu.Game/Graphics/UserInterface/SkipButton.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Timing;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
class SkipButton : Button
|
||||
{
|
||||
private IAdjustableClock sourceClock;
|
||||
private double time;
|
||||
public SkipButton(IAdjustableClock clock, double time)
|
||||
{
|
||||
Height = 60;
|
||||
Width = 100;
|
||||
Text = "skip";
|
||||
Colour = new Color4(238, 51, 153, 255);
|
||||
Action = skip;
|
||||
sourceClock = clock;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Delay(time - 3000, true);
|
||||
Content.FadeOut(250);
|
||||
}
|
||||
|
||||
private void skip()
|
||||
{
|
||||
sourceClock.Seek(time - 3000);
|
||||
FadeOut(250);
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
switch (args.Key)
|
||||
{
|
||||
case Key.Space:
|
||||
if(sourceClock.CurrentTime + 3000 < time)
|
||||
skip();
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
}
|
||||
}
|
@ -12,7 +12,6 @@ using osu.Framework.Platform;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Modes;
|
||||
using osu.Game.Modes.Objects;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using OpenTK.Input;
|
||||
@ -24,6 +23,7 @@ using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Framework.Configuration;
|
||||
using System;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
@ -119,6 +119,7 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
},
|
||||
scoreOverlay,
|
||||
new SkipButton(sourceClock, beatmap.HitObjects.First().StartTime)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,7 @@
|
||||
<Compile Include="Graphics\Backgrounds\Triangles.cs" />
|
||||
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
|
||||
<Compile Include="Graphics\UserInterface\BackButton.cs" />
|
||||
<Compile Include="Graphics\UserInterface\SkipButton.cs" />
|
||||
<Compile Include="Modes\Objects\HitObjectParser.cs" />
|
||||
<Compile Include="Modes\Score.cs" />
|
||||
<Compile Include="Modes\ScoreProcesssor.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user