mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Fix unavailable rulesets crashing at song select
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using JetBrains.Annotations;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Rulesets
|
||||
@ -20,7 +21,13 @@ namespace osu.Game.Rulesets
|
||||
[JsonIgnore]
|
||||
public bool Available { get; set; }
|
||||
|
||||
public virtual Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo), this);
|
||||
[CanBeNull]
|
||||
public virtual Ruleset CreateInstance()
|
||||
{
|
||||
if (!Available) return null;
|
||||
|
||||
return (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo), this);
|
||||
}
|
||||
|
||||
public bool Equals(RulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo;
|
||||
|
||||
|
Reference in New Issue
Block a user