1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 16:27:26 +08:00

Copy ruleset info over default

This commit is contained in:
Dean Herbert 2019-12-24 16:05:20 +09:00
parent d87203857b
commit 5738267642

View File

@ -20,11 +20,17 @@ namespace osu.Game.Rulesets
[JsonIgnore]
public bool Available { get; set; }
// TODO: this should probably be moved to RulesetStore.
public virtual Ruleset CreateInstance()
{
if (!Available) return null;
return (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo));
var ruleset = (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo));
// overwrite the pre-populated RulesetInfo with a potentially database attached copy.
ruleset.RulesetInfo = this;
return ruleset;
}
public bool Equals(RulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo;