49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Security;
|
|
|
|
namespace UnityEngine
|
|
{
|
|
// Token: 0x02000430 RID: 1072
|
|
internal class GUIStateObjects
|
|
{
|
|
// Token: 0x06003835 RID: 14389 RVA: 0x0006091C File Offset: 0x0005EB1C
|
|
[SecuritySafeCritical]
|
|
internal static object GetStateObject(Type t, int controlID)
|
|
{
|
|
object obj;
|
|
if (!GUIStateObjects.s_StateCache.TryGetValue(controlID, out obj) || obj.GetType() != t)
|
|
{
|
|
obj = Activator.CreateInstance(t);
|
|
GUIStateObjects.s_StateCache[controlID] = obj;
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
// Token: 0x06003836 RID: 14390 RVA: 0x00060968 File Offset: 0x0005EB68
|
|
internal static object QueryStateObject(Type t, int controlID)
|
|
{
|
|
object obj = GUIStateObjects.s_StateCache[controlID];
|
|
object obj2;
|
|
if (t.IsInstanceOfType(obj))
|
|
{
|
|
obj2 = obj;
|
|
}
|
|
else
|
|
{
|
|
obj2 = null;
|
|
}
|
|
return obj2;
|
|
}
|
|
|
|
// Token: 0x06003837 RID: 14391 RVA: 0x000609A0 File Offset: 0x0005EBA0
|
|
internal static void Tests_ClearObjects()
|
|
{
|
|
GUIStateObjects.s_StateCache.Clear();
|
|
}
|
|
|
|
// Token: 0x04000FB0 RID: 4016
|
|
private static Dictionary<int, object> s_StateCache = new Dictionary<int, object>();
|
|
}
|
|
}
|