This commit is contained in:
Dean Herbert 2017-01-27 19:14:44 +09:00
parent f3e9da609e
commit 5787b43586
3 changed files with 56 additions and 1 deletions

View 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);
}
}
}

View File

@ -12,7 +12,6 @@
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.Configuration;
using osu.Framework.Configuration;
using System;
using osu.Game.Graphics.UserInterface;
using OpenTK.Graphics;
namespace osu.Game.Screens.Play
@ -119,6 +119,7 @@ private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game
}
},
scoreOverlay,
new SkipButton(sourceClock, beatmap.HitObjects.First().StartTime)
};
}

View File

@ -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" />