mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 18:42:56 +08:00
Make skip button work.
This commit is contained in:
parent
420e61fa97
commit
3e7503e860
@ -13,6 +13,7 @@ using OpenTK.Graphics;
|
|||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework.Graphics.Colour;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
@ -21,7 +22,6 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
Add(new BackButton());
|
Add(new BackButton());
|
||||||
Add(new SkipButton());
|
Add(new SkipButton());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ using osu.Game.Modes.UI;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.UI
|
namespace osu.Game.Modes.Osu.UI
|
||||||
{
|
{
|
||||||
|
@ -3,15 +3,7 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Primitives;
|
|
||||||
using osu.Framework.Graphics.Transformations;
|
|
||||||
using osu.Framework.Input;
|
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -33,244 +25,4 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
HoverColour = colours.PinkDark;
|
HoverColour = colours.PinkDark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SkipButton : TwoLayerButton
|
|
||||||
{
|
|
||||||
public SkipButton()
|
|
||||||
{
|
|
||||||
Text = @"Skip";
|
|
||||||
Icon = FontAwesome.fa_osu_right_o;
|
|
||||||
Anchor = Anchor.BottomRight;
|
|
||||||
Origin = Anchor.BottomRight;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(AudioManager audio, OsuColour colours)
|
|
||||||
{
|
|
||||||
ActivationSound = audio.Sample.Get(@"Menu/menuhit");
|
|
||||||
Colour = colours.Yellow;
|
|
||||||
HoverColour = colours.YellowDark;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TwoLayerButton : ClickableContainer
|
|
||||||
{
|
|
||||||
private TextAwesome icon;
|
|
||||||
|
|
||||||
public Box IconLayer;
|
|
||||||
public Box TextLayer;
|
|
||||||
|
|
||||||
private const int transform_time = 600;
|
|
||||||
private const int pulse_length = 250;
|
|
||||||
|
|
||||||
private const float shear = 0.1f;
|
|
||||||
|
|
||||||
public static readonly Vector2 SIZE_EXTENDED = new Vector2(140, 50);
|
|
||||||
public static readonly Vector2 SIZE_RETRACTED = new Vector2(100, 50);
|
|
||||||
public AudioSample ActivationSound;
|
|
||||||
private SpriteText text;
|
|
||||||
|
|
||||||
public Color4 HoverColour;
|
|
||||||
private Container c1;
|
|
||||||
private Container c2;
|
|
||||||
|
|
||||||
public Color4 Colour
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
TextLayer.Colour = value;
|
|
||||||
IconLayer.Colour = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Anchor Origin
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return base.Origin;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
base.Origin = value;
|
|
||||||
c1.Origin = c1.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopLeft : Anchor.TopRight;
|
|
||||||
c2.Origin = c2.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopRight : Anchor.TopLeft;
|
|
||||||
|
|
||||||
Margin = new MarginPadding
|
|
||||||
{
|
|
||||||
Right = (value & Anchor.x2) > 0 ? -SIZE_RETRACTED.X * shear * 0.5f : 0
|
|
||||||
};
|
|
||||||
|
|
||||||
c1.Depth = (value & Anchor.x2) > 0 ? 0 : 1;
|
|
||||||
c2.Depth = (value & Anchor.x2) > 0 ? 1 : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TwoLayerButton()
|
|
||||||
{
|
|
||||||
Size = SIZE_RETRACTED;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
c2 = new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Width = 0.4f,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Container {
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Shear = new Vector2(shear, 0),
|
|
||||||
Masking = true,
|
|
||||||
EdgeEffect = new EdgeEffect {
|
|
||||||
Type = EdgeEffectType.Shadow,
|
|
||||||
Colour = Color4.Black.Opacity(0.2f),
|
|
||||||
Offset = new Vector2(2, 0),
|
|
||||||
Radius = 2,
|
|
||||||
},
|
|
||||||
Children = new [] {
|
|
||||||
IconLayer = new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
EdgeSmoothness = new Vector2(1.5f, 0),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
icon = new TextAwesome
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
TextSize = 25,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
c1 = new Container
|
|
||||||
{
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Width = 0.6f,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Container {
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Shear = new Vector2(shear, 0),
|
|
||||||
Masking = true,
|
|
||||||
EdgeEffect = new EdgeEffect {
|
|
||||||
Type = EdgeEffectType.Shadow,
|
|
||||||
Colour = Color4.Black.Opacity(0.2f),
|
|
||||||
Offset = new Vector2(2, 0),
|
|
||||||
Radius = 2,
|
|
||||||
},
|
|
||||||
Children = new [] {
|
|
||||||
TextLayer = new Box
|
|
||||||
{
|
|
||||||
Origin = Anchor.TopLeft,
|
|
||||||
Anchor = Anchor.TopLeft,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
EdgeSmoothness = new Vector2(1.5f, 0),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
text = new SpriteText
|
|
||||||
{
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public FontAwesome Icon
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
icon.Icon = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Text
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
text.Text = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos);
|
|
||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
|
||||||
{
|
|
||||||
icon.ClearTransformations();
|
|
||||||
|
|
||||||
ResizeTo(SIZE_EXTENDED, transform_time, EasingTypes.OutElastic);
|
|
||||||
|
|
||||||
int duration = 0; //(int)(Game.Audio.BeatLength / 2);
|
|
||||||
if (duration == 0) duration = pulse_length;
|
|
||||||
|
|
||||||
IconLayer.FadeColour(HoverColour, transform_time, EasingTypes.OutElastic);
|
|
||||||
|
|
||||||
double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
|
|
||||||
double startTime = Time.Current + offset;
|
|
||||||
|
|
||||||
// basic pulse
|
|
||||||
icon.Transforms.Add(new TransformScale
|
|
||||||
{
|
|
||||||
StartValue = new Vector2(1.1f),
|
|
||||||
EndValue = Vector2.One,
|
|
||||||
StartTime = startTime,
|
|
||||||
EndTime = startTime + duration,
|
|
||||||
Easing = EasingTypes.Out,
|
|
||||||
LoopCount = -1,
|
|
||||||
LoopDelay = duration
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnHoverLost(InputState state)
|
|
||||||
{
|
|
||||||
icon.ClearTransformations();
|
|
||||||
|
|
||||||
ResizeTo(SIZE_RETRACTED, transform_time, EasingTypes.OutElastic);
|
|
||||||
|
|
||||||
IconLayer.FadeColour(TextLayer.Colour, transform_time, EasingTypes.OutElastic);
|
|
||||||
|
|
||||||
int duration = 0; //(int)(Game.Audio.BeatLength);
|
|
||||||
if (duration == 0) duration = pulse_length * 2;
|
|
||||||
|
|
||||||
double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
|
|
||||||
double startTime = Time.Current + offset;
|
|
||||||
|
|
||||||
// slow pulse
|
|
||||||
icon.Transforms.Add(new TransformScale
|
|
||||||
{
|
|
||||||
StartValue = new Vector2(1.1f),
|
|
||||||
EndValue = Vector2.One,
|
|
||||||
StartTime = startTime,
|
|
||||||
EndTime = startTime + duration,
|
|
||||||
Easing = EasingTypes.Out,
|
|
||||||
LoopCount = -1,
|
|
||||||
LoopDelay = duration
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnClick(InputState state)
|
|
||||||
{
|
|
||||||
var flash = new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Shear = new Vector2(shear, 0),
|
|
||||||
Colour = Color4.White.Opacity(0.5f),
|
|
||||||
};
|
|
||||||
Add(flash);
|
|
||||||
|
|
||||||
flash.FadeOutFromOne(200);
|
|
||||||
flash.Expire();
|
|
||||||
|
|
||||||
ActivationSound.Play();
|
|
||||||
|
|
||||||
return base.OnClick(state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
237
osu.Game/Graphics/UserInterface/TwoLayerButton.cs
Normal file
237
osu.Game/Graphics/UserInterface/TwoLayerButton.cs
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
public class TwoLayerButton : ClickableContainer
|
||||||
|
{
|
||||||
|
private TextAwesome icon;
|
||||||
|
|
||||||
|
public Box IconLayer;
|
||||||
|
public Box TextLayer;
|
||||||
|
|
||||||
|
private const int transform_time = 600;
|
||||||
|
private const int pulse_length = 250;
|
||||||
|
|
||||||
|
private const float shear = 0.1f;
|
||||||
|
|
||||||
|
public static readonly Vector2 SIZE_EXTENDED = new Vector2(140, 50);
|
||||||
|
public static readonly Vector2 SIZE_RETRACTED = new Vector2(100, 50);
|
||||||
|
public AudioSample ActivationSound;
|
||||||
|
private SpriteText text;
|
||||||
|
|
||||||
|
public Color4 HoverColour;
|
||||||
|
private Container c1;
|
||||||
|
private Container c2;
|
||||||
|
|
||||||
|
public Color4 Colour
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
TextLayer.Colour = value;
|
||||||
|
IconLayer.Colour = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Anchor Origin
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return base.Origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
base.Origin = value;
|
||||||
|
c1.Origin = c1.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopLeft : Anchor.TopRight;
|
||||||
|
c2.Origin = c2.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopRight : Anchor.TopLeft;
|
||||||
|
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Right = (value & Anchor.x2) > 0 ? -SIZE_RETRACTED.X * shear * 0.5f : 0
|
||||||
|
};
|
||||||
|
|
||||||
|
c1.Depth = (value & Anchor.x2) > 0 ? 0 : 1;
|
||||||
|
c2.Depth = (value & Anchor.x2) > 0 ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TwoLayerButton()
|
||||||
|
{
|
||||||
|
Size = SIZE_RETRACTED;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
c2 = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Width = 0.4f,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Container {
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Shear = new Vector2(shear, 0),
|
||||||
|
Masking = true,
|
||||||
|
EdgeEffect = new EdgeEffect {
|
||||||
|
Type = EdgeEffectType.Shadow,
|
||||||
|
Colour = Color4.Black.Opacity(0.2f),
|
||||||
|
Offset = new Vector2(2, 0),
|
||||||
|
Radius = 2,
|
||||||
|
},
|
||||||
|
Children = new [] {
|
||||||
|
IconLayer = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
EdgeSmoothness = new Vector2(1.5f, 0),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon = new TextAwesome
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
TextSize = 25,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
c1 = new Container
|
||||||
|
{
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Width = 0.6f,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Container {
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Shear = new Vector2(shear, 0),
|
||||||
|
Masking = true,
|
||||||
|
EdgeEffect = new EdgeEffect {
|
||||||
|
Type = EdgeEffectType.Shadow,
|
||||||
|
Colour = Color4.Black.Opacity(0.2f),
|
||||||
|
Offset = new Vector2(2, 0),
|
||||||
|
Radius = 2,
|
||||||
|
},
|
||||||
|
Children = new [] {
|
||||||
|
TextLayer = new Box
|
||||||
|
{
|
||||||
|
Origin = Anchor.TopLeft,
|
||||||
|
Anchor = Anchor.TopLeft,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
EdgeSmoothness = new Vector2(1.5f, 0),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
text = new SpriteText
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public FontAwesome Icon
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
icon.Icon = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
text.Text = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Contains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos);
|
||||||
|
|
||||||
|
protected override bool OnHover(InputState state)
|
||||||
|
{
|
||||||
|
icon.ClearTransformations();
|
||||||
|
|
||||||
|
ResizeTo(SIZE_EXTENDED, transform_time, EasingTypes.OutElastic);
|
||||||
|
|
||||||
|
int duration = 0; //(int)(Game.Audio.BeatLength / 2);
|
||||||
|
if (duration == 0) duration = pulse_length;
|
||||||
|
|
||||||
|
IconLayer.FadeColour(HoverColour, transform_time, EasingTypes.OutElastic);
|
||||||
|
|
||||||
|
double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
|
||||||
|
double startTime = Time.Current + offset;
|
||||||
|
|
||||||
|
// basic pulse
|
||||||
|
icon.Transforms.Add(new TransformScale
|
||||||
|
{
|
||||||
|
StartValue = new Vector2(1.1f),
|
||||||
|
EndValue = Vector2.One,
|
||||||
|
StartTime = startTime,
|
||||||
|
EndTime = startTime + duration,
|
||||||
|
Easing = EasingTypes.Out,
|
||||||
|
LoopCount = -1,
|
||||||
|
LoopDelay = duration
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(InputState state)
|
||||||
|
{
|
||||||
|
icon.ClearTransformations();
|
||||||
|
|
||||||
|
ResizeTo(SIZE_RETRACTED, transform_time, EasingTypes.OutElastic);
|
||||||
|
|
||||||
|
IconLayer.FadeColour(TextLayer.Colour, transform_time, EasingTypes.OutElastic);
|
||||||
|
|
||||||
|
int duration = 0; //(int)(Game.Audio.BeatLength);
|
||||||
|
if (duration == 0) duration = pulse_length * 2;
|
||||||
|
|
||||||
|
double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
|
||||||
|
double startTime = Time.Current + offset;
|
||||||
|
|
||||||
|
// slow pulse
|
||||||
|
icon.Transforms.Add(new TransformScale
|
||||||
|
{
|
||||||
|
StartValue = new Vector2(1.1f),
|
||||||
|
EndValue = Vector2.One,
|
||||||
|
StartTime = startTime,
|
||||||
|
EndTime = startTime + duration,
|
||||||
|
Easing = EasingTypes.Out,
|
||||||
|
LoopCount = -1,
|
||||||
|
LoopDelay = duration
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(InputState state)
|
||||||
|
{
|
||||||
|
var flash = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Shear = new Vector2(shear, 0),
|
||||||
|
Colour = Color4.White.Opacity(0.5f),
|
||||||
|
};
|
||||||
|
Add(flash);
|
||||||
|
|
||||||
|
flash.Alpha = 1;
|
||||||
|
flash.FadeOut(500, EasingTypes.OutQuint);
|
||||||
|
flash.Expire();
|
||||||
|
|
||||||
|
ActivationSound.Play();
|
||||||
|
|
||||||
|
return base.OnClick(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -8,6 +8,7 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Game.Modes.UI
|
namespace osu.Game.Modes.UI
|
||||||
{
|
{
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
using osu.Framework;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public abstract class KeyCounter : Container
|
public abstract class KeyCounter : Container
|
||||||
{
|
{
|
@ -2,11 +2,11 @@
|
|||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class KeyCounterCollection : FlowContainer<KeyCounter>
|
public class KeyCounterCollection : FlowContainer<KeyCounter>
|
||||||
{
|
{
|
@ -1,11 +1,11 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK.Input;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using OpenTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class KeyCounterKeyboard : KeyCounter
|
public class KeyCounterKeyboard : KeyCounter
|
||||||
{
|
{
|
@ -1,12 +1,12 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Input;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class KeyCounterMouse : KeyCounter
|
public class KeyCounterMouse : KeyCounter
|
||||||
{
|
{
|
@ -1,21 +1,16 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input;
|
|
||||||
using osu.Framework.Platform;
|
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Screens.Backgrounds;
|
using osu.Game.Screens.Backgrounds;
|
||||||
using OpenTK.Input;
|
|
||||||
using MouseState = osu.Framework.Input.MouseState;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.GameModes;
|
using osu.Framework.GameModes;
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
@ -23,7 +18,8 @@ using osu.Game.Screens.Ranking;
|
|||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using System;
|
using System;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using System.Linq;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
@ -47,6 +43,7 @@ namespace osu.Game.Screens.Play
|
|||||||
private ScoreProcessor scoreProcessor;
|
private ScoreProcessor scoreProcessor;
|
||||||
private HitRenderer hitRenderer;
|
private HitRenderer hitRenderer;
|
||||||
private Bindable<int> dimLevel;
|
private Bindable<int> dimLevel;
|
||||||
|
private SkipButton skipButton;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game, OsuConfigManager config)
|
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game, OsuConfigManager config)
|
||||||
@ -116,13 +113,40 @@ namespace osu.Game.Screens.Play
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
hitRenderer,
|
hitRenderer,
|
||||||
|
skipButton = new SkipButton { Alpha = 0 },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scoreOverlay,
|
scoreOverlay,
|
||||||
//new SkipButton(sourceClock, beatmap.HitObjects.First().StartTime)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initializeSkipButton()
|
||||||
|
{
|
||||||
|
const double skip_required_cutoff = 3000;
|
||||||
|
const double fade_time = 300;
|
||||||
|
|
||||||
|
double firstHitObject = Beatmap.Beatmap.HitObjects.First().StartTime;
|
||||||
|
|
||||||
|
if (firstHitObject < skip_required_cutoff)
|
||||||
|
{
|
||||||
|
skipButton.Alpha = 0;
|
||||||
|
skipButton.Expire();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
skipButton.FadeInFromZero(fade_time);
|
||||||
|
|
||||||
|
skipButton.Action = () =>
|
||||||
|
{
|
||||||
|
sourceClock.Seek(firstHitObject - skip_required_cutoff - fade_time);
|
||||||
|
skipButton.Action = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
skipButton.Delay(firstHitObject - skip_required_cutoff - fade_time);
|
||||||
|
skipButton.FadeOut(fade_time);
|
||||||
|
skipButton.Expire();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -135,6 +159,7 @@ namespace osu.Game.Screens.Play
|
|||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
sourceClock.Start();
|
sourceClock.Start();
|
||||||
|
initializeSkipButton();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
32
osu.Game/Screens/Play/SkipButton.cs
Normal file
32
osu.Game/Screens/Play/SkipButton.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Play
|
||||||
|
{
|
||||||
|
public class SkipButton : TwoLayerButton
|
||||||
|
{
|
||||||
|
private readonly double skipDestination;
|
||||||
|
|
||||||
|
public SkipButton()
|
||||||
|
{
|
||||||
|
Text = @"Skip";
|
||||||
|
Icon = FontAwesome.fa_osu_right_o;
|
||||||
|
Anchor = Anchor.BottomRight;
|
||||||
|
Origin = Anchor.BottomRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio, OsuColour colours)
|
||||||
|
{
|
||||||
|
ActivationSound = audio.Sample.Get(@"Menu/menuhit");
|
||||||
|
Colour = colours.Yellow;
|
||||||
|
HoverColour = colours.YellowDark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -67,6 +67,7 @@
|
|||||||
<Compile Include="Graphics\Backgrounds\Triangles.cs" />
|
<Compile Include="Graphics\Backgrounds\Triangles.cs" />
|
||||||
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
|
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\BackButton.cs" />
|
<Compile Include="Graphics\UserInterface\BackButton.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\TwoLayerButton.cs" />
|
||||||
<Compile Include="Modes\Objects\HitObjectParser.cs" />
|
<Compile Include="Modes\Objects\HitObjectParser.cs" />
|
||||||
<Compile Include="Modes\Score.cs" />
|
<Compile Include="Modes\Score.cs" />
|
||||||
<Compile Include="Modes\ScoreProcesssor.cs" />
|
<Compile Include="Modes\ScoreProcesssor.cs" />
|
||||||
@ -118,6 +119,7 @@
|
|||||||
<Compile Include="Screens\Multiplayer\MatchCreate.cs" />
|
<Compile Include="Screens\Multiplayer\MatchCreate.cs" />
|
||||||
<Compile Include="Screens\Play\FailDialog.cs" />
|
<Compile Include="Screens\Play\FailDialog.cs" />
|
||||||
<Compile Include="Screens\Play\PlayerInputManager.cs" />
|
<Compile Include="Screens\Play\PlayerInputManager.cs" />
|
||||||
|
<Compile Include="Screens\Play\SkipButton.cs" />
|
||||||
<Compile Include="Screens\Select\CarouselContainer.cs" />
|
<Compile Include="Screens\Select\CarouselContainer.cs" />
|
||||||
<Compile Include="Screens\Select\MatchSongSelect.cs" />
|
<Compile Include="Screens\Select\MatchSongSelect.cs" />
|
||||||
<Compile Include="Screens\OsuGameMode.cs" />
|
<Compile Include="Screens\OsuGameMode.cs" />
|
||||||
@ -145,10 +147,10 @@
|
|||||||
<Compile Include="Graphics\Cursor\OsuCursorContainer.cs" />
|
<Compile Include="Graphics\Cursor\OsuCursorContainer.cs" />
|
||||||
<Compile Include="Graphics\Processing\RatioAdjust.cs" />
|
<Compile Include="Graphics\Processing\RatioAdjust.cs" />
|
||||||
<Compile Include="Graphics\TextAwesome.cs" />
|
<Compile Include="Graphics\TextAwesome.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\KeyCounter.cs" />
|
<Compile Include="Screens\Play\KeyCounter.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\KeyCounterKeyboard.cs" />
|
<Compile Include="Screens\Play\KeyCounterKeyboard.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\KeyCounterCollection.cs" />
|
<Compile Include="Screens\Play\KeyCounterCollection.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\KeyCounterMouse.cs" />
|
<Compile Include="Screens\Play\KeyCounterMouse.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\PercentageCounter.cs" />
|
<Compile Include="Graphics\UserInterface\PercentageCounter.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\ScoreCounter.cs" />
|
<Compile Include="Graphics\UserInterface\ScoreCounter.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\StarCounter.cs" />
|
<Compile Include="Graphics\UserInterface\StarCounter.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user