mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Move play modes to their own projects.
This commit is contained in:
78
osu.Game.Modes.Mania/UI/ManiaComboCounter.cs
Normal file
78
osu.Game.Modes.Mania/UI/ManiaComboCounter.cs
Normal file
@ -0,0 +1,78 @@
|
||||
//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.Graphics;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Game.Modes.Taiko.UI;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Mania.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Similar to osu!taiko, with a pop-out animation when failing (rolling). Used in osu!mania.
|
||||
/// </summary>
|
||||
public class ManiaComboCounter : TaikoComboCounter
|
||||
{
|
||||
protected ushort KeysHeld = 0;
|
||||
|
||||
protected Color4 OriginalColour;
|
||||
|
||||
protected Color4 TintColour => Color4.Orange;
|
||||
protected EasingTypes TintEasing => EasingTypes.None;
|
||||
protected int TintDuration => 500;
|
||||
|
||||
protected Color4 PopOutColor => Color4.Red;
|
||||
protected override float PopOutInitialAlpha => 1.0f;
|
||||
protected override double PopOutDuration => 300;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
PopOutSpriteText.Anchor = Anchor.BottomCentre;
|
||||
PopOutSpriteText.Origin = Anchor.Centre;
|
||||
PopOutSpriteText.FadeColour(PopOutColor, 0);
|
||||
OriginalColour = DisplayedCountSpriteText.Colour;
|
||||
}
|
||||
|
||||
protected override void OnCountRolling(ulong currentValue, ulong newValue)
|
||||
{
|
||||
if (!IsRolling && newValue < currentValue)
|
||||
{
|
||||
PopOutSpriteText.Text = FormatCount(currentValue);
|
||||
|
||||
PopOutSpriteText.FadeTo(PopOutInitialAlpha);
|
||||
PopOutSpriteText.ScaleTo(1.0f);
|
||||
|
||||
PopOutSpriteText.FadeOut(PopOutDuration, PopOutEasing);
|
||||
PopOutSpriteText.ScaleTo(PopOutScale, PopOutDuration, PopOutEasing);
|
||||
}
|
||||
|
||||
base.OnCountRolling(currentValue, newValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tints text while holding a key.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Does not alter combo. This has to be done depending of the scoring system.
|
||||
/// (i.e. v1 = each period of time; v2 = when starting and ending a key hold)
|
||||
/// </remarks>
|
||||
public void HoldStart()
|
||||
{
|
||||
if (KeysHeld == 0)
|
||||
DisplayedCountSpriteText.FadeColour(TintColour, TintDuration, TintEasing);
|
||||
KeysHeld++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ends tinting.
|
||||
/// </summary>
|
||||
public void HoldEnd()
|
||||
{
|
||||
KeysHeld--;
|
||||
if (KeysHeld == 0)
|
||||
DisplayedCountSpriteText.FadeColour(OriginalColour, TintDuration, TintEasing);
|
||||
}
|
||||
}
|
||||
}
|
33
osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs
Normal file
33
osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs
Normal file
@ -0,0 +1,33 @@
|
||||
//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.Game.Modes.Mania.Objects;
|
||||
using osu.Game.Modes.Objects;
|
||||
using osu.Game.Modes.UI;
|
||||
|
||||
namespace osu.Game.Modes.Mania.UI
|
||||
{
|
||||
public class ManiaHitRenderer : HitRenderer<ManiaBaseHit>
|
||||
{
|
||||
private readonly int columns;
|
||||
|
||||
public ManiaHitRenderer(int columns = 5)
|
||||
{
|
||||
this.columns = columns;
|
||||
}
|
||||
|
||||
protected override HitObjectConverter<ManiaBaseHit> Converter => new ManiaConverter(columns);
|
||||
|
||||
protected override Playfield CreatePlayfield() => new ManiaPlayfield(columns);
|
||||
|
||||
protected override DrawableHitObject GetVisualRepresentation(ManiaBaseHit h)
|
||||
{
|
||||
return null;
|
||||
//return new DrawableNote(h)
|
||||
//{
|
||||
// Position = new Vector2((float)(h.Column + 0.5) / columns, -0.1f),
|
||||
// RelativePositionAxes = Axes.Both
|
||||
//};
|
||||
}
|
||||
}
|
||||
}
|
38
osu.Game.Modes.Mania/UI/ManiaPlayfield.cs
Normal file
38
osu.Game.Modes.Mania/UI/ManiaPlayfield.cs
Normal file
@ -0,0 +1,38 @@
|
||||
//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.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Modes.UI;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Mania.UI
|
||||
{
|
||||
public class ManiaPlayfield : Playfield
|
||||
{
|
||||
private readonly int columns;
|
||||
|
||||
public ManiaPlayfield(int columns)
|
||||
{
|
||||
this.columns = columns;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Size = new Vector2(columns / 20f, 1f);
|
||||
Anchor = Anchor.BottomCentre;
|
||||
Origin = Anchor.BottomCentre;
|
||||
|
||||
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
||||
|
||||
for (int i = 0; i < columns; i++)
|
||||
Add(new Box()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Size = new Vector2(2, 1),
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Position = new Vector2((float)i / columns, 0),
|
||||
Alpha = 0.5f,
|
||||
Colour = Color4.Black
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user