1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 01:47:24 +08:00

Merge pull request #448 from peppy/less-mods-enum

Remove Mods enum.
This commit is contained in:
Dean Herbert 2017-03-07 14:19:01 +09:00 committed by GitHub
commit 95fb34ccfb
8 changed files with 77 additions and 201 deletions

View File

@ -17,7 +17,6 @@ namespace osu.Game.Modes.Catch
{
public override string Description => @"Play with no approach circles and fading notes for a slight score advantage.";
public override double ScoreMultiplier => 1.06;
public override Mods[] DisablesMods => new Mods[] { };
}
public class CatchModHardRock : ModHardRock
@ -54,7 +53,6 @@ namespace osu.Game.Modes.Catch
public class CatchModFlashlight : ModFlashlight
{
public override double ScoreMultiplier => 1.12;
public override Mods[] DisablesMods => new Mods[] { };
}
public class CatchModPerfect : ModPerfect

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Graphics;
namespace osu.Game.Modes.Mania
@ -19,13 +20,12 @@ namespace osu.Game.Modes.Mania
{
public override string Description => @"The notes fade out before you hit them!";
public override double ScoreMultiplier => 1.0;
public override Mods[] DisablesMods => new[] { Mods.Flashlight };
public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) };
}
public class ManiaModHardRock : ModHardRock
{
public override double ScoreMultiplier => 1.0;
public override bool Ranked => false;
}
public class ManiaModSuddenDeath : ModSuddenDeath
@ -51,7 +51,7 @@ namespace osu.Game.Modes.Mania
public class ManiaModFlashlight : ModFlashlight
{
public override double ScoreMultiplier => 1.0;
public override Mods[] DisablesMods => new[] { Mods.Hidden };
public override Type[] IncompatibleMods => new[] { typeof(ModHidden) };
}
public class ManiaModPerfect : ModPerfect
@ -61,95 +61,86 @@ namespace osu.Game.Modes.Mania
public class ManiaModFadeIn : Mod
{
public override Mods Name => Mods.FadeIn;
public override string Name => "FadeIn";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
public override string Description => @"";
public override double ScoreMultiplier => 1;
public override bool Ranked => true;
public override Mods[] DisablesMods => new[] { Mods.Flashlight };
public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) };
}
public class ManiaModRandom : Mod
{
public override Mods Name => Mods.Random;
public override FontAwesome Icon => FontAwesome.fa_close;
public override string Name => "Random";
public override string Description => @"Shuffle around the notes!";
public override double ScoreMultiplier => 1;
public override bool Ranked => false;
public override Mods[] DisablesMods => new Mods[] { };
}
public abstract class ManiaKeyMod : Mod
{
public abstract int KeyCount { get; }
public override FontAwesome Icon => FontAwesome.fa_close; // TODO: Add proper key icons
public override string Description => @"";
public override double ScoreMultiplier => 1; // TODO: Implement the mania key mod score multiplier
public override bool Ranked => true;
public override Mods[] DisablesMods => new Mods[] { };
}
public class ManiaModKey1 : ManiaKeyMod
{
public override int KeyCount => 1;
public override Mods Name => Mods.Key1;
public override string Name => "1K";
}
public class ManiaModKey2 : ManiaKeyMod
{
public override int KeyCount => 2;
public override Mods Name => Mods.Key2;
public override string Name => "2K";
}
public class ManiaModKey3 : ManiaKeyMod
{
public override int KeyCount => 3;
public override Mods Name => Mods.Key3;
public override string Name => "3K";
}
public class ManiaModKey4 : ManiaKeyMod
{
public override int KeyCount => 4;
public override Mods Name => Mods.Key4;
public override string Name => "4K";
}
public class ManiaModKey5 : ManiaKeyMod
{
public override int KeyCount => 5;
public override Mods Name => Mods.Key5;
public override string Name => "5K";
}
public class ManiaModKey6 : ManiaKeyMod
{
public override int KeyCount => 6;
public override Mods Name => Mods.Key6;
public override string Name => "6K";
}
public class ManiaModKey7 : ManiaKeyMod
{
public override int KeyCount => 7;
public override Mods Name => Mods.Key7;
public override string Name => "7K";
}
public class ManiaModKey8 : ManiaKeyMod
{
public override int KeyCount => 8;
public override Mods Name => Mods.Key8;
public override string Name => "8K";
}
public class ManiaModKey9 : ManiaKeyMod
{
public override int KeyCount => 9;
public override Mods Name => Mods.Key9;
public override string Name => "9K";
}
public class ManiaModKeyCoop : Mod
{
public override Mods Name => Mods.KeyCoop;
public override FontAwesome Icon => FontAwesome.fa_close;
public override string Name => "KeyCoop";
public override string Description => @"Double the key amount, double the fun!";
public override double ScoreMultiplier => 1;
public override bool Ranked => true;
public override Mods[] DisablesMods => new Mods[] { };
}
}

