mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 14:46:38 +09:00
Add IMod and change ShortenedName to Acronym
This commit is contained in:
@ -120,7 +120,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
base.Ruleset = value;
|
||||
|
||||
// Evaluate the mod string
|
||||
Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray();
|
||||
Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.Acronym)).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
osu.Game/Rulesets/Mods/IMod.cs
Normal file
10
osu.Game/Rulesets/Mods/IMod.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public interface IMod
|
||||
{
|
||||
/// <summary>
|
||||
/// The shortened name of this mod.
|
||||
/// </summary>
|
||||
string Acronym { get; }
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
/// <summary>
|
||||
/// The base class for gameplay modifiers.
|
||||
/// </summary>
|
||||
public abstract class Mod : IJsonSerializable
|
||||
public abstract class Mod : IMod, IJsonSerializable
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of this mod.
|
||||
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
/// <summary>
|
||||
/// The shortened name of this mod.
|
||||
/// </summary>
|
||||
public abstract string ShortenedName { get; }
|
||||
public abstract string Acronym { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The icon of this mod.
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class ModAutoplay : Mod, IApplicableFailOverride
|
||||
{
|
||||
public override string Name => "Autoplay";
|
||||
public override string ShortenedName => "AT";
|
||||
public override string Acronym => "AT";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto;
|
||||
public override ModType Type => ModType.Automation;
|
||||
public override string Description => "Watch a perfect automated play through the song.";
|
||||
|
@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public class ModCinema : ModAutoplay
|
||||
{
|
||||
public override string Name => "Cinema";
|
||||
public override string ShortenedName => "CN";
|
||||
public override string Acronym => "CN";
|
||||
public override bool HasImplementation => false;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_cinema;
|
||||
public override string Description => "Watch the video without visual distractions.";
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class ModDaycore : ModHalfTime
|
||||
{
|
||||
public override string Name => "Daycore";
|
||||
public override string ShortenedName => "DC";
|
||||
public override string Acronym => "DC";
|
||||
public override FontAwesome Icon => FontAwesome.fa_question;
|
||||
public override string Description => "Whoaaaaa...";
|
||||
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class ModDoubleTime : Mod, IApplicableToClock
|
||||
{
|
||||
public override string Name => "Double Time";
|
||||
public override string ShortenedName => "DT";
|
||||
public override string Acronym => "DT";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override string Description => "Zoooooooooom...";
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class ModEasy : Mod, IApplicableToDifficulty
|
||||
{
|
||||
public override string Name => "Easy";
|
||||
public override string ShortenedName => "EZ";
|
||||
public override string Acronym => "EZ";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy;
|
||||
public override ModType Type => ModType.DifficultyReduction;
|
||||
public override double ScoreMultiplier => 0.5;
|
||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class ModFlashlight : Mod
|
||||
{
|
||||
public override string Name => "Flashlight";
|
||||
public override string ShortenedName => "FL";
|
||||
public override string Acronym => "FL";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override string Description => "Restricted view area.";
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class ModHalfTime : Mod, IApplicableToClock
|
||||
{
|
||||
public override string Name => "Half Time";
|
||||
public override string ShortenedName => "HT";
|
||||
public override string Acronym => "HT";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime;
|
||||
public override ModType Type => ModType.DifficultyReduction;
|
||||
public override string Description => "Less zoom...";
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class ModHardRock : Mod, IApplicableToDifficulty
|
||||
{
|
||||
public override string Name => "Hard Rock";
|
||||
public override string ShortenedName => "HR";
|
||||
public override string Acronym => "HR";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override string Description => "Everything just got a bit harder...";
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class ModHidden : Mod, IReadFromConfig, IApplicableToDrawableHitObjects
|
||||
{
|
||||
public override string Name => "Hidden";
|
||||
public override string ShortenedName => "HD";
|
||||
public override string Acronym => "HD";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override bool Ranked => true;
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class ModNightcore : ModDoubleTime
|
||||
{
|
||||
public override string Name => "Nightcore";
|
||||
public override string ShortenedName => "NC";
|
||||
public override string Acronym => "NC";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nightcore;
|
||||
public override string Description => "Uguuuuuuuu...";
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class ModNoFail : Mod, IApplicableFailOverride
|
||||
{
|
||||
public override string Name => "No Fail";
|
||||
public override string ShortenedName => "NF";
|
||||
public override string Acronym => "NF";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail;
|
||||
public override ModType Type => ModType.DifficultyReduction;
|
||||
public override string Description => "You can't fail, no matter what.";
|
||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class ModPerfect : ModSuddenDeath
|
||||
{
|
||||
public override string Name => "Perfect";
|
||||
public override string ShortenedName => "PF";
|
||||
public override string Acronym => "PF";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_perfect;
|
||||
public override string Description => "SS or quit.";
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class ModRelax : Mod
|
||||
{
|
||||
public override string Name => "Relax";
|
||||
public override string ShortenedName => "RX";
|
||||
public override string Acronym => "RX";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax;
|
||||
public override ModType Type => ModType.Automation;
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public abstract class ModSuddenDeath : Mod, IApplicableToScoreProcessor
|
||||
{
|
||||
public override string Name => "Sudden Death";
|
||||
public override string ShortenedName => "SD";
|
||||
public override string Acronym => "SD";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override string Description => "Miss and fail.";
|
||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public class MultiMod : Mod
|
||||
{
|
||||
public override string Name => string.Empty;
|
||||
public override string ShortenedName => string.Empty;
|
||||
public override string Acronym => string.Empty;
|
||||
public override string Description => string.Empty;
|
||||
public override double ScoreMultiplier => 0;
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public sealed class NoModMod : Mod
|
||||
{
|
||||
public override string Name => "No Mod";
|
||||
public override string ShortenedName => "NM";
|
||||
public override string Acronym => "NM";
|
||||
public override double ScoreMultiplier => 1;
|
||||
}
|
||||
}
|
||||
|
@ -53,19 +53,19 @@ namespace osu.Game.Scoring
|
||||
}
|
||||
set
|
||||
{
|
||||
modsJson = null;
|
||||
mods = value;
|
||||
ModsJson = null;
|
||||
}
|
||||
}
|
||||
|
||||
private Mod[] getModsFromRuleset(DeserializedMod[] mods) => Ruleset.CreateInstance().GetAllMods().Where(mod => mods.Any(d => d.ShortenedName == mod.ShortenedName)).ToArray();
|
||||
private Mod[] getModsFromRuleset(DeserializedMod[] mods) => Ruleset.CreateInstance().GetAllMods().Where(mod => mods.Any(d => d.Acronym == mod.Acronym)).ToArray();
|
||||
|
||||
private string modsJson;
|
||||
|
||||
[Column("Mods")]
|
||||
public string ModsJson
|
||||
{
|
||||
get => modsJson ?? JsonConvert.SerializeObject(Mods);
|
||||
get => modsJson ?? (modsJson = JsonConvert.SerializeObject(mods));
|
||||
set
|
||||
{
|
||||
modsJson = value;
|
||||
@ -121,11 +121,9 @@ namespace osu.Game.Scoring
|
||||
public bool DeletePending { get; set; }
|
||||
|
||||
[Serializable]
|
||||
protected class DeserializedMod : Mod
|
||||
protected class DeserializedMod : IMod
|
||||
{
|
||||
public override string Name { get; } = string.Empty;
|
||||
public override string ShortenedName { get; } = string.Empty;
|
||||
public override double ScoreMultiplier { get; } = 0;
|
||||
public string Acronym { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user