Use reflection for AllTypes until it's public

This commit is contained in:
Sinai 2022-02-07 22:12:18 +11:00
parent f6d0acab7b
commit df8522963e

View File

@ -1,4 +1,5 @@
using System; using HarmonyLib;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using UniverseLib; using UniverseLib;
using UniverseLib.UI; using UniverseLib.UI;
@ -64,9 +65,10 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
allowedTypes = ReflectionUtility.GetImplementationsOf(BaseType, allowAbstract, allowEnum, false); allowedTypes = ReflectionUtility.GetImplementationsOf(BaseType, allowAbstract, allowEnum, false);
else else
{ {
// TODO: Use direct reference. Will make AllTypes public in next release of UniverseLib
allowedTypes = new(); allowedTypes = new();
foreach (var entry in ReflectionUtility.AllTypes) foreach (var entry in (SortedDictionary<string, Type>)AccessTools.Field(typeof(ReflectionUtility), "AllTypes").GetValue(null))
allowedTypes.Add(entry.Value as Type); allowedTypes.Add(entry.Value);
} }
} }