View File

@ -1,13 +1,15 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using osu.Game.Graphics;
namespace osu.Game.Modes.Osu
{
public class OsuModNoFail : ModNoFail
{
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray();
}
public class OsuModEasy : ModEasy
@ -19,7 +21,6 @@ namespace osu.Game.Modes.Osu
{
public override string Description => @"Play with no approach circles and fading notes for a slight score advantage.";
public override double ScoreMultiplier => 1.06;
public override Mods[] DisablesMods => new Mods[] { };
}
public class OsuModHardRock : ModHardRock
@ -30,7 +31,7 @@ namespace osu.Game.Modes.Osu
public class OsuModSuddenDeath : ModSuddenDeath
{
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray();
}
public class OsuModDoubleTime : ModDoubleTime
@ -41,6 +42,7 @@ namespace osu.Game.Modes.Osu
public class OsuModRelax : ModRelax
{
public override string Description => "You don't need to click.\nGive your clicking/tapping finger a break from the heat of things.";
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray();
}
public class OsuModHalfTime : ModHalfTime
@ -56,7 +58,6 @@ namespace osu.Game.Modes.Osu
public class OsuModFlashlight : ModFlashlight
{
public override double ScoreMultiplier => 1.12;
public override Mods[] DisablesMods => new Mods[] { };
}
public class OsuModPerfect : ModPerfect
@ -66,31 +67,34 @@ namespace osu.Game.Modes.Osu
public class OsuModSpunOut : Mod
{
public override Mods Name => Mods.SpunOut;
public override string Name => "Spun Out";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_spunout;
public override string Description => @"Spinners will be automatically completed";
public override double ScoreMultiplier => 0.9;
public override bool Ranked => true;
public override Mods[] DisablesMods => new[] { Mods.Autoplay, Mods.Cinema, Mods.Autopilot };
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModCinema), typeof(OsuModAutopilot) };
}
public class OsuModAutopilot : Mod
{
public override Mods Name => Mods.Autopilot;
public override string Name => "Autopilot";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_autopilot;
public override string Description => @"Automatic cursor movement - just follow the rhythm.";
public override double ScoreMultiplier => 0;
public override bool Ranked => false;
public override Mods[] DisablesMods => new[] { Mods.SpunOut, Mods.Relax, Mods.SuddenDeath, Mods.Perfect, Mods.NoFail, Mods.Autoplay, Mods.Cinema };
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModPerfect), typeof(ModNoFail), typeof(ModAutoplay), typeof(ModCinema) };
}
public class OsuModAutoplay : ModAutoplay
{
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray();
}
public class OsuModTarget : Mod
{
public override Mods Name => Mods.Target;
public override string Name => "Target";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_target;
public override string Description => @"";
public override double ScoreMultiplier => 1;
public override bool Ranked => false;
public override Mods[] DisablesMods => new Mods[] { };
}
}

View File

@ -81,7 +81,7 @@ namespace osu.Game.Modes.Osu
{
Mods = new Mod[]
{
new ModAutoplay(),
new OsuModAutoplay(),
new ModCinema(),
},
},

View File

