scripts
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
namespace UnityEngine
|
||||
{
|
||||
// Token: 0x020003B8 RID: 952
|
||||
internal class AttributeHelperEngine
|
||||
{
|
||||
// Token: 0x060037A9 RID: 14249 RVA: 0x0005EB4C File Offset: 0x0005CD4C
|
||||
[RequiredByNativeCode]
|
||||
private static Type GetParentTypeDisallowingMultipleInclusion(Type type)
|
||||
{
|
||||
Stack<Type> stack = new Stack<Type>();
|
||||
while (type != null && type != typeof(MonoBehaviour))
|
||||
{
|
||||
stack.Push(type);
|
||||
type = type.BaseType;
|
||||
}
|
||||
while (stack.Count > 0)
|
||||
{
|
||||
Type type2 = stack.Pop();
|
||||
object[] customAttributes = type2.GetCustomAttributes(typeof(DisallowMultipleComponent), false);
|
||||
int num = customAttributes.Length;
|
||||
if (num != 0)
|
||||
{
|
||||
return type2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x060037AA RID: 14250 RVA: 0x0005EBD8 File Offset: 0x0005CDD8
|
||||
[RequiredByNativeCode]
|
||||
private static Type[] GetRequiredComponents(Type klass)
|
||||
{
|
||||
List<Type> list = null;
|
||||
while (klass != null && klass != typeof(MonoBehaviour))
|
||||
{
|
||||
RequireComponent[] array = (RequireComponent[])klass.GetCustomAttributes(typeof(RequireComponent), false);
|
||||
Type baseType = klass.BaseType;
|
||||
foreach (RequireComponent requireComponent in array)
|
||||
{
|
||||
if (list == null && array.Length == 1 && baseType == typeof(MonoBehaviour))
|
||||
{
|
||||
return new Type[] { requireComponent.m_Type0, requireComponent.m_Type1, requireComponent.m_Type2 };
|
||||
}
|
||||
if (list == null)
|
||||
{
|
||||
list = new List<Type>();
|
||||
}
|
||||
if (requireComponent.m_Type0 != null)
|
||||
{
|
||||
list.Add(requireComponent.m_Type0);
|
||||
}
|
||||
if (requireComponent.m_Type1 != null)
|
||||
{
|
||||
list.Add(requireComponent.m_Type1);
|
||||
}
|
||||
if (requireComponent.m_Type2 != null)
|
||||
{
|
||||
list.Add(requireComponent.m_Type2);
|
||||
}
|
||||
}
|
||||
klass = baseType;
|
||||
}
|
||||
if (list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
// Token: 0x060037AB RID: 14251 RVA: 0x0005ED08 File Offset: 0x0005CF08
|
||||
[RequiredByNativeCode]
|
||||
private static bool CheckIsEditorScript(Type klass)
|
||||
{
|
||||
while (klass != null && klass != typeof(MonoBehaviour))
|
||||
{
|
||||
object[] customAttributes = klass.GetCustomAttributes(typeof(ExecuteInEditMode), false);
|
||||
int num = customAttributes.Length;
|
||||
if (num != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
klass = klass.BaseType;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x060037AC RID: 14252 RVA: 0x0005ED68 File Offset: 0x0005CF68
|
||||
[RequiredByNativeCode]
|
||||
private static int GetDefaultExecutionOrderFor(Type klass)
|
||||
{
|
||||
DefaultExecutionOrder customAttributeOfType = AttributeHelperEngine.GetCustomAttributeOfType<DefaultExecutionOrder>(klass);
|
||||
int num;
|
||||
if (customAttributeOfType == null)
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = customAttributeOfType.order;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x060037AD RID: 14253 RVA: 0x0005ED98 File Offset: 0x0005CF98
|
||||
private static T GetCustomAttributeOfType<T>(Type klass) where T : Attribute
|
||||
{
|
||||
Type typeFromHandle = typeof(T);
|
||||
object[] customAttributes = klass.GetCustomAttributes(typeFromHandle, true);
|
||||
T t;
|
||||
if (customAttributes != null && customAttributes.Length != 0)
|
||||
{
|
||||
t = (T)((object)customAttributes[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
t = (T)((object)null);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user