private static Type FindType(Mod mod, string typeName)
        {
            if (string.IsNullOrEmpty(typeName))
            {
                return(null);
            }

            Type type;

            if (types.TryGetValue(typeName, out type))
            {
                return(type);
            }

            if ((type = mod.GetCompiledType(typeName)) == null && mod.ModInfo.Dependencies != null)
            {
                for (int i = 0; i < mod.ModInfo.Dependencies.Length; i++)
                {
                    ModDependency dependency = mod.ModInfo.Dependencies[i];
                    if (!dependency.IsOptional)
                    {
                        Mod target = ModManager.Instance.GetModFromName(dependency.Name);
                        if (target != null && (type = target.GetCompiledType(typeName)) != null)
                        {
                            break;
                        }
                    }
                }
            }

            return(types[typeName] = type);
        }
Esempio n. 2
0
        private static Type FindType(Mod mod, string typeName)
        {
            if (string.IsNullOrEmpty(typeName))
            {
                return(null);
            }

            Type type;

            if (types.TryGetValue(typeName, out type))
            {
                return(type);
            }

            return(types[typeName] = mod.GetCompiledType(typeName));
        }