@ -17,7 +17,6 @@ namespace osu.Game.Modes.Taiko
{
public override string Description => @"The notes fade out before you hit them!";
public override double ScoreMultiplier => 1.06;
public override Mods[] DisablesMods => new Mods[] { };
}
public class TaikoModHardRock : ModHardRock
@ -54,7 +53,6 @@ namespace osu.Game.Modes.Taiko
public class TaikoModFlashlight : ModFlashlight
{
public override double ScoreMultiplier => 1.12;
public override Mods[] DisablesMods => new Mods[] { };
}
public class TaikoModPerfect : ModPerfect

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.ComponentModel;
using osu.Game.Graphics;
namespace osu.Game.Modes
@ -15,17 +14,17 @@ namespace osu.Game.Modes
/// <summary>
/// The name of this mod.
/// </summary>
public abstract Mods Name { get; }
public abstract string Name { get; }
/// <summary>
/// The icon of this mod.
/// </summary>
public abstract FontAwesome Icon { get; }
public virtual FontAwesome Icon => FontAwesome.fa_question;
/// <summary>
/// The user readable description of this mod.
/// </summary>
public abstract string Description { get; }
public virtual string Description => string.Empty;
/// <summary>
/// The score multiplier of this mod.
@ -35,234 +34,130 @@ namespace osu.Game.Modes
/// <summary>
/// Returns if this mod is ranked.
/// </summary>
public abstract bool Ranked { get; }
public virtual bool Ranked => false;
/// <summary>
/// The mods this mod cannot be enabled with.
/// </summary>
public abstract Mods[] DisablesMods { get; }
public virtual Type[] IncompatibleMods => new Type[] { };
}
public class MultiMod : Mod
{
public override Mods Name => Modes.Mods.None;
public override FontAwesome Icon => FontAwesome.fa_close;
public override string Description => @"";
public override string Name => string.Empty;
public override string Description => string.Empty;
public override double ScoreMultiplier => 0.0;
public override bool Ranked => false;
public override Mods[] DisablesMods => new Mods[] { };
public Mod[] Mods;
}
public abstract class ModNoFail : Mod
{
public override Mods Name => Mods.NoFail;
public override string Name => "NoFail";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail;
public override string Description => @"You can't fail, no matter what.";
public override string Description => "You can't fail, no matter what.";
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Mods[] DisablesMods => new[] { Mods.Relax, Mods.Autopilot, Mods.SuddenDeath, Mods.Perfect };
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModPerfect) };
}
public abstract class ModEasy : Mod
{
public override Mods Name => Mods.Easy;
public override string Name => "Easy";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy;
public override string Description => @"Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required.";
public override string Description => "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required.";
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Mods[] DisablesMods => new[] { Mods.HardRock };
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
}
public abstract class ModHidden : Mod
{
public override Mods Name => Mods.Hidden;
public override string Name => "Hidden";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
public override bool Ranked => true;
}
public abstract class ModHardRock : Mod
{
public override Mods Name => Mods.HardRock;
public override string Name => "Hard Rock";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock;
public override string Description => @"Everything just got a bit harder...";
public override Mods[] DisablesMods => new[] { Mods.Easy };
public override string Description => "Everything just got a bit harder...";
public override Type[] IncompatibleMods => new[] { typeof(ModEasy) };
}
public abstract class ModSuddenDeath : Mod
{
public override Mods Name => Mods.SuddenDeath;
public override string Name => "Sudden Death";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath;
public override string Description => @"Miss a note and fail.";
public override string Description => "Miss a note and fail.";
public override double ScoreMultiplier => 1;
public override bool Ranked => true;
public override Mods[] DisablesMods => new[] { Mods.NoFail, Mods.Relax, Mods.Autopilot, Mods.Autoplay, Mods.Cinema };
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay), typeof(ModCinema) };
}
public abstract class ModDoubleTime : Mod
{
public override Mods Name => Mods.DoubleTime;
public override string Name => "Double Time";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime;
public override string Description => @"Zoooooooooom";
public override string Description => "Zoooooooooom";
public override bool Ranked => true;
public override Mods[] DisablesMods => new[] { Mods.HalfTime };
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) };
}
public abstract class ModRelax : Mod
{
public override Mods Name => Mods.Relax;
public override string Name => "Relax";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax;
public override double ScoreMultiplier => 0;
public override bool Ranked => false;
public override Mods[] DisablesMods => new[] { Mods.Autopilot, Mods.Autoplay, Mods.Cinema, Mods.NoFail, Mods.SuddenDeath, Mods.Perfect };
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModCinema), typeof(ModNoFail), typeof(ModSuddenDeath), typeof(ModPerfect) };
}
public abstract class ModHalfTime : Mod
{
public override Mods Name => Mods.HalfTime;
public override string Name => "Half Time";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime;
public override string Description => @"Less zoom";
public override string Description => "Less zoom";
public override bool Ranked => true;
public override Mods[] DisablesMods => new[] { Mods.DoubleTime, Mods.Nightcore };
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModNightcore) };
}
public abstract class ModNightcore : ModDoubleTime
{
public override Mods Name => Mods.Nightcore;
public override string Name => "Nightcore";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nightcore;
public override string Description => @"uguuuuuuuu";
public override string Description => "uguuuuuuuu";
}
public abstract class ModFlashlight : Mod
{
public override Mods Name => Mods.Flashlight;
public override string Name => "Flashlight";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight;
public override string Description => @"Restricted view area.";
public override string Description => "Restricted view area.";
public override bool Ranked => true;
}
public class ModAutoplay : Mod
{
public override Mods Name => Mods.Autoplay;
public override string Name => "Autoplay";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto;
public override string Description => @"Watch a perfect automated play through the song";
public override string Description => "Watch a perfect automated play through the song";
public override double ScoreMultiplier => 0;
public override bool Ranked => false;
public override Mods[] DisablesMods => new[] { Mods.Relax, Mods.Autopilot, Mods.SpunOut, Mods.SuddenDeath, Mods.Perfect };
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModPerfect) };
}
public abstract class ModPerfect : ModSuddenDeath
{
public override Mods Name => Mods.Perfect;
public override FontAwesome Icon => FontAwesome.fa_close;
public override string Description => @"SS or quit.";
public override string Name => "Perfect";
public override string Description => "SS or quit.";
}
public class ModCinema : ModAutoplay
{
public override Mods Name => Mods.Cinema;
public override string Name => "Cinema";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_cinema;
}
[Flags]
public enum Mods
{
None = 0,
[Description(@"No Fail")]
NoFail = 1 << 0,
[Description(@"Easy")]
Easy = 1 << 1,
//NoVideo = 1 << 2,
[Description(@"Hidden")]
Hidden = 1 << 3,
[Description(@"Hard Rock")]
HardRock = 1 << 4,
[Description(@"Sudden Death")]
SuddenDeath = 1 << 5,
[Description(@"Double Time")]
DoubleTime = 1 << 6,
[Description(@"Relax")]
Relax = 1 << 7,
[Description(@"Halftime")]
HalfTime = 1 << 8,
[Description(@"Nightcore")]
Nightcore = 1 << 9,
[Description(@"Flashlight")]
Flashlight = 1 << 10,
[Description(@"Auto")]
Autoplay = 1 << 11,
[Description(@"Spun Out")]
SpunOut = 1 << 12,
[Description(@"Autopilot")]
Autopilot = 1 << 13,
[Description(@"Perfect")]
Perfect = 1 << 14,
[Description(@"4K")]
Key4 = 1 << 15,
[Description(@"5K")]
Key5 = 1 << 16,
[Description(@"6K")]
Key6 = 1 << 17,
[Description(@"7K")]
Key7 = 1 << 18,
[Description(@"8K")]
Key8 = 1 << 19,
[Description(@"Fade In")]
FadeIn = 1 << 20,
[Description(@"Random")]
Random = 1 << 21,
[Description(@"Cinema")]
Cinema = 1 << 22,
[Description(@"Target Practice")]
Target = 1 << 23,
[Description(@"9K")]
Key9 = 1 << 24,
[Description(@"Co-Op")]
KeyCoop = 1 << 25,
[Description(@"1K")]
Key1 = 1 << 26,
[Description(@"3K")]
Key3 = 1 << 27,
[Description(@"2K")]
Key2 = 1 << 28,
LastMod = 1 << 29,
KeyMod = Key1 | Key2 | Key3 | Key4 | Key5 | Key6 | Key7 | Key8 | Key9 | KeyCoop,
FreeModAllowed = NoFail | Easy | Hidden | HardRock | SuddenDeath | Flashlight | FadeIn | Relax | Autopilot | SpunOut | KeyMod,
ScoreIncreaseMods = Hidden | HardRock | DoubleTime | Flashlight | FadeIn
}
public enum ModType
{
DifficultyReduction,

View File

@ -9,7 +9,6 @@ using OpenTK.Input;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
@ -111,14 +110,7 @@ namespace osu.Game.Overlays.Mods
if (mod == value) return;
mod = value;
if (mod is MultiMod)
{
Mods = ((MultiMod)mod).Mods;
}
else
{
Mods = new[] { mod };
}
Mods = (mod as MultiMod)?.Mods ?? new[] { mod };
createIcons();
if (Mods.Length > 0)
@ -185,7 +177,7 @@ namespace osu.Game.Overlays.Mods
private void displayMod(Mod mod)
{
displayIcon.Icon = mod.Icon;
text.Text = mod.Name.GetDescription();
text.Text = mod.Name;
}
private void displaySelectedMod()

View File

@ -124,7 +124,7 @@ namespace osu.Game.Overlays.Mods
}
}
public void DeselectMod(Modes.Mods modName)
public void DeselectType(Type modType)
{
foreach (ModSection section in modSectionsContainer.Children)
{
@ -132,7 +132,7 @@ namespace osu.Game.Overlays.Mods
{
foreach (Mod mod in button.Mods)
{
if (mod.Name == modName)
if (modType.IsInstanceOfType(mod))
{
button.Deselect();
return;
@ -146,10 +146,8 @@ namespace osu.Game.Overlays.Mods
{
if (selectedMod != null)
{
foreach (Modes.Mods disableMod in selectedMod.DisablesMods)
{
DeselectMod(disableMod);
}
foreach (Type t in selectedMod.IncompatibleMods)
DeselectType(t);
}
refreshSelectedMods();