1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-24 12:47:24 +08:00
osu-lazer/osu.Game.Rulesets.Osu/Mods/OsuModAlternate.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1.2 KiB
C#
Raw Normal View History

2022-01-29 20:38:12 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
2022-01-29 20:38:12 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
2022-01-29 20:38:12 +08:00
namespace osu.Game.Rulesets.Osu.Mods
{
public class OsuModAlternate : InputBlockingMod
2022-01-29 20:38:12 +08:00
{
public override string Name => @"Alternate";
public override string Acronym => @"AL";
public override string Description => @"Don't use the same key twice in a row!";
public override IconUsage? Icon => FontAwesome.Solid.Keyboard;
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModSingleTap) }).ToArray();
protected override bool CheckCorrectAction(OsuAction action)
2022-01-29 20:38:12 +08:00
{
if (base.CheckCorrectAction(action))
return true;
if (LastActionPressed != action)
2022-01-29 20:38:12 +08:00
{
// User alternated correctly.
LastActionPressed = action;
2022-01-29 20:38:12 +08:00
return true;
}
Ruleset.Cursor.FlashColour(Colour4.Red, FLASH_DURATION, Easing.OutQuint);
2022-01-29 20:38:12 +08:00
return false;
}
}
}