mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Use Ruleset
's ShortName
for mod caching purposes
This commit is contained in:
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets
|
|||||||
{
|
{
|
||||||
public RulesetInfo RulesetInfo { get; internal set; }
|
public RulesetInfo RulesetInfo { get; internal set; }
|
||||||
|
|
||||||
private static readonly ConcurrentDictionary<int, IMod[]> mod_reference_cache = new ConcurrentDictionary<int, IMod[]>();
|
private static readonly ConcurrentDictionary<string, IMod[]> mod_reference_cache = new ConcurrentDictionary<string, IMod[]>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A queryable source containing all available mods.
|
/// A queryable source containing all available mods.
|
||||||
@ -49,11 +49,8 @@ namespace osu.Game.Rulesets
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!(RulesetInfo.ID is int id))
|
if (!mod_reference_cache.TryGetValue(ShortName, out var mods))
|
||||||
return CreateAllMods();
|
mod_reference_cache[ShortName] = mods = CreateAllMods().Cast<IMod>().ToArray();
|
||||||
|
|
||||||
if (!mod_reference_cache.TryGetValue(id, out var mods))
|
|
||||||
mod_reference_cache[id] = mods = CreateAllMods().Cast<IMod>().ToArray();
|
|
||||||
|
|
||||||
return mods;
|
return mods;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user