mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Weaver IsNetworkBehaviour uses IsDerivedFrom
This commit is contained in:
parent
22c97de71a
commit
3f0d3af349
@ -1400,33 +1400,6 @@ static void SetupWriteFunctions()
|
||||
};
|
||||
}
|
||||
|
||||
static bool IsNetworkBehaviour(TypeDefinition td)
|
||||
{
|
||||
if (!td.IsClass)
|
||||
return false;
|
||||
|
||||
// are ANY parent classes NetworkBehaviours
|
||||
TypeReference parent = td.BaseType;
|
||||
while (parent != null)
|
||||
{
|
||||
if (parent.FullName == NetworkBehaviourType.FullName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
try
|
||||
{
|
||||
parent = parent.Resolve().BaseType;
|
||||
}
|
||||
catch (AssemblyResolutionException)
|
||||
{
|
||||
// this can happen for plugins.
|
||||
//Console.WriteLine("AssemblyResolutionException: "+ ex.ToString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsDerivedFrom(TypeDefinition td, TypeReference baseClass)
|
||||
{
|
||||
if (!td.IsClass)
|
||||
@ -1463,6 +1436,11 @@ public static bool IsDerivedFrom(TypeDefinition td, TypeReference baseClass)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsNetworkBehaviour(TypeDefinition td)
|
||||
{
|
||||
return IsDerivedFrom(td, NetworkBehaviourType);
|
||||
}
|
||||
|
||||
public static bool ImplementsInterface(TypeDefinition td, TypeReference baseInterface)
|
||||
{
|
||||
TypeDefinition typedef = td;
|
||||
|
Loading…
Reference in New Issue
Block a user