1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 12:53:11 +08:00

Make Mod IJsonSerializable

This commit is contained in:
smoogipoo 2018-11-28 13:12:29 +09:00
parent c5d2dc2f6a
commit ea52d2d527

View File

@ -3,17 +3,20 @@
using osu.Game.Graphics; using osu.Game.Graphics;
using System; using System;
using Newtonsoft.Json;
using osu.Game.IO.Serialization;
namespace osu.Game.Rulesets.Mods namespace osu.Game.Rulesets.Mods
{ {
/// <summary> /// <summary>
/// The base class for gameplay modifiers. /// The base class for gameplay modifiers.
/// </summary> /// </summary>
public abstract class Mod public abstract class Mod : IJsonSerializable
{ {
/// <summary> /// <summary>
/// The name of this mod. /// The name of this mod.
/// </summary> /// </summary>
[JsonIgnore]
public abstract string Name { get; } public abstract string Name { get; }
/// <summary> /// <summary>
@ -24,36 +27,43 @@ namespace osu.Game.Rulesets.Mods
/// <summary> /// <summary>
/// The icon of this mod. /// The icon of this mod.
/// </summary> /// </summary>
[JsonIgnore]
public virtual FontAwesome Icon => FontAwesome.fa_question; public virtual FontAwesome Icon => FontAwesome.fa_question;
/// <summary> /// <summary>
/// The type of this mod. /// The type of this mod.
/// </summary> /// </summary>
[JsonIgnore]
public virtual ModType Type => ModType.Fun; public virtual ModType Type => ModType.Fun;
/// <summary> /// <summary>
/// The user readable description of this mod. /// The user readable description of this mod.
/// </summary> /// </summary>
[JsonIgnore]
public virtual string Description => string.Empty; public virtual string Description => string.Empty;
/// <summary> /// <summary>
/// The score multiplier of this mod. /// The score multiplier of this mod.
/// </summary> /// </summary>
[JsonIgnore]
public abstract double ScoreMultiplier { get; } public abstract double ScoreMultiplier { get; }
/// <summary> /// <summary>
/// Returns true if this mod is implemented (and playable). /// Returns true if this mod is implemented (and playable).
/// </summary> /// </summary>
[JsonIgnore]
public virtual bool HasImplementation => this is IApplicableMod; public virtual bool HasImplementation => this is IApplicableMod;
/// <summary> /// <summary>
/// Returns if this mod is ranked. /// Returns if this mod is ranked.
/// </summary> /// </summary>
[JsonIgnore]
public virtual bool Ranked => false; public virtual bool Ranked => false;
/// <summary> /// <summary>
/// The mods this mod cannot be enabled with. /// The mods this mod cannot be enabled with.
/// </summary> /// </summary>
[JsonIgnore]
public virtual Type[] IncompatibleMods => new Type[] { }; public virtual Type[] IncompatibleMods => new Type[] { };
} }
} }