This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
@@ -0,0 +1,33 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000021 RID: 33
public abstract class AbstractEventData
{
// Token: 0x06000094 RID: 148 RVA: 0x00003602 File Offset: 0x00001A02
public virtual void Reset()
{
this.m_Used = false;
}
// Token: 0x06000095 RID: 149 RVA: 0x0000360C File Offset: 0x00001A0C
public virtual void Use()
{
this.m_Used = true;
}
// Token: 0x17000021 RID: 33
// (get) Token: 0x06000096 RID: 150 RVA: 0x00003618 File Offset: 0x00001A18
public virtual bool used
{
get
{
return this.m_Used;
}
}
// Token: 0x0400005D RID: 93
protected bool m_Used;
}
}
@@ -0,0 +1,26 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000020 RID: 32
public class AxisEventData : BaseEventData
{
// Token: 0x0600008E RID: 142 RVA: 0x00003694 File Offset: 0x00001A94
public AxisEventData(EventSystem eventSystem)
: base(eventSystem)
{
this.moveVector = Vector2.zero;
this.moveDir = MoveDirection.None;
}
// Token: 0x1700001F RID: 31
// (get) Token: 0x0600008F RID: 143 RVA: 0x000036B0 File Offset: 0x00001AB0
// (set) Token: 0x06000090 RID: 144 RVA: 0x000036CA File Offset: 0x00001ACA
public Vector2 moveVector { get; set; }
// Token: 0x17000020 RID: 32
// (get) Token: 0x06000091 RID: 145 RVA: 0x000036D4 File Offset: 0x00001AD4
// (set) Token: 0x06000092 RID: 146 RVA: 0x000036EE File Offset: 0x00001AEE
public MoveDirection moveDir { get; set; }
}
}
@@ -0,0 +1,42 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000022 RID: 34
public class BaseEventData : AbstractEventData
{
// Token: 0x06000097 RID: 151 RVA: 0x00003633 File Offset: 0x00001A33
public BaseEventData(EventSystem eventSystem)
{
this.m_EventSystem = eventSystem;
}
// Token: 0x17000022 RID: 34
// (get) Token: 0x06000098 RID: 152 RVA: 0x00003644 File Offset: 0x00001A44
public BaseInputModule currentInputModule
{
get
{
return this.m_EventSystem.currentInputModule;
}
}
// Token: 0x17000023 RID: 35
// (get) Token: 0x06000099 RID: 153 RVA: 0x00003664 File Offset: 0x00001A64
// (set) Token: 0x0600009A RID: 154 RVA: 0x00003684 File Offset: 0x00001A84
public GameObject selectedObject
{
get
{
return this.m_EventSystem.currentSelectedGameObject;
}
set
{
this.m_EventSystem.SetSelectedGameObject(value, this);
}
}
// Token: 0x0400005E RID: 94
private readonly EventSystem m_EventSystem;
}
}
+134
View File
@@ -0,0 +1,134 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000026 RID: 38
public class BaseInput : UIBehaviour
{
// Token: 0x1700003A RID: 58
// (get) Token: 0x060000CA RID: 202 RVA: 0x00003C9C File Offset: 0x0000209C
public virtual string compositionString
{
get
{
return Input.compositionString;
}
}
// Token: 0x1700003B RID: 59
// (get) Token: 0x060000CB RID: 203 RVA: 0x00003CB8 File Offset: 0x000020B8
// (set) Token: 0x060000CC RID: 204 RVA: 0x00003CD2 File Offset: 0x000020D2
public virtual IMECompositionMode imeCompositionMode
{
get
{
return Input.imeCompositionMode;
}
set
{
Input.imeCompositionMode = value;
}
}
// Token: 0x1700003C RID: 60
// (get) Token: 0x060000CD RID: 205 RVA: 0x00003CDC File Offset: 0x000020DC
// (set) Token: 0x060000CE RID: 206 RVA: 0x00003CF6 File Offset: 0x000020F6
public virtual Vector2 compositionCursorPos
{
get
{
return Input.compositionCursorPos;
}
set
{
Input.compositionCursorPos = value;
}
}
// Token: 0x1700003D RID: 61
// (get) Token: 0x060000CF RID: 207 RVA: 0x00003D00 File Offset: 0x00002100
public virtual bool mousePresent
{
get
{
return Input.mousePresent;
}
}
// Token: 0x060000D0 RID: 208 RVA: 0x00003D1C File Offset: 0x0000211C
public virtual bool GetMouseButtonDown(int button)
{
return Input.GetMouseButtonDown(button);
}
// Token: 0x060000D1 RID: 209 RVA: 0x00003D38 File Offset: 0x00002138
public virtual bool GetMouseButtonUp(int button)
{
return Input.GetMouseButtonUp(button);
}
// Token: 0x060000D2 RID: 210 RVA: 0x00003D54 File Offset: 0x00002154
public virtual bool GetMouseButton(int button)
{
return Input.GetMouseButton(button);
}
// Token: 0x1700003E RID: 62
// (get) Token: 0x060000D3 RID: 211 RVA: 0x00003D70 File Offset: 0x00002170
public virtual Vector2 mousePosition
{
get
{
return Input.mousePosition;
}
}
// Token: 0x1700003F RID: 63
// (get) Token: 0x060000D4 RID: 212 RVA: 0x00003D90 File Offset: 0x00002190
public virtual Vector2 mouseScrollDelta
{
get
{
return Input.mouseScrollDelta;
}
}
// Token: 0x17000040 RID: 64
// (get) Token: 0x060000D5 RID: 213 RVA: 0x00003DAC File Offset: 0x000021AC
public virtual bool touchSupported
{
get
{
return Input.touchSupported;
}
}
// Token: 0x17000041 RID: 65
// (get) Token: 0x060000D6 RID: 214 RVA: 0x00003DC8 File Offset: 0x000021C8
public virtual int touchCount
{
get
{
return Input.touchCount;
}
}
// Token: 0x060000D7 RID: 215 RVA: 0x00003DE4 File Offset: 0x000021E4
public virtual Touch GetTouch(int index)
{
return Input.GetTouch(index);
}
// Token: 0x060000D8 RID: 216 RVA: 0x00003E00 File Offset: 0x00002200
public virtual float GetAxisRaw(string axisName)
{
return Input.GetAxisRaw(axisName);
}
// Token: 0x060000D9 RID: 217 RVA: 0x00003E1C File Offset: 0x0000221C
public virtual bool GetButtonDown(string buttonName)
{
return Input.GetButtonDown(buttonName);
}
}
}
@@ -0,0 +1,275 @@
using System;
using System.Collections.Generic;
namespace UnityEngine.EventSystems
{
// Token: 0x02000027 RID: 39
[RequireComponent(typeof(EventSystem))]
public abstract class BaseInputModule : UIBehaviour
{
// Token: 0x17000042 RID: 66
// (get) Token: 0x060000DB RID: 219 RVA: 0x00003E4C File Offset: 0x0000224C
public BaseInput input
{
get
{
BaseInput baseInput;
if (this.m_InputOverride != null)
{
baseInput = this.m_InputOverride;
}
else
{
if (this.m_DefaultInput == null)
{
BaseInput[] components = base.GetComponents<BaseInput>();
foreach (BaseInput baseInput2 in components)
{
if (baseInput2 != null && baseInput2.GetType() == typeof(BaseInput))
{
this.m_DefaultInput = baseInput2;
break;
}
}
if (this.m_DefaultInput == null)
{
this.m_DefaultInput = base.gameObject.AddComponent<BaseInput>();
}
}
baseInput = this.m_DefaultInput;
}
return baseInput;
}
}
// Token: 0x17000043 RID: 67
// (get) Token: 0x060000DC RID: 220 RVA: 0x00003F10 File Offset: 0x00002310
protected EventSystem eventSystem
{
get
{
return this.m_EventSystem;
}
}
// Token: 0x060000DD RID: 221 RVA: 0x00003F2B File Offset: 0x0000232B
protected override void OnEnable()
{
base.OnEnable();
this.m_EventSystem = base.GetComponent<EventSystem>();
this.m_EventSystem.UpdateModules();
}
// Token: 0x060000DE RID: 222 RVA: 0x00003F4B File Offset: 0x0000234B
protected override void OnDisable()
{
this.m_EventSystem.UpdateModules();
base.OnDisable();
}
// Token: 0x060000DF RID: 223
public abstract void Process();
// Token: 0x060000E0 RID: 224 RVA: 0x00003F60 File Offset: 0x00002360
protected static RaycastResult FindFirstRaycast(List<RaycastResult> candidates)
{
for (int i = 0; i < candidates.Count; i++)
{
if (!(candidates[i].gameObject == null))
{
return candidates[i];
}
}
return default(RaycastResult);
}
// Token: 0x060000E1 RID: 225 RVA: 0x00003FC4 File Offset: 0x000023C4
protected static MoveDirection DetermineMoveDirection(float x, float y)
{
return BaseInputModule.DetermineMoveDirection(x, y, 0.6f);
}
// Token: 0x060000E2 RID: 226 RVA: 0x00003FE8 File Offset: 0x000023E8
protected static MoveDirection DetermineMoveDirection(float x, float y, float deadZone)
{
Vector2 vector = new Vector2(x, y);
MoveDirection moveDirection;
if (vector.sqrMagnitude < deadZone * deadZone)
{
moveDirection = MoveDirection.None;
}
else if (Mathf.Abs(x) > Mathf.Abs(y))
{
if (x > 0f)
{
moveDirection = MoveDirection.Right;
}
else
{
moveDirection = MoveDirection.Left;
}
}
else if (y > 0f)
{
moveDirection = MoveDirection.Up;
}
else
{
moveDirection = MoveDirection.Down;
}
return moveDirection;
}
// Token: 0x060000E3 RID: 227 RVA: 0x0000405C File Offset: 0x0000245C
protected static GameObject FindCommonRoot(GameObject g1, GameObject g2)
{
GameObject gameObject;
if (g1 == null || g2 == null)
{
gameObject = null;
}
else
{
Transform transform = g1.transform;
while (transform != null)
{
Transform transform2 = g2.transform;
while (transform2 != null)
{
if (transform == transform2)
{
return transform.gameObject;
}
transform2 = transform2.parent;
}
transform = transform.parent;
}
gameObject = null;
}
return gameObject;
}
// Token: 0x060000E4 RID: 228 RVA: 0x000040EC File Offset: 0x000024EC
protected void HandlePointerExitAndEnter(PointerEventData currentPointerData, GameObject newEnterTarget)
{
if (newEnterTarget == null || currentPointerData.pointerEnter == null)
{
for (int i = 0; i < currentPointerData.hovered.Count; i++)
{
ExecuteEvents.Execute<IPointerExitHandler>(currentPointerData.hovered[i], currentPointerData, ExecuteEvents.pointerExitHandler);
}
currentPointerData.hovered.Clear();
if (newEnterTarget == null)
{
currentPointerData.pointerEnter = newEnterTarget;
return;
}
}
if (!(currentPointerData.pointerEnter == newEnterTarget) || !newEnterTarget)
{
GameObject gameObject = BaseInputModule.FindCommonRoot(currentPointerData.pointerEnter, newEnterTarget);
if (currentPointerData.pointerEnter != null)
{
Transform transform = currentPointerData.pointerEnter.transform;
while (transform != null)
{
if (gameObject != null && gameObject.transform == transform)
{
break;
}
ExecuteEvents.Execute<IPointerExitHandler>(transform.gameObject, currentPointerData, ExecuteEvents.pointerExitHandler);
currentPointerData.hovered.Remove(transform.gameObject);
transform = transform.parent;
}
}
currentPointerData.pointerEnter = newEnterTarget;
if (newEnterTarget != null)
{
Transform transform2 = newEnterTarget.transform;
while (transform2 != null && transform2.gameObject != gameObject)
{
ExecuteEvents.Execute<IPointerEnterHandler>(transform2.gameObject, currentPointerData, ExecuteEvents.pointerEnterHandler);
currentPointerData.hovered.Add(transform2.gameObject);
transform2 = transform2.parent;
}
}
}
}
// Token: 0x060000E5 RID: 229 RVA: 0x00004288 File Offset: 0x00002688
protected virtual AxisEventData GetAxisEventData(float x, float y, float moveDeadZone)
{
if (this.m_AxisEventData == null)
{
this.m_AxisEventData = new AxisEventData(this.eventSystem);
}
this.m_AxisEventData.Reset();
this.m_AxisEventData.moveVector = new Vector2(x, y);
this.m_AxisEventData.moveDir = BaseInputModule.DetermineMoveDirection(x, y, moveDeadZone);
return this.m_AxisEventData;
}
// Token: 0x060000E6 RID: 230 RVA: 0x000042F0 File Offset: 0x000026F0
protected virtual BaseEventData GetBaseEventData()
{
if (this.m_BaseEventData == null)
{
this.m_BaseEventData = new BaseEventData(this.eventSystem);
}
this.m_BaseEventData.Reset();
return this.m_BaseEventData;
}
// Token: 0x060000E7 RID: 231 RVA: 0x00004334 File Offset: 0x00002734
public virtual bool IsPointerOverGameObject(int pointerId)
{
return false;
}
// Token: 0x060000E8 RID: 232 RVA: 0x0000434C File Offset: 0x0000274C
public virtual bool ShouldActivateModule()
{
return base.enabled && base.gameObject.activeInHierarchy;
}
// Token: 0x060000E9 RID: 233 RVA: 0x0000437A File Offset: 0x0000277A
public virtual void DeactivateModule()
{
}
// Token: 0x060000EA RID: 234 RVA: 0x0000437D File Offset: 0x0000277D
public virtual void ActivateModule()
{
}
// Token: 0x060000EB RID: 235 RVA: 0x00004380 File Offset: 0x00002780
public virtual void UpdateModule()
{
}
// Token: 0x060000EC RID: 236 RVA: 0x00004384 File Offset: 0x00002784
public virtual bool IsModuleSupported()
{
return true;
}
// Token: 0x0400007D RID: 125
[NonSerialized]
protected List<RaycastResult> m_RaycastResultCache = new List<RaycastResult>();
// Token: 0x0400007E RID: 126
private AxisEventData m_AxisEventData;
// Token: 0x0400007F RID: 127
private EventSystem m_EventSystem;
// Token: 0x04000080 RID: 128
private BaseEventData m_BaseEventData;
// Token: 0x04000081 RID: 129
protected BaseInput m_InputOverride;
// Token: 0x04000082 RID: 130
private BaseInput m_DefaultInput;
}
}
@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
namespace UnityEngine.EventSystems
{
// Token: 0x0200002F RID: 47
public abstract class BaseRaycaster : UIBehaviour
{
// Token: 0x0600013E RID: 318
public abstract void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList);
// Token: 0x17000051 RID: 81
// (get) Token: 0x0600013F RID: 319
public abstract Camera eventCamera { get; }
// Token: 0x17000052 RID: 82
// (get) Token: 0x06000140 RID: 320 RVA: 0x00006098 File Offset: 0x00004498
[Obsolete("Please use sortOrderPriority and renderOrderPriority", false)]
public virtual int priority
{
get
{
return 0;
}
}
// Token: 0x17000053 RID: 83
// (get) Token: 0x06000141 RID: 321 RVA: 0x000060B0 File Offset: 0x000044B0
public virtual int sortOrderPriority
{
get
{
return int.MinValue;
}
}
// Token: 0x17000054 RID: 84
// (get) Token: 0x06000142 RID: 322 RVA: 0x000060CC File Offset: 0x000044CC
public virtual int renderOrderPriority
{
get
{
return int.MinValue;
}
}
// Token: 0x06000143 RID: 323 RVA: 0x000060E8 File Offset: 0x000044E8
public override string ToString()
{
return string.Concat(new object[] { "Name: ", base.gameObject, "\neventCamera: ", this.eventCamera, "\nsortOrderPriority: ", this.sortOrderPriority, "\nrenderOrderPriority: ", this.renderOrderPriority });
}
// Token: 0x06000144 RID: 324 RVA: 0x00006156 File Offset: 0x00004556
protected override void OnEnable()
{
base.OnEnable();
RaycasterManager.AddRaycaster(this);
}
// Token: 0x06000145 RID: 325 RVA: 0x00006165 File Offset: 0x00004565
protected override void OnDisable()
{
RaycasterManager.RemoveRaycasters(this);
base.OnDisable();
}
}
}
@@ -0,0 +1,14 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000002 RID: 2
[Flags]
public enum EventHandle
{
// Token: 0x04000002 RID: 2
Unused = 0,
// Token: 0x04000003 RID: 3
Used = 1
}
}
+403
View File
@@ -0,0 +1,403 @@
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine.Serialization;
namespace UnityEngine.EventSystems
{
// Token: 0x02000015 RID: 21
[AddComponentMenu("Event/Event System")]
public class EventSystem : UIBehaviour
{
// Token: 0x06000012 RID: 18 RVA: 0x000020B4 File Offset: 0x000004B4
protected EventSystem()
{
}
// Token: 0x17000001 RID: 1
// (get) Token: 0x06000013 RID: 19 RVA: 0x000020E0 File Offset: 0x000004E0
// (set) Token: 0x06000014 RID: 20 RVA: 0x000020F9 File Offset: 0x000004F9
public static EventSystem current { get; set; }
// Token: 0x17000002 RID: 2
// (get) Token: 0x06000015 RID: 21 RVA: 0x00002104 File Offset: 0x00000504
// (set) Token: 0x06000016 RID: 22 RVA: 0x0000211F File Offset: 0x0000051F
public bool sendNavigationEvents
{
get
{
return this.m_sendNavigationEvents;
}
set
{
this.m_sendNavigationEvents = value;
}
}
// Token: 0x17000003 RID: 3
// (get) Token: 0x06000017 RID: 23 RVA: 0x0000212C File Offset: 0x0000052C
// (set) Token: 0x06000018 RID: 24 RVA: 0x00002147 File Offset: 0x00000547
public int pixelDragThreshold
{
get
{
return this.m_DragThreshold;
}
set
{
this.m_DragThreshold = value;
}
}
// Token: 0x17000004 RID: 4
// (get) Token: 0x06000019 RID: 25 RVA: 0x00002154 File Offset: 0x00000554
public BaseInputModule currentInputModule
{
get
{
return this.m_CurrentInputModule;
}
}
// Token: 0x17000005 RID: 5
// (get) Token: 0x0600001A RID: 26 RVA: 0x00002170 File Offset: 0x00000570
// (set) Token: 0x0600001B RID: 27 RVA: 0x0000218B File Offset: 0x0000058B
public GameObject firstSelectedGameObject
{
get
{
return this.m_FirstSelected;
}
set
{
this.m_FirstSelected = value;
}
}
// Token: 0x17000006 RID: 6
// (get) Token: 0x0600001C RID: 28 RVA: 0x00002198 File Offset: 0x00000598
public GameObject currentSelectedGameObject
{
get
{
return this.m_CurrentSelected;
}
}
// Token: 0x17000007 RID: 7
// (get) Token: 0x0600001D RID: 29 RVA: 0x000021B4 File Offset: 0x000005B4
[Obsolete("lastSelectedGameObject is no longer supported")]
public GameObject lastSelectedGameObject
{
get
{
return null;
}
}
// Token: 0x17000008 RID: 8
// (get) Token: 0x0600001E RID: 30 RVA: 0x000021CC File Offset: 0x000005CC
public bool isFocused
{
get
{
return this.m_HasFocus;
}
}
// Token: 0x0600001F RID: 31 RVA: 0x000021E8 File Offset: 0x000005E8
public void UpdateModules()
{
base.GetComponents<BaseInputModule>(this.m_SystemInputModules);
for (int i = this.m_SystemInputModules.Count - 1; i >= 0; i--)
{
if (!this.m_SystemInputModules[i] || !this.m_SystemInputModules[i].IsActive())
{
this.m_SystemInputModules.RemoveAt(i);
}
}
}
// Token: 0x17000009 RID: 9
// (get) Token: 0x06000020 RID: 32 RVA: 0x00002260 File Offset: 0x00000660
public bool alreadySelecting
{
get
{
return this.m_SelectionGuard;
}
}
// Token: 0x06000021 RID: 33 RVA: 0x0000227C File Offset: 0x0000067C
public void SetSelectedGameObject(GameObject selected, BaseEventData pointer)
{
if (this.m_SelectionGuard)
{
Debug.LogError("Attempting to select " + selected + "while already selecting an object.");
}
else
{
this.m_SelectionGuard = true;
if (selected == this.m_CurrentSelected)
{
this.m_SelectionGuard = false;
}
else
{
ExecuteEvents.Execute<IDeselectHandler>(this.m_CurrentSelected, pointer, ExecuteEvents.deselectHandler);
this.m_CurrentSelected = selected;
ExecuteEvents.Execute<ISelectHandler>(this.m_CurrentSelected, pointer, ExecuteEvents.selectHandler);
this.m_SelectionGuard = false;
}
}
}
// Token: 0x1700000A RID: 10
// (get) Token: 0x06000022 RID: 34 RVA: 0x00002308 File Offset: 0x00000708
private BaseEventData baseEventDataCache
{
get
{
if (this.m_DummyData == null)
{
this.m_DummyData = new BaseEventData(this);
}
return this.m_DummyData;
}
}
// Token: 0x06000023 RID: 35 RVA: 0x0000233A File Offset: 0x0000073A
public void SetSelectedGameObject(GameObject selected)
{
this.SetSelectedGameObject(selected, this.baseEventDataCache);
}
// Token: 0x06000024 RID: 36 RVA: 0x0000234C File Offset: 0x0000074C
private static int RaycastComparer(RaycastResult lhs, RaycastResult rhs)
{
if (lhs.module != rhs.module)
{
if (lhs.module.eventCamera != null && rhs.module.eventCamera != null && lhs.module.eventCamera.depth != rhs.module.eventCamera.depth)
{
if (lhs.module.eventCamera.depth < rhs.module.eventCamera.depth)
{
return 1;
}
if (lhs.module.eventCamera.depth == rhs.module.eventCamera.depth)
{
return 0;
}
return -1;
}
else
{
if (lhs.module.sortOrderPriority != rhs.module.sortOrderPriority)
{
return rhs.module.sortOrderPriority.CompareTo(lhs.module.sortOrderPriority);
}
if (lhs.module.renderOrderPriority != rhs.module.renderOrderPriority)
{
return rhs.module.renderOrderPriority.CompareTo(lhs.module.renderOrderPriority);
}
}
}
int num;
if (lhs.sortingLayer != rhs.sortingLayer)
{
int layerValueFromID = SortingLayer.GetLayerValueFromID(rhs.sortingLayer);
int layerValueFromID2 = SortingLayer.GetLayerValueFromID(lhs.sortingLayer);
num = layerValueFromID.CompareTo(layerValueFromID2);
}
else if (lhs.sortingOrder != rhs.sortingOrder)
{
num = rhs.sortingOrder.CompareTo(lhs.sortingOrder);
}
else if (lhs.depth != rhs.depth)
{
num = rhs.depth.CompareTo(lhs.depth);
}
else if (lhs.distance != rhs.distance)
{
num = lhs.distance.CompareTo(rhs.distance);
}
else
{
num = lhs.index.CompareTo(rhs.index);
}
return num;
}
// Token: 0x06000025 RID: 37 RVA: 0x00002590 File Offset: 0x00000990
public void RaycastAll(PointerEventData eventData, List<RaycastResult> raycastResults)
{
raycastResults.Clear();
List<BaseRaycaster> raycasters = RaycasterManager.GetRaycasters();
for (int i = 0; i < raycasters.Count; i++)
{
BaseRaycaster baseRaycaster = raycasters[i];
if (!(baseRaycaster == null) && baseRaycaster.IsActive())
{
baseRaycaster.Raycast(eventData, raycastResults);
}
}
raycastResults.Sort(EventSystem.s_RaycastComparer);
}
// Token: 0x06000026 RID: 38 RVA: 0x000025FC File Offset: 0x000009FC
public bool IsPointerOverGameObject()
{
return this.IsPointerOverGameObject(-1);
}
// Token: 0x06000027 RID: 39 RVA: 0x00002618 File Offset: 0x00000A18
public bool IsPointerOverGameObject(int pointerId)
{
return !(this.m_CurrentInputModule == null) && this.m_CurrentInputModule.IsPointerOverGameObject(pointerId);
}
// Token: 0x06000028 RID: 40 RVA: 0x00002651 File Offset: 0x00000A51
protected override void OnEnable()
{
base.OnEnable();
if (EventSystem.current == null)
{
EventSystem.current = this;
}
}
// Token: 0x06000029 RID: 41 RVA: 0x00002670 File Offset: 0x00000A70
protected override void OnDisable()
{
if (this.m_CurrentInputModule != null)
{
this.m_CurrentInputModule.DeactivateModule();
this.m_CurrentInputModule = null;
}
if (EventSystem.current == this)
{
EventSystem.current = null;
}
base.OnDisable();
}
// Token: 0x0600002A RID: 42 RVA: 0x000026C0 File Offset: 0x00000AC0
private void TickModules()
{
for (int i = 0; i < this.m_SystemInputModules.Count; i++)
{
if (this.m_SystemInputModules[i] != null)
{
this.m_SystemInputModules[i].UpdateModule();
}
}
}
// Token: 0x0600002B RID: 43 RVA: 0x00002714 File Offset: 0x00000B14
protected virtual void OnApplicationFocus(bool hasFocus)
{
this.m_HasFocus = hasFocus;
}
// Token: 0x0600002C RID: 44 RVA: 0x00002720 File Offset: 0x00000B20
protected virtual void Update()
{
if (!(EventSystem.current != this))
{
this.TickModules();
bool flag = false;
for (int i = 0; i < this.m_SystemInputModules.Count; i++)
{
BaseInputModule baseInputModule = this.m_SystemInputModules[i];
if (baseInputModule.IsModuleSupported() && baseInputModule.ShouldActivateModule())
{
if (this.m_CurrentInputModule != baseInputModule)
{
this.ChangeEventModule(baseInputModule);
flag = true;
}
break;
}
}
if (this.m_CurrentInputModule == null)
{
for (int j = 0; j < this.m_SystemInputModules.Count; j++)
{
BaseInputModule baseInputModule2 = this.m_SystemInputModules[j];
if (baseInputModule2.IsModuleSupported())
{
this.ChangeEventModule(baseInputModule2);
flag = true;
break;
}
}
}
if (!flag && this.m_CurrentInputModule != null)
{
this.m_CurrentInputModule.Process();
}
}
}
// Token: 0x0600002D RID: 45 RVA: 0x0000282C File Offset: 0x00000C2C
private void ChangeEventModule(BaseInputModule module)
{
if (!(this.m_CurrentInputModule == module))
{
if (this.m_CurrentInputModule != null)
{
this.m_CurrentInputModule.DeactivateModule();
}
if (module != null)
{
module.ActivateModule();
}
this.m_CurrentInputModule = module;
}
}
// Token: 0x0600002E RID: 46 RVA: 0x00002888 File Offset: 0x00000C88
public override string ToString()
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("<b>Selected:</b>" + this.currentSelectedGameObject);
stringBuilder.AppendLine();
stringBuilder.AppendLine();
stringBuilder.AppendLine((!(this.m_CurrentInputModule != null)) ? "No module" : this.m_CurrentInputModule.ToString());
return stringBuilder.ToString();
}
// Token: 0x04000004 RID: 4
private List<BaseInputModule> m_SystemInputModules = new List<BaseInputModule>();
// Token: 0x04000005 RID: 5
private BaseInputModule m_CurrentInputModule;
// Token: 0x04000007 RID: 7
[SerializeField]
[FormerlySerializedAs("m_Selected")]
private GameObject m_FirstSelected;
// Token: 0x04000008 RID: 8
[SerializeField]
private bool m_sendNavigationEvents = true;
// Token: 0x04000009 RID: 9
[SerializeField]
private int m_DragThreshold = 5;
// Token: 0x0400000A RID: 10
private GameObject m_CurrentSelected;
// Token: 0x0400000B RID: 11
private bool m_HasFocus = true;
// Token: 0x0400000C RID: 12
private bool m_SelectionGuard;
// Token: 0x0400000D RID: 13
private BaseEventData m_DummyData;
// Token: 0x0400000E RID: 14
private static readonly Comparison<RaycastResult> s_RaycastComparer = new Comparison<RaycastResult>(EventSystem.RaycastComparer);
}
}
+180
View File
@@ -0,0 +1,180 @@
using System;
using System.Collections.Generic;
using UnityEngine.Events;
using UnityEngine.Serialization;
namespace UnityEngine.EventSystems
{
// Token: 0x02000016 RID: 22
[AddComponentMenu("Event/Event Trigger")]
public class EventTrigger : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler, IPointerUpHandler, IPointerClickHandler, IInitializePotentialDragHandler, IBeginDragHandler, IDragHandler, IEndDragHandler, IDropHandler, IScrollHandler, IUpdateSelectedHandler, ISelectHandler, IDeselectHandler, IMoveHandler, ISubmitHandler, ICancelHandler, IEventSystemHandler
{
// Token: 0x06000030 RID: 48 RVA: 0x0000291F File Offset: 0x00000D1F
protected EventTrigger()
{
}
// Token: 0x1700000B RID: 11
// (get) Token: 0x06000031 RID: 49 RVA: 0x00002928 File Offset: 0x00000D28
// (set) Token: 0x06000032 RID: 50 RVA: 0x00002959 File Offset: 0x00000D59
public List<EventTrigger.Entry> triggers
{
get
{
if (this.m_Delegates == null)
{
this.m_Delegates = new List<EventTrigger.Entry>();
}
return this.m_Delegates;
}
set
{
this.m_Delegates = value;
}
}
// Token: 0x06000033 RID: 51 RVA: 0x00002964 File Offset: 0x00000D64
private void Execute(EventTriggerType id, BaseEventData eventData)
{
int i = 0;
int count = this.triggers.Count;
while (i < count)
{
EventTrigger.Entry entry = this.triggers[i];
if (entry.eventID == id && entry.callback != null)
{
entry.callback.Invoke(eventData);
}
i++;
}
}
// Token: 0x06000034 RID: 52 RVA: 0x000029C2 File Offset: 0x00000DC2
public virtual void OnPointerEnter(PointerEventData eventData)
{
this.Execute(EventTriggerType.PointerEnter, eventData);
}
// Token: 0x06000035 RID: 53 RVA: 0x000029CD File Offset: 0x00000DCD
public virtual void OnPointerExit(PointerEventData eventData)
{
this.Execute(EventTriggerType.PointerExit, eventData);
}
// Token: 0x06000036 RID: 54 RVA: 0x000029D8 File Offset: 0x00000DD8
public virtual void OnDrag(PointerEventData eventData)
{
this.Execute(EventTriggerType.Drag, eventData);
}
// Token: 0x06000037 RID: 55 RVA: 0x000029E3 File Offset: 0x00000DE3
public virtual void OnDrop(PointerEventData eventData)
{
this.Execute(EventTriggerType.Drop, eventData);
}
// Token: 0x06000038 RID: 56 RVA: 0x000029EE File Offset: 0x00000DEE
public virtual void OnPointerDown(PointerEventData eventData)
{
this.Execute(EventTriggerType.PointerDown, eventData);
}
// Token: 0x06000039 RID: 57 RVA: 0x000029F9 File Offset: 0x00000DF9
public virtual void OnPointerUp(PointerEventData eventData)
{
this.Execute(EventTriggerType.PointerUp, eventData);
}
// Token: 0x0600003A RID: 58 RVA: 0x00002A04 File Offset: 0x00000E04
public virtual void OnPointerClick(PointerEventData eventData)
{
this.Execute(EventTriggerType.PointerClick, eventData);
}
// Token: 0x0600003B RID: 59 RVA: 0x00002A0F File Offset: 0x00000E0F
public virtual void OnSelect(BaseEventData eventData)
{
this.Execute(EventTriggerType.Select, eventData);
}
// Token: 0x0600003C RID: 60 RVA: 0x00002A1B File Offset: 0x00000E1B
public virtual void OnDeselect(BaseEventData eventData)
{
this.Execute(EventTriggerType.Deselect, eventData);
}
// Token: 0x0600003D RID: 61 RVA: 0x00002A27 File Offset: 0x00000E27
public virtual void OnScroll(PointerEventData eventData)
{
this.Execute(EventTriggerType.Scroll, eventData);
}
// Token: 0x0600003E RID: 62 RVA: 0x00002A32 File Offset: 0x00000E32
public virtual void OnMove(AxisEventData eventData)
{
this.Execute(EventTriggerType.Move, eventData);
}
// Token: 0x0600003F RID: 63 RVA: 0x00002A3E File Offset: 0x00000E3E
public virtual void OnUpdateSelected(BaseEventData eventData)
{
this.Execute(EventTriggerType.UpdateSelected, eventData);
}
// Token: 0x06000040 RID: 64 RVA: 0x00002A49 File Offset: 0x00000E49
public virtual void OnInitializePotentialDrag(PointerEventData eventData)
{
this.Execute(EventTriggerType.InitializePotentialDrag, eventData);
}
// Token: 0x06000041 RID: 65 RVA: 0x00002A55 File Offset: 0x00000E55
public virtual void OnBeginDrag(PointerEventData eventData)
{
this.Execute(EventTriggerType.BeginDrag, eventData);
}
// Token: 0x06000042 RID: 66 RVA: 0x00002A61 File Offset: 0x00000E61
public virtual void OnEndDrag(PointerEventData eventData)
{
this.Execute(EventTriggerType.EndDrag, eventData);
}
// Token: 0x06000043 RID: 67 RVA: 0x00002A6D File Offset: 0x00000E6D
public virtual void OnSubmit(BaseEventData eventData)
{
this.Execute(EventTriggerType.Submit, eventData);
}
// Token: 0x06000044 RID: 68 RVA: 0x00002A79 File Offset: 0x00000E79
public virtual void OnCancel(BaseEventData eventData)
{
this.Execute(EventTriggerType.Cancel, eventData);
}
// Token: 0x04000010 RID: 16
[FormerlySerializedAs("delegates")]
[SerializeField]
private List<EventTrigger.Entry> m_Delegates;
// Token: 0x04000011 RID: 17
[Obsolete("Please use triggers instead (UnityUpgradable) -> triggers", true)]
public List<EventTrigger.Entry> delegates;
// Token: 0x02000017 RID: 23
[Serializable]
public class TriggerEvent : UnityEvent<BaseEventData>
{
}
// Token: 0x02000018 RID: 24
[Serializable]
public class Entry
{
// Token: 0x04000012 RID: 18
public EventTriggerType eventID = EventTriggerType.PointerClick;
// Token: 0x04000013 RID: 19
public EventTrigger.TriggerEvent callback = new EventTrigger.TriggerEvent();
}
}
}
@@ -0,0 +1,43 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000019 RID: 25
public enum EventTriggerType
{
// Token: 0x04000015 RID: 21
PointerEnter,
// Token: 0x04000016 RID: 22
PointerExit,
// Token: 0x04000017 RID: 23
PointerDown,
// Token: 0x04000018 RID: 24
PointerUp,
// Token: 0x04000019 RID: 25
PointerClick,
// Token: 0x0400001A RID: 26
Drag,
// Token: 0x0400001B RID: 27
Drop,
// Token: 0x0400001C RID: 28
Scroll,
// Token: 0x0400001D RID: 29
UpdateSelected,
// Token: 0x0400001E RID: 30
Select,
// Token: 0x0400001F RID: 31
Deselect,
// Token: 0x04000020 RID: 32
Move,
// Token: 0x04000021 RID: 33
InitializePotentialDrag,
// Token: 0x04000022 RID: 34
BeginDrag,
// Token: 0x04000023 RID: 35
EndDrag,
// Token: 0x04000024 RID: 36
Submit,
// Token: 0x04000025 RID: 37
Cancel
}
}
@@ -0,0 +1,497 @@
using System;
using System.Collections.Generic;
using UnityEngine.UI;
namespace UnityEngine.EventSystems
{
// Token: 0x0200001A RID: 26
public static class ExecuteEvents
{
// Token: 0x06000047 RID: 71 RVA: 0x00002AA8 File Offset: 0x00000EA8
public static T ValidateEventData<T>(BaseEventData data) where T : class
{
if (!(data is T))
{
throw new ArgumentException(string.Format("Invalid type: {0} passed to event expecting {1}", data.GetType(), typeof(T)));
}
return data as T;
}
// Token: 0x06000048 RID: 72 RVA: 0x00002B07 File Offset: 0x00000F07
private static void Execute(IPointerEnterHandler handler, BaseEventData eventData)
{
handler.OnPointerEnter(ExecuteEvents.ValidateEventData<PointerEventData>(eventData));
}
// Token: 0x06000049 RID: 73 RVA: 0x00002B16 File Offset: 0x00000F16
private static void Execute(IPointerExitHandler handler, BaseEventData eventData)
{
handler.OnPointerExit(ExecuteEvents.ValidateEventData<PointerEventData>(eventData));
}
// Token: 0x0600004A RID: 74 RVA: 0x00002B25 File Offset: 0x00000F25
private static void Execute(IPointerDownHandler handler, BaseEventData eventData)
{
handler.OnPointerDown(ExecuteEvents.ValidateEventData<PointerEventData>(eventData));
}
// Token: 0x0600004B RID: 75 RVA: 0x00002B34 File Offset: 0x00000F34
private static void Execute(IPointerUpHandler handler, BaseEventData eventData)
{
handler.OnPointerUp(ExecuteEvents.ValidateEventData<PointerEventData>(eventData));
}
// Token: 0x0600004C RID: 76 RVA: 0x00002B43 File Offset: 0x00000F43
private static void Execute(IPointerClickHandler handler, BaseEventData eventData)
{
handler.OnPointerClick(ExecuteEvents.ValidateEventData<PointerEventData>(eventData));
}
// Token: 0x0600004D RID: 77 RVA: 0x00002B52 File Offset: 0x00000F52
private static void Execute(IInitializePotentialDragHandler handler, BaseEventData eventData)
{
handler.OnInitializePotentialDrag(ExecuteEvents.ValidateEventData<PointerEventData>(eventData));
}
// Token: 0x0600004E RID: 78 RVA: 0x00002B61 File Offset: 0x00000F61
private static void Execute(IBeginDragHandler handler, BaseEventData eventData)
{
handler.OnBeginDrag(ExecuteEvents.ValidateEventData<PointerEventData>(eventData));
}
// Token: 0x0600004F RID: 79 RVA: 0x00002B70 File Offset: 0x00000F70
private static void Execute(IDragHandler handler, BaseEventData eventData)
{
handler.OnDrag(ExecuteEvents.ValidateEventData<PointerEventData>(eventData));
}
// Token: 0x06000050 RID: 80 RVA: 0x00002B7F File Offset: 0x00000F7F
private static void Execute(IEndDragHandler handler, BaseEventData eventData)
{
handler.OnEndDrag(ExecuteEvents.ValidateEventData<PointerEventData>(eventData));
}
// Token: 0x06000051 RID: 81 RVA: 0x00002B8E File Offset: 0x00000F8E
private static void Execute(IDropHandler handler, BaseEventData eventData)
{
handler.OnDrop(ExecuteEvents.ValidateEventData<PointerEventData>(eventData));
}
// Token: 0x06000052 RID: 82 RVA: 0x00002B9D File Offset: 0x00000F9D
private static void Execute(IScrollHandler handler, BaseEventData eventData)
{
handler.OnScroll(ExecuteEvents.ValidateEventData<PointerEventData>(eventData));
}
// Token: 0x06000053 RID: 83 RVA: 0x00002BAC File Offset: 0x00000FAC
private static void Execute(IUpdateSelectedHandler handler, BaseEventData eventData)
{
handler.OnUpdateSelected(eventData);
}
// Token: 0x06000054 RID: 84 RVA: 0x00002BB6 File Offset: 0x00000FB6
private static void Execute(ISelectHandler handler, BaseEventData eventData)
{
handler.OnSelect(eventData);
}
// Token: 0x06000055 RID: 85 RVA: 0x00002BC0 File Offset: 0x00000FC0
private static void Execute(IDeselectHandler handler, BaseEventData eventData)
{
handler.OnDeselect(eventData);
}
// Token: 0x06000056 RID: 86 RVA: 0x00002BCA File Offset: 0x00000FCA
private static void Execute(IMoveHandler handler, BaseEventData eventData)
{
handler.OnMove(ExecuteEvents.ValidateEventData<AxisEventData>(eventData));
}
// Token: 0x06000057 RID: 87 RVA: 0x00002BD9 File Offset: 0x00000FD9
private static void Execute(ISubmitHandler handler, BaseEventData eventData)
{
handler.OnSubmit(eventData);
}
// Token: 0x06000058 RID: 88 RVA: 0x00002BE3 File Offset: 0x00000FE3
private static void Execute(ICancelHandler handler, BaseEventData eventData)
{
handler.OnCancel(eventData);
}
// Token: 0x1700000C RID: 12
// (get) Token: 0x06000059 RID: 89 RVA: 0x00002BF0 File Offset: 0x00000FF0
public static ExecuteEvents.EventFunction<IPointerEnterHandler> pointerEnterHandler
{
get
{
return ExecuteEvents.s_PointerEnterHandler;
}
}
// Token: 0x1700000D RID: 13
// (get) Token: 0x0600005A RID: 90 RVA: 0x00002C0C File Offset: 0x0000100C
public static ExecuteEvents.EventFunction<IPointerExitHandler> pointerExitHandler
{
get
{
return ExecuteEvents.s_PointerExitHandler;
}
}
// Token: 0x1700000E RID: 14
// (get) Token: 0x0600005B RID: 91 RVA: 0x00002C28 File Offset: 0x00001028
public static ExecuteEvents.EventFunction<IPointerDownHandler> pointerDownHandler
{
get
{
return ExecuteEvents.s_PointerDownHandler;
}
}
// Token: 0x1700000F RID: 15
// (get) Token: 0x0600005C RID: 92 RVA: 0x00002C44 File Offset: 0x00001044
public static ExecuteEvents.EventFunction<IPointerUpHandler> pointerUpHandler
{
get
{
return ExecuteEvents.s_PointerUpHandler;
}
}
// Token: 0x17000010 RID: 16
// (get) Token: 0x0600005D RID: 93 RVA: 0x00002C60 File Offset: 0x00001060
public static ExecuteEvents.EventFunction<IPointerClickHandler> pointerClickHandler
{
get
{
return ExecuteEvents.s_PointerClickHandler;
}
}
// Token: 0x17000011 RID: 17
// (get) Token: 0x0600005E RID: 94 RVA: 0x00002C7C File Offset: 0x0000107C
public static ExecuteEvents.EventFunction<IInitializePotentialDragHandler> initializePotentialDrag
{
get
{
return ExecuteEvents.s_InitializePotentialDragHandler;
}
}
// Token: 0x17000012 RID: 18
// (get) Token: 0x0600005F RID: 95 RVA: 0x00002C98 File Offset: 0x00001098
public static ExecuteEvents.EventFunction<IBeginDragHandler> beginDragHandler
{
get
{
return ExecuteEvents.s_BeginDragHandler;
}
}
// Token: 0x17000013 RID: 19
// (get) Token: 0x06000060 RID: 96 RVA: 0x00002CB4 File Offset: 0x000010B4
public static ExecuteEvents.EventFunction<IDragHandler> dragHandler
{
get
{
return ExecuteEvents.s_DragHandler;
}
}
// Token: 0x17000014 RID: 20
// (get) Token: 0x06000061 RID: 97 RVA: 0x00002CD0 File Offset: 0x000010D0
public static ExecuteEvents.EventFunction<IEndDragHandler> endDragHandler
{
get
{
return ExecuteEvents.s_EndDragHandler;
}
}
// Token: 0x17000015 RID: 21
// (get) Token: 0x06000062 RID: 98 RVA: 0x00002CEC File Offset: 0x000010EC
public static ExecuteEvents.EventFunction<IDropHandler> dropHandler
{
get
{
return ExecuteEvents.s_DropHandler;
}
}
// Token: 0x17000016 RID: 22
// (get) Token: 0x06000063 RID: 99 RVA: 0x00002D08 File Offset: 0x00001108
public static ExecuteEvents.EventFunction<IScrollHandler> scrollHandler
{
get
{
return ExecuteEvents.s_ScrollHandler;
}
}
// Token: 0x17000017 RID: 23
// (get) Token: 0x06000064 RID: 100 RVA: 0x00002D24 File Offset: 0x00001124
public static ExecuteEvents.EventFunction<IUpdateSelectedHandler> updateSelectedHandler
{
get
{
return ExecuteEvents.s_UpdateSelectedHandler;
}
}
// Token: 0x17000018 RID: 24
// (get) Token: 0x06000065 RID: 101 RVA: 0x00002D40 File Offset: 0x00001140
public static ExecuteEvents.EventFunction<ISelectHandler> selectHandler
{
get
{
return ExecuteEvents.s_SelectHandler;
}
}
// Token: 0x17000019 RID: 25
// (get) Token: 0x06000066 RID: 102 RVA: 0x00002D5C File Offset: 0x0000115C
public static ExecuteEvents.EventFunction<IDeselectHandler> deselectHandler
{
get
{
return ExecuteEvents.s_DeselectHandler;
}
}
// Token: 0x1700001A RID: 26
// (get) Token: 0x06000067 RID: 103 RVA: 0x00002D78 File Offset: 0x00001178
public static ExecuteEvents.EventFunction<IMoveHandler> moveHandler
{
get
{
return ExecuteEvents.s_MoveHandler;
}
}
// Token: 0x1700001B RID: 27
// (get) Token: 0x06000068 RID: 104 RVA: 0x00002D94 File Offset: 0x00001194
public static ExecuteEvents.EventFunction<ISubmitHandler> submitHandler
{
get
{
return ExecuteEvents.s_SubmitHandler;
}
}
// Token: 0x1700001C RID: 28
// (get) Token: 0x06000069 RID: 105 RVA: 0x00002DB0 File Offset: 0x000011B0
public static ExecuteEvents.EventFunction<ICancelHandler> cancelHandler
{
get
{
return ExecuteEvents.s_CancelHandler;
}
}
// Token: 0x0600006A RID: 106 RVA: 0x00002DCC File Offset: 0x000011CC
private static void GetEventChain(GameObject root, IList<Transform> eventChain)
{
eventChain.Clear();
if (!(root == null))
{
Transform transform = root.transform;
while (transform != null)
{
eventChain.Add(transform);
transform = transform.parent;
}
}
}
// Token: 0x0600006B RID: 107 RVA: 0x00002E1C File Offset: 0x0000121C
public static bool Execute<T>(GameObject target, BaseEventData eventData, ExecuteEvents.EventFunction<T> functor) where T : IEventSystemHandler
{
List<IEventSystemHandler> list = ExecuteEvents.s_HandlerListPool.Get();
ExecuteEvents.GetEventList<T>(target, list);
int i = 0;
while (i < list.Count)
{
T t;
try
{
t = (T)((object)list[i]);
}
catch (Exception ex)
{
IEventSystemHandler eventSystemHandler = list[i];
Debug.LogException(new Exception(string.Format("Type {0} expected {1} received.", typeof(T).Name, eventSystemHandler.GetType().Name), ex));
goto IL_8F;
}
goto Block_2;
IL_8F:
i++;
continue;
Block_2:
try
{
functor(t, eventData);
}
catch (Exception ex2)
{
Debug.LogException(ex2);
}
goto IL_8F;
}
int count = list.Count;
ExecuteEvents.s_HandlerListPool.Release(list);
return count > 0;
}
// Token: 0x0600006C RID: 108 RVA: 0x00002F08 File Offset: 0x00001308
public static GameObject ExecuteHierarchy<T>(GameObject root, BaseEventData eventData, ExecuteEvents.EventFunction<T> callbackFunction) where T : IEventSystemHandler
{
ExecuteEvents.GetEventChain(root, ExecuteEvents.s_InternalTransformList);
for (int i = 0; i < ExecuteEvents.s_InternalTransformList.Count; i++)
{
Transform transform = ExecuteEvents.s_InternalTransformList[i];
if (ExecuteEvents.Execute<T>(transform.gameObject, eventData, callbackFunction))
{
return transform.gameObject;
}
}
return null;
}
// Token: 0x0600006D RID: 109 RVA: 0x00002F70 File Offset: 0x00001370
private static bool ShouldSendToComponent<T>(Component component) where T : IEventSystemHandler
{
bool flag;
if (!(component is T))
{
flag = false;
}
else
{
Behaviour behaviour = component as Behaviour;
flag = !(behaviour != null) || behaviour.isActiveAndEnabled;
}
return flag;
}
// Token: 0x0600006E RID: 110 RVA: 0x00002FBC File Offset: 0x000013BC
private static void GetEventList<T>(GameObject go, IList<IEventSystemHandler> results) where T : IEventSystemHandler
{
if (results == null)
{
throw new ArgumentException("Results array is null", "results");
}
if (!(go == null) && go.activeInHierarchy)
{
List<Component> list = ListPool<Component>.Get();
go.GetComponents<Component>(list);
for (int i = 0; i < list.Count; i++)
{
if (ExecuteEvents.ShouldSendToComponent<T>(list[i]))
{
results.Add(list[i] as IEventSystemHandler);
}
}
ListPool<Component>.Release(list);
}
}
// Token: 0x0600006F RID: 111 RVA: 0x00003050 File Offset: 0x00001450
public static bool CanHandleEvent<T>(GameObject go) where T : IEventSystemHandler
{
List<IEventSystemHandler> list = ExecuteEvents.s_HandlerListPool.Get();
ExecuteEvents.GetEventList<T>(go, list);
int count = list.Count;
ExecuteEvents.s_HandlerListPool.Release(list);
return count != 0;
}
// Token: 0x06000070 RID: 112 RVA: 0x00003090 File Offset: 0x00001490
public static GameObject GetEventHandler<T>(GameObject root) where T : IEventSystemHandler
{
GameObject gameObject;
if (root == null)
{
gameObject = null;
}
else
{
Transform transform = root.transform;
while (transform != null)
{
if (ExecuteEvents.CanHandleEvent<T>(transform.gameObject))
{
return transform.gameObject;
}
transform = transform.parent;
}
gameObject = null;
}
return gameObject;
}
// Token: 0x04000026 RID: 38
private static readonly ExecuteEvents.EventFunction<IPointerEnterHandler> s_PointerEnterHandler = new ExecuteEvents.EventFunction<IPointerEnterHandler>(ExecuteEvents.Execute);
// Token: 0x04000027 RID: 39
private static readonly ExecuteEvents.EventFunction<IPointerExitHandler> s_PointerExitHandler = new ExecuteEvents.EventFunction<IPointerExitHandler>(ExecuteEvents.Execute);
// Token: 0x04000028 RID: 40
private static readonly ExecuteEvents.EventFunction<IPointerDownHandler> s_PointerDownHandler = new ExecuteEvents.EventFunction<IPointerDownHandler>(ExecuteEvents.Execute);
// Token: 0x04000029 RID: 41
private static readonly ExecuteEvents.EventFunction<IPointerUpHandler> s_PointerUpHandler = new ExecuteEvents.EventFunction<IPointerUpHandler>(ExecuteEvents.Execute);
// Token: 0x0400002A RID: 42
private static readonly ExecuteEvents.EventFunction<IPointerClickHandler> s_PointerClickHandler = new ExecuteEvents.EventFunction<IPointerClickHandler>(ExecuteEvents.Execute);
// Token: 0x0400002B RID: 43
private static readonly ExecuteEvents.EventFunction<IInitializePotentialDragHandler> s_InitializePotentialDragHandler = new ExecuteEvents.EventFunction<IInitializePotentialDragHandler>(ExecuteEvents.Execute);
// Token: 0x0400002C RID: 44
private static readonly ExecuteEvents.EventFunction<IBeginDragHandler> s_BeginDragHandler = new ExecuteEvents.EventFunction<IBeginDragHandler>(ExecuteEvents.Execute);
// Token: 0x0400002D RID: 45
private static readonly ExecuteEvents.EventFunction<IDragHandler> s_DragHandler = new ExecuteEvents.EventFunction<IDragHandler>(ExecuteEvents.Execute);
// Token: 0x0400002E RID: 46
private static readonly ExecuteEvents.EventFunction<IEndDragHandler> s_EndDragHandler = new ExecuteEvents.EventFunction<IEndDragHandler>(ExecuteEvents.Execute);
// Token: 0x0400002F RID: 47
private static readonly ExecuteEvents.EventFunction<IDropHandler> s_DropHandler = new ExecuteEvents.EventFunction<IDropHandler>(ExecuteEvents.Execute);
// Token: 0x04000030 RID: 48
private static readonly ExecuteEvents.EventFunction<IScrollHandler> s_ScrollHandler = new ExecuteEvents.EventFunction<IScrollHandler>(ExecuteEvents.Execute);
// Token: 0x04000031 RID: 49
private static readonly ExecuteEvents.EventFunction<IUpdateSelectedHandler> s_UpdateSelectedHandler = new ExecuteEvents.EventFunction<IUpdateSelectedHandler>(ExecuteEvents.Execute);
// Token: 0x04000032 RID: 50
private static readonly ExecuteEvents.EventFunction<ISelectHandler> s_SelectHandler = new ExecuteEvents.EventFunction<ISelectHandler>(ExecuteEvents.Execute);
// Token: 0x04000033 RID: 51
private static readonly ExecuteEvents.EventFunction<IDeselectHandler> s_DeselectHandler = new ExecuteEvents.EventFunction<IDeselectHandler>(ExecuteEvents.Execute);
// Token: 0x04000034 RID: 52
private static readonly ExecuteEvents.EventFunction<IMoveHandler> s_MoveHandler = new ExecuteEvents.EventFunction<IMoveHandler>(ExecuteEvents.Execute);
// Token: 0x04000035 RID: 53
private static readonly ExecuteEvents.EventFunction<ISubmitHandler> s_SubmitHandler = new ExecuteEvents.EventFunction<ISubmitHandler>(ExecuteEvents.Execute);
// Token: 0x04000036 RID: 54
private static readonly ExecuteEvents.EventFunction<ICancelHandler> s_CancelHandler = new ExecuteEvents.EventFunction<ICancelHandler>(ExecuteEvents.Execute);
// Token: 0x04000037 RID: 55
private static readonly ObjectPool<List<IEventSystemHandler>> s_HandlerListPool = new ObjectPool<List<IEventSystemHandler>>(null, delegate(List<IEventSystemHandler> l)
{
l.Clear();
});
// Token: 0x04000038 RID: 56
private static readonly List<Transform> s_InternalTransformList = new List<Transform>(30);
// Token: 0x0200001B RID: 27
// (Invoke) Token: 0x06000074 RID: 116
public delegate void EventFunction<T1>(T1 handler, BaseEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000009 RID: 9
public interface IBeginDragHandler : IEventSystemHandler
{
// Token: 0x06000006 RID: 6
void OnBeginDrag(PointerEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000014 RID: 20
public interface ICancelHandler : IEventSystemHandler
{
// Token: 0x06000011 RID: 17
void OnCancel(BaseEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000011 RID: 17
public interface IDeselectHandler : IEventSystemHandler
{
// Token: 0x0600000E RID: 14
void OnDeselect(BaseEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x0200000B RID: 11
public interface IDragHandler : IEventSystemHandler
{
// Token: 0x06000008 RID: 8
void OnDrag(PointerEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x0200000D RID: 13
public interface IDropHandler : IEventSystemHandler
{
// Token: 0x0600000A RID: 10
void OnDrop(PointerEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x0200000C RID: 12
public interface IEndDragHandler : IEventSystemHandler
{
// Token: 0x06000009 RID: 9
void OnEndDrag(PointerEventData eventData);
}
}
@@ -0,0 +1,9 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000003 RID: 3
public interface IEventSystemHandler
{
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x0200000A RID: 10
public interface IInitializePotentialDragHandler : IEventSystemHandler
{
// Token: 0x06000007 RID: 7
void OnInitializePotentialDrag(PointerEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000012 RID: 18
public interface IMoveHandler : IEventSystemHandler
{
// Token: 0x0600000F RID: 15
void OnMove(AxisEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000008 RID: 8
public interface IPointerClickHandler : IEventSystemHandler
{
// Token: 0x06000005 RID: 5
void OnPointerClick(PointerEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000006 RID: 6
public interface IPointerDownHandler : IEventSystemHandler
{
// Token: 0x06000003 RID: 3
void OnPointerDown(PointerEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000004 RID: 4
public interface IPointerEnterHandler : IEventSystemHandler
{
// Token: 0x06000001 RID: 1
void OnPointerEnter(PointerEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000005 RID: 5
public interface IPointerExitHandler : IEventSystemHandler
{
// Token: 0x06000002 RID: 2
void OnPointerExit(PointerEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000007 RID: 7
public interface IPointerUpHandler : IEventSystemHandler
{
// Token: 0x06000004 RID: 4
void OnPointerUp(PointerEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x0200000E RID: 14
public interface IScrollHandler : IEventSystemHandler
{
// Token: 0x0600000B RID: 11
void OnScroll(PointerEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000010 RID: 16
public interface ISelectHandler : IEventSystemHandler
{
// Token: 0x0600000D RID: 13
void OnSelect(BaseEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x02000013 RID: 19
public interface ISubmitHandler : IEventSystemHandler
{
// Token: 0x06000010 RID: 16
void OnSubmit(BaseEventData eventData);
}
}
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x0200000F RID: 15
public interface IUpdateSelectedHandler : IEventSystemHandler
{
// Token: 0x0600000C RID: 12
void OnUpdateSelected(BaseEventData eventData);
}
}
@@ -0,0 +1,19 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x0200001C RID: 28
public enum MoveDirection
{
// Token: 0x0400004B RID: 75
Left,
// Token: 0x0400004C RID: 76
Up,
// Token: 0x0400004D RID: 77
Right,
// Token: 0x0400004E RID: 78
Down,
// Token: 0x0400004F RID: 79
None
}
}
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using UnityEngine.UI;
namespace UnityEngine.EventSystems
{
// Token: 0x02000030 RID: 48
[AddComponentMenu("Event/Physics 2D Raycaster")]
[RequireComponent(typeof(Camera))]
public class Physics2DRaycaster : PhysicsRaycaster
{
// Token: 0x06000146 RID: 326 RVA: 0x00006482 File Offset: 0x00004882
protected Physics2DRaycaster()
{
}
// Token: 0x06000147 RID: 327 RVA: 0x0000648C File Offset: 0x0000488C
public override void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList)
{
if (!(this.eventCamera == null))
{
Ray ray;
float num;
base.ComputeRayAndDistance(eventData, out ray, out num);
if (ReflectionMethodsCache.Singleton.getRayIntersectionAll != null)
{
RaycastHit2D[] array = ReflectionMethodsCache.Singleton.getRayIntersectionAll(ray, num, base.finalEventMask);
if (array.Length != 0)
{
int i = 0;
int num2 = array.Length;
while (i < num2)
{
SpriteRenderer component = array[i].collider.gameObject.GetComponent<SpriteRenderer>();
RaycastResult raycastResult = new RaycastResult
{
gameObject = array[i].collider.gameObject,
module = this,
distance = Vector3.Distance(this.eventCamera.transform.position, array[i].point),
worldPosition = array[i].point,
worldNormal = array[i].normal,
screenPosition = eventData.position,
index = (float)resultAppendList.Count,
sortingLayer = ((!(component != null)) ? 0 : component.sortingLayerID),
sortingOrder = ((!(component != null)) ? 0 : component.sortingOrder)
};
resultAppendList.Add(raycastResult);
i++;
}
}
}
}
}
}
}
@@ -0,0 +1,125 @@
using System;
using System.Collections.Generic;
using UnityEngine.UI;
namespace UnityEngine.EventSystems
{
// Token: 0x02000031 RID: 49
[AddComponentMenu("Event/Physics Raycaster")]
[RequireComponent(typeof(Camera))]
public class PhysicsRaycaster : BaseRaycaster
{
// Token: 0x06000148 RID: 328 RVA: 0x00006174 File Offset: 0x00004574
protected PhysicsRaycaster()
{
}
// Token: 0x17000055 RID: 85
// (get) Token: 0x06000149 RID: 329 RVA: 0x0000618C File Offset: 0x0000458C
public override Camera eventCamera
{
get
{
if (this.m_EventCamera == null)
{
this.m_EventCamera = base.GetComponent<Camera>();
}
return this.m_EventCamera ?? Camera.main;
}
}
// Token: 0x17000056 RID: 86
// (get) Token: 0x0600014A RID: 330 RVA: 0x000061D0 File Offset: 0x000045D0
public virtual int depth
{
get
{
return (!(this.eventCamera != null)) ? 16777215 : ((int)this.eventCamera.depth);
}
}
// Token: 0x17000057 RID: 87
// (get) Token: 0x0600014B RID: 331 RVA: 0x0000620C File Offset: 0x0000460C
public int finalEventMask
{
get
{
return (!(this.eventCamera != null)) ? (-1) : (this.eventCamera.cullingMask & this.m_EventMask);
}
}
// Token: 0x17000058 RID: 88
// (get) Token: 0x0600014C RID: 332 RVA: 0x00006250 File Offset: 0x00004650
// (set) Token: 0x0600014D RID: 333 RVA: 0x0000626B File Offset: 0x0000466B
public LayerMask eventMask
{
get
{
return this.m_EventMask;
}
set
{
this.m_EventMask = value;
}
}
// Token: 0x0600014E RID: 334 RVA: 0x00006278 File Offset: 0x00004678
protected void ComputeRayAndDistance(PointerEventData eventData, out Ray ray, out float distanceToClipPlane)
{
ray = this.eventCamera.ScreenPointToRay(eventData.position);
float z = ray.direction.z;
distanceToClipPlane = ((!Mathf.Approximately(0f, z)) ? Mathf.Abs((this.eventCamera.farClipPlane - this.eventCamera.nearClipPlane) / z) : float.PositiveInfinity);
}
// Token: 0x0600014F RID: 335 RVA: 0x000062EC File Offset: 0x000046EC
public override void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList)
{
if (!(this.eventCamera == null) && this.eventCamera.pixelRect.Contains(eventData.position))
{
Ray ray;
float num;
this.ComputeRayAndDistance(eventData, out ray, out num);
if (ReflectionMethodsCache.Singleton.raycast3DAll != null)
{
RaycastHit[] array = ReflectionMethodsCache.Singleton.raycast3DAll(ray, num, this.finalEventMask);
if (array.Length > 1)
{
Array.Sort<RaycastHit>(array, (RaycastHit r1, RaycastHit r2) => r1.distance.CompareTo(r2.distance));
}
if (array.Length != 0)
{
int i = 0;
int num2 = array.Length;
while (i < num2)
{
RaycastResult raycastResult = new RaycastResult
{
gameObject = array[i].collider.gameObject,
module = this,
distance = array[i].distance,
worldPosition = array[i].point,
worldNormal = array[i].normal,
screenPosition = eventData.position,
index = (float)resultAppendList.Count,
sortingLayer = 0,
sortingOrder = 0
};
resultAppendList.Add(raycastResult);
i++;
}
}
}
}
}
// Token: 0x040000A1 RID: 161
protected const int kNoEventMaskSet = -1;
// Token: 0x040000A2 RID: 162
protected Camera m_EventCamera;
// Token: 0x040000A3 RID: 163
[SerializeField]
protected LayerMask m_EventMask = -1;
}
}
@@ -0,0 +1,224 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace UnityEngine.EventSystems
{
// Token: 0x02000023 RID: 35
public class PointerEventData : BaseEventData
{
// Token: 0x0600009B RID: 155 RVA: 0x000036F8 File Offset: 0x00001AF8
public PointerEventData(EventSystem eventSystem)
: base(eventSystem)
{
this.eligibleForClick = false;
this.pointerId = -1;
this.position = Vector2.zero;
this.delta = Vector2.zero;
this.pressPosition = Vector2.zero;
this.clickTime = 0f;
this.clickCount = 0;
this.scrollDelta = Vector2.zero;
this.useDragThreshold = true;
this.dragging = false;
this.button = PointerEventData.InputButton.Left;
}
// Token: 0x17000024 RID: 36
// (get) Token: 0x0600009C RID: 156 RVA: 0x0000377C File Offset: 0x00001B7C
// (set) Token: 0x0600009D RID: 157 RVA: 0x00003796 File Offset: 0x00001B96
public GameObject pointerEnter { get; set; }
// Token: 0x17000025 RID: 37
// (get) Token: 0x0600009E RID: 158 RVA: 0x000037A0 File Offset: 0x00001BA0
// (set) Token: 0x0600009F RID: 159 RVA: 0x000037BA File Offset: 0x00001BBA
public GameObject lastPress { get; private set; }
// Token: 0x17000026 RID: 38
// (get) Token: 0x060000A0 RID: 160 RVA: 0x000037C4 File Offset: 0x00001BC4
// (set) Token: 0x060000A1 RID: 161 RVA: 0x000037DE File Offset: 0x00001BDE
public GameObject rawPointerPress { get; set; }
// Token: 0x17000027 RID: 39
// (get) Token: 0x060000A2 RID: 162 RVA: 0x000037E8 File Offset: 0x00001BE8
// (set) Token: 0x060000A3 RID: 163 RVA: 0x00003802 File Offset: 0x00001C02
public GameObject pointerDrag { get; set; }
// Token: 0x17000028 RID: 40
// (get) Token: 0x060000A4 RID: 164 RVA: 0x0000380C File Offset: 0x00001C0C
// (set) Token: 0x060000A5 RID: 165 RVA: 0x00003826 File Offset: 0x00001C26
public RaycastResult pointerCurrentRaycast { get; set; }
// Token: 0x17000029 RID: 41
// (get) Token: 0x060000A6 RID: 166 RVA: 0x00003830 File Offset: 0x00001C30
// (set) Token: 0x060000A7 RID: 167 RVA: 0x0000384A File Offset: 0x00001C4A
public RaycastResult pointerPressRaycast { get; set; }
// Token: 0x1700002A RID: 42
// (get) Token: 0x060000A8 RID: 168 RVA: 0x00003854 File Offset: 0x00001C54
// (set) Token: 0x060000A9 RID: 169 RVA: 0x0000386E File Offset: 0x00001C6E
public bool eligibleForClick { get; set; }
// Token: 0x1700002B RID: 43
// (get) Token: 0x060000AA RID: 170 RVA: 0x00003878 File Offset: 0x00001C78
// (set) Token: 0x060000AB RID: 171 RVA: 0x00003892 File Offset: 0x00001C92
public int pointerId { get; set; }
// Token: 0x1700002C RID: 44
// (get) Token: 0x060000AC RID: 172 RVA: 0x0000389C File Offset: 0x00001C9C
// (set) Token: 0x060000AD RID: 173 RVA: 0x000038B6 File Offset: 0x00001CB6
public Vector2 position { get; set; }
// Token: 0x1700002D RID: 45
// (get) Token: 0x060000AE RID: 174 RVA: 0x000038C0 File Offset: 0x00001CC0
// (set) Token: 0x060000AF RID: 175 RVA: 0x000038DA File Offset: 0x00001CDA
public Vector2 delta { get; set; }
// Token: 0x1700002E RID: 46
// (get) Token: 0x060000B0 RID: 176 RVA: 0x000038E4 File Offset: 0x00001CE4
// (set) Token: 0x060000B1 RID: 177 RVA: 0x000038FE File Offset: 0x00001CFE
public Vector2 pressPosition { get; set; }
// Token: 0x1700002F RID: 47
// (get) Token: 0x060000B2 RID: 178 RVA: 0x00003908 File Offset: 0x00001D08
// (set) Token: 0x060000B3 RID: 179 RVA: 0x00003922 File Offset: 0x00001D22
[Obsolete("Use either pointerCurrentRaycast.worldPosition or pointerPressRaycast.worldPosition")]
public Vector3 worldPosition { get; set; }
// Token: 0x17000030 RID: 48
// (get) Token: 0x060000B4 RID: 180 RVA: 0x0000392C File Offset: 0x00001D2C
// (set) Token: 0x060000B5 RID: 181 RVA: 0x00003946 File Offset: 0x00001D46
[Obsolete("Use either pointerCurrentRaycast.worldNormal or pointerPressRaycast.worldNormal")]
public Vector3 worldNormal { get; set; }
// Token: 0x17000031 RID: 49
// (get) Token: 0x060000B6 RID: 182 RVA: 0x00003950 File Offset: 0x00001D50
// (set) Token: 0x060000B7 RID: 183 RVA: 0x0000396A File Offset: 0x00001D6A
public float clickTime { get; set; }
// Token: 0x17000032 RID: 50
// (get) Token: 0x060000B8 RID: 184 RVA: 0x00003974 File Offset: 0x00001D74
// (set) Token: 0x060000B9 RID: 185 RVA: 0x0000398E File Offset: 0x00001D8E
public int clickCount { get; set; }
// Token: 0x17000033 RID: 51
// (get) Token: 0x060000BA RID: 186 RVA: 0x00003998 File Offset: 0x00001D98
// (set) Token: 0x060000BB RID: 187 RVA: 0x000039B2 File Offset: 0x00001DB2
public Vector2 scrollDelta { get; set; }
// Token: 0x17000034 RID: 52
// (get) Token: 0x060000BC RID: 188 RVA: 0x000039BC File Offset: 0x00001DBC
// (set) Token: 0x060000BD RID: 189 RVA: 0x000039D6 File Offset: 0x00001DD6
public bool useDragThreshold { get; set; }
// Token: 0x17000035 RID: 53
// (get) Token: 0x060000BE RID: 190 RVA: 0x000039E0 File Offset: 0x00001DE0
// (set) Token: 0x060000BF RID: 191 RVA: 0x000039FA File Offset: 0x00001DFA
public bool dragging { get; set; }
// Token: 0x17000036 RID: 54
// (get) Token: 0x060000C0 RID: 192 RVA: 0x00003A04 File Offset: 0x00001E04
// (set) Token: 0x060000C1 RID: 193 RVA: 0x00003A1E File Offset: 0x00001E1E
public PointerEventData.InputButton button { get; set; }
// Token: 0x060000C2 RID: 194 RVA: 0x00003A28 File Offset: 0x00001E28
public bool IsPointerMoving()
{
return this.delta.sqrMagnitude > 0f;
}
// Token: 0x060000C3 RID: 195 RVA: 0x00003A54 File Offset: 0x00001E54
public bool IsScrolling()
{
return this.scrollDelta.sqrMagnitude > 0f;
}
// Token: 0x17000037 RID: 55
// (get) Token: 0x060000C4 RID: 196 RVA: 0x00003A80 File Offset: 0x00001E80
public Camera enterEventCamera
{
get
{
return (!(this.pointerCurrentRaycast.module == null)) ? this.pointerCurrentRaycast.module.eventCamera : null;
}
}
// Token: 0x17000038 RID: 56
// (get) Token: 0x060000C5 RID: 197 RVA: 0x00003AC8 File Offset: 0x00001EC8
public Camera pressEventCamera
{
get
{
return (!(this.pointerPressRaycast.module == null)) ? this.pointerPressRaycast.module.eventCamera : null;
}
}
// Token: 0x17000039 RID: 57
// (get) Token: 0x060000C6 RID: 198 RVA: 0x00003B10 File Offset: 0x00001F10
// (set) Token: 0x060000C7 RID: 199 RVA: 0x00003B2B File Offset: 0x00001F2B
public GameObject pointerPress
{
get
{
return this.m_PointerPress;
}
set
{
if (!(this.m_PointerPress == value))
{
this.lastPress = this.m_PointerPress;
this.m_PointerPress = value;
}
}
}
// Token: 0x060000C8 RID: 200 RVA: 0x00003B58 File Offset: 0x00001F58
public override string ToString()
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("<b>Position</b>: " + this.position);
stringBuilder.AppendLine("<b>delta</b>: " + this.delta);
stringBuilder.AppendLine("<b>eligibleForClick</b>: " + this.eligibleForClick);
stringBuilder.AppendLine("<b>pointerEnter</b>: " + this.pointerEnter);
stringBuilder.AppendLine("<b>pointerPress</b>: " + this.pointerPress);
stringBuilder.AppendLine("<b>lastPointerPress</b>: " + this.lastPress);
stringBuilder.AppendLine("<b>pointerDrag</b>: " + this.pointerDrag);
stringBuilder.AppendLine("<b>Use Drag Threshold</b>: " + this.useDragThreshold);
stringBuilder.AppendLine("<b>Current Rayast:</b>");
stringBuilder.AppendLine(this.pointerCurrentRaycast.ToString());
stringBuilder.AppendLine("<b>Press Rayast:</b>");
stringBuilder.AppendLine(this.pointerPressRaycast.ToString());
return stringBuilder.ToString();
}
// Token: 0x04000060 RID: 96
private GameObject m_PointerPress;
// Token: 0x04000066 RID: 102
public List<GameObject> hovered = new List<GameObject>();
// Token: 0x02000024 RID: 36
public enum InputButton
{
// Token: 0x04000075 RID: 117
Left,
// Token: 0x04000076 RID: 118
Right,
// Token: 0x04000077 RID: 119
Middle
}
// Token: 0x02000025 RID: 37
public enum FramePressState
{
// Token: 0x04000079 RID: 121
Pressed,
// Token: 0x0400007A RID: 122
Released,
// Token: 0x0400007B RID: 123
PressedAndReleased,
// Token: 0x0400007C RID: 124
NotChanged
}
}
}
@@ -0,0 +1,382 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace UnityEngine.EventSystems
{
// Token: 0x02000028 RID: 40
public abstract class PointerInputModule : BaseInputModule
{
// Token: 0x060000EE RID: 238 RVA: 0x000043B8 File Offset: 0x000027B8
protected bool GetPointerData(int id, out PointerEventData data, bool create)
{
bool flag;
if (!this.m_PointerData.TryGetValue(id, out data) && create)
{
data = new PointerEventData(base.eventSystem)
{
pointerId = id
};
this.m_PointerData.Add(id, data);
flag = true;
}
else
{
flag = false;
}
return flag;
}
// Token: 0x060000EF RID: 239 RVA: 0x00004412 File Offset: 0x00002812
protected void RemovePointerData(PointerEventData data)
{
this.m_PointerData.Remove(data.pointerId);
}
// Token: 0x060000F0 RID: 240 RVA: 0x00004428 File Offset: 0x00002828
protected PointerEventData GetTouchPointerEventData(Touch input, out bool pressed, out bool released)
{
PointerEventData pointerEventData;
bool pointerData = this.GetPointerData(input.fingerId, out pointerEventData, true);
pointerEventData.Reset();
pressed = pointerData || input.phase == TouchPhase.Began;
released = input.phase == TouchPhase.Canceled || input.phase == TouchPhase.Ended;
if (pointerData)
{
pointerEventData.position = input.position;
}
if (pressed)
{
pointerEventData.delta = Vector2.zero;
}
else
{
pointerEventData.delta = input.position - pointerEventData.position;
}
pointerEventData.position = input.position;
pointerEventData.button = PointerEventData.InputButton.Left;
base.eventSystem.RaycastAll(pointerEventData, this.m_RaycastResultCache);
RaycastResult raycastResult = BaseInputModule.FindFirstRaycast(this.m_RaycastResultCache);
pointerEventData.pointerCurrentRaycast = raycastResult;
this.m_RaycastResultCache.Clear();
return pointerEventData;
}
// Token: 0x060000F1 RID: 241 RVA: 0x0000450C File Offset: 0x0000290C
protected void CopyFromTo(PointerEventData from, PointerEventData to)
{
to.position = from.position;
to.delta = from.delta;
to.scrollDelta = from.scrollDelta;
to.pointerCurrentRaycast = from.pointerCurrentRaycast;
to.pointerEnter = from.pointerEnter;
}
// Token: 0x060000F2 RID: 242 RVA: 0x0000454C File Offset: 0x0000294C
protected PointerEventData.FramePressState StateForMouseButton(int buttonId)
{
bool mouseButtonDown = base.input.GetMouseButtonDown(buttonId);
bool mouseButtonUp = base.input.GetMouseButtonUp(buttonId);
PointerEventData.FramePressState framePressState;
if (mouseButtonDown && mouseButtonUp)
{
framePressState = PointerEventData.FramePressState.PressedAndReleased;
}
else if (mouseButtonDown)
{
framePressState = PointerEventData.FramePressState.Pressed;
}
else if (mouseButtonUp)
{
framePressState = PointerEventData.FramePressState.Released;
}
else
{
framePressState = PointerEventData.FramePressState.NotChanged;
}
return framePressState;
}
// Token: 0x060000F3 RID: 243 RVA: 0x000045AC File Offset: 0x000029AC
protected virtual PointerInputModule.MouseState GetMousePointerEventData()
{
return this.GetMousePointerEventData(0);
}
// Token: 0x060000F4 RID: 244 RVA: 0x000045C8 File Offset: 0x000029C8
protected virtual PointerInputModule.MouseState GetMousePointerEventData(int id)
{
PointerEventData pointerEventData;
bool pointerData = this.GetPointerData(-1, out pointerEventData, true);
pointerEventData.Reset();
if (pointerData)
{
pointerEventData.position = base.input.mousePosition;
}
Vector2 mousePosition = base.input.mousePosition;
if (Cursor.lockState == CursorLockMode.Locked)
{
pointerEventData.position = new Vector2(-1f, -1f);
pointerEventData.delta = Vector2.zero;
}
else
{
pointerEventData.delta = mousePosition - pointerEventData.position;
pointerEventData.position = mousePosition;
}
pointerEventData.scrollDelta = base.input.mouseScrollDelta;
pointerEventData.button = PointerEventData.InputButton.Left;
base.eventSystem.RaycastAll(pointerEventData, this.m_RaycastResultCache);
RaycastResult raycastResult = BaseInputModule.FindFirstRaycast(this.m_RaycastResultCache);
pointerEventData.pointerCurrentRaycast = raycastResult;
this.m_RaycastResultCache.Clear();
PointerEventData pointerEventData2;
this.GetPointerData(-2, out pointerEventData2, true);
this.CopyFromTo(pointerEventData, pointerEventData2);
pointerEventData2.button = PointerEventData.InputButton.Right;
PointerEventData pointerEventData3;
this.GetPointerData(-3, out pointerEventData3, true);
this.CopyFromTo(pointerEventData, pointerEventData3);
pointerEventData3.button = PointerEventData.InputButton.Middle;
this.m_MouseState.SetButtonState(PointerEventData.InputButton.Left, this.StateForMouseButton(0), pointerEventData);
this.m_MouseState.SetButtonState(PointerEventData.InputButton.Right, this.StateForMouseButton(1), pointerEventData2);
this.m_MouseState.SetButtonState(PointerEventData.InputButton.Middle, this.StateForMouseButton(2), pointerEventData3);
return this.m_MouseState;
}
// Token: 0x060000F5 RID: 245 RVA: 0x00004728 File Offset: 0x00002B28
protected PointerEventData GetLastPointerEventData(int id)
{
PointerEventData pointerEventData;
this.GetPointerData(id, out pointerEventData, false);
return pointerEventData;
}
// Token: 0x060000F6 RID: 246 RVA: 0x0000474C File Offset: 0x00002B4C
private static bool ShouldStartDrag(Vector2 pressPos, Vector2 currentPos, float threshold, bool useDragThreshold)
{
return !useDragThreshold || (pressPos - currentPos).sqrMagnitude >= threshold * threshold;
}
// Token: 0x060000F7 RID: 247 RVA: 0x00004788 File Offset: 0x00002B88
protected virtual void ProcessMove(PointerEventData pointerEvent)
{
GameObject gameObject = ((Cursor.lockState != CursorLockMode.Locked) ? pointerEvent.pointerCurrentRaycast.gameObject : null);
base.HandlePointerExitAndEnter(pointerEvent, gameObject);
}
// Token: 0x060000F8 RID: 248 RVA: 0x000047C0 File Offset: 0x00002BC0
protected virtual void ProcessDrag(PointerEventData pointerEvent)
{
if (pointerEvent.IsPointerMoving() && Cursor.lockState != CursorLockMode.Locked && !(pointerEvent.pointerDrag == null))
{
if (!pointerEvent.dragging && PointerInputModule.ShouldStartDrag(pointerEvent.pressPosition, pointerEvent.position, (float)base.eventSystem.pixelDragThreshold, pointerEvent.useDragThreshold))
{
ExecuteEvents.Execute<IBeginDragHandler>(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.beginDragHandler);
pointerEvent.dragging = true;
}
if (pointerEvent.dragging)
{
if (pointerEvent.pointerPress != pointerEvent.pointerDrag)
{
ExecuteEvents.Execute<IPointerUpHandler>(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);
pointerEvent.eligibleForClick = false;
pointerEvent.pointerPress = null;
pointerEvent.rawPointerPress = null;
}
ExecuteEvents.Execute<IDragHandler>(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.dragHandler);
}
}
}
// Token: 0x060000F9 RID: 249 RVA: 0x000048A8 File Offset: 0x00002CA8
public override bool IsPointerOverGameObject(int pointerId)
{
PointerEventData lastPointerEventData = this.GetLastPointerEventData(pointerId);
return lastPointerEventData != null && lastPointerEventData.pointerEnter != null;
}
// Token: 0x060000FA RID: 250 RVA: 0x000048E0 File Offset: 0x00002CE0
protected void ClearSelection()
{
BaseEventData baseEventData = this.GetBaseEventData();
foreach (PointerEventData pointerEventData in this.m_PointerData.Values)
{
base.HandlePointerExitAndEnter(pointerEventData, null);
}
this.m_PointerData.Clear();
base.eventSystem.SetSelectedGameObject(null, baseEventData);
}
// Token: 0x060000FB RID: 251 RVA: 0x00004968 File Offset: 0x00002D68
public override string ToString()
{
StringBuilder stringBuilder = new StringBuilder("<b>Pointer Input Module of type: </b>" + base.GetType());
stringBuilder.AppendLine();
foreach (KeyValuePair<int, PointerEventData> keyValuePair in this.m_PointerData)
{
if (keyValuePair.Value != null)
{
stringBuilder.AppendLine("<B>Pointer:</b> " + keyValuePair.Key);
stringBuilder.AppendLine(keyValuePair.Value.ToString());
}
}
return stringBuilder.ToString();
}
// Token: 0x060000FC RID: 252 RVA: 0x00004A2C File Offset: 0x00002E2C
protected void DeselectIfSelectionChanged(GameObject currentOverGo, BaseEventData pointerEvent)
{
GameObject eventHandler = ExecuteEvents.GetEventHandler<ISelectHandler>(currentOverGo);
if (eventHandler != base.eventSystem.currentSelectedGameObject)
{
base.eventSystem.SetSelectedGameObject(null, pointerEvent);
}
}
// Token: 0x04000083 RID: 131
public const int kMouseLeftId = -1;
// Token: 0x04000084 RID: 132
public const int kMouseRightId = -2;
// Token: 0x04000085 RID: 133
public const int kMouseMiddleId = -3;
// Token: 0x04000086 RID: 134
public const int kFakeTouchesId = -4;
// Token: 0x04000087 RID: 135
protected Dictionary<int, PointerEventData> m_PointerData = new Dictionary<int, PointerEventData>();
// Token: 0x04000088 RID: 136
private readonly PointerInputModule.MouseState m_MouseState = new PointerInputModule.MouseState();
// Token: 0x02000029 RID: 41
protected class ButtonState
{
// Token: 0x17000044 RID: 68
// (get) Token: 0x060000FE RID: 254 RVA: 0x00004A74 File Offset: 0x00002E74
// (set) Token: 0x060000FF RID: 255 RVA: 0x00004A8F File Offset: 0x00002E8F
public PointerInputModule.MouseButtonEventData eventData
{
get
{
return this.m_EventData;
}
set
{
this.m_EventData = value;
}
}
// Token: 0x17000045 RID: 69
// (get) Token: 0x06000100 RID: 256 RVA: 0x00004A9C File Offset: 0x00002E9C
// (set) Token: 0x06000101 RID: 257 RVA: 0x00004AB7 File Offset: 0x00002EB7
public PointerEventData.InputButton button
{
get
{
return this.m_Button;
}
set
{
this.m_Button = value;
}
}
// Token: 0x04000089 RID: 137
private PointerEventData.InputButton m_Button = PointerEventData.InputButton.Left;
// Token: 0x0400008A RID: 138
private PointerInputModule.MouseButtonEventData m_EventData;
}
// Token: 0x0200002A RID: 42
protected class MouseState
{
// Token: 0x06000103 RID: 259 RVA: 0x00004AD4 File Offset: 0x00002ED4
public bool AnyPressesThisFrame()
{
for (int i = 0; i < this.m_TrackedButtons.Count; i++)
{
if (this.m_TrackedButtons[i].eventData.PressedThisFrame())
{
return true;
}
}
return false;
}
// Token: 0x06000104 RID: 260 RVA: 0x00004B2C File Offset: 0x00002F2C
public bool AnyReleasesThisFrame()
{
for (int i = 0; i < this.m_TrackedButtons.Count; i++)
{
if (this.m_TrackedButtons[i].eventData.ReleasedThisFrame())
{
return true;
}
}
return false;
}
// Token: 0x06000105 RID: 261 RVA: 0x00004B84 File Offset: 0x00002F84
public PointerInputModule.ButtonState GetButtonState(PointerEventData.InputButton button)
{
PointerInputModule.ButtonState buttonState = null;
for (int i = 0; i < this.m_TrackedButtons.Count; i++)
{
if (this.m_TrackedButtons[i].button == button)
{
buttonState = this.m_TrackedButtons[i];
break;
}
}
if (buttonState == null)
{
buttonState = new PointerInputModule.ButtonState
{
button = button,
eventData = new PointerInputModule.MouseButtonEventData()
};
this.m_TrackedButtons.Add(buttonState);
}
return buttonState;
}
// Token: 0x06000106 RID: 262 RVA: 0x00004C14 File Offset: 0x00003014
public void SetButtonState(PointerEventData.InputButton button, PointerEventData.FramePressState stateForMouseButton, PointerEventData data)
{
PointerInputModule.ButtonState buttonState = this.GetButtonState(button);
buttonState.eventData.buttonState = stateForMouseButton;
buttonState.eventData.buttonData = data;
}
// Token: 0x0400008B RID: 139
private List<PointerInputModule.ButtonState> m_TrackedButtons = new List<PointerInputModule.ButtonState>();
}
// Token: 0x0200002B RID: 43
public class MouseButtonEventData
{
// Token: 0x06000108 RID: 264 RVA: 0x00004C4C File Offset: 0x0000304C
public bool PressedThisFrame()
{
return this.buttonState == PointerEventData.FramePressState.Pressed || this.buttonState == PointerEventData.FramePressState.PressedAndReleased;
}
// Token: 0x06000109 RID: 265 RVA: 0x00004C78 File Offset: 0x00003078
public bool ReleasedThisFrame()
{
return this.buttonState == PointerEventData.FramePressState.Released || this.buttonState == PointerEventData.FramePressState.PressedAndReleased;
}
// Token: 0x0400008C RID: 140
public PointerEventData.FramePressState buttonState;
// Token: 0x0400008D RID: 141
public PointerEventData buttonData;
}
}
}
@@ -0,0 +1,119 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x0200001E RID: 30
public struct RaycastResult
{
// Token: 0x1700001D RID: 29
// (get) Token: 0x0600007B RID: 123 RVA: 0x000033E4 File Offset: 0x000017E4
// (set) Token: 0x0600007C RID: 124 RVA: 0x000033FF File Offset: 0x000017FF
public GameObject gameObject
{
get
{
return this.m_GameObject;
}
set
{
this.m_GameObject = value;
}
}
// Token: 0x1700001E RID: 30
// (get) Token: 0x0600007D RID: 125 RVA: 0x0000340C File Offset: 0x0000180C
public bool isValid
{
get
{
return this.module != null && this.gameObject != null;
}
}
// Token: 0x0600007E RID: 126 RVA: 0x00003444 File Offset: 0x00001844
public void Clear()
{
this.gameObject = null;
this.module = null;
this.distance = 0f;
this.index = 0f;
this.depth = 0;
this.sortingLayer = 0;
this.sortingOrder = 0;
this.worldNormal = Vector3.up;
this.worldPosition = Vector3.zero;
this.screenPosition = Vector2.zero;
}
// Token: 0x0600007F RID: 127 RVA: 0x000034AC File Offset: 0x000018AC
public override string ToString()
{
string text;
if (!this.isValid)
{
text = "";
}
else
{
text = string.Concat(new object[]
{
"Name: ",
this.gameObject,
"\nmodule: ",
this.module,
"\ndistance: ",
this.distance,
"\nindex: ",
this.index,
"\ndepth: ",
this.depth,
"\nworldNormal: ",
this.worldNormal,
"\nworldPosition: ",
this.worldPosition,
"\nscreenPosition: ",
this.screenPosition,
"\nmodule.sortOrderPriority: ",
this.module.sortOrderPriority,
"\nmodule.renderOrderPriority: ",
this.module.renderOrderPriority,
"\nsortingLayer: ",
this.sortingLayer,
"\nsortingOrder: ",
this.sortingOrder
});
}
return text;
}
// Token: 0x04000051 RID: 81
private GameObject m_GameObject;
// Token: 0x04000052 RID: 82
public BaseRaycaster module;
// Token: 0x04000053 RID: 83
public float distance;
// Token: 0x04000054 RID: 84
public float index;
// Token: 0x04000055 RID: 85
public int depth;
// Token: 0x04000056 RID: 86
public int sortingLayer;
// Token: 0x04000057 RID: 87
public int sortingOrder;
// Token: 0x04000058 RID: 88
public Vector3 worldPosition;
// Token: 0x04000059 RID: 89
public Vector3 worldNormal;
// Token: 0x0400005A RID: 90
public Vector2 screenPosition;
}
}
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
namespace UnityEngine.EventSystems
{
// Token: 0x0200001D RID: 29
internal static class RaycasterManager
{
// Token: 0x06000077 RID: 119 RVA: 0x00003372 File Offset: 0x00001772
public static void AddRaycaster(BaseRaycaster baseRaycaster)
{
if (!RaycasterManager.s_Raycasters.Contains(baseRaycaster))
{
RaycasterManager.s_Raycasters.Add(baseRaycaster);
}
}
// Token: 0x06000078 RID: 120 RVA: 0x00003398 File Offset: 0x00001798
public static List<BaseRaycaster> GetRaycasters()
{
return RaycasterManager.s_Raycasters;
}
// Token: 0x06000079 RID: 121 RVA: 0x000033B2 File Offset: 0x000017B2
public static void RemoveRaycasters(BaseRaycaster baseRaycaster)
{
if (RaycasterManager.s_Raycasters.Contains(baseRaycaster))
{
RaycasterManager.s_Raycasters.Remove(baseRaycaster);
}
}
// Token: 0x04000050 RID: 80
private static readonly List<BaseRaycaster> s_Raycasters = new List<BaseRaycaster>();
}
}
@@ -0,0 +1,654 @@
using System;
using UnityEngine.Serialization;
namespace UnityEngine.EventSystems
{
// Token: 0x0200002C RID: 44
[AddComponentMenu("Event/Standalone Input Module")]
public class StandaloneInputModule : PointerInputModule
{
// Token: 0x0600010A RID: 266 RVA: 0x00004CA8 File Offset: 0x000030A8
protected StandaloneInputModule()
{
}
// Token: 0x17000046 RID: 70
// (get) Token: 0x0600010B RID: 267 RVA: 0x00004D08 File Offset: 0x00003108
[Obsolete("Mode is no longer needed on input module as it handles both mouse and keyboard simultaneously.", false)]
public StandaloneInputModule.InputMode inputMode
{
get
{
return StandaloneInputModule.InputMode.Mouse;
}
}
// Token: 0x17000047 RID: 71
// (get) Token: 0x0600010C RID: 268 RVA: 0x00004D20 File Offset: 0x00003120
// (set) Token: 0x0600010D RID: 269 RVA: 0x00004D3B File Offset: 0x0000313B
[Obsolete("allowActivationOnMobileDevice has been deprecated. Use forceModuleActive instead (UnityUpgradable) -> forceModuleActive")]
public bool allowActivationOnMobileDevice
{
get
{
return this.m_ForceModuleActive;
}
set
{
this.m_ForceModuleActive = value;
}
}
// Token: 0x17000048 RID: 72
// (get) Token: 0x0600010E RID: 270 RVA: 0x00004D48 File Offset: 0x00003148
// (set) Token: 0x0600010F RID: 271 RVA: 0x00004D63 File Offset: 0x00003163
public bool forceModuleActive
{
get
{
return this.m_ForceModuleActive;
}
set
{
this.m_ForceModuleActive = value;
}
}
// Token: 0x17000049 RID: 73
// (get) Token: 0x06000110 RID: 272 RVA: 0x00004D70 File Offset: 0x00003170
// (set) Token: 0x06000111 RID: 273 RVA: 0x00004D8B File Offset: 0x0000318B
public float inputActionsPerSecond
{
get
{
return this.m_InputActionsPerSecond;
}
set
{
this.m_InputActionsPerSecond = value;
}
}
// Token: 0x1700004A RID: 74
// (get) Token: 0x06000112 RID: 274 RVA: 0x00004D98 File Offset: 0x00003198
// (set) Token: 0x06000113 RID: 275 RVA: 0x00004DB3 File Offset: 0x000031B3
public float repeatDelay
{
get
{
return this.m_RepeatDelay;
}
set
{
this.m_RepeatDelay = value;
}
}
// Token: 0x1700004B RID: 75
// (get) Token: 0x06000114 RID: 276 RVA: 0x00004DC0 File Offset: 0x000031C0
// (set) Token: 0x06000115 RID: 277 RVA: 0x00004DDB File Offset: 0x000031DB
public string horizontalAxis
{
get
{
return this.m_HorizontalAxis;
}
set
{
this.m_HorizontalAxis = value;
}
}
// Token: 0x1700004C RID: 76
// (get) Token: 0x06000116 RID: 278 RVA: 0x00004DE8 File Offset: 0x000031E8
// (set) Token: 0x06000117 RID: 279 RVA: 0x00004E03 File Offset: 0x00003203
public string verticalAxis
{
get
{
return this.m_VerticalAxis;
}
set
{
this.m_VerticalAxis = value;
}
}
// Token: 0x1700004D RID: 77
// (get) Token: 0x06000118 RID: 280 RVA: 0x00004E10 File Offset: 0x00003210
// (set) Token: 0x06000119 RID: 281 RVA: 0x00004E2B File Offset: 0x0000322B
public string submitButton
{
get
{
return this.m_SubmitButton;
}
set
{
this.m_SubmitButton = value;
}
}
// Token: 0x1700004E RID: 78
// (get) Token: 0x0600011A RID: 282 RVA: 0x00004E38 File Offset: 0x00003238
// (set) Token: 0x0600011B RID: 283 RVA: 0x00004E53 File Offset: 0x00003253
public string cancelButton
{
get
{
return this.m_CancelButton;
}
set
{
this.m_CancelButton = value;
}
}
// Token: 0x0600011C RID: 284 RVA: 0x00004E60 File Offset: 0x00003260
private bool ShouldIgnoreEventsOnNoFocus()
{
bool flag;
switch (SystemInfo.operatingSystemFamily)
{
case OperatingSystemFamily.MacOSX:
case OperatingSystemFamily.Windows:
case OperatingSystemFamily.Linux:
flag = true;
break;
default:
flag = false;
break;
}
return flag;
}
// Token: 0x0600011D RID: 285 RVA: 0x00004E9C File Offset: 0x0000329C
public override void UpdateModule()
{
if (base.eventSystem.isFocused || !this.ShouldIgnoreEventsOnNoFocus())
{
this.m_LastMousePosition = this.m_MousePosition;
this.m_MousePosition = base.input.mousePosition;
}
}
// Token: 0x0600011E RID: 286 RVA: 0x00004EDC File Offset: 0x000032DC
public override bool IsModuleSupported()
{
return this.m_ForceModuleActive || base.input.mousePresent || base.input.touchSupported;
}
// Token: 0x0600011F RID: 287 RVA: 0x00004F1C File Offset: 0x0000331C
public override bool ShouldActivateModule()
{
bool flag;
if (!base.ShouldActivateModule())
{
flag = false;
}
else
{
bool flag2 = this.m_ForceModuleActive;
flag2 |= base.input.GetButtonDown(this.m_SubmitButton);
flag2 |= base.input.GetButtonDown(this.m_CancelButton);
flag2 |= !Mathf.Approximately(base.input.GetAxisRaw(this.m_HorizontalAxis), 0f);
flag2 |= !Mathf.Approximately(base.input.GetAxisRaw(this.m_VerticalAxis), 0f);
flag2 |= (this.m_MousePosition - this.m_LastMousePosition).sqrMagnitude > 0f;
flag2 |= base.input.GetMouseButtonDown(0);
if (base.input.touchCount > 0)
{
flag2 = true;
}
flag = flag2;
}
return flag;
}
// Token: 0x06000120 RID: 288 RVA: 0x00004FFC File Offset: 0x000033FC
public override void ActivateModule()
{
if (base.eventSystem.isFocused || !this.ShouldIgnoreEventsOnNoFocus())
{
base.ActivateModule();
this.m_MousePosition = base.input.mousePosition;
this.m_LastMousePosition = base.input.mousePosition;
GameObject gameObject = base.eventSystem.currentSelectedGameObject;
if (gameObject == null)
{
gameObject = base.eventSystem.firstSelectedGameObject;
}
base.eventSystem.SetSelectedGameObject(gameObject, this.GetBaseEventData());
}
}
// Token: 0x06000121 RID: 289 RVA: 0x00005088 File Offset: 0x00003488
public override void DeactivateModule()
{
base.DeactivateModule();
base.ClearSelection();
}
// Token: 0x06000122 RID: 290 RVA: 0x00005098 File Offset: 0x00003498
public override void Process()
{
if (base.eventSystem.isFocused || !this.ShouldIgnoreEventsOnNoFocus())
{
bool flag = this.SendUpdateEventToSelectedObject();
if (base.eventSystem.sendNavigationEvents)
{
if (!flag)
{
flag |= this.SendMoveEventToSelectedObject();
}
if (!flag)
{
this.SendSubmitEventToSelectedObject();
}
}
if (!this.ProcessTouchEvents() && base.input.mousePresent)
{
this.ProcessMouseEvent();
}
}
}
// Token: 0x06000123 RID: 291 RVA: 0x0000511C File Offset: 0x0000351C
private bool ProcessTouchEvents()
{
for (int i = 0; i < base.input.touchCount; i++)
{
Touch touch = base.input.GetTouch(i);
if (touch.type != TouchType.Indirect)
{
bool flag;
bool flag2;
PointerEventData touchPointerEventData = base.GetTouchPointerEventData(touch, out flag, out flag2);
this.ProcessTouchPress(touchPointerEventData, flag, flag2);
if (!flag2)
{
this.ProcessMove(touchPointerEventData);
this.ProcessDrag(touchPointerEventData);
}
else
{
base.RemovePointerData(touchPointerEventData);
}
}
}
return base.input.touchCount > 0;
}
// Token: 0x06000124 RID: 292 RVA: 0x000051BC File Offset: 0x000035BC
protected void ProcessTouchPress(PointerEventData pointerEvent, bool pressed, bool released)
{
GameObject gameObject = pointerEvent.pointerCurrentRaycast.gameObject;
if (pressed)
{
pointerEvent.eligibleForClick = true;
pointerEvent.delta = Vector2.zero;
pointerEvent.dragging = false;
pointerEvent.useDragThreshold = true;
pointerEvent.pressPosition = pointerEvent.position;
pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;
base.DeselectIfSelectionChanged(gameObject, pointerEvent);
if (pointerEvent.pointerEnter != gameObject)
{
base.HandlePointerExitAndEnter(pointerEvent, gameObject);
pointerEvent.pointerEnter = gameObject;
}
GameObject gameObject2 = ExecuteEvents.ExecuteHierarchy<IPointerDownHandler>(gameObject, pointerEvent, ExecuteEvents.pointerDownHandler);
if (gameObject2 == null)
{
gameObject2 = ExecuteEvents.GetEventHandler<IPointerClickHandler>(gameObject);
}
float unscaledTime = Time.unscaledTime;
if (gameObject2 == pointerEvent.lastPress)
{
float num = unscaledTime - pointerEvent.clickTime;
if (num < 0.3f)
{
pointerEvent.clickCount++;
}
else
{
pointerEvent.clickCount = 1;
}
pointerEvent.clickTime = unscaledTime;
}
else
{
pointerEvent.clickCount = 1;
}
pointerEvent.pointerPress = gameObject2;
pointerEvent.rawPointerPress = gameObject;
pointerEvent.clickTime = unscaledTime;
pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler<IDragHandler>(gameObject);
if (pointerEvent.pointerDrag != null)
{
ExecuteEvents.Execute<IInitializePotentialDragHandler>(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag);
}
}
if (released)
{
ExecuteEvents.Execute<IPointerUpHandler>(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);
GameObject eventHandler = ExecuteEvents.GetEventHandler<IPointerClickHandler>(gameObject);
if (pointerEvent.pointerPress == eventHandler && pointerEvent.eligibleForClick)
{
ExecuteEvents.Execute<IPointerClickHandler>(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerClickHandler);
}
else if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
{
ExecuteEvents.ExecuteHierarchy<IDropHandler>(gameObject, pointerEvent, ExecuteEvents.dropHandler);
}
pointerEvent.eligibleForClick = false;
pointerEvent.pointerPress = null;
pointerEvent.rawPointerPress = null;
if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
{
ExecuteEvents.Execute<IEndDragHandler>(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler);
}
pointerEvent.dragging = false;
pointerEvent.pointerDrag = null;
ExecuteEvents.ExecuteHierarchy<IPointerExitHandler>(pointerEvent.pointerEnter, pointerEvent, ExecuteEvents.pointerExitHandler);
pointerEvent.pointerEnter = null;
}
}
// Token: 0x06000125 RID: 293 RVA: 0x000053F4 File Offset: 0x000037F4
protected bool SendSubmitEventToSelectedObject()
{
bool flag;
if (base.eventSystem.currentSelectedGameObject == null)
{
flag = false;
}
else
{
BaseEventData baseEventData = this.GetBaseEventData();
if (base.input.GetButtonDown(this.m_SubmitButton))
{
ExecuteEvents.Execute<ISubmitHandler>(base.eventSystem.currentSelectedGameObject, baseEventData, ExecuteEvents.submitHandler);
}
if (base.input.GetButtonDown(this.m_CancelButton))
{
ExecuteEvents.Execute<ICancelHandler>(base.eventSystem.currentSelectedGameObject, baseEventData, ExecuteEvents.cancelHandler);
}
flag = baseEventData.used;
}
return flag;
}
// Token: 0x06000126 RID: 294 RVA: 0x00005490 File Offset: 0x00003890
private Vector2 GetRawMoveVector()
{
Vector2 zero = Vector2.zero;
zero.x = base.input.GetAxisRaw(this.m_HorizontalAxis);
zero.y = base.input.GetAxisRaw(this.m_VerticalAxis);
if (base.input.GetButtonDown(this.m_HorizontalAxis))
{
if (zero.x < 0f)
{
zero.x = -1f;
}
if (zero.x > 0f)
{
zero.x = 1f;
}
}
if (base.input.GetButtonDown(this.m_VerticalAxis))
{
if (zero.y < 0f)
{
zero.y = -1f;
}
if (zero.y > 0f)
{
zero.y = 1f;
}
}
return zero;
}
// Token: 0x06000127 RID: 295 RVA: 0x00005580 File Offset: 0x00003980
protected bool SendMoveEventToSelectedObject()
{
float unscaledTime = Time.unscaledTime;
Vector2 rawMoveVector = this.GetRawMoveVector();
bool flag;
if (Mathf.Approximately(rawMoveVector.x, 0f) && Mathf.Approximately(rawMoveVector.y, 0f))
{
this.m_ConsecutiveMoveCount = 0;
flag = false;
}
else
{
bool flag2 = base.input.GetButtonDown(this.m_HorizontalAxis) || base.input.GetButtonDown(this.m_VerticalAxis);
bool flag3 = Vector2.Dot(rawMoveVector, this.m_LastMoveVector) > 0f;
if (!flag2)
{
if (flag3 && this.m_ConsecutiveMoveCount == 1)
{
flag2 = unscaledTime > this.m_PrevActionTime + this.m_RepeatDelay;
}
else
{
flag2 = unscaledTime > this.m_PrevActionTime + 1f / this.m_InputActionsPerSecond;
}
}
if (!flag2)
{
flag = false;
}
else
{
AxisEventData axisEventData = this.GetAxisEventData(rawMoveVector.x, rawMoveVector.y, 0.6f);
if (axisEventData.moveDir != MoveDirection.None)
{
ExecuteEvents.Execute<IMoveHandler>(base.eventSystem.currentSelectedGameObject, axisEventData, ExecuteEvents.moveHandler);
if (!flag3)
{
this.m_ConsecutiveMoveCount = 0;
}
this.m_ConsecutiveMoveCount++;
this.m_PrevActionTime = unscaledTime;
this.m_LastMoveVector = rawMoveVector;
}
else
{
this.m_ConsecutiveMoveCount = 0;
}
flag = axisEventData.used;
}
}
return flag;
}
// Token: 0x06000128 RID: 296 RVA: 0x000056F3 File Offset: 0x00003AF3
protected void ProcessMouseEvent()
{
this.ProcessMouseEvent(0);
}
// Token: 0x06000129 RID: 297 RVA: 0x00005700 File Offset: 0x00003B00
[Obsolete("This method is no longer checked, overriding it with return true does nothing!")]
protected virtual bool ForceAutoSelect()
{
return false;
}
// Token: 0x0600012A RID: 298 RVA: 0x00005718 File Offset: 0x00003B18
protected void ProcessMouseEvent(int id)
{
PointerInputModule.MouseState mousePointerEventData = this.GetMousePointerEventData(id);
PointerInputModule.MouseButtonEventData eventData = mousePointerEventData.GetButtonState(PointerEventData.InputButton.Left).eventData;
this.m_CurrentFocusedGameObject = eventData.buttonData.pointerCurrentRaycast.gameObject;
this.ProcessMousePress(eventData);
this.ProcessMove(eventData.buttonData);
this.ProcessDrag(eventData.buttonData);
this.ProcessMousePress(mousePointerEventData.GetButtonState(PointerEventData.InputButton.Right).eventData);
this.ProcessDrag(mousePointerEventData.GetButtonState(PointerEventData.InputButton.Right).eventData.buttonData);
this.ProcessMousePress(mousePointerEventData.GetButtonState(PointerEventData.InputButton.Middle).eventData);
this.ProcessDrag(mousePointerEventData.GetButtonState(PointerEventData.InputButton.Middle).eventData.buttonData);
if (!Mathf.Approximately(eventData.buttonData.scrollDelta.sqrMagnitude, 0f))
{
GameObject eventHandler = ExecuteEvents.GetEventHandler<IScrollHandler>(eventData.buttonData.pointerCurrentRaycast.gameObject);
ExecuteEvents.ExecuteHierarchy<IScrollHandler>(eventHandler, eventData.buttonData, ExecuteEvents.scrollHandler);
}
}
// Token: 0x0600012B RID: 299 RVA: 0x00005818 File Offset: 0x00003C18
protected bool SendUpdateEventToSelectedObject()
{
bool flag;
if (base.eventSystem.currentSelectedGameObject == null)
{
flag = false;
}
else
{
BaseEventData baseEventData = this.GetBaseEventData();
ExecuteEvents.Execute<IUpdateSelectedHandler>(base.eventSystem.currentSelectedGameObject, baseEventData, ExecuteEvents.updateSelectedHandler);
flag = baseEventData.used;
}
return flag;
}
// Token: 0x0600012C RID: 300 RVA: 0x00005870 File Offset: 0x00003C70
protected void ProcessMousePress(PointerInputModule.MouseButtonEventData data)
{
PointerEventData buttonData = data.buttonData;
GameObject gameObject = buttonData.pointerCurrentRaycast.gameObject;
if (data.PressedThisFrame())
{
buttonData.eligibleForClick = true;
buttonData.delta = Vector2.zero;
buttonData.dragging = false;
buttonData.useDragThreshold = true;
buttonData.pressPosition = buttonData.position;
buttonData.pointerPressRaycast = buttonData.pointerCurrentRaycast;
base.DeselectIfSelectionChanged(gameObject, buttonData);
GameObject gameObject2 = ExecuteEvents.ExecuteHierarchy<IPointerDownHandler>(gameObject, buttonData, ExecuteEvents.pointerDownHandler);
if (gameObject2 == null)
{
gameObject2 = ExecuteEvents.GetEventHandler<IPointerClickHandler>(gameObject);
}
float unscaledTime = Time.unscaledTime;
if (gameObject2 == buttonData.lastPress)
{
float num = unscaledTime - buttonData.clickTime;
if (num < 0.3f)
{
buttonData.clickCount++;
}
else
{
buttonData.clickCount = 1;
}
buttonData.clickTime = unscaledTime;
}
else
{
buttonData.clickCount = 1;
}
buttonData.pointerPress = gameObject2;
buttonData.rawPointerPress = gameObject;
buttonData.clickTime = unscaledTime;
buttonData.pointerDrag = ExecuteEvents.GetEventHandler<IDragHandler>(gameObject);
if (buttonData.pointerDrag != null)
{
ExecuteEvents.Execute<IInitializePotentialDragHandler>(buttonData.pointerDrag, buttonData, ExecuteEvents.initializePotentialDrag);
}
}
if (data.ReleasedThisFrame())
{
ExecuteEvents.Execute<IPointerUpHandler>(buttonData.pointerPress, buttonData, ExecuteEvents.pointerUpHandler);
GameObject eventHandler = ExecuteEvents.GetEventHandler<IPointerClickHandler>(gameObject);
if (buttonData.pointerPress == eventHandler && buttonData.eligibleForClick)
{
ExecuteEvents.Execute<IPointerClickHandler>(buttonData.pointerPress, buttonData, ExecuteEvents.pointerClickHandler);
}
else if (buttonData.pointerDrag != null && buttonData.dragging)
{
ExecuteEvents.ExecuteHierarchy<IDropHandler>(gameObject, buttonData, ExecuteEvents.dropHandler);
}
buttonData.eligibleForClick = false;
buttonData.pointerPress = null;
buttonData.rawPointerPress = null;
if (buttonData.pointerDrag != null && buttonData.dragging)
{
ExecuteEvents.Execute<IEndDragHandler>(buttonData.pointerDrag, buttonData, ExecuteEvents.endDragHandler);
}
buttonData.dragging = false;
buttonData.pointerDrag = null;
if (gameObject != buttonData.pointerEnter)
{
base.HandlePointerExitAndEnter(buttonData, null);
base.HandlePointerExitAndEnter(buttonData, gameObject);
}
}
}
// Token: 0x0600012D RID: 301 RVA: 0x00005AA4 File Offset: 0x00003EA4
protected GameObject GetCurrentFocusedGameObject()
{
return this.m_CurrentFocusedGameObject;
}
// Token: 0x0400008E RID: 142
private float m_PrevActionTime;
// Token: 0x0400008F RID: 143
private Vector2 m_LastMoveVector;
// Token: 0x04000090 RID: 144
private int m_ConsecutiveMoveCount = 0;
// Token: 0x04000091 RID: 145
private Vector2 m_LastMousePosition;
// Token: 0x04000092 RID: 146
private Vector2 m_MousePosition;
// Token: 0x04000093 RID: 147
private GameObject m_CurrentFocusedGameObject;
// Token: 0x04000094 RID: 148
[SerializeField]
private string m_HorizontalAxis = "Horizontal";
// Token: 0x04000095 RID: 149
[SerializeField]
private string m_VerticalAxis = "Vertical";
// Token: 0x04000096 RID: 150
[SerializeField]
private string m_SubmitButton = "Submit";
// Token: 0x04000097 RID: 151
[SerializeField]
private string m_CancelButton = "Cancel";
// Token: 0x04000098 RID: 152
[SerializeField]
private float m_InputActionsPerSecond = 10f;
// Token: 0x04000099 RID: 153
[SerializeField]
private float m_RepeatDelay = 0.5f;
// Token: 0x0400009A RID: 154
[SerializeField]
[FormerlySerializedAs("m_AllowActivationOnMobileDevice")]
private bool m_ForceModuleActive;
// Token: 0x0200002D RID: 45
[Obsolete("Mode is no longer needed on input module as it handles both mouse and keyboard simultaneously.", false)]
public enum InputMode
{
// Token: 0x0400009C RID: 156
Mouse,
// Token: 0x0400009D RID: 157
Buttons
}
}
}
@@ -0,0 +1,270 @@
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine.Serialization;
namespace UnityEngine.EventSystems
{
// Token: 0x0200002E RID: 46
[Obsolete("TouchInputModule is no longer required as Touch input is now handled in StandaloneInputModule.")]
[AddComponentMenu("Event/Touch Input Module")]
public class TouchInputModule : PointerInputModule
{
// Token: 0x0600012E RID: 302 RVA: 0x00005ABF File Offset: 0x00003EBF
protected TouchInputModule()
{
}
// Token: 0x1700004F RID: 79
// (get) Token: 0x0600012F RID: 303 RVA: 0x00005AC8 File Offset: 0x00003EC8
// (set) Token: 0x06000130 RID: 304 RVA: 0x00005AE3 File Offset: 0x00003EE3
[Obsolete("allowActivationOnStandalone has been deprecated. Use forceModuleActive instead (UnityUpgradable) -> forceModuleActive")]
public bool allowActivationOnStandalone
{
get
{
return this.m_ForceModuleActive;
}
set
{
this.m_ForceModuleActive = value;
}
}
// Token: 0x17000050 RID: 80
// (get) Token: 0x06000131 RID: 305 RVA: 0x00005AF0 File Offset: 0x00003EF0
// (set) Token: 0x06000132 RID: 306 RVA: 0x00005B0B File Offset: 0x00003F0B
public bool forceModuleActive
{
get
{
return this.m_ForceModuleActive;
}
set
{
this.m_ForceModuleActive = value;
}
}
// Token: 0x06000133 RID: 307 RVA: 0x00005B15 File Offset: 0x00003F15
public override void UpdateModule()
{
this.m_LastMousePosition = this.m_MousePosition;
this.m_MousePosition = base.input.mousePosition;
}
// Token: 0x06000134 RID: 308 RVA: 0x00005B38 File Offset: 0x00003F38
public override bool IsModuleSupported()
{
return this.forceModuleActive || base.input.touchSupported;
}
// Token: 0x06000135 RID: 309 RVA: 0x00005B68 File Offset: 0x00003F68
public override bool ShouldActivateModule()
{
bool flag;
if (!base.ShouldActivateModule())
{
flag = false;
}
else if (this.m_ForceModuleActive)
{
flag = true;
}
else if (this.UseFakeInput())
{
bool flag2 = base.input.GetMouseButtonDown(0);
flag2 |= (this.m_MousePosition - this.m_LastMousePosition).sqrMagnitude > 0f;
flag = flag2;
}
else
{
flag = base.input.touchCount > 0;
}
return flag;
}
// Token: 0x06000136 RID: 310 RVA: 0x00005C00 File Offset: 0x00004000
private bool UseFakeInput()
{
return !base.input.touchSupported;
}
// Token: 0x06000137 RID: 311 RVA: 0x00005C23 File Offset: 0x00004023
public override void Process()
{
if (this.UseFakeInput())
{
this.FakeTouches();
}
else
{
this.ProcessTouchEvents();
}
}
// Token: 0x06000138 RID: 312 RVA: 0x00005C44 File Offset: 0x00004044
private void FakeTouches()
{
PointerInputModule.MouseState mousePointerEventData = this.GetMousePointerEventData(0);
PointerInputModule.MouseButtonEventData eventData = mousePointerEventData.GetButtonState(PointerEventData.InputButton.Left).eventData;
if (eventData.PressedThisFrame())
{
eventData.buttonData.delta = Vector2.zero;
}
this.ProcessTouchPress(eventData.buttonData, eventData.PressedThisFrame(), eventData.ReleasedThisFrame());
if (base.input.GetMouseButton(0))
{
this.ProcessMove(eventData.buttonData);
this.ProcessDrag(eventData.buttonData);
}
}
// Token: 0x06000139 RID: 313 RVA: 0x00005CC8 File Offset: 0x000040C8
private void ProcessTouchEvents()
{
for (int i = 0; i < base.input.touchCount; i++)
{
Touch touch = base.input.GetTouch(i);
if (touch.type != TouchType.Indirect)
{
bool flag;
bool flag2;
PointerEventData touchPointerEventData = base.GetTouchPointerEventData(touch, out flag, out flag2);
this.ProcessTouchPress(touchPointerEventData, flag, flag2);
if (!flag2)
{
this.ProcessMove(touchPointerEventData);
this.ProcessDrag(touchPointerEventData);
}
else
{
base.RemovePointerData(touchPointerEventData);
}
}
}
}
// Token: 0x0600013A RID: 314 RVA: 0x00005D50 File Offset: 0x00004150
protected void ProcessTouchPress(PointerEventData pointerEvent, bool pressed, bool released)
{
GameObject gameObject = pointerEvent.pointerCurrentRaycast.gameObject;
if (pressed)
{
pointerEvent.eligibleForClick = true;
pointerEvent.delta = Vector2.zero;
pointerEvent.dragging = false;
pointerEvent.useDragThreshold = true;
pointerEvent.pressPosition = pointerEvent.position;
pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;
base.DeselectIfSelectionChanged(gameObject, pointerEvent);
if (pointerEvent.pointerEnter != gameObject)
{
base.HandlePointerExitAndEnter(pointerEvent, gameObject);
pointerEvent.pointerEnter = gameObject;
}
GameObject gameObject2 = ExecuteEvents.ExecuteHierarchy<IPointerDownHandler>(gameObject, pointerEvent, ExecuteEvents.pointerDownHandler);
if (gameObject2 == null)
{
gameObject2 = ExecuteEvents.GetEventHandler<IPointerClickHandler>(gameObject);
}
float unscaledTime = Time.unscaledTime;
if (gameObject2 == pointerEvent.lastPress)
{
float num = unscaledTime - pointerEvent.clickTime;
if (num < 0.3f)
{
pointerEvent.clickCount++;
}
else
{
pointerEvent.clickCount = 1;
}
pointerEvent.clickTime = unscaledTime;
}
else
{
pointerEvent.clickCount = 1;
}
pointerEvent.pointerPress = gameObject2;
pointerEvent.rawPointerPress = gameObject;
pointerEvent.clickTime = unscaledTime;
pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler<IDragHandler>(gameObject);
if (pointerEvent.pointerDrag != null)
{
ExecuteEvents.Execute<IInitializePotentialDragHandler>(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag);
}
}
if (released)
{
ExecuteEvents.Execute<IPointerUpHandler>(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);
GameObject eventHandler = ExecuteEvents.GetEventHandler<IPointerClickHandler>(gameObject);
if (pointerEvent.pointerPress == eventHandler && pointerEvent.eligibleForClick)
{
ExecuteEvents.Execute<IPointerClickHandler>(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerClickHandler);
}
else if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
{
ExecuteEvents.ExecuteHierarchy<IDropHandler>(gameObject, pointerEvent, ExecuteEvents.dropHandler);
}
pointerEvent.eligibleForClick = false;
pointerEvent.pointerPress = null;
pointerEvent.rawPointerPress = null;
if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
{
ExecuteEvents.Execute<IEndDragHandler>(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler);
}
pointerEvent.dragging = false;
pointerEvent.pointerDrag = null;
if (pointerEvent.pointerDrag != null)
{
ExecuteEvents.Execute<IEndDragHandler>(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler);
}
pointerEvent.pointerDrag = null;
ExecuteEvents.ExecuteHierarchy<IPointerExitHandler>(pointerEvent.pointerEnter, pointerEvent, ExecuteEvents.pointerExitHandler);
pointerEvent.pointerEnter = null;
}
}
// Token: 0x0600013B RID: 315 RVA: 0x00005FB0 File Offset: 0x000043B0
public override void DeactivateModule()
{
base.DeactivateModule();
base.ClearSelection();
}
// Token: 0x0600013C RID: 316 RVA: 0x00005FC0 File Offset: 0x000043C0
public override string ToString()
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine((!this.UseFakeInput()) ? "Input: Touch" : "Input: Faked");
if (this.UseFakeInput())
{
PointerEventData lastPointerEventData = base.GetLastPointerEventData(-1);
if (lastPointerEventData != null)
{
stringBuilder.AppendLine(lastPointerEventData.ToString());
}
}
else
{
foreach (KeyValuePair<int, PointerEventData> keyValuePair in this.m_PointerData)
{
stringBuilder.AppendLine(keyValuePair.ToString());
}
}
return stringBuilder.ToString();
}
// Token: 0x0400009E RID: 158
private Vector2 m_LastMousePosition;
// Token: 0x0400009F RID: 159
private Vector2 m_MousePosition;
// Token: 0x040000A0 RID: 160
[SerializeField]
[FormerlySerializedAs("m_AllowActivationOnStandalone")]
private bool m_ForceModuleActive;
}
}
@@ -0,0 +1,75 @@
using System;
namespace UnityEngine.EventSystems
{
// Token: 0x0200001F RID: 31
public abstract class UIBehaviour : MonoBehaviour
{
// Token: 0x06000081 RID: 129 RVA: 0x00002058 File Offset: 0x00000458
protected virtual void Awake()
{
}
// Token: 0x06000082 RID: 130 RVA: 0x0000205B File Offset: 0x0000045B
protected virtual void OnEnable()
{
}
// Token: 0x06000083 RID: 131 RVA: 0x0000205E File Offset: 0x0000045E
protected virtual void Start()
{
}
// Token: 0x06000084 RID: 132 RVA: 0x00002061 File Offset: 0x00000461
protected virtual void OnDisable()
{
}
// Token: 0x06000085 RID: 133 RVA: 0x00002064 File Offset: 0x00000464
protected virtual void OnDestroy()
{
}
// Token: 0x06000086 RID: 134 RVA: 0x00002068 File Offset: 0x00000468
public virtual bool IsActive()
{
return base.isActiveAndEnabled;
}
// Token: 0x06000087 RID: 135 RVA: 0x00002083 File Offset: 0x00000483
protected virtual void OnRectTransformDimensionsChange()
{
}
// Token: 0x06000088 RID: 136 RVA: 0x00002086 File Offset: 0x00000486
protected virtual void OnBeforeTransformParentChanged()
{
}
// Token: 0x06000089 RID: 137 RVA: 0x00002089 File Offset: 0x00000489
protected virtual void OnTransformParentChanged()
{
}
// Token: 0x0600008A RID: 138 RVA: 0x0000208C File Offset: 0x0000048C
protected virtual void OnDidApplyAnimationProperties()
{
}
// Token: 0x0600008B RID: 139 RVA: 0x0000208F File Offset: 0x0000048F
protected virtual void OnCanvasGroupChanged()
{
}
// Token: 0x0600008C RID: 140 RVA: 0x00002092 File Offset: 0x00000492
protected virtual void OnCanvasHierarchyChanged()
{
}
// Token: 0x0600008D RID: 141 RVA: 0x00002098 File Offset: 0x00000498
public bool IsDestroyed()
{
return this == null;
}
}
}
+18
View File
@@ -0,0 +1,18 @@
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyTitle("guisystem")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("guisystem")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2013")]
[assembly: AssemblyTrademark("")]
[assembly: InternalsVisibleTo("UnityEngine.UI.Tests")]
[assembly: ComVisible(false)]
[assembly: Guid("d4f464c7-9b15-460d-b4bc-2cacd1c1df73")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+103
View File
@@ -0,0 +1,103 @@
using System;
using UnityEngine.Serialization;
namespace UnityEngine.UI
{
// Token: 0x02000039 RID: 57
[Serializable]
public class AnimationTriggers
{
// Token: 0x17000064 RID: 100
// (get) Token: 0x06000179 RID: 377 RVA: 0x00006BFC File Offset: 0x00004FFC
// (set) Token: 0x0600017A RID: 378 RVA: 0x00006C17 File Offset: 0x00005017
public string normalTrigger
{
get
{
return this.m_NormalTrigger;
}
set
{
this.m_NormalTrigger = value;
}
}
// Token: 0x17000065 RID: 101
// (get) Token: 0x0600017B RID: 379 RVA: 0x00006C24 File Offset: 0x00005024
// (set) Token: 0x0600017C RID: 380 RVA: 0x00006C3F File Offset: 0x0000503F
public string highlightedTrigger
{
get
{
return this.m_HighlightedTrigger;
}
set
{
this.m_HighlightedTrigger = value;
}
}
// Token: 0x17000066 RID: 102
// (get) Token: 0x0600017D RID: 381 RVA: 0x00006C4C File Offset: 0x0000504C
// (set) Token: 0x0600017E RID: 382 RVA: 0x00006C67 File Offset: 0x00005067
public string pressedTrigger
{
get
{
return this.m_PressedTrigger;
}
set
{
this.m_PressedTrigger = value;
}
}
// Token: 0x17000067 RID: 103
// (get) Token: 0x0600017F RID: 383 RVA: 0x00006C74 File Offset: 0x00005074
// (set) Token: 0x06000180 RID: 384 RVA: 0x00006C8F File Offset: 0x0000508F
public string disabledTrigger
{
get
{
return this.m_DisabledTrigger;
}
set
{
this.m_DisabledTrigger = value;
}
}
// Token: 0x040000B6 RID: 182
private const string kDefaultNormalAnimName = "Normal";
// Token: 0x040000B7 RID: 183
private const string kDefaultSelectedAnimName = "Highlighted";
// Token: 0x040000B8 RID: 184
private const string kDefaultPressedAnimName = "Pressed";
// Token: 0x040000B9 RID: 185
private const string kDefaultDisabledAnimName = "Disabled";
// Token: 0x040000BA RID: 186
[FormerlySerializedAs("normalTrigger")]
[SerializeField]
private string m_NormalTrigger = "Normal";
// Token: 0x040000BB RID: 187
[FormerlySerializedAs("highlightedTrigger")]
[FormerlySerializedAs("m_SelectedTrigger")]
[SerializeField]
private string m_HighlightedTrigger = "Highlighted";
// Token: 0x040000BC RID: 188
[FormerlySerializedAs("pressedTrigger")]
[SerializeField]
private string m_PressedTrigger = "Pressed";
// Token: 0x040000BD RID: 189
[FormerlySerializedAs("disabledTrigger")]
[SerializeField]
private string m_DisabledTrigger = "Disabled";
}
}
+197
View File
@@ -0,0 +1,197 @@
using System;
using UnityEngine.EventSystems;
namespace UnityEngine.UI
{
// Token: 0x02000087 RID: 135
[AddComponentMenu("Layout/Aspect Ratio Fitter", 142)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
[DisallowMultipleComponent]
public class AspectRatioFitter : UIBehaviour, ILayoutSelfController, ILayoutController
{
// Token: 0x060004F8 RID: 1272 RVA: 0x0001A942 File Offset: 0x00018D42
protected AspectRatioFitter()
{
}
// Token: 0x1700015A RID: 346
// (get) Token: 0x060004F9 RID: 1273 RVA: 0x0001A960 File Offset: 0x00018D60
// (set) Token: 0x060004FA RID: 1274 RVA: 0x0001A97B File Offset: 0x00018D7B
public AspectRatioFitter.AspectMode aspectMode
{
get
{
return this.m_AspectMode;
}
set
{
if (SetPropertyUtility.SetStruct<AspectRatioFitter.AspectMode>(ref this.m_AspectMode, value))
{
this.SetDirty();
}
}
}
// Token: 0x1700015B RID: 347
// (get) Token: 0x060004FB RID: 1275 RVA: 0x0001A998 File Offset: 0x00018D98
// (set) Token: 0x060004FC RID: 1276 RVA: 0x0001A9B3 File Offset: 0x00018DB3
public float aspectRatio
{
get
{
return this.m_AspectRatio;
}
set
{
if (SetPropertyUtility.SetStruct<float>(ref this.m_AspectRatio, value))
{
this.SetDirty();
}
}
}
// Token: 0x1700015C RID: 348
// (get) Token: 0x060004FD RID: 1277 RVA: 0x0001A9D0 File Offset: 0x00018DD0
private RectTransform rectTransform
{
get
{
if (this.m_Rect == null)
{
this.m_Rect = base.GetComponent<RectTransform>();
}
return this.m_Rect;
}
}
// Token: 0x060004FE RID: 1278 RVA: 0x0001AA08 File Offset: 0x00018E08
protected override void OnEnable()
{
base.OnEnable();
this.SetDirty();
}
// Token: 0x060004FF RID: 1279 RVA: 0x0001AA17 File Offset: 0x00018E17
protected override void OnDisable()
{
this.m_Tracker.Clear();
LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform);
base.OnDisable();
}
// Token: 0x06000500 RID: 1280 RVA: 0x0001AA36 File Offset: 0x00018E36
protected override void OnRectTransformDimensionsChange()
{
this.UpdateRect();
}
// Token: 0x06000501 RID: 1281 RVA: 0x0001AA40 File Offset: 0x00018E40
private void UpdateRect()
{
if (this.IsActive())
{
this.m_Tracker.Clear();
switch (this.m_AspectMode)
{
case AspectRatioFitter.AspectMode.WidthControlsHeight:
this.m_Tracker.Add(this, this.rectTransform, DrivenTransformProperties.SizeDeltaY);
this.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, this.rectTransform.rect.width / this.m_AspectRatio);
break;
case AspectRatioFitter.AspectMode.HeightControlsWidth:
this.m_Tracker.Add(this, this.rectTransform, DrivenTransformProperties.SizeDeltaX);
this.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, this.rectTransform.rect.height * this.m_AspectRatio);
break;
case AspectRatioFitter.AspectMode.FitInParent:
case AspectRatioFitter.AspectMode.EnvelopeParent:
{
this.m_Tracker.Add(this, this.rectTransform, DrivenTransformProperties.AnchoredPositionX | DrivenTransformProperties.AnchoredPositionY | DrivenTransformProperties.AnchorMinX | DrivenTransformProperties.AnchorMinY | DrivenTransformProperties.AnchorMaxX | DrivenTransformProperties.AnchorMaxY | DrivenTransformProperties.SizeDeltaX | DrivenTransformProperties.SizeDeltaY);
this.rectTransform.anchorMin = Vector2.zero;
this.rectTransform.anchorMax = Vector2.one;
this.rectTransform.anchoredPosition = Vector2.zero;
Vector2 zero = Vector2.zero;
Vector2 parentSize = this.GetParentSize();
if ((parentSize.y * this.aspectRatio < parentSize.x) ^ (this.m_AspectMode == AspectRatioFitter.AspectMode.FitInParent))
{
zero.y = this.GetSizeDeltaToProduceSize(parentSize.x / this.aspectRatio, 1);
}
else
{
zero.x = this.GetSizeDeltaToProduceSize(parentSize.y * this.aspectRatio, 0);
}
this.rectTransform.sizeDelta = zero;
break;
}
}
}
}
// Token: 0x06000502 RID: 1282 RVA: 0x0001ABE4 File Offset: 0x00018FE4
private float GetSizeDeltaToProduceSize(float size, int axis)
{
return size - this.GetParentSize()[axis] * (this.rectTransform.anchorMax[axis] - this.rectTransform.anchorMin[axis]);
}
// Token: 0x06000503 RID: 1283 RVA: 0x0001AC34 File Offset: 0x00019034
private Vector2 GetParentSize()
{
RectTransform rectTransform = this.rectTransform.parent as RectTransform;
Vector2 vector;
if (!rectTransform)
{
vector = Vector2.zero;
}
else
{
vector = rectTransform.rect.size;
}
return vector;
}
// Token: 0x06000504 RID: 1284 RVA: 0x0001AC7E File Offset: 0x0001907E
public virtual void SetLayoutHorizontal()
{
}
// Token: 0x06000505 RID: 1285 RVA: 0x0001AC81 File Offset: 0x00019081
public virtual void SetLayoutVertical()
{
}
// Token: 0x06000506 RID: 1286 RVA: 0x0001AC84 File Offset: 0x00019084
protected void SetDirty()
{
this.UpdateRect();
}
// Token: 0x04000259 RID: 601
[SerializeField]
private AspectRatioFitter.AspectMode m_AspectMode = AspectRatioFitter.AspectMode.None;
// Token: 0x0400025A RID: 602
[SerializeField]
private float m_AspectRatio = 1f;
// Token: 0x0400025B RID: 603
[NonSerialized]
private RectTransform m_Rect;
// Token: 0x0400025C RID: 604
private DrivenRectTransformTracker m_Tracker;
// Token: 0x02000088 RID: 136
public enum AspectMode
{
// Token: 0x0400025E RID: 606
None,
// Token: 0x0400025F RID: 607
WidthControlsHeight,
// Token: 0x04000260 RID: 608
HeightControlsWidth,
// Token: 0x04000261 RID: 609
FitInParent,
// Token: 0x04000262 RID: 610
EnvelopeParent
}
}
}
+71
View File
@@ -0,0 +1,71 @@
using System;
using UnityEngine.EventSystems;
namespace UnityEngine.UI
{
// Token: 0x020000AA RID: 170
[ExecuteInEditMode]
public abstract class BaseMeshEffect : UIBehaviour, IMeshModifier
{
// Token: 0x1700019B RID: 411
// (get) Token: 0x06000619 RID: 1561 RVA: 0x0001E574 File Offset: 0x0001C974
protected Graphic graphic
{
get
{
if (this.m_Graphic == null)
{
this.m_Graphic = base.GetComponent<Graphic>();
}
return this.m_Graphic;
}
}
// Token: 0x0600061A RID: 1562 RVA: 0x0001E5AC File Offset: 0x0001C9AC
protected override void OnEnable()
{
base.OnEnable();
if (this.graphic != null)
{
this.graphic.SetVerticesDirty();
}
}
// Token: 0x0600061B RID: 1563 RVA: 0x0001E5D1 File Offset: 0x0001C9D1
protected override void OnDisable()
{
if (this.graphic != null)
{
this.graphic.SetVerticesDirty();
}
base.OnDisable();
}
// Token: 0x0600061C RID: 1564 RVA: 0x0001E5F6 File Offset: 0x0001C9F6
protected override void OnDidApplyAnimationProperties()
{
if (this.graphic != null)
{
this.graphic.SetVerticesDirty();
}
base.OnDidApplyAnimationProperties();
}
// Token: 0x0600061D RID: 1565 RVA: 0x0001E61C File Offset: 0x0001CA1C
public virtual void ModifyMesh(Mesh mesh)
{
using (VertexHelper vertexHelper = new VertexHelper(mesh))
{
this.ModifyMesh(vertexHelper);
vertexHelper.FillMesh(mesh);
}
}
// Token: 0x0600061E RID: 1566
public abstract void ModifyMesh(VertexHelper vh);
// Token: 0x040002D6 RID: 726
[NonSerialized]
private Graphic m_Graphic;
}
}
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
namespace UnityEngine.UI
{
// Token: 0x020000A9 RID: 169
[Obsolete("Use BaseMeshEffect instead", true)]
public abstract class BaseVertexEffect
{
// Token: 0x06000617 RID: 1559
[Obsolete("Use BaseMeshEffect.ModifyMeshes instead", true)]
public abstract void ModifyVertices(List<UIVertex> vertices);
}
}
+88
View File
@@ -0,0 +1,88 @@
using System;
using System.Collections;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
namespace UnityEngine.UI
{
// Token: 0x0200003A RID: 58
[AddComponentMenu("UI/Button", 30)]
public class Button : Selectable, IPointerClickHandler, ISubmitHandler, IEventSystemHandler
{
// Token: 0x06000181 RID: 385 RVA: 0x00007B73 File Offset: 0x00005F73
protected Button()
{
}
// Token: 0x17000068 RID: 104
// (get) Token: 0x06000182 RID: 386 RVA: 0x00007B88 File Offset: 0x00005F88
// (set) Token: 0x06000183 RID: 387 RVA: 0x00007BA3 File Offset: 0x00005FA3
public Button.ButtonClickedEvent onClick
{
get
{
return this.m_OnClick;
}
set
{
this.m_OnClick = value;
}
}
// Token: 0x06000184 RID: 388 RVA: 0x00007BAD File Offset: 0x00005FAD
private void Press()
{
if (this.IsActive() && this.IsInteractable())
{
UISystemProfilerApi.AddMarker("Button.onClick", this);
this.m_OnClick.Invoke();
}
}
// Token: 0x06000185 RID: 389 RVA: 0x00007BE1 File Offset: 0x00005FE1
public virtual void OnPointerClick(PointerEventData eventData)
{
if (eventData.button == PointerEventData.InputButton.Left)
{
this.Press();
}
}
// Token: 0x06000186 RID: 390 RVA: 0x00007BFA File Offset: 0x00005FFA
public virtual void OnSubmit(BaseEventData eventData)
{
this.Press();
if (this.IsActive() && this.IsInteractable())
{
this.DoStateTransition(Selectable.SelectionState.Pressed, false);
base.StartCoroutine(this.OnFinishSubmit());
}
}
// Token: 0x06000187 RID: 391 RVA: 0x00007C34 File Offset: 0x00006034
private IEnumerator OnFinishSubmit()
{
float fadeTime = base.colors.fadeDuration;
float elapsedTime = 0f;
while (elapsedTime < fadeTime)
{
elapsedTime += Time.unscaledDeltaTime;
yield return null;
}
this.DoStateTransition(base.currentSelectionState, false);
yield break;
}
// Token: 0x040000BE RID: 190
[FormerlySerializedAs("onClick")]
[SerializeField]
private Button.ButtonClickedEvent m_OnClick = new Button.ButtonClickedEvent();
// Token: 0x0200003B RID: 59
[Serializable]
public class ButtonClickedEvent : UnityEvent
{
}
}
}
+432
View File
@@ -0,0 +1,432 @@
using System;
using UnityEngine.EventSystems;
namespace UnityEngine.UI
{
// Token: 0x02000089 RID: 137
[RequireComponent(typeof(Canvas))]
[ExecuteInEditMode]
[AddComponentMenu("Layout/Canvas Scaler", 101)]
public class CanvasScaler : UIBehaviour
{
// Token: 0x06000507 RID: 1287 RVA: 0x0001AC90 File Offset: 0x00019090
protected CanvasScaler()
{
}
// Token: 0x1700015D RID: 349
// (get) Token: 0x06000508 RID: 1288 RVA: 0x0001AD28 File Offset: 0x00019128
// (set) Token: 0x06000509 RID: 1289 RVA: 0x0001AD43 File Offset: 0x00019143
public CanvasScaler.ScaleMode uiScaleMode
{
get
{
return this.m_UiScaleMode;
}
set
{
this.m_UiScaleMode = value;
}
}
// Token: 0x1700015E RID: 350
// (get) Token: 0x0600050A RID: 1290 RVA: 0x0001AD50 File Offset: 0x00019150
// (set) Token: 0x0600050B RID: 1291 RVA: 0x0001AD6B File Offset: 0x0001916B
public float referencePixelsPerUnit
{
get
{
return this.m_ReferencePixelsPerUnit;
}
set
{
this.m_ReferencePixelsPerUnit = value;
}
}
// Token: 0x1700015F RID: 351
// (get) Token: 0x0600050C RID: 1292 RVA: 0x0001AD78 File Offset: 0x00019178
// (set) Token: 0x0600050D RID: 1293 RVA: 0x0001AD93 File Offset: 0x00019193
public float scaleFactor
{
get
{
return this.m_ScaleFactor;
}
set
{
this.m_ScaleFactor = Mathf.Max(0.01f, value);
}
}
// Token: 0x17000160 RID: 352
// (get) Token: 0x0600050E RID: 1294 RVA: 0x0001ADA8 File Offset: 0x000191A8
// (set) Token: 0x0600050F RID: 1295 RVA: 0x0001ADC4 File Offset: 0x000191C4
public Vector2 referenceResolution
{
get
{
return this.m_ReferenceResolution;
}
set
{
this.m_ReferenceResolution = value;
if (this.m_ReferenceResolution.x > -1E-05f && this.m_ReferenceResolution.x < 1E-05f)
{
this.m_ReferenceResolution.x = 1E-05f * Mathf.Sign(this.m_ReferenceResolution.x);
}
if (this.m_ReferenceResolution.y > -1E-05f && this.m_ReferenceResolution.y < 1E-05f)
{
this.m_ReferenceResolution.y = 1E-05f * Mathf.Sign(this.m_ReferenceResolution.y);
}
}
}
// Token: 0x17000161 RID: 353
// (get) Token: 0x06000510 RID: 1296 RVA: 0x0001AE70 File Offset: 0x00019270
// (set) Token: 0x06000511 RID: 1297 RVA: 0x0001AE8B File Offset: 0x0001928B
public CanvasScaler.ScreenMatchMode screenMatchMode
{
get
{
return this.m_ScreenMatchMode;
}
set
{
this.m_ScreenMatchMode = value;
}
}
// Token: 0x17000162 RID: 354
// (get) Token: 0x06000512 RID: 1298 RVA: 0x0001AE98 File Offset: 0x00019298
// (set) Token: 0x06000513 RID: 1299 RVA: 0x0001AEB3 File Offset: 0x000192B3
public float matchWidthOrHeight
{
get
{
return this.m_MatchWidthOrHeight;
}
set
{
this.m_MatchWidthOrHeight = value;
}
}
// Token: 0x17000163 RID: 355
// (get) Token: 0x06000514 RID: 1300 RVA: 0x0001AEC0 File Offset: 0x000192C0
// (set) Token: 0x06000515 RID: 1301 RVA: 0x0001AEDB File Offset: 0x000192DB
public CanvasScaler.Unit physicalUnit
{
get
{
return this.m_PhysicalUnit;
}
set
{
this.m_PhysicalUnit = value;
}
}
// Token: 0x17000164 RID: 356
// (get) Token: 0x06000516 RID: 1302 RVA: 0x0001AEE8 File Offset: 0x000192E8
// (set) Token: 0x06000517 RID: 1303 RVA: 0x0001AF03 File Offset: 0x00019303
public float fallbackScreenDPI
{
get
{
return this.m_FallbackScreenDPI;
}
set
{
this.m_FallbackScreenDPI = value;
}
}
// Token: 0x17000165 RID: 357
// (get) Token: 0x06000518 RID: 1304 RVA: 0x0001AF10 File Offset: 0x00019310
// (set) Token: 0x06000519 RID: 1305 RVA: 0x0001AF2B File Offset: 0x0001932B
public float defaultSpriteDPI
{
get
{
return this.m_DefaultSpriteDPI;
}
set
{
this.m_DefaultSpriteDPI = Mathf.Max(1f, value);
}
}
// Token: 0x17000166 RID: 358
// (get) Token: 0x0600051A RID: 1306 RVA: 0x0001AF40 File Offset: 0x00019340
// (set) Token: 0x0600051B RID: 1307 RVA: 0x0001AF5B File Offset: 0x0001935B
public float dynamicPixelsPerUnit
{
get
{
return this.m_DynamicPixelsPerUnit;
}
set
{
this.m_DynamicPixelsPerUnit = value;
}
}
// Token: 0x0600051C RID: 1308 RVA: 0x0001AF65 File Offset: 0x00019365
protected override void OnEnable()
{
base.OnEnable();
this.m_Canvas = base.GetComponent<Canvas>();
this.Handle();
}
// Token: 0x0600051D RID: 1309 RVA: 0x0001AF80 File Offset: 0x00019380
protected override void OnDisable()
{
this.SetScaleFactor(1f);
this.SetReferencePixelsPerUnit(100f);
base.OnDisable();
}
// Token: 0x0600051E RID: 1310 RVA: 0x0001AF9F File Offset: 0x0001939F
protected virtual void Update()
{
this.Handle();
}
// Token: 0x0600051F RID: 1311 RVA: 0x0001AFA8 File Offset: 0x000193A8
protected virtual void Handle()
{
if (!(this.m_Canvas == null) && this.m_Canvas.isRootCanvas)
{
if (this.m_Canvas.renderMode == RenderMode.WorldSpace)
{
this.HandleWorldCanvas();
}
else
{
CanvasScaler.ScaleMode uiScaleMode = this.m_UiScaleMode;
if (uiScaleMode != CanvasScaler.ScaleMode.ConstantPixelSize)
{
if (uiScaleMode != CanvasScaler.ScaleMode.ScaleWithScreenSize)
{
if (uiScaleMode == CanvasScaler.ScaleMode.ConstantPhysicalSize)
{
this.HandleConstantPhysicalSize();
}
}
else
{
this.HandleScaleWithScreenSize();
}
}
else
{
this.HandleConstantPixelSize();
}
}
}
}
// Token: 0x06000520 RID: 1312 RVA: 0x0001B03A File Offset: 0x0001943A
protected virtual void HandleWorldCanvas()
{
this.SetScaleFactor(this.m_DynamicPixelsPerUnit);
this.SetReferencePixelsPerUnit(this.m_ReferencePixelsPerUnit);
}
// Token: 0x06000521 RID: 1313 RVA: 0x0001B055 File Offset: 0x00019455
protected virtual void HandleConstantPixelSize()
{
this.SetScaleFactor(this.m_ScaleFactor);
this.SetReferencePixelsPerUnit(this.m_ReferencePixelsPerUnit);
}
// Token: 0x06000522 RID: 1314 RVA: 0x0001B070 File Offset: 0x00019470
protected virtual void HandleScaleWithScreenSize()
{
Vector2 vector = new Vector2((float)Screen.width, (float)Screen.height);
int targetDisplay = this.m_Canvas.targetDisplay;
if (targetDisplay > 0 && targetDisplay < Display.displays.Length)
{
Display display = Display.displays[targetDisplay];
vector = new Vector2((float)display.renderingWidth, (float)display.renderingHeight);
}
float num = 0f;
CanvasScaler.ScreenMatchMode screenMatchMode = this.m_ScreenMatchMode;
if (screenMatchMode != CanvasScaler.ScreenMatchMode.MatchWidthOrHeight)
{
if (screenMatchMode != CanvasScaler.ScreenMatchMode.Expand)
{
if (screenMatchMode == CanvasScaler.ScreenMatchMode.Shrink)
{
num = Mathf.Max(vector.x / this.m_ReferenceResolution.x, vector.y / this.m_ReferenceResolution.y);
}
}
else
{
num = Mathf.Min(vector.x / this.m_ReferenceResolution.x, vector.y / this.m_ReferenceResolution.y);
}
}
else
{
float num2 = Mathf.Log(vector.x / this.m_ReferenceResolution.x, 2f);
float num3 = Mathf.Log(vector.y / this.m_ReferenceResolution.y, 2f);
float num4 = Mathf.Lerp(num2, num3, this.m_MatchWidthOrHeight);
num = Mathf.Pow(2f, num4);
}
this.SetScaleFactor(num);
this.SetReferencePixelsPerUnit(this.m_ReferencePixelsPerUnit);
}
// Token: 0x06000523 RID: 1315 RVA: 0x0001B1D4 File Offset: 0x000195D4
protected virtual void HandleConstantPhysicalSize()
{
float dpi = Screen.dpi;
float num = ((dpi != 0f) ? dpi : this.m_FallbackScreenDPI);
float num2 = 1f;
switch (this.m_PhysicalUnit)
{
case CanvasScaler.Unit.Centimeters:
num2 = 2.54f;
break;
case CanvasScaler.Unit.Millimeters:
num2 = 25.4f;
break;
case CanvasScaler.Unit.Inches:
num2 = 1f;
break;
case CanvasScaler.Unit.Points:
num2 = 72f;
break;
case CanvasScaler.Unit.Picas:
num2 = 6f;
break;
}
this.SetScaleFactor(num / num2);
this.SetReferencePixelsPerUnit(this.m_ReferencePixelsPerUnit * num2 / this.m_DefaultSpriteDPI);
}
// Token: 0x06000524 RID: 1316 RVA: 0x0001B281 File Offset: 0x00019681
protected void SetScaleFactor(float scaleFactor)
{
if (scaleFactor != this.m_PrevScaleFactor)
{
this.m_Canvas.scaleFactor = scaleFactor;
this.m_PrevScaleFactor = scaleFactor;
}
}
// Token: 0x06000525 RID: 1317 RVA: 0x0001B2A8 File Offset: 0x000196A8
protected void SetReferencePixelsPerUnit(float referencePixelsPerUnit)
{
if (referencePixelsPerUnit != this.m_PrevReferencePixelsPerUnit)
{
this.m_Canvas.referencePixelsPerUnit = referencePixelsPerUnit;
this.m_PrevReferencePixelsPerUnit = referencePixelsPerUnit;
}
}
// Token: 0x04000263 RID: 611
[Tooltip("Determines how UI elements in the Canvas are scaled.")]
[SerializeField]
private CanvasScaler.ScaleMode m_UiScaleMode = CanvasScaler.ScaleMode.ConstantPixelSize;
// Token: 0x04000264 RID: 612
[Tooltip("If a sprite has this 'Pixels Per Unit' setting, then one pixel in the sprite will cover one unit in the UI.")]
[SerializeField]
protected float m_ReferencePixelsPerUnit = 100f;
// Token: 0x04000265 RID: 613
[Tooltip("Scales all UI elements in the Canvas by this factor.")]
[SerializeField]
protected float m_ScaleFactor = 1f;
// Token: 0x04000266 RID: 614
[Tooltip("The resolution the UI layout is designed for. If the screen resolution is larger, the UI will be scaled up, and if it's smaller, the UI will be scaled down. This is done in accordance with the Screen Match Mode.")]
[SerializeField]
protected Vector2 m_ReferenceResolution = new Vector2(800f, 600f);
// Token: 0x04000267 RID: 615
[Tooltip("A mode used to scale the canvas area if the aspect ratio of the current resolution doesn't fit the reference resolution.")]
[SerializeField]
protected CanvasScaler.ScreenMatchMode m_ScreenMatchMode = CanvasScaler.ScreenMatchMode.MatchWidthOrHeight;
// Token: 0x04000268 RID: 616
[Tooltip("Determines if the scaling is using the width or height as reference, or a mix in between.")]
[Range(0f, 1f)]
[SerializeField]
protected float m_MatchWidthOrHeight = 0f;
// Token: 0x04000269 RID: 617
private const float kLogBase = 2f;
// Token: 0x0400026A RID: 618
[Tooltip("The physical unit to specify positions and sizes in.")]
[SerializeField]
protected CanvasScaler.Unit m_PhysicalUnit = CanvasScaler.Unit.Points;
// Token: 0x0400026B RID: 619
[Tooltip("The DPI to assume if the screen DPI is not known.")]
[SerializeField]
protected float m_FallbackScreenDPI = 96f;
// Token: 0x0400026C RID: 620
[Tooltip("The pixels per inch to use for sprites that have a 'Pixels Per Unit' setting that matches the 'Reference Pixels Per Unit' setting.")]
[SerializeField]
protected float m_DefaultSpriteDPI = 96f;
// Token: 0x0400026D RID: 621
[Tooltip("The amount of pixels per unit to use for dynamically created bitmaps in the UI, such as Text.")]
[SerializeField]
protected float m_DynamicPixelsPerUnit = 1f;
// Token: 0x0400026E RID: 622
private Canvas m_Canvas;
// Token: 0x0400026F RID: 623
[NonSerialized]
private float m_PrevScaleFactor = 1f;
// Token: 0x04000270 RID: 624
[NonSerialized]
private float m_PrevReferencePixelsPerUnit = 100f;
// Token: 0x0200008A RID: 138
public enum ScaleMode
{
// Token: 0x04000272 RID: 626
ConstantPixelSize,
// Token: 0x04000273 RID: 627
ScaleWithScreenSize,
// Token: 0x04000274 RID: 628
ConstantPhysicalSize
}
// Token: 0x0200008B RID: 139
public enum ScreenMatchMode
{
// Token: 0x04000276 RID: 630
MatchWidthOrHeight,
// Token: 0x04000277 RID: 631
Expand,
// Token: 0x04000278 RID: 632
Shrink
}
// Token: 0x0200008C RID: 140
public enum Unit
{
// Token: 0x0400027A RID: 634
Centimeters,
// Token: 0x0400027B RID: 635
Millimeters,
// Token: 0x0400027C RID: 636
Inches,
// Token: 0x0400027D RID: 637
Points,
// Token: 0x0400027E RID: 638
Picas
}
}
}
+21
View File
@@ -0,0 +1,21 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x0200003C RID: 60
public enum CanvasUpdate
{
// Token: 0x040000C0 RID: 192
Prelayout,
// Token: 0x040000C1 RID: 193
Layout,
// Token: 0x040000C2 RID: 194
PostLayout,
// Token: 0x040000C3 RID: 195
PreRender,
// Token: 0x040000C4 RID: 196
LatePreRender,
// Token: 0x040000C5 RID: 197
MaxUpdateValue
}
}
+273
View File
@@ -0,0 +1,273 @@
using System;
using UnityEngine.UI.Collections;
namespace UnityEngine.UI
{
// Token: 0x0200003E RID: 62
public class CanvasUpdateRegistry
{
// Token: 0x0600018E RID: 398 RVA: 0x00007D71 File Offset: 0x00006171
protected CanvasUpdateRegistry()
{
Canvas.willRenderCanvases += this.PerformUpdate;
}
// Token: 0x1700006A RID: 106
// (get) Token: 0x0600018F RID: 399 RVA: 0x00007DA4 File Offset: 0x000061A4
public static CanvasUpdateRegistry instance
{
get
{
if (CanvasUpdateRegistry.s_Instance == null)
{
CanvasUpdateRegistry.s_Instance = new CanvasUpdateRegistry();
}
return CanvasUpdateRegistry.s_Instance;
}
}
// Token: 0x06000190 RID: 400 RVA: 0x00007DD4 File Offset: 0x000061D4
private bool ObjectValidForUpdate(ICanvasElement element)
{
bool flag = element != null;
bool flag2 = element is Object;
if (flag2)
{
flag = element as Object != null;
}
return flag;
}
// Token: 0x06000191 RID: 401 RVA: 0x00007E10 File Offset: 0x00006210
private void CleanInvalidItems()
{
for (int i = this.m_LayoutRebuildQueue.Count - 1; i >= 0; i--)
{
ICanvasElement canvasElement = this.m_LayoutRebuildQueue[i];
if (canvasElement == null)
{
this.m_LayoutRebuildQueue.RemoveAt(i);
}
else if (canvasElement.IsDestroyed())
{
this.m_LayoutRebuildQueue.RemoveAt(i);
canvasElement.LayoutComplete();
}
}
for (int j = this.m_GraphicRebuildQueue.Count - 1; j >= 0; j--)
{
ICanvasElement canvasElement2 = this.m_GraphicRebuildQueue[j];
if (canvasElement2 == null)
{
this.m_GraphicRebuildQueue.RemoveAt(j);
}
else if (canvasElement2.IsDestroyed())
{
this.m_GraphicRebuildQueue.RemoveAt(j);
canvasElement2.GraphicUpdateComplete();
}
}
}
// Token: 0x06000192 RID: 402 RVA: 0x00007EE8 File Offset: 0x000062E8
private void PerformUpdate()
{
UISystemProfilerApi.BeginSample(UISystemProfilerApi.SampleType.Layout);
this.CleanInvalidItems();
this.m_PerformingLayoutUpdate = true;
this.m_LayoutRebuildQueue.Sort(CanvasUpdateRegistry.s_SortLayoutFunction);
for (int i = 0; i <= 2; i++)
{
for (int j = 0; j < this.m_LayoutRebuildQueue.Count; j++)
{
ICanvasElement canvasElement = CanvasUpdateRegistry.instance.m_LayoutRebuildQueue[j];
try
{
if (this.ObjectValidForUpdate(canvasElement))
{
canvasElement.Rebuild((CanvasUpdate)i);
}
}
catch (Exception ex)
{
Debug.LogException(ex, canvasElement.transform);
}
}
}
for (int k = 0; k < this.m_LayoutRebuildQueue.Count; k++)
{
this.m_LayoutRebuildQueue[k].LayoutComplete();
}
CanvasUpdateRegistry.instance.m_LayoutRebuildQueue.Clear();
this.m_PerformingLayoutUpdate = false;
ClipperRegistry.instance.Cull();
this.m_PerformingGraphicUpdate = true;
for (int l = 3; l < 5; l++)
{
for (int m = 0; m < CanvasUpdateRegistry.instance.m_GraphicRebuildQueue.Count; m++)
{
try
{
ICanvasElement canvasElement2 = CanvasUpdateRegistry.instance.m_GraphicRebuildQueue[m];
if (this.ObjectValidForUpdate(canvasElement2))
{
canvasElement2.Rebuild((CanvasUpdate)l);
}
}
catch (Exception ex2)
{
Debug.LogException(ex2, CanvasUpdateRegistry.instance.m_GraphicRebuildQueue[m].transform);
}
}
}
for (int n = 0; n < this.m_GraphicRebuildQueue.Count; n++)
{
this.m_GraphicRebuildQueue[n].GraphicUpdateComplete();
}
CanvasUpdateRegistry.instance.m_GraphicRebuildQueue.Clear();
this.m_PerformingGraphicUpdate = false;
UISystemProfilerApi.EndSample(UISystemProfilerApi.SampleType.Layout);
}
// Token: 0x06000193 RID: 403 RVA: 0x000080E4 File Offset: 0x000064E4
private static int ParentCount(Transform child)
{
int num;
if (child == null)
{
num = 0;
}
else
{
Transform transform = child.parent;
int num2 = 0;
while (transform != null)
{
num2++;
transform = transform.parent;
}
num = num2;
}
return num;
}
// Token: 0x06000194 RID: 404 RVA: 0x00008134 File Offset: 0x00006534
private static int SortLayoutList(ICanvasElement x, ICanvasElement y)
{
Transform transform = x.transform;
Transform transform2 = y.transform;
return CanvasUpdateRegistry.ParentCount(transform) - CanvasUpdateRegistry.ParentCount(transform2);
}
// Token: 0x06000195 RID: 405 RVA: 0x00008164 File Offset: 0x00006564
public static void RegisterCanvasElementForLayoutRebuild(ICanvasElement element)
{
CanvasUpdateRegistry.instance.InternalRegisterCanvasElementForLayoutRebuild(element);
}
// Token: 0x06000196 RID: 406 RVA: 0x00008174 File Offset: 0x00006574
public static bool TryRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
{
return CanvasUpdateRegistry.instance.InternalRegisterCanvasElementForLayoutRebuild(element);
}
// Token: 0x06000197 RID: 407 RVA: 0x00008194 File Offset: 0x00006594
private bool InternalRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
{
return !this.m_LayoutRebuildQueue.Contains(element) && this.m_LayoutRebuildQueue.AddUnique(element);
}
// Token: 0x06000198 RID: 408 RVA: 0x000081CD File Offset: 0x000065CD
public static void RegisterCanvasElementForGraphicRebuild(ICanvasElement element)
{
CanvasUpdateRegistry.instance.InternalRegisterCanvasElementForGraphicRebuild(element);
}
// Token: 0x06000199 RID: 409 RVA: 0x000081DC File Offset: 0x000065DC
public static bool TryRegisterCanvasElementForGraphicRebuild(ICanvasElement element)
{
return CanvasUpdateRegistry.instance.InternalRegisterCanvasElementForGraphicRebuild(element);
}
// Token: 0x0600019A RID: 410 RVA: 0x000081FC File Offset: 0x000065FC
private bool InternalRegisterCanvasElementForGraphicRebuild(ICanvasElement element)
{
bool flag;
if (this.m_PerformingGraphicUpdate)
{
Debug.LogError(string.Format("Trying to add {0} for graphic rebuild while we are already inside a graphic rebuild loop. This is not supported.", element));
flag = false;
}
else
{
flag = this.m_GraphicRebuildQueue.AddUnique(element);
}
return flag;
}
// Token: 0x0600019B RID: 411 RVA: 0x00008240 File Offset: 0x00006640
public static void UnRegisterCanvasElementForRebuild(ICanvasElement element)
{
CanvasUpdateRegistry.instance.InternalUnRegisterCanvasElementForLayoutRebuild(element);
CanvasUpdateRegistry.instance.InternalUnRegisterCanvasElementForGraphicRebuild(element);
}
// Token: 0x0600019C RID: 412 RVA: 0x00008259 File Offset: 0x00006659
private void InternalUnRegisterCanvasElementForLayoutRebuild(ICanvasElement element)
{
if (this.m_PerformingLayoutUpdate)
{
Debug.LogError(string.Format("Trying to remove {0} from rebuild list while we are already inside a rebuild loop. This is not supported.", element));
}
else
{
element.LayoutComplete();
CanvasUpdateRegistry.instance.m_LayoutRebuildQueue.Remove(element);
}
}
// Token: 0x0600019D RID: 413 RVA: 0x00008294 File Offset: 0x00006694
private void InternalUnRegisterCanvasElementForGraphicRebuild(ICanvasElement element)
{
if (this.m_PerformingGraphicUpdate)
{
Debug.LogError(string.Format("Trying to remove {0} from rebuild list while we are already inside a rebuild loop. This is not supported.", element));
}
else
{
element.GraphicUpdateComplete();
CanvasUpdateRegistry.instance.m_GraphicRebuildQueue.Remove(element);
}
}
// Token: 0x0600019E RID: 414 RVA: 0x000082D0 File Offset: 0x000066D0
public static bool IsRebuildingLayout()
{
return CanvasUpdateRegistry.instance.m_PerformingLayoutUpdate;
}
// Token: 0x0600019F RID: 415 RVA: 0x000082F0 File Offset: 0x000066F0
public static bool IsRebuildingGraphics()
{
return CanvasUpdateRegistry.instance.m_PerformingGraphicUpdate;
}
// Token: 0x040000C6 RID: 198
private static CanvasUpdateRegistry s_Instance;
// Token: 0x040000C7 RID: 199
private bool m_PerformingLayoutUpdate;
// Token: 0x040000C8 RID: 200
private bool m_PerformingGraphicUpdate;
// Token: 0x040000C9 RID: 201
private readonly IndexedSet<ICanvasElement> m_LayoutRebuildQueue = new IndexedSet<ICanvasElement>();
// Token: 0x040000CA RID: 202
private readonly IndexedSet<ICanvasElement> m_GraphicRebuildQueue = new IndexedSet<ICanvasElement>();
// Token: 0x040000CB RID: 203
private static readonly Comparison<ICanvasElement> s_SortLayoutFunction = new Comparison<ICanvasElement>(CanvasUpdateRegistry.SortLayoutList);
}
}
+58
View File
@@ -0,0 +1,58 @@
using System;
using UnityEngine.UI.Collections;
namespace UnityEngine.UI
{
// Token: 0x02000082 RID: 130
public class ClipperRegistry
{
// Token: 0x060004E9 RID: 1257 RVA: 0x0001A590 File Offset: 0x00018990
protected ClipperRegistry()
{
}
// Token: 0x17000157 RID: 343
// (get) Token: 0x060004EA RID: 1258 RVA: 0x0001A5B0 File Offset: 0x000189B0
public static ClipperRegistry instance
{
get
{
if (ClipperRegistry.s_Instance == null)
{
ClipperRegistry.s_Instance = new ClipperRegistry();
}
return ClipperRegistry.s_Instance;
}
}
// Token: 0x060004EB RID: 1259 RVA: 0x0001A5E0 File Offset: 0x000189E0
public void Cull()
{
for (int i = 0; i < this.m_Clippers.Count; i++)
{
this.m_Clippers[i].PerformClipping();
}
}
// Token: 0x060004EC RID: 1260 RVA: 0x0001A61D File Offset: 0x00018A1D
public static void Register(IClipper c)
{
if (c != null)
{
ClipperRegistry.instance.m_Clippers.AddUnique(c);
}
}
// Token: 0x060004ED RID: 1261 RVA: 0x0001A63C File Offset: 0x00018A3C
public static void Unregister(IClipper c)
{
ClipperRegistry.instance.m_Clippers.Remove(c);
}
// Token: 0x04000255 RID: 597
private static ClipperRegistry s_Instance;
// Token: 0x04000256 RID: 598
private readonly IndexedSet<IClipper> m_Clippers = new IndexedSet<IClipper>();
}
}
+61
View File
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
namespace UnityEngine.UI
{
// Token: 0x02000083 RID: 131
public static class Clipping
{
// Token: 0x060004EE RID: 1262 RVA: 0x0001A650 File Offset: 0x00018A50
public static Rect FindCullAndClipWorldRect(List<RectMask2D> rectMaskParents, out bool validRect)
{
Rect rect;
if (rectMaskParents.Count == 0)
{
validRect = false;
rect = default(Rect);
}
else
{
Rect rect2 = rectMaskParents[0].canvasRect;
for (int i = 0; i < rectMaskParents.Count; i++)
{
rect2 = Clipping.RectIntersect(rect2, rectMaskParents[i].canvasRect);
}
bool flag = rect2.width <= 0f || rect2.height <= 0f;
if (flag)
{
validRect = false;
rect = default(Rect);
}
else
{
Vector3 vector = new Vector3(rect2.x, rect2.y, 0f);
Vector3 vector2 = new Vector3(rect2.x + rect2.width, rect2.y + rect2.height, 0f);
validRect = true;
rect = new Rect(vector.x, vector.y, vector2.x - vector.x, vector2.y - vector.y);
}
}
return rect;
}
// Token: 0x060004EF RID: 1263 RVA: 0x0001A774 File Offset: 0x00018B74
private static Rect RectIntersect(Rect a, Rect b)
{
float num = Mathf.Max(a.x, b.x);
float num2 = Mathf.Min(a.x + a.width, b.x + b.width);
float num3 = Mathf.Max(a.y, b.y);
float num4 = Mathf.Min(a.y + a.height, b.y + b.height);
Rect rect;
if (num2 >= num && num4 >= num3)
{
rect = new Rect(num, num3, num2 - num, num4 - num3);
}
else
{
rect = new Rect(0f, 0f, 0f, 0f);
}
return rect;
}
}
}
+186
View File
@@ -0,0 +1,186 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace UnityEngine.UI.Collections
{
// Token: 0x020000A0 RID: 160
internal class IndexedSet<T> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
{
// Token: 0x060005D5 RID: 1493 RVA: 0x0001D6D3 File Offset: 0x0001BAD3
public void Add(T item)
{
this.m_List.Add(item);
this.m_Dictionary.Add(item, this.m_List.Count - 1);
}
// Token: 0x060005D6 RID: 1494 RVA: 0x0001D6FC File Offset: 0x0001BAFC
public bool AddUnique(T item)
{
bool flag;
if (this.m_Dictionary.ContainsKey(item))
{
flag = false;
}
else
{
this.m_List.Add(item);
this.m_Dictionary.Add(item, this.m_List.Count - 1);
flag = true;
}
return flag;
}
// Token: 0x060005D7 RID: 1495 RVA: 0x0001D750 File Offset: 0x0001BB50
public bool Remove(T item)
{
int num = -1;
bool flag;
if (!this.m_Dictionary.TryGetValue(item, out num))
{
flag = false;
}
else
{
this.RemoveAt(num);
flag = true;
}
return flag;
}
// Token: 0x060005D8 RID: 1496 RVA: 0x0001D789 File Offset: 0x0001BB89
public IEnumerator<T> GetEnumerator()
{
throw new NotImplementedException();
}
// Token: 0x060005D9 RID: 1497 RVA: 0x0001D794 File Offset: 0x0001BB94
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
// Token: 0x060005DA RID: 1498 RVA: 0x0001D7AF File Offset: 0x0001BBAF
public void Clear()
{
this.m_List.Clear();
this.m_Dictionary.Clear();
}
// Token: 0x060005DB RID: 1499 RVA: 0x0001D7C8 File Offset: 0x0001BBC8
public bool Contains(T item)
{
return this.m_Dictionary.ContainsKey(item);
}
// Token: 0x060005DC RID: 1500 RVA: 0x0001D7E9 File Offset: 0x0001BBE9
public void CopyTo(T[] array, int arrayIndex)
{
this.m_List.CopyTo(array, arrayIndex);
}
// Token: 0x17000192 RID: 402
// (get) Token: 0x060005DD RID: 1501 RVA: 0x0001D7FC File Offset: 0x0001BBFC
public int Count
{
get
{
return this.m_List.Count;
}
}
// Token: 0x17000193 RID: 403
// (get) Token: 0x060005DE RID: 1502 RVA: 0x0001D81C File Offset: 0x0001BC1C
public bool IsReadOnly
{
get
{
return false;
}
}
// Token: 0x060005DF RID: 1503 RVA: 0x0001D834 File Offset: 0x0001BC34
public int IndexOf(T item)
{
int num = -1;
this.m_Dictionary.TryGetValue(item, out num);
return num;
}
// Token: 0x060005E0 RID: 1504 RVA: 0x0001D85B File Offset: 0x0001BC5B
public void Insert(int index, T item)
{
throw new NotSupportedException("Random Insertion is semantically invalid, since this structure does not guarantee ordering.");
}
// Token: 0x060005E1 RID: 1505 RVA: 0x0001D868 File Offset: 0x0001BC68
public void RemoveAt(int index)
{
T t = this.m_List[index];
this.m_Dictionary.Remove(t);
if (index == this.m_List.Count - 1)
{
this.m_List.RemoveAt(index);
}
else
{
int num = this.m_List.Count - 1;
T t2 = this.m_List[num];
this.m_List[index] = t2;
this.m_Dictionary[t2] = index;
this.m_List.RemoveAt(num);
}
}
// Token: 0x17000194 RID: 404
public T this[int index]
{
get
{
return this.m_List[index];
}
set
{
T t = this.m_List[index];
this.m_Dictionary.Remove(t);
this.m_List[index] = value;
this.m_Dictionary.Add(t, index);
}
}
// Token: 0x060005E4 RID: 1508 RVA: 0x0001D960 File Offset: 0x0001BD60
public void RemoveAll(Predicate<T> match)
{
int i = 0;
while (i < this.m_List.Count)
{
T t = this.m_List[i];
if (match(t))
{
this.Remove(t);
}
else
{
i++;
}
}
}
// Token: 0x060005E5 RID: 1509 RVA: 0x0001D9B4 File Offset: 0x0001BDB4
public void Sort(Comparison<T> sortLayoutFunction)
{
this.m_List.Sort(sortLayoutFunction);
for (int i = 0; i < this.m_List.Count; i++)
{
T t = this.m_List[i];
this.m_Dictionary[t] = i;
}
}
// Token: 0x040002BF RID: 703
private readonly List<T> m_List = new List<T>();
// Token: 0x040002C0 RID: 704
private Dictionary<T, int> m_Dictionary = new Dictionary<T, int>();
}
}
+179
View File
@@ -0,0 +1,179 @@
using System;
using UnityEngine.Serialization;
namespace UnityEngine.UI
{
// Token: 0x0200003F RID: 63
[Serializable]
public struct ColorBlock : IEquatable<ColorBlock>
{
// Token: 0x1700006B RID: 107
// (get) Token: 0x060001A1 RID: 417 RVA: 0x00008334 File Offset: 0x00006734
// (set) Token: 0x060001A2 RID: 418 RVA: 0x0000834F File Offset: 0x0000674F
public Color normalColor
{
get
{
return this.m_NormalColor;
}
set
{
this.m_NormalColor = value;
}
}
// Token: 0x1700006C RID: 108
// (get) Token: 0x060001A3 RID: 419 RVA: 0x0000835C File Offset: 0x0000675C
// (set) Token: 0x060001A4 RID: 420 RVA: 0x00008377 File Offset: 0x00006777
public Color highlightedColor
{
get
{
return this.m_HighlightedColor;
}
set
{
this.m_HighlightedColor = value;
}
}
// Token: 0x1700006D RID: 109
// (get) Token: 0x060001A5 RID: 421 RVA: 0x00008384 File Offset: 0x00006784
// (set) Token: 0x060001A6 RID: 422 RVA: 0x0000839F File Offset: 0x0000679F
public Color pressedColor
{
get
{
return this.m_PressedColor;
}
set
{
this.m_PressedColor = value;
}
}
// Token: 0x1700006E RID: 110
// (get) Token: 0x060001A7 RID: 423 RVA: 0x000083AC File Offset: 0x000067AC
// (set) Token: 0x060001A8 RID: 424 RVA: 0x000083C7 File Offset: 0x000067C7
public Color disabledColor
{
get
{
return this.m_DisabledColor;
}
set
{
this.m_DisabledColor = value;
}
}
// Token: 0x1700006F RID: 111
// (get) Token: 0x060001A9 RID: 425 RVA: 0x000083D4 File Offset: 0x000067D4
// (set) Token: 0x060001AA RID: 426 RVA: 0x000083EF File Offset: 0x000067EF
public float colorMultiplier
{
get
{
return this.m_ColorMultiplier;
}
set
{
this.m_ColorMultiplier = value;
}
}
// Token: 0x17000070 RID: 112
// (get) Token: 0x060001AB RID: 427 RVA: 0x000083FC File Offset: 0x000067FC
// (set) Token: 0x060001AC RID: 428 RVA: 0x00008417 File Offset: 0x00006817
public float fadeDuration
{
get
{
return this.m_FadeDuration;
}
set
{
this.m_FadeDuration = value;
}
}
// Token: 0x17000071 RID: 113
// (get) Token: 0x060001AD RID: 429 RVA: 0x00008424 File Offset: 0x00006824
public static ColorBlock defaultColorBlock
{
get
{
return new ColorBlock
{
m_NormalColor = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue),
m_HighlightedColor = new Color32(245, 245, 245, byte.MaxValue),
m_PressedColor = new Color32(200, 200, 200, byte.MaxValue),
m_DisabledColor = new Color32(200, 200, 200, 128),
colorMultiplier = 1f,
fadeDuration = 0.1f
};
}
}
// Token: 0x060001AE RID: 430 RVA: 0x000084F0 File Offset: 0x000068F0
public override bool Equals(object obj)
{
return obj is ColorBlock && this.Equals((ColorBlock)obj);
}
// Token: 0x060001AF RID: 431 RVA: 0x00008524 File Offset: 0x00006924
public bool Equals(ColorBlock other)
{
return this.normalColor == other.normalColor && this.highlightedColor == other.highlightedColor && this.pressedColor == other.pressedColor && this.disabledColor == other.disabledColor && this.colorMultiplier == other.colorMultiplier && this.fadeDuration == other.fadeDuration;
}
// Token: 0x060001B0 RID: 432 RVA: 0x000085BC File Offset: 0x000069BC
public static bool operator ==(ColorBlock point1, ColorBlock point2)
{
return point1.Equals(point2);
}
// Token: 0x060001B1 RID: 433 RVA: 0x000085DC File Offset: 0x000069DC
public static bool operator !=(ColorBlock point1, ColorBlock point2)
{
return !point1.Equals(point2);
}
// Token: 0x060001B2 RID: 434 RVA: 0x000085FC File Offset: 0x000069FC
public override int GetHashCode()
{
return base.GetHashCode();
}
// Token: 0x040000CD RID: 205
[FormerlySerializedAs("normalColor")]
[SerializeField]
private Color m_NormalColor;
// Token: 0x040000CE RID: 206
[FormerlySerializedAs("highlightedColor")]
[FormerlySerializedAs("m_SelectedColor")]
[SerializeField]
private Color m_HighlightedColor;
// Token: 0x040000CF RID: 207
[FormerlySerializedAs("pressedColor")]
[SerializeField]
private Color m_PressedColor;
// Token: 0x040000D0 RID: 208
[FormerlySerializedAs("disabledColor")]
[SerializeField]
private Color m_DisabledColor;
// Token: 0x040000D1 RID: 209
[Range(1f, 5f)]
[SerializeField]
private float m_ColorMultiplier;
// Token: 0x040000D2 RID: 210
[FormerlySerializedAs("fadeDuration")]
[SerializeField]
private float m_FadeDuration;
}
}
+158
View File
@@ -0,0 +1,158 @@
using System;
using UnityEngine.EventSystems;
namespace UnityEngine.UI
{
// Token: 0x0200008D RID: 141
[AddComponentMenu("Layout/Content Size Fitter", 141)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
public class ContentSizeFitter : UIBehaviour, ILayoutSelfController, ILayoutController
{
// Token: 0x06000526 RID: 1318 RVA: 0x0001B2CF File Offset: 0x000196CF
protected ContentSizeFitter()
{
}
// Token: 0x17000167 RID: 359
// (get) Token: 0x06000527 RID: 1319 RVA: 0x0001B2E8 File Offset: 0x000196E8
// (set) Token: 0x06000528 RID: 1320 RVA: 0x0001B303 File Offset: 0x00019703
public ContentSizeFitter.FitMode horizontalFit
{
get
{
return this.m_HorizontalFit;
}
set
{
if (SetPropertyUtility.SetStruct<ContentSizeFitter.FitMode>(ref this.m_HorizontalFit, value))
{
this.SetDirty();
}
}
}
// Token: 0x17000168 RID: 360
// (get) Token: 0x06000529 RID: 1321 RVA: 0x0001B320 File Offset: 0x00019720
// (set) Token: 0x0600052A RID: 1322 RVA: 0x0001B33B File Offset: 0x0001973B
public ContentSizeFitter.FitMode verticalFit
{
get
{
return this.m_VerticalFit;
}
set
{
if (SetPropertyUtility.SetStruct<ContentSizeFitter.FitMode>(ref this.m_VerticalFit, value))
{
this.SetDirty();
}
}
}
// Token: 0x17000169 RID: 361
// (get) Token: 0x0600052B RID: 1323 RVA: 0x0001B358 File Offset: 0x00019758
private RectTransform rectTransform
{
get
{
if (this.m_Rect == null)
{
this.m_Rect = base.GetComponent<RectTransform>();
}
return this.m_Rect;
}
}
// Token: 0x0600052C RID: 1324 RVA: 0x0001B390 File Offset: 0x00019790
protected override void OnEnable()
{
base.OnEnable();
this.SetDirty();
}
// Token: 0x0600052D RID: 1325 RVA: 0x0001B39F File Offset: 0x0001979F
protected override void OnDisable()
{
this.m_Tracker.Clear();
LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform);
base.OnDisable();
}
// Token: 0x0600052E RID: 1326 RVA: 0x0001B3BE File Offset: 0x000197BE
protected override void OnRectTransformDimensionsChange()
{
this.SetDirty();
}
// Token: 0x0600052F RID: 1327 RVA: 0x0001B3C8 File Offset: 0x000197C8
private void HandleSelfFittingAlongAxis(int axis)
{
ContentSizeFitter.FitMode fitMode = ((axis != 0) ? this.verticalFit : this.horizontalFit);
if (fitMode == ContentSizeFitter.FitMode.Unconstrained)
{
this.m_Tracker.Add(this, this.rectTransform, DrivenTransformProperties.None);
}
else
{
this.m_Tracker.Add(this, this.rectTransform, (axis != 0) ? DrivenTransformProperties.SizeDeltaY : DrivenTransformProperties.SizeDeltaX);
if (fitMode == ContentSizeFitter.FitMode.MinSize)
{
this.rectTransform.SetSizeWithCurrentAnchors((RectTransform.Axis)axis, LayoutUtility.GetMinSize(this.m_Rect, axis));
}
else
{
this.rectTransform.SetSizeWithCurrentAnchors((RectTransform.Axis)axis, LayoutUtility.GetPreferredSize(this.m_Rect, axis));
}
}
}
// Token: 0x06000530 RID: 1328 RVA: 0x0001B470 File Offset: 0x00019870
public virtual void SetLayoutHorizontal()
{
this.m_Tracker.Clear();
this.HandleSelfFittingAlongAxis(0);
}
// Token: 0x06000531 RID: 1329 RVA: 0x0001B485 File Offset: 0x00019885
public virtual void SetLayoutVertical()
{
this.HandleSelfFittingAlongAxis(1);
}
// Token: 0x06000532 RID: 1330 RVA: 0x0001B48F File Offset: 0x0001988F
protected void SetDirty()
{
if (this.IsActive())
{
LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform);
}
}
// Token: 0x0400027F RID: 639
[SerializeField]
protected ContentSizeFitter.FitMode m_HorizontalFit = ContentSizeFitter.FitMode.Unconstrained;
// Token: 0x04000280 RID: 640
[SerializeField]
protected ContentSizeFitter.FitMode m_VerticalFit = ContentSizeFitter.FitMode.Unconstrained;
// Token: 0x04000281 RID: 641
[NonSerialized]
private RectTransform m_Rect;
// Token: 0x04000282 RID: 642
private DrivenRectTransformTracker m_Tracker;
// Token: 0x0200008E RID: 142
public enum FitMode
{
// Token: 0x04000284 RID: 644
Unconstrained,
// Token: 0x04000285 RID: 645
MinSize,
// Token: 0x04000286 RID: 646
PreferredSize
}
}
}
@@ -0,0 +1,166 @@
using System;
using UnityEngine.Events;
namespace UnityEngine.UI.CoroutineTween
{
// Token: 0x02000033 RID: 51
internal struct ColorTween : ITweenValue
{
// Token: 0x1700005B RID: 91
// (get) Token: 0x06000155 RID: 341 RVA: 0x00006614 File Offset: 0x00004A14
// (set) Token: 0x06000156 RID: 342 RVA: 0x0000662F File Offset: 0x00004A2F
public Color startColor
{
get
{
return this.m_StartColor;
}
set
{
this.m_StartColor = value;
}
}
// Token: 0x1700005C RID: 92
// (get) Token: 0x06000157 RID: 343 RVA: 0x0000663C File Offset: 0x00004A3C
// (set) Token: 0x06000158 RID: 344 RVA: 0x00006657 File Offset: 0x00004A57
public Color targetColor
{
get
{
return this.m_TargetColor;
}
set
{
this.m_TargetColor = value;
}
}
// Token: 0x1700005D RID: 93
// (get) Token: 0x06000159 RID: 345 RVA: 0x00006664 File Offset: 0x00004A64
// (set) Token: 0x0600015A RID: 346 RVA: 0x0000667F File Offset: 0x00004A7F
public ColorTween.ColorTweenMode tweenMode
{
get
{
return this.m_TweenMode;
}
set
{
this.m_TweenMode = value;
}
}
// Token: 0x1700005E RID: 94
// (get) Token: 0x0600015B RID: 347 RVA: 0x0000668C File Offset: 0x00004A8C
// (set) Token: 0x0600015C RID: 348 RVA: 0x000066A7 File Offset: 0x00004AA7
public float duration
{
get
{
return this.m_Duration;
}
set
{
this.m_Duration = value;
}
}
// Token: 0x1700005F RID: 95
// (get) Token: 0x0600015D RID: 349 RVA: 0x000066B4 File Offset: 0x00004AB4
// (set) Token: 0x0600015E RID: 350 RVA: 0x000066CF File Offset: 0x00004ACF
public bool ignoreTimeScale
{
get
{
return this.m_IgnoreTimeScale;
}
set
{
this.m_IgnoreTimeScale = value;
}
}
// Token: 0x0600015F RID: 351 RVA: 0x000066DC File Offset: 0x00004ADC
public void TweenValue(float floatPercentage)
{
if (this.ValidTarget())
{
Color color = Color.Lerp(this.m_StartColor, this.m_TargetColor, floatPercentage);
if (this.m_TweenMode == ColorTween.ColorTweenMode.Alpha)
{
color.r = this.m_StartColor.r;
color.g = this.m_StartColor.g;
color.b = this.m_StartColor.b;
}
else if (this.m_TweenMode == ColorTween.ColorTweenMode.RGB)
{
color.a = this.m_StartColor.a;
}
this.m_Target.Invoke(color);
}
}
// Token: 0x06000160 RID: 352 RVA: 0x00006782 File Offset: 0x00004B82
public void AddOnChangedCallback(UnityAction<Color> callback)
{
if (this.m_Target == null)
{
this.m_Target = new ColorTween.ColorTweenCallback();
}
this.m_Target.AddListener(callback);
}
// Token: 0x06000161 RID: 353 RVA: 0x000067A8 File Offset: 0x00004BA8
public bool GetIgnoreTimescale()
{
return this.m_IgnoreTimeScale;
}
// Token: 0x06000162 RID: 354 RVA: 0x000067C4 File Offset: 0x00004BC4
public float GetDuration()
{
return this.m_Duration;
}
// Token: 0x06000163 RID: 355 RVA: 0x000067E0 File Offset: 0x00004BE0
public bool ValidTarget()
{
return this.m_Target != null;
}
// Token: 0x040000A5 RID: 165
private ColorTween.ColorTweenCallback m_Target;
// Token: 0x040000A6 RID: 166
private Color m_StartColor;
// Token: 0x040000A7 RID: 167
private Color m_TargetColor;
// Token: 0x040000A8 RID: 168
private ColorTween.ColorTweenMode m_TweenMode;
// Token: 0x040000A9 RID: 169
private float m_Duration;
// Token: 0x040000AA RID: 170
private bool m_IgnoreTimeScale;
// Token: 0x02000034 RID: 52
public enum ColorTweenMode
{
// Token: 0x040000AC RID: 172
All,
// Token: 0x040000AD RID: 173
RGB,
// Token: 0x040000AE RID: 174
Alpha
}
// Token: 0x02000035 RID: 53
public class ColorTweenCallback : UnityEvent<Color>
{
}
}
}
@@ -0,0 +1,127 @@
using System;
using UnityEngine.Events;
namespace UnityEngine.UI.CoroutineTween
{
// Token: 0x02000036 RID: 54
internal struct FloatTween : ITweenValue
{
// Token: 0x17000060 RID: 96
// (get) Token: 0x06000165 RID: 357 RVA: 0x0000680C File Offset: 0x00004C0C
// (set) Token: 0x06000166 RID: 358 RVA: 0x00006827 File Offset: 0x00004C27
public float startValue
{
get
{
return this.m_StartValue;
}
set
{
this.m_StartValue = value;
}
}
// Token: 0x17000061 RID: 97
// (get) Token: 0x06000167 RID: 359 RVA: 0x00006834 File Offset: 0x00004C34
// (set) Token: 0x06000168 RID: 360 RVA: 0x0000684F File Offset: 0x00004C4F
public float targetValue
{
get
{
return this.m_TargetValue;
}
set
{
this.m_TargetValue = value;
}
}
// Token: 0x17000062 RID: 98
// (get) Token: 0x06000169 RID: 361 RVA: 0x0000685C File Offset: 0x00004C5C
// (set) Token: 0x0600016A RID: 362 RVA: 0x00006877 File Offset: 0x00004C77
public float duration
{
get
{
return this.m_Duration;
}
set
{
this.m_Duration = value;
}
}
// Token: 0x17000063 RID: 99
// (get) Token: 0x0600016B RID: 363 RVA: 0x00006884 File Offset: 0x00004C84
// (set) Token: 0x0600016C RID: 364 RVA: 0x0000689F File Offset: 0x00004C9F
public bool ignoreTimeScale
{
get
{
return this.m_IgnoreTimeScale;
}
set
{
this.m_IgnoreTimeScale = value;
}
}
// Token: 0x0600016D RID: 365 RVA: 0x000068AC File Offset: 0x00004CAC
public void TweenValue(float floatPercentage)
{
if (this.ValidTarget())
{
float num = Mathf.Lerp(this.m_StartValue, this.m_TargetValue, floatPercentage);
this.m_Target.Invoke(num);
}
}
// Token: 0x0600016E RID: 366 RVA: 0x000068E9 File Offset: 0x00004CE9
public void AddOnChangedCallback(UnityAction<float> callback)
{
if (this.m_Target == null)
{
this.m_Target = new FloatTween.FloatTweenCallback();
}
this.m_Target.AddListener(callback);
}
// Token: 0x0600016F RID: 367 RVA: 0x00006910 File Offset: 0x00004D10
public bool GetIgnoreTimescale()
{
return this.m_IgnoreTimeScale;
}
// Token: 0x06000170 RID: 368 RVA: 0x0000692C File Offset: 0x00004D2C
public float GetDuration()
{
return this.m_Duration;
}
// Token: 0x06000171 RID: 369 RVA: 0x00006948 File Offset: 0x00004D48
public bool ValidTarget()
{
return this.m_Target != null;
}
// Token: 0x040000AF RID: 175
private FloatTween.FloatTweenCallback m_Target;
// Token: 0x040000B0 RID: 176
private float m_StartValue;
// Token: 0x040000B1 RID: 177
private float m_TargetValue;
// Token: 0x040000B2 RID: 178
private float m_Duration;
// Token: 0x040000B3 RID: 179
private bool m_IgnoreTimeScale;
// Token: 0x02000037 RID: 55
public class FloatTweenCallback : UnityEvent<float>
{
}
}
}
@@ -0,0 +1,22 @@
using System;
namespace UnityEngine.UI.CoroutineTween
{
// Token: 0x02000032 RID: 50
internal interface ITweenValue
{
// Token: 0x06000151 RID: 337
void TweenValue(float floatPercentage);
// Token: 0x17000059 RID: 89
// (get) Token: 0x06000152 RID: 338
bool ignoreTimeScale { get; }
// Token: 0x1700005A RID: 90
// (get) Token: 0x06000153 RID: 339
float duration { get; }
// Token: 0x06000154 RID: 340
bool ValidTarget();
}
}
@@ -0,0 +1,72 @@
using System;
using System.Collections;
namespace UnityEngine.UI.CoroutineTween
{
// Token: 0x02000038 RID: 56
internal class TweenRunner<T> where T : struct, ITweenValue
{
// Token: 0x06000174 RID: 372 RVA: 0x0000697C File Offset: 0x00004D7C
private static IEnumerator Start(T tweenInfo)
{
if (!tweenInfo.ValidTarget())
{
yield break;
}
float elapsedTime = 0f;
while (elapsedTime < tweenInfo.duration)
{
elapsedTime += ((!tweenInfo.ignoreTimeScale) ? Time.deltaTime : Time.unscaledDeltaTime);
float percentage = Mathf.Clamp01(elapsedTime / tweenInfo.duration);
tweenInfo.TweenValue(percentage);
yield return null;
}
tweenInfo.TweenValue(1f);
yield break;
}
// Token: 0x06000175 RID: 373 RVA: 0x0000699E File Offset: 0x00004D9E
public void Init(MonoBehaviour coroutineContainer)
{
this.m_CoroutineContainer = coroutineContainer;
}
// Token: 0x06000176 RID: 374 RVA: 0x000069A8 File Offset: 0x00004DA8
public void StartTween(T info)
{
if (this.m_CoroutineContainer == null)
{
Debug.LogWarning("Coroutine container not configured... did you forget to call Init?");
}
else
{
this.StopTween();
if (!this.m_CoroutineContainer.gameObject.activeInHierarchy)
{
info.TweenValue(1f);
}
else
{
this.m_Tween = TweenRunner<T>.Start(info);
this.m_CoroutineContainer.StartCoroutine(this.m_Tween);
}
}
}
// Token: 0x06000177 RID: 375 RVA: 0x00006A28 File Offset: 0x00004E28
public void StopTween()
{
if (this.m_Tween != null)
{
this.m_CoroutineContainer.StopCoroutine(this.m_Tween);
this.m_Tween = null;
}
}
// Token: 0x040000B4 RID: 180
protected MonoBehaviour m_CoroutineContainer;
// Token: 0x040000B5 RID: 181
protected IEnumerator m_Tween;
}
}
+514
View File
@@ -0,0 +1,514 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000040 RID: 64
public static class DefaultControls
{
// Token: 0x060001B3 RID: 435 RVA: 0x00008624 File Offset: 0x00006A24
private static GameObject CreateUIElementRoot(string name, Vector2 size)
{
GameObject gameObject = new GameObject(name);
RectTransform rectTransform = gameObject.AddComponent<RectTransform>();
rectTransform.sizeDelta = size;
return gameObject;
}
// Token: 0x060001B4 RID: 436 RVA: 0x00008650 File Offset: 0x00006A50
private static GameObject CreateUIObject(string name, GameObject parent)
{
GameObject gameObject = new GameObject(name);
gameObject.AddComponent<RectTransform>();
DefaultControls.SetParentAndAlign(gameObject, parent);
return gameObject;
}
// Token: 0x060001B5 RID: 437 RVA: 0x0000867B File Offset: 0x00006A7B
private static void SetDefaultTextValues(Text lbl)
{
lbl.color = DefaultControls.s_TextColor;
lbl.AssignDefaultFont();
}
// Token: 0x060001B6 RID: 438 RVA: 0x00008690 File Offset: 0x00006A90
private static void SetDefaultColorTransitionValues(Selectable slider)
{
ColorBlock colors = slider.colors;
colors.highlightedColor = new Color(0.882f, 0.882f, 0.882f);
colors.pressedColor = new Color(0.698f, 0.698f, 0.698f);
colors.disabledColor = new Color(0.521f, 0.521f, 0.521f);
}
// Token: 0x060001B7 RID: 439 RVA: 0x000086F6 File Offset: 0x00006AF6
private static void SetParentAndAlign(GameObject child, GameObject parent)
{
if (!(parent == null))
{
child.transform.SetParent(parent.transform, false);
DefaultControls.SetLayerRecursively(child, parent.layer);
}
}
// Token: 0x060001B8 RID: 440 RVA: 0x00008728 File Offset: 0x00006B28
private static void SetLayerRecursively(GameObject go, int layer)
{
go.layer = layer;
Transform transform = go.transform;
for (int i = 0; i < transform.childCount; i++)
{
DefaultControls.SetLayerRecursively(transform.GetChild(i).gameObject, layer);
}
}
// Token: 0x060001B9 RID: 441 RVA: 0x00008770 File Offset: 0x00006B70
public static GameObject CreatePanel(DefaultControls.Resources resources)
{
GameObject gameObject = DefaultControls.CreateUIElementRoot("Panel", DefaultControls.s_ThickElementSize);
RectTransform component = gameObject.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.anchoredPosition = Vector2.zero;
component.sizeDelta = Vector2.zero;
Image image = gameObject.AddComponent<Image>();
image.sprite = resources.background;
image.type = Image.Type.Sliced;
image.color = DefaultControls.s_PanelColor;
return gameObject;
}
// Token: 0x060001BA RID: 442 RVA: 0x000087F0 File Offset: 0x00006BF0
public static GameObject CreateButton(DefaultControls.Resources resources)
{
GameObject gameObject = DefaultControls.CreateUIElementRoot("Button", DefaultControls.s_ThickElementSize);
GameObject gameObject2 = new GameObject("Text");
gameObject2.AddComponent<RectTransform>();
DefaultControls.SetParentAndAlign(gameObject2, gameObject);
Image image = gameObject.AddComponent<Image>();
image.sprite = resources.standard;
image.type = Image.Type.Sliced;
image.color = DefaultControls.s_DefaultSelectableColor;
Button button = gameObject.AddComponent<Button>();
DefaultControls.SetDefaultColorTransitionValues(button);
Text text = gameObject2.AddComponent<Text>();
text.text = "Button";
text.alignment = TextAnchor.MiddleCenter;
DefaultControls.SetDefaultTextValues(text);
RectTransform component = gameObject2.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.sizeDelta = Vector2.zero;
return gameObject;
}
// Token: 0x060001BB RID: 443 RVA: 0x000088B4 File Offset: 0x00006CB4
public static GameObject CreateText(DefaultControls.Resources resources)
{
GameObject gameObject = DefaultControls.CreateUIElementRoot("Text", DefaultControls.s_ThickElementSize);
Text text = gameObject.AddComponent<Text>();
text.text = "New Text";
DefaultControls.SetDefaultTextValues(text);
return gameObject;
}
// Token: 0x060001BC RID: 444 RVA: 0x000088F4 File Offset: 0x00006CF4
public static GameObject CreateImage(DefaultControls.Resources resources)
{
GameObject gameObject = DefaultControls.CreateUIElementRoot("Image", DefaultControls.s_ImageElementSize);
gameObject.AddComponent<Image>();
return gameObject;
}
// Token: 0x060001BD RID: 445 RVA: 0x00008924 File Offset: 0x00006D24
public static GameObject CreateRawImage(DefaultControls.Resources resources)
{
GameObject gameObject = DefaultControls.CreateUIElementRoot("RawImage", DefaultControls.s_ImageElementSize);
gameObject.AddComponent<RawImage>();
return gameObject;
}
// Token: 0x060001BE RID: 446 RVA: 0x00008954 File Offset: 0x00006D54
public static GameObject CreateSlider(DefaultControls.Resources resources)
{
GameObject gameObject = DefaultControls.CreateUIElementRoot("Slider", DefaultControls.s_ThinElementSize);
GameObject gameObject2 = DefaultControls.CreateUIObject("Background", gameObject);
GameObject gameObject3 = DefaultControls.CreateUIObject("Fill Area", gameObject);
GameObject gameObject4 = DefaultControls.CreateUIObject("Fill", gameObject3);
GameObject gameObject5 = DefaultControls.CreateUIObject("Handle Slide Area", gameObject);
GameObject gameObject6 = DefaultControls.CreateUIObject("Handle", gameObject5);
Image image = gameObject2.AddComponent<Image>();
image.sprite = resources.background;
image.type = Image.Type.Sliced;
image.color = DefaultControls.s_DefaultSelectableColor;
RectTransform component = gameObject2.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 0.25f);
component.anchorMax = new Vector2(1f, 0.75f);
component.sizeDelta = new Vector2(0f, 0f);
RectTransform component2 = gameObject3.GetComponent<RectTransform>();
component2.anchorMin = new Vector2(0f, 0.25f);
component2.anchorMax = new Vector2(1f, 0.75f);
component2.anchoredPosition = new Vector2(-5f, 0f);
component2.sizeDelta = new Vector2(-20f, 0f);
Image image2 = gameObject4.AddComponent<Image>();
image2.sprite = resources.standard;
image2.type = Image.Type.Sliced;
image2.color = DefaultControls.s_DefaultSelectableColor;
RectTransform component3 = gameObject4.GetComponent<RectTransform>();
component3.sizeDelta = new Vector2(10f, 0f);
RectTransform component4 = gameObject5.GetComponent<RectTransform>();
component4.sizeDelta = new Vector2(-20f, 0f);
component4.anchorMin = new Vector2(0f, 0f);
component4.anchorMax = new Vector2(1f, 1f);
Image image3 = gameObject6.AddComponent<Image>();
image3.sprite = resources.knob;
image3.color = DefaultControls.s_DefaultSelectableColor;
RectTransform component5 = gameObject6.GetComponent<RectTransform>();
component5.sizeDelta = new Vector2(20f, 0f);
Slider slider = gameObject.AddComponent<Slider>();
slider.fillRect = gameObject4.GetComponent<RectTransform>();
slider.handleRect = gameObject6.GetComponent<RectTransform>();
slider.targetGraphic = image3;
slider.direction = Slider.Direction.LeftToRight;
DefaultControls.SetDefaultColorTransitionValues(slider);
return gameObject;
}
// Token: 0x060001BF RID: 447 RVA: 0x00008BA0 File Offset: 0x00006FA0
public static GameObject CreateScrollbar(DefaultControls.Resources resources)
{
GameObject gameObject = DefaultControls.CreateUIElementRoot("Scrollbar", DefaultControls.s_ThinElementSize);
GameObject gameObject2 = DefaultControls.CreateUIObject("Sliding Area", gameObject);
GameObject gameObject3 = DefaultControls.CreateUIObject("Handle", gameObject2);
Image image = gameObject.AddComponent<Image>();
image.sprite = resources.background;
image.type = Image.Type.Sliced;
image.color = DefaultControls.s_DefaultSelectableColor;
Image image2 = gameObject3.AddComponent<Image>();
image2.sprite = resources.standard;
image2.type = Image.Type.Sliced;
image2.color = DefaultControls.s_DefaultSelectableColor;
RectTransform component = gameObject2.GetComponent<RectTransform>();
component.sizeDelta = new Vector2(-20f, -20f);
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
RectTransform component2 = gameObject3.GetComponent<RectTransform>();
component2.sizeDelta = new Vector2(20f, 20f);
Scrollbar scrollbar = gameObject.AddComponent<Scrollbar>();
scrollbar.handleRect = component2;
scrollbar.targetGraphic = image2;
DefaultControls.SetDefaultColorTransitionValues(scrollbar);
return gameObject;
}
// Token: 0x060001C0 RID: 448 RVA: 0x00008CA8 File Offset: 0x000070A8
public static GameObject CreateToggle(DefaultControls.Resources resources)
{
GameObject gameObject = DefaultControls.CreateUIElementRoot("Toggle", DefaultControls.s_ThinElementSize);
GameObject gameObject2 = DefaultControls.CreateUIObject("Background", gameObject);
GameObject gameObject3 = DefaultControls.CreateUIObject("Checkmark", gameObject2);
GameObject gameObject4 = DefaultControls.CreateUIObject("Label", gameObject);
Toggle toggle = gameObject.AddComponent<Toggle>();
toggle.isOn = true;
Image image = gameObject2.AddComponent<Image>();
image.sprite = resources.standard;
image.type = Image.Type.Sliced;
image.color = DefaultControls.s_DefaultSelectableColor;
Image image2 = gameObject3.AddComponent<Image>();
image2.sprite = resources.checkmark;
Text text = gameObject4.AddComponent<Text>();
text.text = "Toggle";
DefaultControls.SetDefaultTextValues(text);
toggle.graphic = image2;
toggle.targetGraphic = image;
DefaultControls.SetDefaultColorTransitionValues(toggle);
RectTransform component = gameObject2.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 1f);
component.anchorMax = new Vector2(0f, 1f);
component.anchoredPosition = new Vector2(10f, -10f);
component.sizeDelta = new Vector2(20f, 20f);
RectTransform component2 = gameObject3.GetComponent<RectTransform>();
component2.anchorMin = new Vector2(0.5f, 0.5f);
component2.anchorMax = new Vector2(0.5f, 0.5f);
component2.anchoredPosition = Vector2.zero;
component2.sizeDelta = new Vector2(20f, 20f);
RectTransform component3 = gameObject4.GetComponent<RectTransform>();
component3.anchorMin = new Vector2(0f, 0f);
component3.anchorMax = new Vector2(1f, 1f);
component3.offsetMin = new Vector2(23f, 1f);
component3.offsetMax = new Vector2(-5f, -2f);
return gameObject;
}
// Token: 0x060001C1 RID: 449 RVA: 0x00008E90 File Offset: 0x00007290
public static GameObject CreateInputField(DefaultControls.Resources resources)
{
GameObject gameObject = DefaultControls.CreateUIElementRoot("InputField", DefaultControls.s_ThickElementSize);
GameObject gameObject2 = DefaultControls.CreateUIObject("Placeholder", gameObject);
GameObject gameObject3 = DefaultControls.CreateUIObject("Text", gameObject);
Image image = gameObject.AddComponent<Image>();
image.sprite = resources.inputField;
image.type = Image.Type.Sliced;
image.color = DefaultControls.s_DefaultSelectableColor;
InputField inputField = gameObject.AddComponent<InputField>();
DefaultControls.SetDefaultColorTransitionValues(inputField);
Text text = gameObject3.AddComponent<Text>();
text.text = "";
text.supportRichText = false;
DefaultControls.SetDefaultTextValues(text);
Text text2 = gameObject2.AddComponent<Text>();
text2.text = "Enter text...";
text2.fontStyle = FontStyle.Italic;
Color color = text.color;
color.a *= 0.5f;
text2.color = color;
RectTransform component = gameObject3.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.sizeDelta = Vector2.zero;
component.offsetMin = new Vector2(10f, 6f);
component.offsetMax = new Vector2(-10f, -7f);
RectTransform component2 = gameObject2.GetComponent<RectTransform>();
component2.anchorMin = Vector2.zero;
component2.anchorMax = Vector2.one;
component2.sizeDelta = Vector2.zero;
component2.offsetMin = new Vector2(10f, 6f);
component2.offsetMax = new Vector2(-10f, -7f);
inputField.textComponent = text;
inputField.placeholder = text2;
return gameObject;
}
// Token: 0x060001C2 RID: 450 RVA: 0x0000902C File Offset: 0x0000742C
public static GameObject CreateDropdown(DefaultControls.Resources resources)
{
GameObject gameObject = DefaultControls.CreateUIElementRoot("Dropdown", DefaultControls.s_ThickElementSize);
GameObject gameObject2 = DefaultControls.CreateUIObject("Label", gameObject);
GameObject gameObject3 = DefaultControls.CreateUIObject("Arrow", gameObject);
GameObject gameObject4 = DefaultControls.CreateUIObject("Template", gameObject);
GameObject gameObject5 = DefaultControls.CreateUIObject("Viewport", gameObject4);
GameObject gameObject6 = DefaultControls.CreateUIObject("Content", gameObject5);
GameObject gameObject7 = DefaultControls.CreateUIObject("Item", gameObject6);
GameObject gameObject8 = DefaultControls.CreateUIObject("Item Background", gameObject7);
GameObject gameObject9 = DefaultControls.CreateUIObject("Item Checkmark", gameObject7);
GameObject gameObject10 = DefaultControls.CreateUIObject("Item Label", gameObject7);
GameObject gameObject11 = DefaultControls.CreateScrollbar(resources);
gameObject11.name = "Scrollbar";
DefaultControls.SetParentAndAlign(gameObject11, gameObject4);
Scrollbar component = gameObject11.GetComponent<Scrollbar>();
component.SetDirection(Scrollbar.Direction.BottomToTop, true);
RectTransform component2 = gameObject11.GetComponent<RectTransform>();
component2.anchorMin = Vector2.right;
component2.anchorMax = Vector2.one;
component2.pivot = Vector2.one;
component2.sizeDelta = new Vector2(component2.sizeDelta.x, 0f);
Text text = gameObject10.AddComponent<Text>();
DefaultControls.SetDefaultTextValues(text);
text.alignment = TextAnchor.MiddleLeft;
Image image = gameObject8.AddComponent<Image>();
image.color = new Color32(245, 245, 245, byte.MaxValue);
Image image2 = gameObject9.AddComponent<Image>();
image2.sprite = resources.checkmark;
Toggle toggle = gameObject7.AddComponent<Toggle>();
toggle.targetGraphic = image;
toggle.graphic = image2;
toggle.isOn = true;
Image image3 = gameObject4.AddComponent<Image>();
image3.sprite = resources.standard;
image3.type = Image.Type.Sliced;
ScrollRect scrollRect = gameObject4.AddComponent<ScrollRect>();
scrollRect.content = (RectTransform)gameObject6.transform;
scrollRect.viewport = (RectTransform)gameObject5.transform;
scrollRect.horizontal = false;
scrollRect.movementType = ScrollRect.MovementType.Clamped;
scrollRect.verticalScrollbar = component;
scrollRect.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
scrollRect.verticalScrollbarSpacing = -3f;
Mask mask = gameObject5.AddComponent<Mask>();
mask.showMaskGraphic = false;
Image image4 = gameObject5.AddComponent<Image>();
image4.sprite = resources.mask;
image4.type = Image.Type.Sliced;
Text text2 = gameObject2.AddComponent<Text>();
DefaultControls.SetDefaultTextValues(text2);
text2.alignment = TextAnchor.MiddleLeft;
Image image5 = gameObject3.AddComponent<Image>();
image5.sprite = resources.dropdown;
Image image6 = gameObject.AddComponent<Image>();
image6.sprite = resources.standard;
image6.color = DefaultControls.s_DefaultSelectableColor;
image6.type = Image.Type.Sliced;
Dropdown dropdown = gameObject.AddComponent<Dropdown>();
dropdown.targetGraphic = image6;
DefaultControls.SetDefaultColorTransitionValues(dropdown);
dropdown.template = gameObject4.GetComponent<RectTransform>();
dropdown.captionText = text2;
dropdown.itemText = text;
text.text = "Option A";
dropdown.options.Add(new Dropdown.OptionData
{
text = "Option A"
});
dropdown.options.Add(new Dropdown.OptionData
{
text = "Option B"
});
dropdown.options.Add(new Dropdown.OptionData
{
text = "Option C"
});
dropdown.RefreshShownValue();
RectTransform component3 = gameObject2.GetComponent<RectTransform>();
component3.anchorMin = Vector2.zero;
component3.anchorMax = Vector2.one;
component3.offsetMin = new Vector2(10f, 6f);
component3.offsetMax = new Vector2(-25f, -7f);
RectTransform component4 = gameObject3.GetComponent<RectTransform>();
component4.anchorMin = new Vector2(1f, 0.5f);
component4.anchorMax = new Vector2(1f, 0.5f);
component4.sizeDelta = new Vector2(20f, 20f);
component4.anchoredPosition = new Vector2(-15f, 0f);
RectTransform component5 = gameObject4.GetComponent<RectTransform>();
component5.anchorMin = new Vector2(0f, 0f);
component5.anchorMax = new Vector2(1f, 0f);
component5.pivot = new Vector2(0.5f, 1f);
component5.anchoredPosition = new Vector2(0f, 2f);
component5.sizeDelta = new Vector2(0f, 150f);
RectTransform component6 = gameObject5.GetComponent<RectTransform>();
component6.anchorMin = new Vector2(0f, 0f);
component6.anchorMax = new Vector2(1f, 1f);
component6.sizeDelta = new Vector2(-18f, 0f);
component6.pivot = new Vector2(0f, 1f);
RectTransform component7 = gameObject6.GetComponent<RectTransform>();
component7.anchorMin = new Vector2(0f, 1f);
component7.anchorMax = new Vector2(1f, 1f);
component7.pivot = new Vector2(0.5f, 1f);
component7.anchoredPosition = new Vector2(0f, 0f);
component7.sizeDelta = new Vector2(0f, 28f);
RectTransform component8 = gameObject7.GetComponent<RectTransform>();
component8.anchorMin = new Vector2(0f, 0.5f);
component8.anchorMax = new Vector2(1f, 0.5f);
component8.sizeDelta = new Vector2(0f, 20f);
RectTransform component9 = gameObject8.GetComponent<RectTransform>();
component9.anchorMin = Vector2.zero;
component9.anchorMax = Vector2.one;
component9.sizeDelta = Vector2.zero;
RectTransform component10 = gameObject9.GetComponent<RectTransform>();
component10.anchorMin = new Vector2(0f, 0.5f);
component10.anchorMax = new Vector2(0f, 0.5f);
component10.sizeDelta = new Vector2(20f, 20f);
component10.anchoredPosition = new Vector2(10f, 0f);
RectTransform component11 = gameObject10.GetComponent<RectTransform>();
component11.anchorMin = Vector2.zero;
component11.anchorMax = Vector2.one;
component11.offsetMin = new Vector2(20f, 1f);
component11.offsetMax = new Vector2(-10f, -2f);
gameObject4.SetActive(false);
return gameObject;
}
// Token: 0x060001C3 RID: 451 RVA: 0x0000969C File Offset: 0x00007A9C
public static GameObject CreateScrollView(DefaultControls.Resources resources)
{
GameObject gameObject = DefaultControls.CreateUIElementRoot("Scroll View", new Vector2(200f, 200f));
GameObject gameObject2 = DefaultControls.CreateUIObject("Viewport", gameObject);
GameObject gameObject3 = DefaultControls.CreateUIObject("Content", gameObject2);
GameObject gameObject4 = DefaultControls.CreateScrollbar(resources);
gameObject4.name = "Scrollbar Horizontal";
DefaultControls.SetParentAndAlign(gameObject4, gameObject);
RectTransform component = gameObject4.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.right;
component.pivot = Vector2.zero;
component.sizeDelta = new Vector2(0f, component.sizeDelta.y);
GameObject gameObject5 = DefaultControls.CreateScrollbar(resources);
gameObject5.name = "Scrollbar Vertical";
DefaultControls.SetParentAndAlign(gameObject5, gameObject);
gameObject5.GetComponent<Scrollbar>().SetDirection(Scrollbar.Direction.BottomToTop, true);
RectTransform component2 = gameObject5.GetComponent<RectTransform>();
component2.anchorMin = Vector2.right;
component2.anchorMax = Vector2.one;
component2.pivot = Vector2.one;
component2.sizeDelta = new Vector2(component2.sizeDelta.x, 0f);
RectTransform component3 = gameObject2.GetComponent<RectTransform>();
component3.anchorMin = Vector2.zero;
component3.anchorMax = Vector2.one;
component3.sizeDelta = Vector2.zero;
component3.pivot = Vector2.up;
RectTransform component4 = gameObject3.GetComponent<RectTransform>();
component4.anchorMin = Vector2.up;
component4.anchorMax = Vector2.one;
component4.sizeDelta = new Vector2(0f, 300f);
component4.pivot = Vector2.up;
ScrollRect scrollRect = gameObject.AddComponent<ScrollRect>();
scrollRect.content = component4;
scrollRect.viewport = component3;
scrollRect.horizontalScrollbar = gameObject4.GetComponent<Scrollbar>();
scrollRect.verticalScrollbar = gameObject5.GetComponent<Scrollbar>();
scrollRect.horizontalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
scrollRect.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
scrollRect.horizontalScrollbarSpacing = -3f;
scrollRect.verticalScrollbarSpacing = -3f;
Image image = gameObject.AddComponent<Image>();
image.sprite = resources.background;
image.type = Image.Type.Sliced;
image.color = DefaultControls.s_PanelColor;
Mask mask = gameObject2.AddComponent<Mask>();
mask.showMaskGraphic = false;
Image image2 = gameObject2.AddComponent<Image>();
image2.sprite = resources.mask;
image2.type = Image.Type.Sliced;
return gameObject;
}
// Token: 0x040000D3 RID: 211
private const float kWidth = 160f;
// Token: 0x040000D4 RID: 212
private const float kThickHeight = 30f;
// Token: 0x040000D5 RID: 213
private const float kThinHeight = 20f;
// Token: 0x040000D6 RID: 214
private static Vector2 s_ThickElementSize = new Vector2(160f, 30f);
// Token: 0x040000D7 RID: 215
private static Vector2 s_ThinElementSize = new Vector2(160f, 20f);
// Token: 0x040000D8 RID: 216
private static Vector2 s_ImageElementSize = new Vector2(100f, 100f);
// Token: 0x040000D9 RID: 217
private static Color s_DefaultSelectableColor = new Color(1f, 1f, 1f, 1f);
// Token: 0x040000DA RID: 218
private static Color s_PanelColor = new Color(1f, 1f, 1f, 0.392f);
// Token: 0x040000DB RID: 219
private static Color s_TextColor = new Color(0.19607843f, 0.19607843f, 0.19607843f, 1f);
// Token: 0x02000041 RID: 65
public struct Resources
{
// Token: 0x040000DC RID: 220
public Sprite standard;
// Token: 0x040000DD RID: 221
public Sprite background;
// Token: 0x040000DE RID: 222
public Sprite inputField;
// Token: 0x040000DF RID: 223
public Sprite knob;
// Token: 0x040000E0 RID: 224
public Sprite checkmark;
// Token: 0x040000E1 RID: 225
public Sprite dropdown;
// Token: 0x040000E2 RID: 226
public Sprite mask;
}
}
}
+857
View File
@@ -0,0 +1,857 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI.CoroutineTween;
namespace UnityEngine.UI
{
// Token: 0x02000042 RID: 66
[AddComponentMenu("UI/Dropdown", 35)]
[RequireComponent(typeof(RectTransform))]
public class Dropdown : Selectable, IPointerClickHandler, ISubmitHandler, ICancelHandler, IEventSystemHandler
{
// Token: 0x060001C5 RID: 453 RVA: 0x00009997 File Offset: 0x00007D97
protected Dropdown()
{
}
// Token: 0x17000072 RID: 114
// (get) Token: 0x060001C6 RID: 454 RVA: 0x000099C8 File Offset: 0x00007DC8
// (set) Token: 0x060001C7 RID: 455 RVA: 0x000099E3 File Offset: 0x00007DE3
public RectTransform template
{
get
{
return this.m_Template;
}
set
{
this.m_Template = value;
this.RefreshShownValue();
}
}
// Token: 0x17000073 RID: 115
// (get) Token: 0x060001C8 RID: 456 RVA: 0x000099F4 File Offset: 0x00007DF4
// (set) Token: 0x060001C9 RID: 457 RVA: 0x00009A0F File Offset: 0x00007E0F
public Text captionText
{
get
{
return this.m_CaptionText;
}
set
{
this.m_CaptionText = value;
this.RefreshShownValue();
}
}
// Token: 0x17000074 RID: 116
// (get) Token: 0x060001CA RID: 458 RVA: 0x00009A20 File Offset: 0x00007E20
// (set) Token: 0x060001CB RID: 459 RVA: 0x00009A3B File Offset: 0x00007E3B
public Image captionImage
{
get
{
return this.m_CaptionImage;
}
set
{
this.m_CaptionImage = value;
this.RefreshShownValue();
}
}
// Token: 0x17000075 RID: 117
// (get) Token: 0x060001CC RID: 460 RVA: 0x00009A4C File Offset: 0x00007E4C
// (set) Token: 0x060001CD RID: 461 RVA: 0x00009A67 File Offset: 0x00007E67
public Text itemText
{
get
{
return this.m_ItemText;
}
set
{
this.m_ItemText = value;
this.RefreshShownValue();
}
}
// Token: 0x17000076 RID: 118
// (get) Token: 0x060001CE RID: 462 RVA: 0x00009A78 File Offset: 0x00007E78
// (set) Token: 0x060001CF RID: 463 RVA: 0x00009A93 File Offset: 0x00007E93
public Image itemImage
{
get
{
return this.m_ItemImage;
}
set
{
this.m_ItemImage = value;
this.RefreshShownValue();
}
}
// Token: 0x17000077 RID: 119
// (get) Token: 0x060001D0 RID: 464 RVA: 0x00009AA4 File Offset: 0x00007EA4
// (set) Token: 0x060001D1 RID: 465 RVA: 0x00009AC4 File Offset: 0x00007EC4
public List<Dropdown.OptionData> options
{
get
{
return this.m_Options.options;
}
set
{
this.m_Options.options = value;
this.RefreshShownValue();
}
}
// Token: 0x17000078 RID: 120
// (get) Token: 0x060001D2 RID: 466 RVA: 0x00009ADC File Offset: 0x00007EDC
// (set) Token: 0x060001D3 RID: 467 RVA: 0x00009AF7 File Offset: 0x00007EF7
public Dropdown.DropdownEvent onValueChanged
{
get
{
return this.m_OnValueChanged;
}
set
{
this.m_OnValueChanged = value;
}
}
// Token: 0x17000079 RID: 121
// (get) Token: 0x060001D4 RID: 468 RVA: 0x00009B04 File Offset: 0x00007F04
// (set) Token: 0x060001D5 RID: 469 RVA: 0x00009B20 File Offset: 0x00007F20
public int value
{
get
{
return this.m_Value;
}
set
{
if (!Application.isPlaying || (value != this.m_Value && this.options.Count != 0))
{
this.m_Value = Mathf.Clamp(value, 0, this.options.Count - 1);
this.RefreshShownValue();
UISystemProfilerApi.AddMarker("Dropdown.value", this);
this.m_OnValueChanged.Invoke(this.m_Value);
}
}
}
// Token: 0x060001D6 RID: 470 RVA: 0x00009B98 File Offset: 0x00007F98
protected override void Awake()
{
this.m_AlphaTweenRunner = new TweenRunner<FloatTween>();
this.m_AlphaTweenRunner.Init(this);
if (this.m_CaptionImage)
{
this.m_CaptionImage.enabled = this.m_CaptionImage.sprite != null;
}
if (this.m_Template)
{
this.m_Template.gameObject.SetActive(false);
}
}
// Token: 0x060001D7 RID: 471 RVA: 0x00009C0C File Offset: 0x0000800C
public void RefreshShownValue()
{
Dropdown.OptionData optionData = Dropdown.s_NoOptionData;
if (this.options.Count > 0)
{
optionData = this.options[Mathf.Clamp(this.m_Value, 0, this.options.Count - 1)];
}
if (this.m_CaptionText)
{
if (optionData != null && optionData.text != null)
{
this.m_CaptionText.text = optionData.text;
}
else
{
this.m_CaptionText.text = "";
}
}
if (this.m_CaptionImage)
{
if (optionData != null)
{
this.m_CaptionImage.sprite = optionData.image;
}
else
{
this.m_CaptionImage.sprite = null;
}
this.m_CaptionImage.enabled = this.m_CaptionImage.sprite != null;
}
}
// Token: 0x060001D8 RID: 472 RVA: 0x00009CF5 File Offset: 0x000080F5
public void AddOptions(List<Dropdown.OptionData> options)
{
this.options.AddRange(options);
this.RefreshShownValue();
}
// Token: 0x060001D9 RID: 473 RVA: 0x00009D0C File Offset: 0x0000810C
public void AddOptions(List<string> options)
{
for (int i = 0; i < options.Count; i++)
{
this.options.Add(new Dropdown.OptionData(options[i]));
}
this.RefreshShownValue();
}
// Token: 0x060001DA RID: 474 RVA: 0x00009D50 File Offset: 0x00008150
public void AddOptions(List<Sprite> options)
{
for (int i = 0; i < options.Count; i++)
{
this.options.Add(new Dropdown.OptionData(options[i]));
}
this.RefreshShownValue();
}
// Token: 0x060001DB RID: 475 RVA: 0x00009D92 File Offset: 0x00008192
public void ClearOptions()
{
this.options.Clear();
this.RefreshShownValue();
}
// Token: 0x060001DC RID: 476 RVA: 0x00009DA8 File Offset: 0x000081A8
private void SetupTemplate()
{
this.validTemplate = false;
if (!this.m_Template)
{
Debug.LogError("The dropdown template is not assigned. The template needs to be assigned and must have a child GameObject with a Toggle component serving as the item.", this);
}
else
{
GameObject gameObject = this.m_Template.gameObject;
gameObject.SetActive(true);
Toggle componentInChildren = this.m_Template.GetComponentInChildren<Toggle>();
this.validTemplate = true;
if (!componentInChildren || componentInChildren.transform == this.template)
{
this.validTemplate = false;
Debug.LogError("The dropdown template is not valid. The template must have a child GameObject with a Toggle component serving as the item.", this.template);
}
else if (!(componentInChildren.transform.parent is RectTransform))
{
this.validTemplate = false;
Debug.LogError("The dropdown template is not valid. The child GameObject with a Toggle component (the item) must have a RectTransform on its parent.", this.template);
}
else if (this.itemText != null && !this.itemText.transform.IsChildOf(componentInChildren.transform))
{
this.validTemplate = false;
Debug.LogError("The dropdown template is not valid. The Item Text must be on the item GameObject or children of it.", this.template);
}
else if (this.itemImage != null && !this.itemImage.transform.IsChildOf(componentInChildren.transform))
{
this.validTemplate = false;
Debug.LogError("The dropdown template is not valid. The Item Image must be on the item GameObject or children of it.", this.template);
}
if (!this.validTemplate)
{
gameObject.SetActive(false);
}
else
{
Dropdown.DropdownItem dropdownItem = componentInChildren.gameObject.AddComponent<Dropdown.DropdownItem>();
dropdownItem.text = this.m_ItemText;
dropdownItem.image = this.m_ItemImage;
dropdownItem.toggle = componentInChildren;
dropdownItem.rectTransform = (RectTransform)componentInChildren.transform;
Canvas orAddComponent = Dropdown.GetOrAddComponent<Canvas>(gameObject);
orAddComponent.overrideSorting = true;
orAddComponent.sortingOrder = 30000;
Dropdown.GetOrAddComponent<GraphicRaycaster>(gameObject);
Dropdown.GetOrAddComponent<CanvasGroup>(gameObject);
gameObject.SetActive(false);
this.validTemplate = true;
}
}
}
// Token: 0x060001DD RID: 477 RVA: 0x00009F90 File Offset: 0x00008390
private static T GetOrAddComponent<T>(GameObject go) where T : Component
{
T t = go.GetComponent<T>();
if (!t)
{
t = go.AddComponent<T>();
}
return t;
}
// Token: 0x060001DE RID: 478 RVA: 0x00009FC4 File Offset: 0x000083C4
public virtual void OnPointerClick(PointerEventData eventData)
{
this.Show();
}
// Token: 0x060001DF RID: 479 RVA: 0x00009FCD File Offset: 0x000083CD
public virtual void OnSubmit(BaseEventData eventData)
{
this.Show();
}
// Token: 0x060001E0 RID: 480 RVA: 0x00009FD6 File Offset: 0x000083D6
public virtual void OnCancel(BaseEventData eventData)
{
this.Hide();
}
// Token: 0x060001E1 RID: 481 RVA: 0x00009FE0 File Offset: 0x000083E0
public void Show()
{
if (this.IsActive() && this.IsInteractable() && !(this.m_Dropdown != null))
{
if (!this.validTemplate)
{
this.SetupTemplate();
if (!this.validTemplate)
{
return;
}
}
List<Canvas> list = ListPool<Canvas>.Get();
base.gameObject.GetComponentsInParent<Canvas>(false, list);
if (list.Count != 0)
{
Canvas canvas = list[0];
ListPool<Canvas>.Release(list);
this.m_Template.gameObject.SetActive(true);
this.m_Dropdown = this.CreateDropdownList(this.m_Template.gameObject);
this.m_Dropdown.name = "Dropdown List";
this.m_Dropdown.SetActive(true);
RectTransform rectTransform = this.m_Dropdown.transform as RectTransform;
rectTransform.SetParent(this.m_Template.transform.parent, false);
Dropdown.DropdownItem componentInChildren = this.m_Dropdown.GetComponentInChildren<Dropdown.DropdownItem>();
GameObject gameObject = componentInChildren.rectTransform.parent.gameObject;
RectTransform rectTransform2 = gameObject.transform as RectTransform;
componentInChildren.rectTransform.gameObject.SetActive(true);
Rect rect = rectTransform2.rect;
Rect rect2 = componentInChildren.rectTransform.rect;
Vector2 vector = rect2.min - rect.min + componentInChildren.rectTransform.localPosition;
Vector2 vector2 = rect2.max - rect.max + componentInChildren.rectTransform.localPosition;
Vector2 size = rect2.size;
this.m_Items.Clear();
Toggle toggle = null;
for (int i = 0; i < this.options.Count; i++)
{
Dropdown.OptionData optionData = this.options[i];
Dropdown.DropdownItem item = this.AddItem(optionData, this.value == i, componentInChildren, this.m_Items);
if (!(item == null))
{
item.toggle.isOn = this.value == i;
item.toggle.onValueChanged.AddListener(delegate(bool x)
{
this.OnSelectItem(item.toggle);
});
if (item.toggle.isOn)
{
item.toggle.Select();
}
if (toggle != null)
{
Navigation navigation = toggle.navigation;
Navigation navigation2 = item.toggle.navigation;
navigation.mode = Navigation.Mode.Explicit;
navigation2.mode = Navigation.Mode.Explicit;
navigation.selectOnDown = item.toggle;
navigation.selectOnRight = item.toggle;
navigation2.selectOnLeft = toggle;
navigation2.selectOnUp = toggle;
toggle.navigation = navigation;
item.toggle.navigation = navigation2;
}
toggle = item.toggle;
}
}
Vector2 sizeDelta = rectTransform2.sizeDelta;
sizeDelta.y = size.y * (float)this.m_Items.Count + vector.y - vector2.y;
rectTransform2.sizeDelta = sizeDelta;
float num = rectTransform.rect.height - rectTransform2.rect.height;
if (num > 0f)
{
rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, rectTransform.sizeDelta.y - num);
}
Vector3[] array = new Vector3[4];
rectTransform.GetWorldCorners(array);
RectTransform rectTransform3 = canvas.transform as RectTransform;
Rect rect3 = rectTransform3.rect;
for (int j = 0; j < 2; j++)
{
bool flag = false;
for (int k = 0; k < 4; k++)
{
Vector3 vector3 = rectTransform3.InverseTransformPoint(array[k]);
if (vector3[j] < rect3.min[j] || vector3[j] > rect3.max[j])
{
flag = true;
break;
}
}
if (flag)
{
RectTransformUtility.FlipLayoutOnAxis(rectTransform, j, false, false);
}
}
for (int l = 0; l < this.m_Items.Count; l++)
{
RectTransform rectTransform4 = this.m_Items[l].rectTransform;
rectTransform4.anchorMin = new Vector2(rectTransform4.anchorMin.x, 0f);
rectTransform4.anchorMax = new Vector2(rectTransform4.anchorMax.x, 0f);
rectTransform4.anchoredPosition = new Vector2(rectTransform4.anchoredPosition.x, vector.y + size.y * (float)(this.m_Items.Count - 1 - l) + size.y * rectTransform4.pivot.y);
rectTransform4.sizeDelta = new Vector2(rectTransform4.sizeDelta.x, size.y);
}
this.AlphaFadeList(0.15f, 0f, 1f);
this.m_Template.gameObject.SetActive(false);
componentInChildren.gameObject.SetActive(false);
this.m_Blocker = this.CreateBlocker(canvas);
}
}
}
// Token: 0x060001E2 RID: 482 RVA: 0x0000A5A4 File Offset: 0x000089A4
protected virtual GameObject CreateBlocker(Canvas rootCanvas)
{
GameObject gameObject = new GameObject("Blocker");
RectTransform rectTransform = gameObject.AddComponent<RectTransform>();
rectTransform.SetParent(rootCanvas.transform, false);
rectTransform.anchorMin = Vector3.zero;
rectTransform.anchorMax = Vector3.one;
rectTransform.sizeDelta = Vector2.zero;
Canvas canvas = gameObject.AddComponent<Canvas>();
canvas.overrideSorting = true;
Canvas component = this.m_Dropdown.GetComponent<Canvas>();
canvas.sortingLayerID = component.sortingLayerID;
canvas.sortingOrder = component.sortingOrder - 1;
gameObject.AddComponent<GraphicRaycaster>();
Image image = gameObject.AddComponent<Image>();
image.color = Color.clear;
Button button = gameObject.AddComponent<Button>();
button.onClick.AddListener(new UnityAction(this.Hide));
return gameObject;
}
// Token: 0x060001E3 RID: 483 RVA: 0x0000A675 File Offset: 0x00008A75
protected virtual void DestroyBlocker(GameObject blocker)
{
Object.Destroy(blocker);
}
// Token: 0x060001E4 RID: 484 RVA: 0x0000A680 File Offset: 0x00008A80
protected virtual GameObject CreateDropdownList(GameObject template)
{
return Object.Instantiate<GameObject>(template);
}
// Token: 0x060001E5 RID: 485 RVA: 0x0000A69B File Offset: 0x00008A9B
protected virtual void DestroyDropdownList(GameObject dropdownList)
{
Object.Destroy(dropdownList);
}
// Token: 0x060001E6 RID: 486 RVA: 0x0000A6A4 File Offset: 0x00008AA4
protected virtual Dropdown.DropdownItem CreateItem(Dropdown.DropdownItem itemTemplate)
{
return Object.Instantiate<Dropdown.DropdownItem>(itemTemplate);
}
// Token: 0x060001E7 RID: 487 RVA: 0x0000A6BF File Offset: 0x00008ABF
protected virtual void DestroyItem(Dropdown.DropdownItem item)
{
}
// Token: 0x060001E8 RID: 488 RVA: 0x0000A6C4 File Offset: 0x00008AC4
private Dropdown.DropdownItem AddItem(Dropdown.OptionData data, bool selected, Dropdown.DropdownItem itemTemplate, List<Dropdown.DropdownItem> items)
{
Dropdown.DropdownItem dropdownItem = this.CreateItem(itemTemplate);
dropdownItem.rectTransform.SetParent(itemTemplate.rectTransform.parent, false);
dropdownItem.gameObject.SetActive(true);
dropdownItem.gameObject.name = "Item " + items.Count + ((data.text == null) ? "" : (": " + data.text));
if (dropdownItem.toggle != null)
{
dropdownItem.toggle.isOn = false;
}
if (dropdownItem.text)
{
dropdownItem.text.text = data.text;
}
if (dropdownItem.image)
{
dropdownItem.image.sprite = data.image;
dropdownItem.image.enabled = dropdownItem.image.sprite != null;
}
items.Add(dropdownItem);
return dropdownItem;
}
// Token: 0x060001E9 RID: 489 RVA: 0x0000A7D4 File Offset: 0x00008BD4
private void AlphaFadeList(float duration, float alpha)
{
CanvasGroup component = this.m_Dropdown.GetComponent<CanvasGroup>();
this.AlphaFadeList(duration, component.alpha, alpha);
}
// Token: 0x060001EA RID: 490 RVA: 0x0000A7FC File Offset: 0x00008BFC
private void AlphaFadeList(float duration, float start, float end)
{
if (!end.Equals(start))
{
FloatTween floatTween = new FloatTween
{
duration = duration,
startValue = start,
targetValue = end
};
floatTween.AddOnChangedCallback(new UnityAction<float>(this.SetAlpha));
floatTween.ignoreTimeScale = true;
this.m_AlphaTweenRunner.StartTween(floatTween);
}
}
// Token: 0x060001EB RID: 491 RVA: 0x0000A868 File Offset: 0x00008C68
private void SetAlpha(float alpha)
{
if (this.m_Dropdown)
{
CanvasGroup component = this.m_Dropdown.GetComponent<CanvasGroup>();
component.alpha = alpha;
}
}
// Token: 0x060001EC RID: 492 RVA: 0x0000A8A0 File Offset: 0x00008CA0
public void Hide()
{
if (this.m_Dropdown != null)
{
this.AlphaFadeList(0.15f, 0f);
if (this.IsActive())
{
base.StartCoroutine(this.DelayedDestroyDropdownList(0.15f));
}
}
if (this.m_Blocker != null)
{
this.DestroyBlocker(this.m_Blocker);
}
this.m_Blocker = null;
this.Select();
}
// Token: 0x060001ED RID: 493 RVA: 0x0000A918 File Offset: 0x00008D18
private IEnumerator DelayedDestroyDropdownList(float delay)
{
yield return new WaitForSecondsRealtime(delay);
for (int i = 0; i < this.m_Items.Count; i++)
{
if (this.m_Items[i] != null)
{
this.DestroyItem(this.m_Items[i]);
}
}
this.m_Items.Clear();
if (this.m_Dropdown != null)
{
this.DestroyDropdownList(this.m_Dropdown);
}
this.m_Dropdown = null;
yield break;
}
// Token: 0x060001EE RID: 494 RVA: 0x0000A944 File Offset: 0x00008D44
private void OnSelectItem(Toggle toggle)
{
if (!toggle.isOn)
{
toggle.isOn = true;
}
int num = -1;
Transform transform = toggle.transform;
Transform parent = transform.parent;
for (int i = 0; i < parent.childCount; i++)
{
if (parent.GetChild(i) == transform)
{
num = i - 1;
break;
}
}
if (num >= 0)
{
this.value = num;
this.Hide();
}
}
// Token: 0x040000E3 RID: 227
[SerializeField]
private RectTransform m_Template;
// Token: 0x040000E4 RID: 228
[SerializeField]
private Text m_CaptionText;
// Token: 0x040000E5 RID: 229
[SerializeField]
private Image m_CaptionImage;
// Token: 0x040000E6 RID: 230
[Space]
[SerializeField]
private Text m_ItemText;
// Token: 0x040000E7 RID: 231
[SerializeField]
private Image m_ItemImage;
// Token: 0x040000E8 RID: 232
[Space]
[SerializeField]
private int m_Value;
// Token: 0x040000E9 RID: 233
[Space]
[SerializeField]
private Dropdown.OptionDataList m_Options = new Dropdown.OptionDataList();
// Token: 0x040000EA RID: 234
[Space]
[SerializeField]
private Dropdown.DropdownEvent m_OnValueChanged = new Dropdown.DropdownEvent();
// Token: 0x040000EB RID: 235
private GameObject m_Dropdown;
// Token: 0x040000EC RID: 236
private GameObject m_Blocker;
// Token: 0x040000ED RID: 237
private List<Dropdown.DropdownItem> m_Items = new List<Dropdown.DropdownItem>();
// Token: 0x040000EE RID: 238
private TweenRunner<FloatTween> m_AlphaTweenRunner;
// Token: 0x040000EF RID: 239
private bool validTemplate = false;
// Token: 0x040000F0 RID: 240
private static Dropdown.OptionData s_NoOptionData = new Dropdown.OptionData();
// Token: 0x02000043 RID: 67
protected internal class DropdownItem : MonoBehaviour, IPointerEnterHandler, ICancelHandler, IEventSystemHandler
{
// Token: 0x1700007A RID: 122
// (get) Token: 0x060001F1 RID: 497 RVA: 0x0000A9D8 File Offset: 0x00008DD8
// (set) Token: 0x060001F2 RID: 498 RVA: 0x0000A9F3 File Offset: 0x00008DF3
public Text text
{
get
{
return this.m_Text;
}
set
{
this.m_Text = value;
}
}
// Token: 0x1700007B RID: 123
// (get) Token: 0x060001F3 RID: 499 RVA: 0x0000AA00 File Offset: 0x00008E00
// (set) Token: 0x060001F4 RID: 500 RVA: 0x0000AA1B File Offset: 0x00008E1B
public Image image
{
get
{
return this.m_Image;
}
set
{
this.m_Image = value;
}
}
// Token: 0x1700007C RID: 124
// (get) Token: 0x060001F5 RID: 501 RVA: 0x0000AA28 File Offset: 0x00008E28
// (set) Token: 0x060001F6 RID: 502 RVA: 0x0000AA43 File Offset: 0x00008E43
public RectTransform rectTransform
{
get
{
return this.m_RectTransform;
}
set
{
this.m_RectTransform = value;
}
}
// Token: 0x1700007D RID: 125
// (get) Token: 0x060001F7 RID: 503 RVA: 0x0000AA50 File Offset: 0x00008E50
// (set) Token: 0x060001F8 RID: 504 RVA: 0x0000AA6B File Offset: 0x00008E6B
public Toggle toggle
{
get
{
return this.m_Toggle;
}
set
{
this.m_Toggle = value;
}
}
// Token: 0x060001F9 RID: 505 RVA: 0x0000AA75 File Offset: 0x00008E75
public virtual void OnPointerEnter(PointerEventData eventData)
{
EventSystem.current.SetSelectedGameObject(base.gameObject);
}
// Token: 0x060001FA RID: 506 RVA: 0x0000AA88 File Offset: 0x00008E88
public virtual void OnCancel(BaseEventData eventData)
{
Dropdown componentInParent = base.GetComponentInParent<Dropdown>();
if (componentInParent)
{
componentInParent.Hide();
}
}
// Token: 0x040000F1 RID: 241
[SerializeField]
private Text m_Text;
// Token: 0x040000F2 RID: 242
[SerializeField]
private Image m_Image;
// Token: 0x040000F3 RID: 243
[SerializeField]
private RectTransform m_RectTransform;
// Token: 0x040000F4 RID: 244
[SerializeField]
private Toggle m_Toggle;
}
// Token: 0x02000044 RID: 68
[Serializable]
public class OptionData
{
// Token: 0x060001FB RID: 507 RVA: 0x0000AAAE File Offset: 0x00008EAE
public OptionData()
{
}
// Token: 0x060001FC RID: 508 RVA: 0x0000AAB7 File Offset: 0x00008EB7
public OptionData(string text)
{
this.text = text;
}
// Token: 0x060001FD RID: 509 RVA: 0x0000AAC7 File Offset: 0x00008EC7
public OptionData(Sprite image)
{
this.image = image;
}
// Token: 0x060001FE RID: 510 RVA: 0x0000AAD7 File Offset: 0x00008ED7
public OptionData(string text, Sprite image)
{
this.text = text;
this.image = image;
}
// Token: 0x1700007E RID: 126
// (get) Token: 0x060001FF RID: 511 RVA: 0x0000AAF0 File Offset: 0x00008EF0
// (set) Token: 0x06000200 RID: 512 RVA: 0x0000AB0B File Offset: 0x00008F0B
public string text
{
get
{
return this.m_Text;
}
set
{
this.m_Text = value;
}
}
// Token: 0x1700007F RID: 127
// (get) Token: 0x06000201 RID: 513 RVA: 0x0000AB18 File Offset: 0x00008F18
// (set) Token: 0x06000202 RID: 514 RVA: 0x0000AB33 File Offset: 0x00008F33
public Sprite image
{
get
{
return this.m_Image;
}
set
{
this.m_Image = value;
}
}
// Token: 0x040000F5 RID: 245
[SerializeField]
private string m_Text;
// Token: 0x040000F6 RID: 246
[SerializeField]
private Sprite m_Image;
}
// Token: 0x02000045 RID: 69
[Serializable]
public class OptionDataList
{
// Token: 0x06000203 RID: 515 RVA: 0x0000AB3D File Offset: 0x00008F3D
public OptionDataList()
{
this.options = new List<Dropdown.OptionData>();
}
// Token: 0x17000080 RID: 128
// (get) Token: 0x06000204 RID: 516 RVA: 0x0000AB54 File Offset: 0x00008F54
// (set) Token: 0x06000205 RID: 517 RVA: 0x0000AB6F File Offset: 0x00008F6F
public List<Dropdown.OptionData> options
{
get
{
return this.m_Options;
}
set
{
this.m_Options = value;
}
}
// Token: 0x040000F7 RID: 247
[SerializeField]
private List<Dropdown.OptionData> m_Options;
}
// Token: 0x02000046 RID: 70
[Serializable]
public class DropdownEvent : UnityEvent<int>
{
}
}
}
+279
View File
@@ -0,0 +1,279 @@
using System;
using UnityEngine.Serialization;
namespace UnityEngine.UI
{
// Token: 0x02000047 RID: 71
[Serializable]
public class FontData : ISerializationCallbackReceiver
{
// Token: 0x17000081 RID: 129
// (get) Token: 0x06000208 RID: 520 RVA: 0x0000AD08 File Offset: 0x00009108
public static FontData defaultFontData
{
get
{
return new FontData
{
m_FontSize = 14,
m_LineSpacing = 1f,
m_FontStyle = FontStyle.Normal,
m_BestFit = false,
m_MinSize = 10,
m_MaxSize = 40,
m_Alignment = TextAnchor.UpperLeft,
m_HorizontalOverflow = HorizontalWrapMode.Wrap,
m_VerticalOverflow = VerticalWrapMode.Truncate,
m_RichText = true,
m_AlignByGeometry = false
};
}
}
// Token: 0x17000082 RID: 130
// (get) Token: 0x06000209 RID: 521 RVA: 0x0000AD7C File Offset: 0x0000917C
// (set) Token: 0x0600020A RID: 522 RVA: 0x0000AD97 File Offset: 0x00009197
public Font font
{
get
{
return this.m_Font;
}
set
{
this.m_Font = value;
}
}
// Token: 0x17000083 RID: 131
// (get) Token: 0x0600020B RID: 523 RVA: 0x0000ADA4 File Offset: 0x000091A4
// (set) Token: 0x0600020C RID: 524 RVA: 0x0000ADBF File Offset: 0x000091BF
public int fontSize
{
get
{
return this.m_FontSize;
}
set
{
this.m_FontSize = value;
}
}
// Token: 0x17000084 RID: 132
// (get) Token: 0x0600020D RID: 525 RVA: 0x0000ADCC File Offset: 0x000091CC
// (set) Token: 0x0600020E RID: 526 RVA: 0x0000ADE7 File Offset: 0x000091E7
public FontStyle fontStyle
{
get
{
return this.m_FontStyle;
}
set
{
this.m_FontStyle = value;
}
}
// Token: 0x17000085 RID: 133
// (get) Token: 0x0600020F RID: 527 RVA: 0x0000ADF4 File Offset: 0x000091F4
// (set) Token: 0x06000210 RID: 528 RVA: 0x0000AE0F File Offset: 0x0000920F
public bool bestFit
{
get
{
return this.m_BestFit;
}
set
{
this.m_BestFit = value;
}
}
// Token: 0x17000086 RID: 134
// (get) Token: 0x06000211 RID: 529 RVA: 0x0000AE1C File Offset: 0x0000921C
// (set) Token: 0x06000212 RID: 530 RVA: 0x0000AE37 File Offset: 0x00009237
public int minSize
{
get
{
return this.m_MinSize;
}
set
{
this.m_MinSize = value;
}
}
// Token: 0x17000087 RID: 135
// (get) Token: 0x06000213 RID: 531 RVA: 0x0000AE44 File Offset: 0x00009244
// (set) Token: 0x06000214 RID: 532 RVA: 0x0000AE5F File Offset: 0x0000925F
public int maxSize
{
get
{
return this.m_MaxSize;
}
set
{
this.m_MaxSize = value;
}
}
// Token: 0x17000088 RID: 136
// (get) Token: 0x06000215 RID: 533 RVA: 0x0000AE6C File Offset: 0x0000926C
// (set) Token: 0x06000216 RID: 534 RVA: 0x0000AE87 File Offset: 0x00009287
public TextAnchor alignment
{
get
{
return this.m_Alignment;
}
set
{
this.m_Alignment = value;
}
}
// Token: 0x17000089 RID: 137
// (get) Token: 0x06000217 RID: 535 RVA: 0x0000AE94 File Offset: 0x00009294
// (set) Token: 0x06000218 RID: 536 RVA: 0x0000AEAF File Offset: 0x000092AF
public bool alignByGeometry
{
get
{
return this.m_AlignByGeometry;
}
set
{
this.m_AlignByGeometry = value;
}
}
// Token: 0x1700008A RID: 138
// (get) Token: 0x06000219 RID: 537 RVA: 0x0000AEBC File Offset: 0x000092BC
// (set) Token: 0x0600021A RID: 538 RVA: 0x0000AED7 File Offset: 0x000092D7
public bool richText
{
get
{
return this.m_RichText;
}
set
{
this.m_RichText = value;
}
}
// Token: 0x1700008B RID: 139
// (get) Token: 0x0600021B RID: 539 RVA: 0x0000AEE4 File Offset: 0x000092E4
// (set) Token: 0x0600021C RID: 540 RVA: 0x0000AEFF File Offset: 0x000092FF
public HorizontalWrapMode horizontalOverflow
{
get
{
return this.m_HorizontalOverflow;
}
set
{
this.m_HorizontalOverflow = value;
}
}
// Token: 0x1700008C RID: 140
// (get) Token: 0x0600021D RID: 541 RVA: 0x0000AF0C File Offset: 0x0000930C
// (set) Token: 0x0600021E RID: 542 RVA: 0x0000AF27 File Offset: 0x00009327
public VerticalWrapMode verticalOverflow
{
get
{
return this.m_VerticalOverflow;
}
set
{
this.m_VerticalOverflow = value;
}
}
// Token: 0x1700008D RID: 141
// (get) Token: 0x0600021F RID: 543 RVA: 0x0000AF34 File Offset: 0x00009334
// (set) Token: 0x06000220 RID: 544 RVA: 0x0000AF4F File Offset: 0x0000934F
public float lineSpacing
{
get
{
return this.m_LineSpacing;
}
set
{
this.m_LineSpacing = value;
}
}
// Token: 0x06000221 RID: 545 RVA: 0x0000AF59 File Offset: 0x00009359
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
}
// Token: 0x06000222 RID: 546 RVA: 0x0000AF5C File Offset: 0x0000935C
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
this.m_FontSize = Mathf.Clamp(this.m_FontSize, 0, 300);
this.m_MinSize = Mathf.Clamp(this.m_MinSize, 0, this.m_FontSize);
this.m_MaxSize = Mathf.Clamp(this.m_MaxSize, this.m_FontSize, 300);
}
// Token: 0x040000F8 RID: 248
[SerializeField]
[FormerlySerializedAs("font")]
private Font m_Font;
// Token: 0x040000F9 RID: 249
[SerializeField]
[FormerlySerializedAs("fontSize")]
private int m_FontSize;
// Token: 0x040000FA RID: 250
[SerializeField]
[FormerlySerializedAs("fontStyle")]
private FontStyle m_FontStyle;
// Token: 0x040000FB RID: 251
[SerializeField]
private bool m_BestFit;
// Token: 0x040000FC RID: 252
[SerializeField]
private int m_MinSize;
// Token: 0x040000FD RID: 253
[SerializeField]
private int m_MaxSize;
// Token: 0x040000FE RID: 254
[SerializeField]
[FormerlySerializedAs("alignment")]
private TextAnchor m_Alignment;
// Token: 0x040000FF RID: 255
[SerializeField]
private bool m_AlignByGeometry;
// Token: 0x04000100 RID: 256
[SerializeField]
[FormerlySerializedAs("richText")]
private bool m_RichText;
// Token: 0x04000101 RID: 257
[SerializeField]
private HorizontalWrapMode m_HorizontalOverflow;
// Token: 0x04000102 RID: 258
[SerializeField]
private VerticalWrapMode m_VerticalOverflow;
// Token: 0x04000103 RID: 259
[SerializeField]
private float m_LineSpacing;
}
}
+71
View File
@@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
namespace UnityEngine.UI
{
// Token: 0x02000048 RID: 72
public static class FontUpdateTracker
{
// Token: 0x06000223 RID: 547 RVA: 0x0000AFB8 File Offset: 0x000093B8
public static void TrackText(Text t)
{
if (!(t.font == null))
{
HashSet<Text> hashSet;
FontUpdateTracker.m_Tracked.TryGetValue(t.font, out hashSet);
if (hashSet == null)
{
if (FontUpdateTracker.m_Tracked.Count == 0)
{
Font.textureRebuilt += FontUpdateTracker.RebuildForFont;
}
hashSet = new HashSet<Text>();
FontUpdateTracker.m_Tracked.Add(t.font, hashSet);
}
if (!hashSet.Contains(t))
{
hashSet.Add(t);
}
}
}
// Token: 0x06000224 RID: 548 RVA: 0x0000B054 File Offset: 0x00009454
private static void RebuildForFont(Font f)
{
HashSet<Text> hashSet;
FontUpdateTracker.m_Tracked.TryGetValue(f, out hashSet);
if (hashSet != null)
{
foreach (Text text in hashSet)
{
text.FontTextureChanged();
}
}
}
// Token: 0x06000225 RID: 549 RVA: 0x0000B0C8 File Offset: 0x000094C8
public static void UntrackText(Text t)
{
if (!(t.font == null))
{
HashSet<Text> hashSet;
FontUpdateTracker.m_Tracked.TryGetValue(t.font, out hashSet);
if (hashSet != null)
{
hashSet.Remove(t);
if (hashSet.Count == 0)
{
FontUpdateTracker.m_Tracked.Remove(t.font);
if (FontUpdateTracker.m_Tracked.Count == 0)
{
Font.textureRebuilt -= FontUpdateTracker.RebuildForFont;
}
}
}
}
}
// Token: 0x04000104 RID: 260
private static Dictionary<Font, HashSet<Text>> m_Tracked = new Dictionary<Font, HashSet<Text>>();
}
}
+739
View File
@@ -0,0 +1,739 @@
using System;
using System.Collections.Generic;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
using UnityEngine.UI.CoroutineTween;
namespace UnityEngine.UI
{
// Token: 0x02000049 RID: 73
[DisallowMultipleComponent]
[RequireComponent(typeof(CanvasRenderer))]
[RequireComponent(typeof(RectTransform))]
[ExecuteInEditMode]
public abstract class Graphic : UIBehaviour, ICanvasElement
{
// Token: 0x06000227 RID: 551 RVA: 0x0000B170 File Offset: 0x00009570
protected Graphic()
{
if (this.m_ColorTweenRunner == null)
{
this.m_ColorTweenRunner = new TweenRunner<ColorTween>();
}
this.m_ColorTweenRunner.Init(this);
this.useLegacyMeshGeneration = true;
}
// Token: 0x1700008E RID: 142
// (get) Token: 0x06000228 RID: 552 RVA: 0x0000B1C0 File Offset: 0x000095C0
public static Material defaultGraphicMaterial
{
get
{
if (Graphic.s_DefaultUI == null)
{
Graphic.s_DefaultUI = Canvas.GetDefaultCanvasMaterial();
}
return Graphic.s_DefaultUI;
}
}
// Token: 0x1700008F RID: 143
// (get) Token: 0x06000229 RID: 553 RVA: 0x0000B1F4 File Offset: 0x000095F4
// (set) Token: 0x0600022A RID: 554 RVA: 0x0000B20F File Offset: 0x0000960F
public virtual Color color
{
get
{
return this.m_Color;
}
set
{
if (SetPropertyUtility.SetColor(ref this.m_Color, value))
{
this.SetVerticesDirty();
}
}
}
// Token: 0x17000090 RID: 144
// (get) Token: 0x0600022B RID: 555 RVA: 0x0000B22C File Offset: 0x0000962C
// (set) Token: 0x0600022C RID: 556 RVA: 0x0000B247 File Offset: 0x00009647
public virtual bool raycastTarget
{
get
{
return this.m_RaycastTarget;
}
set
{
this.m_RaycastTarget = value;
}
}
// Token: 0x17000091 RID: 145
// (get) Token: 0x0600022D RID: 557 RVA: 0x0000B254 File Offset: 0x00009654
// (set) Token: 0x0600022E RID: 558 RVA: 0x0000B26E File Offset: 0x0000966E
protected bool useLegacyMeshGeneration { get; set; }
// Token: 0x0600022F RID: 559 RVA: 0x0000B277 File Offset: 0x00009677
public virtual void SetAllDirty()
{
this.SetLayoutDirty();
this.SetVerticesDirty();
this.SetMaterialDirty();
}
// Token: 0x06000230 RID: 560 RVA: 0x0000B28C File Offset: 0x0000968C
public virtual void SetLayoutDirty()
{
if (this.IsActive())
{
LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform);
if (this.m_OnDirtyLayoutCallback != null)
{
this.m_OnDirtyLayoutCallback();
}
}
}
// Token: 0x06000231 RID: 561 RVA: 0x0000B2C0 File Offset: 0x000096C0
public virtual void SetVerticesDirty()
{
if (this.IsActive())
{
this.m_VertsDirty = true;
CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this);
if (this.m_OnDirtyVertsCallback != null)
{
this.m_OnDirtyVertsCallback();
}
}
}
// Token: 0x06000232 RID: 562 RVA: 0x0000B2F6 File Offset: 0x000096F6
public virtual void SetMaterialDirty()
{
if (this.IsActive())
{
this.m_MaterialDirty = true;
CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this);
if (this.m_OnDirtyMaterialCallback != null)
{
this.m_OnDirtyMaterialCallback();
}
}
}
// Token: 0x06000233 RID: 563 RVA: 0x0000B32C File Offset: 0x0000972C
protected override void OnRectTransformDimensionsChange()
{
if (base.gameObject.activeInHierarchy)
{
if (CanvasUpdateRegistry.IsRebuildingLayout())
{
this.SetVerticesDirty();
}
else
{
this.SetVerticesDirty();
this.SetLayoutDirty();
}
}
}
// Token: 0x06000234 RID: 564 RVA: 0x0000B364 File Offset: 0x00009764
protected override void OnBeforeTransformParentChanged()
{
GraphicRegistry.UnregisterGraphicForCanvas(this.canvas, this);
LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform);
}
// Token: 0x06000235 RID: 565 RVA: 0x0000B37E File Offset: 0x0000977E
protected override void OnTransformParentChanged()
{
base.OnTransformParentChanged();
this.m_Canvas = null;
if (this.IsActive())
{
this.CacheCanvas();
GraphicRegistry.RegisterGraphicForCanvas(this.canvas, this);
this.SetAllDirty();
}
}
// Token: 0x17000092 RID: 146
// (get) Token: 0x06000236 RID: 566 RVA: 0x0000B3B8 File Offset: 0x000097B8
public int depth
{
get
{
return this.canvasRenderer.absoluteDepth;
}
}
// Token: 0x17000093 RID: 147
// (get) Token: 0x06000237 RID: 567 RVA: 0x0000B3D8 File Offset: 0x000097D8
public RectTransform rectTransform
{
get
{
RectTransform rectTransform;
if ((rectTransform = this.m_RectTransform) == null)
{
rectTransform = (this.m_RectTransform = base.GetComponent<RectTransform>());
}
return rectTransform;
}
}
// Token: 0x17000094 RID: 148
// (get) Token: 0x06000238 RID: 568 RVA: 0x0000B40C File Offset: 0x0000980C
public Canvas canvas
{
get
{
if (this.m_Canvas == null)
{
this.CacheCanvas();
}
return this.m_Canvas;
}
}
// Token: 0x06000239 RID: 569 RVA: 0x0000B440 File Offset: 0x00009840
private void CacheCanvas()
{
List<Canvas> list = ListPool<Canvas>.Get();
base.gameObject.GetComponentsInParent<Canvas>(false, list);
if (list.Count > 0)
{
for (int i = 0; i < list.Count; i++)
{
if (list[i].isActiveAndEnabled)
{
this.m_Canvas = list[i];
break;
}
}
}
else
{
this.m_Canvas = null;
}
ListPool<Canvas>.Release(list);
}
// Token: 0x17000095 RID: 149
// (get) Token: 0x0600023A RID: 570 RVA: 0x0000B4C0 File Offset: 0x000098C0
public CanvasRenderer canvasRenderer
{
get
{
if (this.m_CanvasRender == null)
{
this.m_CanvasRender = base.GetComponent<CanvasRenderer>();
}
return this.m_CanvasRender;
}
}
// Token: 0x17000096 RID: 150
// (get) Token: 0x0600023B RID: 571 RVA: 0x0000B4F8 File Offset: 0x000098F8
public virtual Material defaultMaterial
{
get
{
return Graphic.defaultGraphicMaterial;
}
}
// Token: 0x17000097 RID: 151
// (get) Token: 0x0600023C RID: 572 RVA: 0x0000B514 File Offset: 0x00009914
// (set) Token: 0x0600023D RID: 573 RVA: 0x0000B54B File Offset: 0x0000994B
public virtual Material material
{
get
{
return (!(this.m_Material != null)) ? this.defaultMaterial : this.m_Material;
}
set
{
if (!(this.m_Material == value))
{
this.m_Material = value;
this.SetMaterialDirty();
}
}
}
// Token: 0x17000098 RID: 152
// (get) Token: 0x0600023E RID: 574 RVA: 0x0000B574 File Offset: 0x00009974
public virtual Material materialForRendering
{
get
{
List<Component> list = ListPool<Component>.Get();
base.GetComponents(typeof(IMaterialModifier), list);
Material material = this.material;
for (int i = 0; i < list.Count; i++)
{
material = (list[i] as IMaterialModifier).GetModifiedMaterial(material);
}
ListPool<Component>.Release(list);
return material;
}
}
// Token: 0x17000099 RID: 153
// (get) Token: 0x0600023F RID: 575 RVA: 0x0000B5D8 File Offset: 0x000099D8
public virtual Texture mainTexture
{
get
{
return Graphic.s_WhiteTexture;
}
}
// Token: 0x06000240 RID: 576 RVA: 0x0000B5F2 File Offset: 0x000099F2
protected override void OnEnable()
{
base.OnEnable();
this.CacheCanvas();
GraphicRegistry.RegisterGraphicForCanvas(this.canvas, this);
if (Graphic.s_WhiteTexture == null)
{
Graphic.s_WhiteTexture = Texture2D.whiteTexture;
}
this.SetAllDirty();
}
// Token: 0x06000241 RID: 577 RVA: 0x0000B630 File Offset: 0x00009A30
protected override void OnDisable()
{
GraphicRegistry.UnregisterGraphicForCanvas(this.canvas, this);
CanvasUpdateRegistry.UnRegisterCanvasElementForRebuild(this);
if (this.canvasRenderer != null)
{
this.canvasRenderer.Clear();
}
LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform);
base.OnDisable();
}
// Token: 0x06000242 RID: 578 RVA: 0x0000B680 File Offset: 0x00009A80
protected override void OnCanvasHierarchyChanged()
{
Canvas canvas = this.m_Canvas;
this.m_Canvas = null;
if (this.IsActive())
{
this.CacheCanvas();
if (canvas != this.m_Canvas)
{
GraphicRegistry.UnregisterGraphicForCanvas(canvas, this);
if (this.IsActive())
{
GraphicRegistry.RegisterGraphicForCanvas(this.canvas, this);
}
}
}
}
// Token: 0x06000243 RID: 579 RVA: 0x0000B6E4 File Offset: 0x00009AE4
public virtual void Rebuild(CanvasUpdate update)
{
if (!this.canvasRenderer.cull)
{
if (update == CanvasUpdate.PreRender)
{
if (this.m_VertsDirty)
{
this.UpdateGeometry();
this.m_VertsDirty = false;
}
if (this.m_MaterialDirty)
{
this.UpdateMaterial();
this.m_MaterialDirty = false;
}
}
}
}
// Token: 0x06000244 RID: 580 RVA: 0x0000B74C File Offset: 0x00009B4C
public virtual void LayoutComplete()
{
}
// Token: 0x06000245 RID: 581 RVA: 0x0000B74F File Offset: 0x00009B4F
public virtual void GraphicUpdateComplete()
{
}
// Token: 0x06000246 RID: 582 RVA: 0x0000B754 File Offset: 0x00009B54
protected virtual void UpdateMaterial()
{
if (this.IsActive())
{
this.canvasRenderer.materialCount = 1;
this.canvasRenderer.SetMaterial(this.materialForRendering, 0);
this.canvasRenderer.SetTexture(this.mainTexture);
}
}
// Token: 0x06000247 RID: 583 RVA: 0x0000B7A1 File Offset: 0x00009BA1
protected virtual void UpdateGeometry()
{
if (this.useLegacyMeshGeneration)
{
this.DoLegacyMeshGeneration();
}
else
{
this.DoMeshGeneration();
}
}
// Token: 0x06000248 RID: 584 RVA: 0x0000B7C0 File Offset: 0x00009BC0
private void DoMeshGeneration()
{
if (this.rectTransform != null && this.rectTransform.rect.width >= 0f && this.rectTransform.rect.height >= 0f)
{
this.OnPopulateMesh(Graphic.s_VertexHelper);
}
else
{
Graphic.s_VertexHelper.Clear();
}
List<Component> list = ListPool<Component>.Get();
base.GetComponents(typeof(IMeshModifier), list);
for (int i = 0; i < list.Count; i++)
{
((IMeshModifier)list[i]).ModifyMesh(Graphic.s_VertexHelper);
}
ListPool<Component>.Release(list);
Graphic.s_VertexHelper.FillMesh(Graphic.workerMesh);
this.canvasRenderer.SetMesh(Graphic.workerMesh);
}
// Token: 0x06000249 RID: 585 RVA: 0x0000B89C File Offset: 0x00009C9C
private void DoLegacyMeshGeneration()
{
if (this.rectTransform != null && this.rectTransform.rect.width >= 0f && this.rectTransform.rect.height >= 0f)
{
this.OnPopulateMesh(Graphic.workerMesh);
}
else
{
Graphic.workerMesh.Clear();
}
List<Component> list = ListPool<Component>.Get();
base.GetComponents(typeof(IMeshModifier), list);
for (int i = 0; i < list.Count; i++)
{
((IMeshModifier)list[i]).ModifyMesh(Graphic.workerMesh);
}
ListPool<Component>.Release(list);
this.canvasRenderer.SetMesh(Graphic.workerMesh);
}
// Token: 0x1700009A RID: 154
// (get) Token: 0x0600024A RID: 586 RVA: 0x0000B970 File Offset: 0x00009D70
protected static Mesh workerMesh
{
get
{
if (Graphic.s_Mesh == null)
{
Graphic.s_Mesh = new Mesh();
Graphic.s_Mesh.name = "Shared UI Mesh";
Graphic.s_Mesh.hideFlags = HideFlags.HideAndDontSave;
}
return Graphic.s_Mesh;
}
}
// Token: 0x0600024B RID: 587 RVA: 0x0000B9C1 File Offset: 0x00009DC1
[Obsolete("Use OnPopulateMesh instead.", true)]
protected virtual void OnFillVBO(List<UIVertex> vbo)
{
}
// Token: 0x0600024C RID: 588 RVA: 0x0000B9C4 File Offset: 0x00009DC4
[Obsolete("Use OnPopulateMesh(VertexHelper vh) instead.", false)]
protected virtual void OnPopulateMesh(Mesh m)
{
this.OnPopulateMesh(Graphic.s_VertexHelper);
Graphic.s_VertexHelper.FillMesh(m);
}
// Token: 0x0600024D RID: 589 RVA: 0x0000B9E0 File Offset: 0x00009DE0
protected virtual void OnPopulateMesh(VertexHelper vh)
{
Rect pixelAdjustedRect = this.GetPixelAdjustedRect();
Vector4 vector = new Vector4(pixelAdjustedRect.x, pixelAdjustedRect.y, pixelAdjustedRect.x + pixelAdjustedRect.width, pixelAdjustedRect.y + pixelAdjustedRect.height);
Color32 color = this.color;
vh.Clear();
vh.AddVert(new Vector3(vector.x, vector.y), color, new Vector2(0f, 0f));
vh.AddVert(new Vector3(vector.x, vector.w), color, new Vector2(0f, 1f));
vh.AddVert(new Vector3(vector.z, vector.w), color, new Vector2(1f, 1f));
vh.AddVert(new Vector3(vector.z, vector.y), color, new Vector2(1f, 0f));
vh.AddTriangle(0, 1, 2);
vh.AddTriangle(2, 3, 0);
}
// Token: 0x0600024E RID: 590 RVA: 0x0000BAF0 File Offset: 0x00009EF0
protected override void OnDidApplyAnimationProperties()
{
this.SetAllDirty();
}
// Token: 0x0600024F RID: 591 RVA: 0x0000BAF9 File Offset: 0x00009EF9
public virtual void SetNativeSize()
{
}
// Token: 0x06000250 RID: 592 RVA: 0x0000BAFC File Offset: 0x00009EFC
public virtual bool Raycast(Vector2 sp, Camera eventCamera)
{
bool flag;
if (!base.isActiveAndEnabled)
{
flag = false;
}
else
{
Transform transform = base.transform;
List<Component> list = ListPool<Component>.Get();
bool flag2 = false;
bool flag3 = true;
while (transform != null)
{
transform.GetComponents<Component>(list);
for (int i = 0; i < list.Count; i++)
{
Canvas canvas = list[i] as Canvas;
if (canvas != null && canvas.overrideSorting)
{
flag3 = false;
}
ICanvasRaycastFilter canvasRaycastFilter = list[i] as ICanvasRaycastFilter;
if (canvasRaycastFilter != null)
{
bool flag4 = true;
CanvasGroup canvasGroup = list[i] as CanvasGroup;
if (canvasGroup != null)
{
if (!flag2 && canvasGroup.ignoreParentGroups)
{
flag2 = true;
flag4 = canvasRaycastFilter.IsRaycastLocationValid(sp, eventCamera);
}
else if (!flag2)
{
flag4 = canvasRaycastFilter.IsRaycastLocationValid(sp, eventCamera);
}
}
else
{
flag4 = canvasRaycastFilter.IsRaycastLocationValid(sp, eventCamera);
}
if (!flag4)
{
ListPool<Component>.Release(list);
return false;
}
}
}
transform = ((!flag3) ? null : transform.parent);
}
ListPool<Component>.Release(list);
flag = true;
}
return flag;
}
// Token: 0x06000251 RID: 593 RVA: 0x0000BC4C File Offset: 0x0000A04C
public Vector2 PixelAdjustPoint(Vector2 point)
{
Vector2 vector;
if (!this.canvas || this.canvas.renderMode == RenderMode.WorldSpace || this.canvas.scaleFactor == 0f || !this.canvas.pixelPerfect)
{
vector = point;
}
else
{
vector = RectTransformUtility.PixelAdjustPoint(point, base.transform, this.canvas);
}
return vector;
}
// Token: 0x06000252 RID: 594 RVA: 0x0000BCC4 File Offset: 0x0000A0C4
public Rect GetPixelAdjustedRect()
{
Rect rect;
if (!this.canvas || this.canvas.renderMode == RenderMode.WorldSpace || this.canvas.scaleFactor == 0f || !this.canvas.pixelPerfect)
{
rect = this.rectTransform.rect;
}
else
{
rect = RectTransformUtility.PixelAdjustRect(this.rectTransform, this.canvas);
}
return rect;
}
// Token: 0x06000253 RID: 595 RVA: 0x0000BD41 File Offset: 0x0000A141
public virtual void CrossFadeColor(Color targetColor, float duration, bool ignoreTimeScale, bool useAlpha)
{
this.CrossFadeColor(targetColor, duration, ignoreTimeScale, useAlpha, true);
}
// Token: 0x06000254 RID: 596 RVA: 0x0000BD50 File Offset: 0x0000A150
public virtual void CrossFadeColor(Color targetColor, float duration, bool ignoreTimeScale, bool useAlpha, bool useRGB)
{
if (!(this.canvasRenderer == null) && (useRGB || useAlpha))
{
if (this.canvasRenderer.GetColor().Equals(targetColor))
{
this.m_ColorTweenRunner.StopTween();
}
else
{
ColorTween.ColorTweenMode colorTweenMode = ((!useRGB || !useAlpha) ? ((!useRGB) ? ColorTween.ColorTweenMode.Alpha : ColorTween.ColorTweenMode.RGB) : ColorTween.ColorTweenMode.All);
ColorTween colorTween = new ColorTween
{
duration = duration,
startColor = this.canvasRenderer.GetColor(),
targetColor = targetColor
};
colorTween.AddOnChangedCallback(new UnityAction<Color>(this.canvasRenderer.SetColor));
colorTween.ignoreTimeScale = ignoreTimeScale;
colorTween.tweenMode = colorTweenMode;
this.m_ColorTweenRunner.StartTween(colorTween);
}
}
}
// Token: 0x06000255 RID: 597 RVA: 0x0000BE3C File Offset: 0x0000A23C
private static Color CreateColorFromAlpha(float alpha)
{
Color black = Color.black;
black.a = alpha;
return black;
}
// Token: 0x06000256 RID: 598 RVA: 0x0000BE60 File Offset: 0x0000A260
public virtual void CrossFadeAlpha(float alpha, float duration, bool ignoreTimeScale)
{
this.CrossFadeColor(Graphic.CreateColorFromAlpha(alpha), duration, ignoreTimeScale, true, false);
}
// Token: 0x06000257 RID: 599 RVA: 0x0000BE73 File Offset: 0x0000A273
public void RegisterDirtyLayoutCallback(UnityAction action)
{
this.m_OnDirtyLayoutCallback = (UnityAction)Delegate.Combine(this.m_OnDirtyLayoutCallback, action);
}
// Token: 0x06000258 RID: 600 RVA: 0x0000BE8D File Offset: 0x0000A28D
public void UnregisterDirtyLayoutCallback(UnityAction action)
{
this.m_OnDirtyLayoutCallback = (UnityAction)Delegate.Remove(this.m_OnDirtyLayoutCallback, action);
}
// Token: 0x06000259 RID: 601 RVA: 0x0000BEA7 File Offset: 0x0000A2A7
public void RegisterDirtyVerticesCallback(UnityAction action)
{
this.m_OnDirtyVertsCallback = (UnityAction)Delegate.Combine(this.m_OnDirtyVertsCallback, action);
}
// Token: 0x0600025A RID: 602 RVA: 0x0000BEC1 File Offset: 0x0000A2C1
public void UnregisterDirtyVerticesCallback(UnityAction action)
{
this.m_OnDirtyVertsCallback = (UnityAction)Delegate.Remove(this.m_OnDirtyVertsCallback, action);
}
// Token: 0x0600025B RID: 603 RVA: 0x0000BEDB File Offset: 0x0000A2DB
public void RegisterDirtyMaterialCallback(UnityAction action)
{
this.m_OnDirtyMaterialCallback = (UnityAction)Delegate.Combine(this.m_OnDirtyMaterialCallback, action);
}
// Token: 0x0600025C RID: 604 RVA: 0x0000BEF5 File Offset: 0x0000A2F5
public void UnregisterDirtyMaterialCallback(UnityAction action)
{
this.m_OnDirtyMaterialCallback = (UnityAction)Delegate.Remove(this.m_OnDirtyMaterialCallback, action);
}
// Token: 0x0600025E RID: 606 RVA: 0x0000BF27 File Offset: 0x0000A327
Transform ICanvasElement.get_transform()
{
return base.transform;
}
// Token: 0x04000107 RID: 263
protected static Material s_DefaultUI = null;
// Token: 0x04000108 RID: 264
protected static Texture2D s_WhiteTexture = null;
// Token: 0x04000109 RID: 265
[FormerlySerializedAs("m_Mat")]
[SerializeField]
protected Material m_Material;
// Token: 0x0400010A RID: 266
[SerializeField]
private Color m_Color = Color.white;
// Token: 0x0400010B RID: 267
[SerializeField]
private bool m_RaycastTarget = true;
// Token: 0x0400010C RID: 268
[NonSerialized]
private RectTransform m_RectTransform;
// Token: 0x0400010D RID: 269
[NonSerialized]
private CanvasRenderer m_CanvasRender;
// Token: 0x0400010E RID: 270
[NonSerialized]
private Canvas m_Canvas;
// Token: 0x0400010F RID: 271
[NonSerialized]
private bool m_VertsDirty;
// Token: 0x04000110 RID: 272
[NonSerialized]
private bool m_MaterialDirty;
// Token: 0x04000111 RID: 273
[NonSerialized]
protected UnityAction m_OnDirtyLayoutCallback;
// Token: 0x04000112 RID: 274
[NonSerialized]
protected UnityAction m_OnDirtyVertsCallback;
// Token: 0x04000113 RID: 275
[NonSerialized]
protected UnityAction m_OnDirtyMaterialCallback;
// Token: 0x04000114 RID: 276
[NonSerialized]
protected static Mesh s_Mesh;
// Token: 0x04000115 RID: 277
[NonSerialized]
private static readonly VertexHelper s_VertexHelper = new VertexHelper();
// Token: 0x04000116 RID: 278
[NonSerialized]
private readonly TweenRunner<ColorTween> m_ColorTweenRunner;
}
}
+340
View File
@@ -0,0 +1,340 @@
using System;
using System.Collections.Generic;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
namespace UnityEngine.UI
{
// Token: 0x0200004A RID: 74
[AddComponentMenu("Event/Graphic Raycaster")]
[RequireComponent(typeof(Canvas))]
public class GraphicRaycaster : BaseRaycaster
{
// Token: 0x0600025F RID: 607 RVA: 0x0000BF2F File Offset: 0x0000A32F
protected GraphicRaycaster()
{
}
// Token: 0x1700009B RID: 155
// (get) Token: 0x06000260 RID: 608 RVA: 0x0000BF60 File Offset: 0x0000A360
public override int sortOrderPriority
{
get
{
int num;
if (this.canvas.renderMode == RenderMode.ScreenSpaceOverlay)
{
num = this.canvas.sortingOrder;
}
else
{
num = base.sortOrderPriority;
}
return num;
}
}
// Token: 0x1700009C RID: 156
// (get) Token: 0x06000261 RID: 609 RVA: 0x0000BF9C File Offset: 0x0000A39C
public override int renderOrderPriority
{
get
{
int num;
if (this.canvas.renderMode == RenderMode.ScreenSpaceOverlay)
{
num = this.canvas.rootCanvas.renderOrder;
}
else
{
num = base.renderOrderPriority;
}
return num;
}
}
// Token: 0x1700009D RID: 157
// (get) Token: 0x06000262 RID: 610 RVA: 0x0000BFE0 File Offset: 0x0000A3E0
// (set) Token: 0x06000263 RID: 611 RVA: 0x0000BFFB File Offset: 0x0000A3FB
public bool ignoreReversedGraphics
{
get
{
return this.m_IgnoreReversedGraphics;
}
set
{
this.m_IgnoreReversedGraphics = value;
}
}
// Token: 0x1700009E RID: 158
// (get) Token: 0x06000264 RID: 612 RVA: 0x0000C008 File Offset: 0x0000A408
// (set) Token: 0x06000265 RID: 613 RVA: 0x0000C023 File Offset: 0x0000A423
public GraphicRaycaster.BlockingObjects blockingObjects
{
get
{
return this.m_BlockingObjects;
}
set
{
this.m_BlockingObjects = value;
}
}
// Token: 0x1700009F RID: 159
// (get) Token: 0x06000266 RID: 614 RVA: 0x0000C030 File Offset: 0x0000A430
private Canvas canvas
{
get
{
Canvas canvas;
if (this.m_Canvas != null)
{
canvas = this.m_Canvas;
}
else
{
this.m_Canvas = base.GetComponent<Canvas>();
canvas = this.m_Canvas;
}
return canvas;
}
}
// Token: 0x06000267 RID: 615 RVA: 0x0000C074 File Offset: 0x0000A474
public override void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList)
{
if (!(this.canvas == null))
{
int num;
if (this.canvas.renderMode == RenderMode.ScreenSpaceOverlay || !this.eventCamera)
{
num = this.canvas.targetDisplay;
}
else
{
num = this.eventCamera.targetDisplay;
}
Vector3 vector = Display.RelativeMouseAt(eventData.position);
if (vector != Vector3.zero)
{
int num2 = (int)vector.z;
if (num2 != num)
{
return;
}
}
else
{
vector = eventData.position;
}
Vector2 vector2;
if (this.eventCamera == null)
{
float num3 = (float)Screen.width;
float num4 = (float)Screen.height;
if (num > 0 && num < Display.displays.Length)
{
num3 = (float)Display.displays[num].systemWidth;
num4 = (float)Display.displays[num].systemHeight;
}
vector2 = new Vector2(vector.x / num3, vector.y / num4);
}
else
{
vector2 = this.eventCamera.ScreenToViewportPoint(vector);
}
if (vector2.x >= 0f && vector2.x <= 1f && vector2.y >= 0f && vector2.y <= 1f)
{
float num5 = float.MaxValue;
Ray ray = default(Ray);
if (this.eventCamera != null)
{
ray = this.eventCamera.ScreenPointToRay(vector);
}
if (this.canvas.renderMode != RenderMode.ScreenSpaceOverlay && this.blockingObjects != GraphicRaycaster.BlockingObjects.None)
{
float num6 = 100f;
if (this.eventCamera != null)
{
float z = ray.direction.z;
num6 = ((!Mathf.Approximately(0f, z)) ? Mathf.Abs((this.eventCamera.farClipPlane - this.eventCamera.nearClipPlane) / z) : float.PositiveInfinity);
}
if (this.blockingObjects == GraphicRaycaster.BlockingObjects.ThreeD || this.blockingObjects == GraphicRaycaster.BlockingObjects.All)
{
if (ReflectionMethodsCache.Singleton.raycast3D != null)
{
RaycastHit[] array = ReflectionMethodsCache.Singleton.raycast3DAll(ray, num6, this.m_BlockingMask);
if (array.Length > 0)
{
num5 = array[0].distance;
}
}
}
if (this.blockingObjects == GraphicRaycaster.BlockingObjects.TwoD || this.blockingObjects == GraphicRaycaster.BlockingObjects.All)
{
if (ReflectionMethodsCache.Singleton.raycast2D != null)
{
RaycastHit2D[] array2 = ReflectionMethodsCache.Singleton.getRayIntersectionAll(ray, num6, this.m_BlockingMask);
if (array2.Length > 0)
{
num5 = array2[0].distance;
}
}
}
}
this.m_RaycastResults.Clear();
GraphicRaycaster.Raycast(this.canvas, this.eventCamera, vector, this.m_RaycastResults);
int i = 0;
while (i < this.m_RaycastResults.Count)
{
GameObject gameObject = this.m_RaycastResults[i].gameObject;
bool flag = true;
if (this.ignoreReversedGraphics)
{
if (this.eventCamera == null)
{
Vector3 vector3 = gameObject.transform.rotation * Vector3.forward;
flag = Vector3.Dot(Vector3.forward, vector3) > 0f;
}
else
{
Vector3 vector4 = this.eventCamera.transform.rotation * Vector3.forward;
Vector3 vector5 = gameObject.transform.rotation * Vector3.forward;
flag = Vector3.Dot(vector4, vector5) > 0f;
}
}
if (flag)
{
float num7;
if (this.eventCamera == null || this.canvas.renderMode == RenderMode.ScreenSpaceOverlay)
{
num7 = 0f;
}
else
{
Transform transform = gameObject.transform;
Vector3 forward = transform.forward;
num7 = Vector3.Dot(forward, transform.position - this.eventCamera.transform.position) / Vector3.Dot(forward, ray.direction);
if (num7 < 0f)
{
goto IL_4F9;
}
}
if (num7 < num5)
{
RaycastResult raycastResult = new RaycastResult
{
gameObject = gameObject,
module = this,
distance = num7,
screenPosition = vector,
index = (float)resultAppendList.Count,
depth = this.m_RaycastResults[i].depth,
sortingLayer = this.canvas.sortingLayerID,
sortingOrder = this.canvas.sortingOrder
};
resultAppendList.Add(raycastResult);
}
}
IL_4F9:
i++;
continue;
goto IL_4F9;
}
}
}
}
// Token: 0x170000A0 RID: 160
// (get) Token: 0x06000268 RID: 616 RVA: 0x0000C594 File Offset: 0x0000A994
public override Camera eventCamera
{
get
{
Camera camera;
if (this.canvas.renderMode == RenderMode.ScreenSpaceOverlay || (this.canvas.renderMode == RenderMode.ScreenSpaceCamera && this.canvas.worldCamera == null))
{
camera = null;
}
else
{
camera = ((!(this.canvas.worldCamera != null)) ? Camera.main : this.canvas.worldCamera);
}
return camera;
}
}
// Token: 0x06000269 RID: 617 RVA: 0x0000C614 File Offset: 0x0000AA14
private static void Raycast(Canvas canvas, Camera eventCamera, Vector2 pointerPosition, List<Graphic> results)
{
IList<Graphic> graphicsForCanvas = GraphicRegistry.GetGraphicsForCanvas(canvas);
for (int i = 0; i < graphicsForCanvas.Count; i++)
{
Graphic graphic = graphicsForCanvas[i];
if (!graphic.canvasRenderer.cull)
{
if (graphic.depth != -1 && graphic.raycastTarget)
{
if (RectTransformUtility.RectangleContainsScreenPoint(graphic.rectTransform, pointerPosition, eventCamera))
{
if (graphic.Raycast(pointerPosition, eventCamera))
{
GraphicRaycaster.s_SortedGraphics.Add(graphic);
}
}
}
}
}
GraphicRaycaster.s_SortedGraphics.Sort((Graphic g1, Graphic g2) => g2.depth.CompareTo(g1.depth));
for (int j = 0; j < GraphicRaycaster.s_SortedGraphics.Count; j++)
{
results.Add(GraphicRaycaster.s_SortedGraphics[j]);
}
GraphicRaycaster.s_SortedGraphics.Clear();
}
// Token: 0x04000118 RID: 280
protected const int kNoEventMaskSet = -1;
// Token: 0x04000119 RID: 281
[FormerlySerializedAs("ignoreReversedGraphics")]
[SerializeField]
private bool m_IgnoreReversedGraphics = true;
// Token: 0x0400011A RID: 282
[FormerlySerializedAs("blockingObjects")]
[SerializeField]
private GraphicRaycaster.BlockingObjects m_BlockingObjects = GraphicRaycaster.BlockingObjects.None;
// Token: 0x0400011B RID: 283
[SerializeField]
protected LayerMask m_BlockingMask = -1;
// Token: 0x0400011C RID: 284
private Canvas m_Canvas;
// Token: 0x0400011D RID: 285
[NonSerialized]
private List<Graphic> m_RaycastResults = new List<Graphic>();
// Token: 0x0400011E RID: 286
[NonSerialized]
private static readonly List<Graphic> s_SortedGraphics = new List<Graphic>();
// Token: 0x0200004B RID: 75
public enum BlockingObjects
{
// Token: 0x04000121 RID: 289
None,
// Token: 0x04000122 RID: 290
TwoD,
// Token: 0x04000123 RID: 291
ThreeD,
// Token: 0x04000124 RID: 292
All
}
}
}
+91
View File
@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using UnityEngine.UI.Collections;
namespace UnityEngine.UI
{
// Token: 0x0200004C RID: 76
public class GraphicRegistry
{
// Token: 0x0600026C RID: 620 RVA: 0x0000C740 File Offset: 0x0000AB40
protected GraphicRegistry()
{
}
// Token: 0x170000A1 RID: 161
// (get) Token: 0x0600026D RID: 621 RVA: 0x0000C760 File Offset: 0x0000AB60
public static GraphicRegistry instance
{
get
{
if (GraphicRegistry.s_Instance == null)
{
GraphicRegistry.s_Instance = new GraphicRegistry();
}
return GraphicRegistry.s_Instance;
}
}
// Token: 0x0600026E RID: 622 RVA: 0x0000C790 File Offset: 0x0000AB90
public static void RegisterGraphicForCanvas(Canvas c, Graphic graphic)
{
if (!(c == null))
{
IndexedSet<Graphic> indexedSet;
GraphicRegistry.instance.m_Graphics.TryGetValue(c, out indexedSet);
if (indexedSet != null)
{
indexedSet.AddUnique(graphic);
}
else
{
indexedSet = new IndexedSet<Graphic>();
indexedSet.Add(graphic);
GraphicRegistry.instance.m_Graphics.Add(c, indexedSet);
}
}
}
// Token: 0x0600026F RID: 623 RVA: 0x0000C7F4 File Offset: 0x0000ABF4
public static void UnregisterGraphicForCanvas(Canvas c, Graphic graphic)
{
if (!(c == null))
{
IndexedSet<Graphic> indexedSet;
if (GraphicRegistry.instance.m_Graphics.TryGetValue(c, out indexedSet))
{
indexedSet.Remove(graphic);
if (indexedSet.Count == 0)
{
GraphicRegistry.instance.m_Graphics.Remove(c);
}
}
}
}
// Token: 0x06000270 RID: 624 RVA: 0x0000C850 File Offset: 0x0000AC50
public static IList<Graphic> GetGraphicsForCanvas(Canvas canvas)
{
IndexedSet<Graphic> indexedSet;
IList<Graphic> list;
if (GraphicRegistry.instance.m_Graphics.TryGetValue(canvas, out indexedSet))
{
list = indexedSet;
}
else
{
list = GraphicRegistry.s_EmptyList;
}
return list;
}
// Token: 0x04000125 RID: 293
private static GraphicRegistry s_Instance;
// Token: 0x04000126 RID: 294
private readonly Dictionary<Canvas, IndexedSet<Graphic>> m_Graphics = new Dictionary<Canvas, IndexedSet<Graphic>>();
// Token: 0x04000127 RID: 295
private static readonly List<Graphic> s_EmptyList = new List<Graphic>();
}
}
+313
View File
@@ -0,0 +1,313 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x0200008F RID: 143
[AddComponentMenu("Layout/Grid Layout Group", 152)]
public class GridLayoutGroup : LayoutGroup
{
// Token: 0x06000533 RID: 1331 RVA: 0x0001BBD4 File Offset: 0x00019FD4
protected GridLayoutGroup()
{
}
// Token: 0x1700016A RID: 362
// (get) Token: 0x06000534 RID: 1332 RVA: 0x0001BC24 File Offset: 0x0001A024
// (set) Token: 0x06000535 RID: 1333 RVA: 0x0001BC3F File Offset: 0x0001A03F
public GridLayoutGroup.Corner startCorner
{
get
{
return this.m_StartCorner;
}
set
{
base.SetProperty<GridLayoutGroup.Corner>(ref this.m_StartCorner, value);
}
}
// Token: 0x1700016B RID: 363
// (get) Token: 0x06000536 RID: 1334 RVA: 0x0001BC50 File Offset: 0x0001A050
// (set) Token: 0x06000537 RID: 1335 RVA: 0x0001BC6B File Offset: 0x0001A06B
public GridLayoutGroup.Axis startAxis
{
get
{
return this.m_StartAxis;
}
set
{
base.SetProperty<GridLayoutGroup.Axis>(ref this.m_StartAxis, value);
}
}
// Token: 0x1700016C RID: 364
// (get) Token: 0x06000538 RID: 1336 RVA: 0x0001BC7C File Offset: 0x0001A07C
// (set) Token: 0x06000539 RID: 1337 RVA: 0x0001BC97 File Offset: 0x0001A097
public Vector2 cellSize
{
get
{
return this.m_CellSize;
}
set
{
base.SetProperty<Vector2>(ref this.m_CellSize, value);
}
}
// Token: 0x1700016D RID: 365
// (get) Token: 0x0600053A RID: 1338 RVA: 0x0001BCA8 File Offset: 0x0001A0A8
// (set) Token: 0x0600053B RID: 1339 RVA: 0x0001BCC3 File Offset: 0x0001A0C3
public Vector2 spacing
{
get
{
return this.m_Spacing;
}
set
{
base.SetProperty<Vector2>(ref this.m_Spacing, value);
}
}
// Token: 0x1700016E RID: 366
// (get) Token: 0x0600053C RID: 1340 RVA: 0x0001BCD4 File Offset: 0x0001A0D4
// (set) Token: 0x0600053D RID: 1341 RVA: 0x0001BCEF File Offset: 0x0001A0EF
public GridLayoutGroup.Constraint constraint
{
get
{
return this.m_Constraint;
}
set
{
base.SetProperty<GridLayoutGroup.Constraint>(ref this.m_Constraint, value);
}
}
// Token: 0x1700016F RID: 367
// (get) Token: 0x0600053E RID: 1342 RVA: 0x0001BD00 File Offset: 0x0001A100
// (set) Token: 0x0600053F RID: 1343 RVA: 0x0001BD1B File Offset: 0x0001A11B
public int constraintCount
{
get
{
return this.m_ConstraintCount;
}
set
{
base.SetProperty<int>(ref this.m_ConstraintCount, Mathf.Max(1, value));
}
}
// Token: 0x06000540 RID: 1344 RVA: 0x0001BD34 File Offset: 0x0001A134
public override void CalculateLayoutInputHorizontal()
{
base.CalculateLayoutInputHorizontal();
int num2;
int num;
if (this.m_Constraint == GridLayoutGroup.Constraint.FixedColumnCount)
{
num = (num2 = this.m_ConstraintCount);
}
else if (this.m_Constraint == GridLayoutGroup.Constraint.FixedRowCount)
{
num = (num2 = Mathf.CeilToInt((float)base.rectChildren.Count / (float)this.m_ConstraintCount - 0.001f));
}
else
{
num2 = 1;
num = Mathf.CeilToInt(Mathf.Sqrt((float)base.rectChildren.Count));
}
base.SetLayoutInputForAxis((float)base.padding.horizontal + (this.cellSize.x + this.spacing.x) * (float)num2 - this.spacing.x, (float)base.padding.horizontal + (this.cellSize.x + this.spacing.x) * (float)num - this.spacing.x, -1f, 0);
}
// Token: 0x06000541 RID: 1345 RVA: 0x0001BE40 File Offset: 0x0001A240
public override void CalculateLayoutInputVertical()
{
int num;
if (this.m_Constraint == GridLayoutGroup.Constraint.FixedColumnCount)
{
num = Mathf.CeilToInt((float)base.rectChildren.Count / (float)this.m_ConstraintCount - 0.001f);
}
else if (this.m_Constraint == GridLayoutGroup.Constraint.FixedRowCount)
{
num = this.m_ConstraintCount;
}
else
{
float x = base.rectTransform.rect.size.x;
int num2 = Mathf.Max(1, Mathf.FloorToInt((x - (float)base.padding.horizontal + this.spacing.x + 0.001f) / (this.cellSize.x + this.spacing.x)));
num = Mathf.CeilToInt((float)base.rectChildren.Count / (float)num2);
}
float num3 = (float)base.padding.vertical + (this.cellSize.y + this.spacing.y) * (float)num - this.spacing.y;
base.SetLayoutInputForAxis(num3, num3, -1f, 1);
}
// Token: 0x06000542 RID: 1346 RVA: 0x0001BF73 File Offset: 0x0001A373
public override void SetLayoutHorizontal()
{
this.SetCellsAlongAxis(0);
}
// Token: 0x06000543 RID: 1347 RVA: 0x0001BF7D File Offset: 0x0001A37D
public override void SetLayoutVertical()
{
this.SetCellsAlongAxis(1);
}
// Token: 0x06000544 RID: 1348 RVA: 0x0001BF88 File Offset: 0x0001A388
private void SetCellsAlongAxis(int axis)
{
if (axis == 0)
{
for (int i = 0; i < base.rectChildren.Count; i++)
{
RectTransform rectTransform = base.rectChildren[i];
this.m_Tracker.Add(this, rectTransform, DrivenTransformProperties.AnchoredPositionX | DrivenTransformProperties.AnchoredPositionY | DrivenTransformProperties.AnchorMinX | DrivenTransformProperties.AnchorMinY | DrivenTransformProperties.AnchorMaxX | DrivenTransformProperties.AnchorMaxY | DrivenTransformProperties.SizeDeltaX | DrivenTransformProperties.SizeDeltaY);
rectTransform.anchorMin = Vector2.up;
rectTransform.anchorMax = Vector2.up;
rectTransform.sizeDelta = this.cellSize;
}
}
else
{
float x = base.rectTransform.rect.size.x;
float y = base.rectTransform.rect.size.y;
int num;
int num2;
if (this.m_Constraint == GridLayoutGroup.Constraint.FixedColumnCount)
{
num = this.m_ConstraintCount;
num2 = Mathf.CeilToInt((float)base.rectChildren.Count / (float)num - 0.001f);
}
else if (this.m_Constraint == GridLayoutGroup.Constraint.FixedRowCount)
{
num2 = this.m_ConstraintCount;
num = Mathf.CeilToInt((float)base.rectChildren.Count / (float)num2 - 0.001f);
}
else
{
if (this.cellSize.x + this.spacing.x <= 0f)
{
num = int.MaxValue;
}
else
{
num = Mathf.Max(1, Mathf.FloorToInt((x - (float)base.padding.horizontal + this.spacing.x + 0.001f) / (this.cellSize.x + this.spacing.x)));
}
if (this.cellSize.y + this.spacing.y <= 0f)
{
num2 = int.MaxValue;
}
else
{
num2 = Mathf.Max(1, Mathf.FloorToInt((y - (float)base.padding.vertical + this.spacing.y + 0.001f) / (this.cellSize.y + this.spacing.y)));
}
}
int num3 = (int)(this.startCorner % GridLayoutGroup.Corner.LowerLeft);
int num4 = (int)(this.startCorner / GridLayoutGroup.Corner.LowerLeft);
int num5;
int num6;
int num7;
if (this.startAxis == GridLayoutGroup.Axis.Horizontal)
{
num5 = num;
num6 = Mathf.Clamp(num, 1, base.rectChildren.Count);
num7 = Mathf.Clamp(num2, 1, Mathf.CeilToInt((float)base.rectChildren.Count / (float)num5));
}
else
{
num5 = num2;
num7 = Mathf.Clamp(num2, 1, base.rectChildren.Count);
num6 = Mathf.Clamp(num, 1, Mathf.CeilToInt((float)base.rectChildren.Count / (float)num5));
}
Vector2 vector = new Vector2((float)num6 * this.cellSize.x + (float)(num6 - 1) * this.spacing.x, (float)num7 * this.cellSize.y + (float)(num7 - 1) * this.spacing.y);
Vector2 vector2 = new Vector2(base.GetStartOffset(0, vector.x), base.GetStartOffset(1, vector.y));
for (int j = 0; j < base.rectChildren.Count; j++)
{
int num8;
int num9;
if (this.startAxis == GridLayoutGroup.Axis.Horizontal)
{
num8 = j % num5;
num9 = j / num5;
}
else
{
num8 = j / num5;
num9 = j % num5;
}
if (num3 == 1)
{
num8 = num6 - 1 - num8;
}
if (num4 == 1)
{
num9 = num7 - 1 - num9;
}
base.SetChildAlongAxis(base.rectChildren[j], 0, vector2.x + (this.cellSize[0] + this.spacing[0]) * (float)num8, this.cellSize[0]);
base.SetChildAlongAxis(base.rectChildren[j], 1, vector2.y + (this.cellSize[1] + this.spacing[1]) * (float)num9, this.cellSize[1]);
}
}
}
// Token: 0x04000287 RID: 647
[SerializeField]
protected GridLayoutGroup.Corner m_StartCorner = GridLayoutGroup.Corner.UpperLeft;
// Token: 0x04000288 RID: 648
[SerializeField]
protected GridLayoutGroup.Axis m_StartAxis = GridLayoutGroup.Axis.Horizontal;
// Token: 0x04000289 RID: 649
[SerializeField]
protected Vector2 m_CellSize = new Vector2(100f, 100f);
// Token: 0x0400028A RID: 650
[SerializeField]
protected Vector2 m_Spacing = Vector2.zero;
// Token: 0x0400028B RID: 651
[SerializeField]
protected GridLayoutGroup.Constraint m_Constraint = GridLayoutGroup.Constraint.Flexible;
// Token: 0x0400028C RID: 652
[SerializeField]
protected int m_ConstraintCount = 2;
// Token: 0x02000090 RID: 144
public enum Corner
{
// Token: 0x0400028E RID: 654
UpperLeft,
// Token: 0x0400028F RID: 655
UpperRight,
// Token: 0x04000290 RID: 656
LowerLeft,
// Token: 0x04000291 RID: 657
LowerRight
}
// Token: 0x02000091 RID: 145
public enum Axis
{
// Token: 0x04000293 RID: 659
Horizontal,
// Token: 0x04000294 RID: 660
Vertical
}
// Token: 0x02000092 RID: 146
public enum Constraint
{
// Token: 0x04000296 RID: 662
Flexible,
// Token: 0x04000297 RID: 663
FixedColumnCount,
// Token: 0x04000298 RID: 664
FixedRowCount
}
}
}
@@ -0,0 +1,39 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000093 RID: 147
[AddComponentMenu("Layout/Horizontal Layout Group", 150)]
public class HorizontalLayoutGroup : HorizontalOrVerticalLayoutGroup
{
// Token: 0x06000545 RID: 1349 RVA: 0x0001C9A2 File Offset: 0x0001ADA2
protected HorizontalLayoutGroup()
{
}
// Token: 0x06000546 RID: 1350 RVA: 0x0001C9AB File Offset: 0x0001ADAB
public override void CalculateLayoutInputHorizontal()
{
base.CalculateLayoutInputHorizontal();
base.CalcAlongAxis(0, false);
}
// Token: 0x06000547 RID: 1351 RVA: 0x0001C9BC File Offset: 0x0001ADBC
public override void CalculateLayoutInputVertical()
{
base.CalcAlongAxis(1, false);
}
// Token: 0x06000548 RID: 1352 RVA: 0x0001C9C7 File Offset: 0x0001ADC7
public override void SetLayoutHorizontal()
{
base.SetChildrenAlongAxis(0, false);
}
// Token: 0x06000549 RID: 1353 RVA: 0x0001C9D2 File Offset: 0x0001ADD2
public override void SetLayoutVertical()
{
base.SetChildrenAlongAxis(1, false);
}
}
}
@@ -0,0 +1,237 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000094 RID: 148
public abstract class HorizontalOrVerticalLayoutGroup : LayoutGroup
{
// Token: 0x17000170 RID: 368
// (get) Token: 0x0600054B RID: 1355 RVA: 0x0001C41C File Offset: 0x0001A81C
// (set) Token: 0x0600054C RID: 1356 RVA: 0x0001C437 File Offset: 0x0001A837
public float spacing
{
get
{
return this.m_Spacing;
}
set
{
base.SetProperty<float>(ref this.m_Spacing, value);
}
}
// Token: 0x17000171 RID: 369
// (get) Token: 0x0600054D RID: 1357 RVA: 0x0001C448 File Offset: 0x0001A848
// (set) Token: 0x0600054E RID: 1358 RVA: 0x0001C463 File Offset: 0x0001A863
public bool childForceExpandWidth
{
get
{
return this.m_ChildForceExpandWidth;
}
set
{
base.SetProperty<bool>(ref this.m_ChildForceExpandWidth, value);
}
}
// Token: 0x17000172 RID: 370
// (get) Token: 0x0600054F RID: 1359 RVA: 0x0001C474 File Offset: 0x0001A874
// (set) Token: 0x06000550 RID: 1360 RVA: 0x0001C48F File Offset: 0x0001A88F
public bool childForceExpandHeight
{
get
{
return this.m_ChildForceExpandHeight;
}
set
{
base.SetProperty<bool>(ref this.m_ChildForceExpandHeight, value);
}
}
// Token: 0x17000173 RID: 371
// (get) Token: 0x06000551 RID: 1361 RVA: 0x0001C4A0 File Offset: 0x0001A8A0
// (set) Token: 0x06000552 RID: 1362 RVA: 0x0001C4BB File Offset: 0x0001A8BB
public bool childControlWidth
{
get
{
return this.m_ChildControlWidth;
}
set
{
base.SetProperty<bool>(ref this.m_ChildControlWidth, value);
}
}
// Token: 0x17000174 RID: 372
// (get) Token: 0x06000553 RID: 1363 RVA: 0x0001C4CC File Offset: 0x0001A8CC
// (set) Token: 0x06000554 RID: 1364 RVA: 0x0001C4E7 File Offset: 0x0001A8E7
public bool childControlHeight
{
get
{
return this.m_ChildControlHeight;
}
set
{
base.SetProperty<bool>(ref this.m_ChildControlHeight, value);
}
}
// Token: 0x06000555 RID: 1365 RVA: 0x0001C4F8 File Offset: 0x0001A8F8
protected void CalcAlongAxis(int axis, bool isVertical)
{
float num = (float)((axis != 0) ? base.padding.vertical : base.padding.horizontal);
bool flag = ((axis != 0) ? this.m_ChildControlHeight : this.m_ChildControlWidth);
bool flag2 = ((axis != 0) ? this.childForceExpandHeight : this.childForceExpandWidth);
float num2 = num;
float num3 = num;
float num4 = 0f;
bool flag3 = isVertical ^ (axis == 1);
for (int i = 0; i < base.rectChildren.Count; i++)
{
RectTransform rectTransform = base.rectChildren[i];
float num5;
float num6;
float num7;
this.GetChildSizes(rectTransform, axis, flag, flag2, out num5, out num6, out num7);
if (flag3)
{
num2 = Mathf.Max(num5 + num, num2);
num3 = Mathf.Max(num6 + num, num3);
num4 = Mathf.Max(num7, num4);
}
else
{
num2 += num5 + this.spacing;
num3 += num6 + this.spacing;
num4 += num7;
}
}
if (!flag3 && base.rectChildren.Count > 0)
{
num2 -= this.spacing;
num3 -= this.spacing;
}
num3 = Mathf.Max(num2, num3);
base.SetLayoutInputForAxis(num2, num3, num4, axis);
}
// Token: 0x06000556 RID: 1366 RVA: 0x0001C648 File Offset: 0x0001AA48
protected void SetChildrenAlongAxis(int axis, bool isVertical)
{
float num = base.rectTransform.rect.size[axis];
bool flag = ((axis != 0) ? this.m_ChildControlHeight : this.m_ChildControlWidth);
bool flag2 = ((axis != 0) ? this.childForceExpandHeight : this.childForceExpandWidth);
float alignmentOnAxis = base.GetAlignmentOnAxis(axis);
bool flag3 = isVertical ^ (axis == 1);
if (flag3)
{
float num2 = num - (float)((axis != 0) ? base.padding.vertical : base.padding.horizontal);
for (int i = 0; i < base.rectChildren.Count; i++)
{
RectTransform rectTransform = base.rectChildren[i];
float num3;
float num4;
float num5;
this.GetChildSizes(rectTransform, axis, flag, flag2, out num3, out num4, out num5);
float num6 = Mathf.Clamp(num2, num3, (num5 <= 0f) ? num4 : num);
float startOffset = base.GetStartOffset(axis, num6);
if (flag)
{
base.SetChildAlongAxis(rectTransform, axis, startOffset, num6);
}
else
{
float num7 = (num6 - rectTransform.sizeDelta[axis]) * alignmentOnAxis;
base.SetChildAlongAxis(rectTransform, axis, startOffset + num7);
}
}
}
else
{
float num8 = (float)((axis != 0) ? base.padding.top : base.padding.left);
if (base.GetTotalFlexibleSize(axis) == 0f && base.GetTotalPreferredSize(axis) < num)
{
num8 = base.GetStartOffset(axis, base.GetTotalPreferredSize(axis) - (float)((axis != 0) ? base.padding.vertical : base.padding.horizontal));
}
float num9 = 0f;
if (base.GetTotalMinSize(axis) != base.GetTotalPreferredSize(axis))
{
num9 = Mathf.Clamp01((num - base.GetTotalMinSize(axis)) / (base.GetTotalPreferredSize(axis) - base.GetTotalMinSize(axis)));
}
float num10 = 0f;
if (num > base.GetTotalPreferredSize(axis))
{
if (base.GetTotalFlexibleSize(axis) > 0f)
{
num10 = (num - base.GetTotalPreferredSize(axis)) / base.GetTotalFlexibleSize(axis);
}
}
for (int j = 0; j < base.rectChildren.Count; j++)
{
RectTransform rectTransform2 = base.rectChildren[j];
float num11;
float num12;
float num13;
this.GetChildSizes(rectTransform2, axis, flag, flag2, out num11, out num12, out num13);
float num14 = Mathf.Lerp(num11, num12, num9);
num14 += num13 * num10;
if (flag)
{
base.SetChildAlongAxis(rectTransform2, axis, num8, num14);
}
else
{
float num15 = (num14 - rectTransform2.sizeDelta[axis]) * alignmentOnAxis;
base.SetChildAlongAxis(rectTransform2, axis, num8 + num15);
}
num8 += num14 + this.spacing;
}
}
}
// Token: 0x06000557 RID: 1367 RVA: 0x0001C930 File Offset: 0x0001AD30
private void GetChildSizes(RectTransform child, int axis, bool controlSize, bool childForceExpand, out float min, out float preferred, out float flexible)
{
if (!controlSize)
{
min = child.sizeDelta[axis];
preferred = min;
flexible = 0f;
}
else
{
min = LayoutUtility.GetMinSize(child, axis);
preferred = LayoutUtility.GetPreferredSize(child, axis);
flexible = LayoutUtility.GetFlexibleSize(child, axis);
}
if (childForceExpand)
{
flexible = Mathf.Max(flexible, 1f);
}
}
// Token: 0x04000299 RID: 665
[SerializeField]
protected float m_Spacing = 0f;
// Token: 0x0400029A RID: 666
[SerializeField]
protected bool m_ChildForceExpandWidth = true;
// Token: 0x0400029B RID: 667
[SerializeField]
protected bool m_ChildForceExpandHeight = true;
// Token: 0x0400029C RID: 668
[SerializeField]
protected bool m_ChildControlWidth = true;
// Token: 0x0400029D RID: 669
[SerializeField]
protected bool m_ChildControlHeight = true;
}
}
+24
View File
@@ -0,0 +1,24 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x0200003D RID: 61
public interface ICanvasElement
{
// Token: 0x06000189 RID: 393
void Rebuild(CanvasUpdate executing);
// Token: 0x17000069 RID: 105
// (get) Token: 0x0600018A RID: 394
Transform transform { get; }
// Token: 0x0600018B RID: 395
void LayoutComplete();
// Token: 0x0600018C RID: 396
void GraphicUpdateComplete();
// Token: 0x0600018D RID: 397
bool IsDestroyed();
}
}
+25
View File
@@ -0,0 +1,25 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000085 RID: 133
public interface IClippable
{
// Token: 0x17000158 RID: 344
// (get) Token: 0x060004F1 RID: 1265
GameObject gameObject { get; }
// Token: 0x060004F2 RID: 1266
void RecalculateClipping();
// Token: 0x17000159 RID: 345
// (get) Token: 0x060004F3 RID: 1267
RectTransform rectTransform { get; }
// Token: 0x060004F4 RID: 1268
void Cull(Rect clipRect, bool validRect);
// Token: 0x060004F5 RID: 1269
void SetClipRect(Rect value, bool validRect);
}
}
+11
View File
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000084 RID: 132
public interface IClipper
{
// Token: 0x060004F0 RID: 1264
void PerformClipping();
}
}
@@ -0,0 +1,12 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x0200004D RID: 77
[Obsolete("Not supported anymore")]
internal interface IGraphicEnabledDisabled
{
// Token: 0x06000272 RID: 626
void OnSiblingGraphicEnabledDisabled();
}
}
+14
View File
@@ -0,0 +1,14 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000096 RID: 150
public interface ILayoutController
{
// Token: 0x06000561 RID: 1377
void SetLayoutHorizontal();
// Token: 0x06000562 RID: 1378
void SetLayoutVertical();
}
}
+42
View File
@@ -0,0 +1,42 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000095 RID: 149
public interface ILayoutElement
{
// Token: 0x06000558 RID: 1368
void CalculateLayoutInputHorizontal();
// Token: 0x06000559 RID: 1369
void CalculateLayoutInputVertical();
// Token: 0x17000175 RID: 373
// (get) Token: 0x0600055A RID: 1370
float minWidth { get; }
// Token: 0x17000176 RID: 374
// (get) Token: 0x0600055B RID: 1371
float preferredWidth { get; }
// Token: 0x17000177 RID: 375
// (get) Token: 0x0600055C RID: 1372
float flexibleWidth { get; }
// Token: 0x17000178 RID: 376
// (get) Token: 0x0600055D RID: 1373
float minHeight { get; }
// Token: 0x17000179 RID: 377
// (get) Token: 0x0600055E RID: 1374
float preferredHeight { get; }
// Token: 0x1700017A RID: 378
// (get) Token: 0x0600055F RID: 1375
float flexibleHeight { get; }
// Token: 0x1700017B RID: 379
// (get) Token: 0x06000560 RID: 1376
int layoutPriority { get; }
}
}
+9
View File
@@ -0,0 +1,9 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000097 RID: 151
public interface ILayoutGroup : ILayoutController
{
}
}
+12
View File
@@ -0,0 +1,12 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000099 RID: 153
public interface ILayoutIgnorer
{
// Token: 0x1700017C RID: 380
// (get) Token: 0x06000563 RID: 1379
bool ignoreLayout { get; }
}
}
@@ -0,0 +1,9 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000098 RID: 152
public interface ILayoutSelfController : ILayoutController
{
}
}
+16
View File
@@ -0,0 +1,16 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000056 RID: 86
[Obsolete("Not supported anymore.", true)]
public interface IMask
{
// Token: 0x060002AC RID: 684
bool Enabled();
// Token: 0x170000BA RID: 186
// (get) Token: 0x060002AD RID: 685
RectTransform rectTransform { get; }
}
}
+11
View File
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000057 RID: 87
public interface IMaskable
{
// Token: 0x060002AE RID: 686
void RecalculateMasking();
}
}
+11
View File
@@ -0,0 +1,11 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x0200009F RID: 159
public interface IMaterialModifier
{
// Token: 0x060005D3 RID: 1491
Material GetModifiedMaterial(Material baseMaterial);
}
}
+15
View File
@@ -0,0 +1,15 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x020000AC RID: 172
public interface IMeshModifier
{
// Token: 0x06000620 RID: 1568
[Obsolete("use IMeshModifier.ModifyMesh (VertexHelper verts) instead", false)]
void ModifyMesh(Mesh mesh);
// Token: 0x06000621 RID: 1569
void ModifyMesh(VertexHelper verts);
}
}
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
namespace UnityEngine.UI
{
// Token: 0x020000AB RID: 171
[Obsolete("Use IMeshModifier instead", true)]
public interface IVertexModifier
{
// Token: 0x0600061F RID: 1567
[Obsolete("use IMeshModifier.ModifyMesh (VertexHelper verts) instead", true)]
void ModifyVertices(List<UIVertex> verts);
}
}
+1379
View File
@@ -0,0 +1,1379 @@
using System;
using UnityEngine.Serialization;
using UnityEngine.Sprites;
namespace UnityEngine.UI
{
// Token: 0x0200004E RID: 78
[AddComponentMenu("UI/Image", 11)]
public class Image : MaskableGraphic, ISerializationCallbackReceiver, ILayoutElement, ICanvasRaycastFilter
{
// Token: 0x06000273 RID: 627 RVA: 0x0000CD44 File Offset: 0x0000B144
protected Image()
{
base.useLegacyMeshGeneration = false;
}
// Token: 0x170000A2 RID: 162
// (get) Token: 0x06000274 RID: 628 RVA: 0x0000CD98 File Offset: 0x0000B198
// (set) Token: 0x06000275 RID: 629 RVA: 0x0000CDB3 File Offset: 0x0000B1B3
public Sprite sprite
{
get
{
return this.m_Sprite;
}
set
{
if (SetPropertyUtility.SetClass<Sprite>(ref this.m_Sprite, value))
{
this.SetAllDirty();
}
}
}
// Token: 0x170000A3 RID: 163
// (get) Token: 0x06000276 RID: 630 RVA: 0x0000CDD0 File Offset: 0x0000B1D0
// (set) Token: 0x06000277 RID: 631 RVA: 0x0000CDEB File Offset: 0x0000B1EB
public Sprite overrideSprite
{
get
{
return this.activeSprite;
}
set
{
if (SetPropertyUtility.SetClass<Sprite>(ref this.m_OverrideSprite, value))
{
this.SetAllDirty();
}
}
}
// Token: 0x170000A4 RID: 164
// (get) Token: 0x06000278 RID: 632 RVA: 0x0000CE08 File Offset: 0x0000B208
private Sprite activeSprite
{
get
{
return (!(this.m_OverrideSprite != null)) ? this.sprite : this.m_OverrideSprite;
}
}
// Token: 0x170000A5 RID: 165
// (get) Token: 0x06000279 RID: 633 RVA: 0x0000CE40 File Offset: 0x0000B240
// (set) Token: 0x0600027A RID: 634 RVA: 0x0000CE5B File Offset: 0x0000B25B
public Image.Type type
{
get
{
return this.m_Type;
}
set
{
if (SetPropertyUtility.SetStruct<Image.Type>(ref this.m_Type, value))
{
this.SetVerticesDirty();
}
}
}
// Token: 0x170000A6 RID: 166
// (get) Token: 0x0600027B RID: 635 RVA: 0x0000CE78 File Offset: 0x0000B278
// (set) Token: 0x0600027C RID: 636 RVA: 0x0000CE93 File Offset: 0x0000B293
public bool preserveAspect
{
get
{
return this.m_PreserveAspect;
}
set
{
if (SetPropertyUtility.SetStruct<bool>(ref this.m_PreserveAspect, value))
{
this.SetVerticesDirty();
}
}
}
// Token: 0x170000A7 RID: 167
// (get) Token: 0x0600027D RID: 637 RVA: 0x0000CEB0 File Offset: 0x0000B2B0
// (set) Token: 0x0600027E RID: 638 RVA: 0x0000CECB File Offset: 0x0000B2CB
public bool fillCenter
{
get
{
return this.m_FillCenter;
}
set
{
if (SetPropertyUtility.SetStruct<bool>(ref this.m_FillCenter, value))
{
this.SetVerticesDirty();
}
}
}
// Token: 0x170000A8 RID: 168
// (get) Token: 0x0600027F RID: 639 RVA: 0x0000CEE8 File Offset: 0x0000B2E8
// (set) Token: 0x06000280 RID: 640 RVA: 0x0000CF03 File Offset: 0x0000B303
public Image.FillMethod fillMethod
{
get
{
return this.m_FillMethod;
}
set
{
if (SetPropertyUtility.SetStruct<Image.FillMethod>(ref this.m_FillMethod, value))
{
this.SetVerticesDirty();
this.m_FillOrigin = 0;
}
}
}
// Token: 0x170000A9 RID: 169
// (get) Token: 0x06000281 RID: 641 RVA: 0x0000CF28 File Offset: 0x0000B328
// (set) Token: 0x06000282 RID: 642 RVA: 0x0000CF43 File Offset: 0x0000B343
public float fillAmount
{
get
{
return this.m_FillAmount;
}
set
{
if (SetPropertyUtility.SetStruct<float>(ref this.m_FillAmount, Mathf.Clamp01(value)))
{
this.SetVerticesDirty();
}
}
}
// Token: 0x170000AA RID: 170
// (get) Token: 0x06000283 RID: 643 RVA: 0x0000CF64 File Offset: 0x0000B364
// (set) Token: 0x06000284 RID: 644 RVA: 0x0000CF7F File Offset: 0x0000B37F
public bool fillClockwise
{
get
{
return this.m_FillClockwise;
}
set
{
if (SetPropertyUtility.SetStruct<bool>(ref this.m_FillClockwise, value))
{
this.SetVerticesDirty();
}
}
}
// Token: 0x170000AB RID: 171
// (get) Token: 0x06000285 RID: 645 RVA: 0x0000CF9C File Offset: 0x0000B39C
// (set) Token: 0x06000286 RID: 646 RVA: 0x0000CFB7 File Offset: 0x0000B3B7
public int fillOrigin
{
get
{
return this.m_FillOrigin;
}
set
{
if (SetPropertyUtility.SetStruct<int>(ref this.m_FillOrigin, value))
{
this.SetVerticesDirty();
}
}
}
// Token: 0x170000AC RID: 172
// (get) Token: 0x06000287 RID: 647 RVA: 0x0000CFD4 File Offset: 0x0000B3D4
// (set) Token: 0x06000288 RID: 648 RVA: 0x0000CFF5 File Offset: 0x0000B3F5
[Obsolete("eventAlphaThreshold has been deprecated. Use eventMinimumAlphaThreshold instead (UnityUpgradable) -> alphaHitTestMinimumThreshold")]
public float eventAlphaThreshold
{
get
{
return 1f - this.alphaHitTestMinimumThreshold;
}
set
{
this.alphaHitTestMinimumThreshold = 1f - value;
}
}
// Token: 0x170000AD RID: 173
// (get) Token: 0x06000289 RID: 649 RVA: 0x0000D008 File Offset: 0x0000B408
// (set) Token: 0x0600028A RID: 650 RVA: 0x0000D023 File Offset: 0x0000B423
public float alphaHitTestMinimumThreshold
{
get
{
return this.m_AlphaHitTestMinimumThreshold;
}
set
{
this.m_AlphaHitTestMinimumThreshold = value;
}
}
// Token: 0x170000AE RID: 174
// (get) Token: 0x0600028B RID: 651 RVA: 0x0000D030 File Offset: 0x0000B430
public static Material defaultETC1GraphicMaterial
{
get
{
if (Image.s_ETC1DefaultUI == null)
{
Image.s_ETC1DefaultUI = Canvas.GetETC1SupportedCanvasMaterial();
}
return Image.s_ETC1DefaultUI;
}
}
// Token: 0x170000AF RID: 175
// (get) Token: 0x0600028C RID: 652 RVA: 0x0000D064 File Offset: 0x0000B464
public override Texture mainTexture
{
get
{
Texture texture;
if (this.activeSprite == null)
{
if (this.material != null && this.material.mainTexture != null)
{
texture = this.material.mainTexture;
}
else
{
texture = Graphic.s_WhiteTexture;
}
}
else
{
texture = this.activeSprite.texture;
}
return texture;
}
}
// Token: 0x170000B0 RID: 176
// (get) Token: 0x0600028D RID: 653 RVA: 0x0000D0DC File Offset: 0x0000B4DC
public bool hasBorder
{
get
{
return this.activeSprite != null && this.activeSprite.border.sqrMagnitude > 0f;
}
}
// Token: 0x170000B1 RID: 177
// (get) Token: 0x0600028E RID: 654 RVA: 0x0000D124 File Offset: 0x0000B524
public float pixelsPerUnit
{
get
{
float num = 100f;
if (this.activeSprite)
{
num = this.activeSprite.pixelsPerUnit;
}
float num2 = 100f;
if (base.canvas)
{
num2 = base.canvas.referencePixelsPerUnit;
}
return num / num2;
}
}
// Token: 0x170000B2 RID: 178
// (get) Token: 0x0600028F RID: 655 RVA: 0x0000D180 File Offset: 0x0000B580
// (set) Token: 0x06000290 RID: 656 RVA: 0x0000D1E9 File Offset: 0x0000B5E9
public override Material material
{
get
{
Material material;
if (this.m_Material != null)
{
material = this.m_Material;
}
else if (this.activeSprite && this.activeSprite.associatedAlphaSplitTexture != null)
{
material = Image.defaultETC1GraphicMaterial;
}
else
{
material = this.defaultMaterial;
}
return material;
}
set
{
base.material = value;
}
}
// Token: 0x06000291 RID: 657 RVA: 0x0000D1F3 File Offset: 0x0000B5F3
public virtual void OnBeforeSerialize()
{
}
// Token: 0x06000292 RID: 658 RVA: 0x0000D1F8 File Offset: 0x0000B5F8
public virtual void OnAfterDeserialize()
{
if (this.m_FillOrigin < 0)
{
this.m_FillOrigin = 0;
}
else if (this.m_FillMethod == Image.FillMethod.Horizontal && this.m_FillOrigin > 1)
{
this.m_FillOrigin = 0;
}
else if (this.m_FillMethod == Image.FillMethod.Vertical && this.m_FillOrigin > 1)
{
this.m_FillOrigin = 0;
}
else if (this.m_FillOrigin > 3)
{
this.m_FillOrigin = 0;
}
this.m_FillAmount = Mathf.Clamp(this.m_FillAmount, 0f, 1f);
}
// Token: 0x06000293 RID: 659 RVA: 0x0000D294 File Offset: 0x0000B694
private Vector4 GetDrawingDimensions(bool shouldPreserveAspect)
{
Vector4 vector = ((!(this.activeSprite == null)) ? DataUtility.GetPadding(this.activeSprite) : Vector4.zero);
Vector2 vector2 = ((!(this.activeSprite == null)) ? new Vector2(this.activeSprite.rect.width, this.activeSprite.rect.height) : Vector2.zero);
Rect pixelAdjustedRect = base.GetPixelAdjustedRect();
int num = Mathf.RoundToInt(vector2.x);
int num2 = Mathf.RoundToInt(vector2.y);
Vector4 vector3 = new Vector4(vector.x / (float)num, vector.y / (float)num2, ((float)num - vector.z) / (float)num, ((float)num2 - vector.w) / (float)num2);
if (shouldPreserveAspect && vector2.sqrMagnitude > 0f)
{
float num3 = vector2.x / vector2.y;
float num4 = pixelAdjustedRect.width / pixelAdjustedRect.height;
if (num3 > num4)
{
float height = pixelAdjustedRect.height;
pixelAdjustedRect.height = pixelAdjustedRect.width * (1f / num3);
pixelAdjustedRect.y += (height - pixelAdjustedRect.height) * base.rectTransform.pivot.y;
}
else
{
float width = pixelAdjustedRect.width;
pixelAdjustedRect.width = pixelAdjustedRect.height * num3;
pixelAdjustedRect.x += (width - pixelAdjustedRect.width) * base.rectTransform.pivot.x;
}
}
vector3 = new Vector4(pixelAdjustedRect.x + pixelAdjustedRect.width * vector3.x, pixelAdjustedRect.y + pixelAdjustedRect.height * vector3.y, pixelAdjustedRect.x + pixelAdjustedRect.width * vector3.z, pixelAdjustedRect.y + pixelAdjustedRect.height * vector3.w);
return vector3;
}
// Token: 0x06000294 RID: 660 RVA: 0x0000D4C0 File Offset: 0x0000B8C0
public override void SetNativeSize()
{
if (this.activeSprite != null)
{
float num = this.activeSprite.rect.width / this.pixelsPerUnit;
float num2 = this.activeSprite.rect.height / this.pixelsPerUnit;
base.rectTransform.anchorMax = base.rectTransform.anchorMin;
base.rectTransform.sizeDelta = new Vector2(num, num2);
this.SetAllDirty();
}
}
// Token: 0x06000295 RID: 661 RVA: 0x0000D548 File Offset: 0x0000B948
protected override void OnPopulateMesh(VertexHelper toFill)
{
if (this.activeSprite == null)
{
base.OnPopulateMesh(toFill);
}
else
{
switch (this.type)
{
case Image.Type.Simple:
this.GenerateSimpleSprite(toFill, this.m_PreserveAspect);
break;
case Image.Type.Sliced:
this.GenerateSlicedSprite(toFill);
break;
case Image.Type.Tiled:
this.GenerateTiledSprite(toFill);
break;
case Image.Type.Filled:
this.GenerateFilledSprite(toFill, this.m_PreserveAspect);
break;
}
}
}
// Token: 0x06000296 RID: 662 RVA: 0x0000D5D4 File Offset: 0x0000B9D4
protected override void UpdateMaterial()
{
base.UpdateMaterial();
if (this.activeSprite == null)
{
base.canvasRenderer.SetAlphaTexture(null);
}
else
{
Texture2D associatedAlphaSplitTexture = this.activeSprite.associatedAlphaSplitTexture;
if (associatedAlphaSplitTexture != null)
{
base.canvasRenderer.SetAlphaTexture(associatedAlphaSplitTexture);
}
}
}
// Token: 0x06000297 RID: 663 RVA: 0x0000D634 File Offset: 0x0000BA34
private void GenerateSimpleSprite(VertexHelper vh, bool lPreserveAspect)
{
Vector4 drawingDimensions = this.GetDrawingDimensions(lPreserveAspect);
Vector4 vector = ((!(this.activeSprite != null)) ? Vector4.zero : DataUtility.GetOuterUV(this.activeSprite));
Color color = this.color;
vh.Clear();
vh.AddVert(new Vector3(drawingDimensions.x, drawingDimensions.y), color, new Vector2(vector.x, vector.y));
vh.AddVert(new Vector3(drawingDimensions.x, drawingDimensions.w), color, new Vector2(vector.x, vector.w));
vh.AddVert(new Vector3(drawingDimensions.z, drawingDimensions.w), color, new Vector2(vector.z, vector.w));
vh.AddVert(new Vector3(drawingDimensions.z, drawingDimensions.y), color, new Vector2(vector.z, vector.y));
vh.AddTriangle(0, 1, 2);
vh.AddTriangle(2, 3, 0);
}
// Token: 0x06000298 RID: 664 RVA: 0x0000D758 File Offset: 0x0000BB58
private void GenerateSlicedSprite(VertexHelper toFill)
{
if (!this.hasBorder)
{
this.GenerateSimpleSprite(toFill, false);
}
else
{
Vector4 vector;
Vector4 vector2;
Vector4 vector3;
Vector4 vector4;
if (this.activeSprite != null)
{
vector = DataUtility.GetOuterUV(this.activeSprite);
vector2 = DataUtility.GetInnerUV(this.activeSprite);
vector3 = DataUtility.GetPadding(this.activeSprite);
vector4 = this.activeSprite.border;
}
else
{
vector = Vector4.zero;
vector2 = Vector4.zero;
vector3 = Vector4.zero;
vector4 = Vector4.zero;
}
Rect pixelAdjustedRect = base.GetPixelAdjustedRect();
Vector4 adjustedBorders = this.GetAdjustedBorders(vector4 / this.pixelsPerUnit, pixelAdjustedRect);
vector3 /= this.pixelsPerUnit;
Image.s_VertScratch[0] = new Vector2(vector3.x, vector3.y);
Image.s_VertScratch[3] = new Vector2(pixelAdjustedRect.width - vector3.z, pixelAdjustedRect.height - vector3.w);
Image.s_VertScratch[1].x = adjustedBorders.x;
Image.s_VertScratch[1].y = adjustedBorders.y;
Image.s_VertScratch[2].x = pixelAdjustedRect.width - adjustedBorders.z;
Image.s_VertScratch[2].y = pixelAdjustedRect.height - adjustedBorders.w;
for (int i = 0; i < 4; i++)
{
Vector2[] array = Image.s_VertScratch;
int num = i;
array[num].x = array[num].x + pixelAdjustedRect.x;
Vector2[] array2 = Image.s_VertScratch;
int num2 = i;
array2[num2].y = array2[num2].y + pixelAdjustedRect.y;
}
Image.s_UVScratch[0] = new Vector2(vector.x, vector.y);
Image.s_UVScratch[1] = new Vector2(vector2.x, vector2.y);
Image.s_UVScratch[2] = new Vector2(vector2.z, vector2.w);
Image.s_UVScratch[3] = new Vector2(vector.z, vector.w);
toFill.Clear();
for (int j = 0; j < 3; j++)
{
int num3 = j + 1;
for (int k = 0; k < 3; k++)
{
if (this.m_FillCenter || j != 1 || k != 1)
{
int num4 = k + 1;
Image.AddQuad(toFill, new Vector2(Image.s_VertScratch[j].x, Image.s_VertScratch[k].y), new Vector2(Image.s_VertScratch[num3].x, Image.s_VertScratch[num4].y), this.color, new Vector2(Image.s_UVScratch[j].x, Image.s_UVScratch[k].y), new Vector2(Image.s_UVScratch[num3].x, Image.s_UVScratch[num4].y));
}
}
}
}
}
// Token: 0x06000299 RID: 665 RVA: 0x0000DAC0 File Offset: 0x0000BEC0
private void GenerateTiledSprite(VertexHelper toFill)
{
Vector4 vector;
Vector4 vector2;
Vector4 vector3;
Vector2 vector4;
if (this.activeSprite != null)
{
vector = DataUtility.GetOuterUV(this.activeSprite);
vector2 = DataUtility.GetInnerUV(this.activeSprite);
vector3 = this.activeSprite.border;
vector4 = this.activeSprite.rect.size;
}
else
{
vector = Vector4.zero;
vector2 = Vector4.zero;
vector3 = Vector4.zero;
vector4 = Vector2.one * 100f;
}
Rect pixelAdjustedRect = base.GetPixelAdjustedRect();
float num = (vector4.x - vector3.x - vector3.z) / this.pixelsPerUnit;
float num2 = (vector4.y - vector3.y - vector3.w) / this.pixelsPerUnit;
vector3 = this.GetAdjustedBorders(vector3 / this.pixelsPerUnit, pixelAdjustedRect);
Vector2 vector5 = new Vector2(vector2.x, vector2.y);
Vector2 vector6 = new Vector2(vector2.z, vector2.w);
float x = vector3.x;
float num3 = pixelAdjustedRect.width - vector3.z;
float y = vector3.y;
float num4 = pixelAdjustedRect.height - vector3.w;
toFill.Clear();
Vector2 vector7 = vector6;
if (num <= 0f)
{
num = num3 - x;
}
if (num2 <= 0f)
{
num2 = num4 - y;
}
if (this.activeSprite != null && (this.hasBorder || this.activeSprite.packed || this.activeSprite.texture.wrapMode != TextureWrapMode.Repeat))
{
long num5;
long num6;
if (this.m_FillCenter)
{
num5 = (long)Math.Ceiling((double)((num3 - x) / num));
num6 = (long)Math.Ceiling((double)((num4 - y) / num2));
double num7;
if (this.hasBorder)
{
num7 = ((double)num5 + 2.0) * ((double)num6 + 2.0) * 4.0;
}
else
{
num7 = (double)(num5 * num6) * 4.0;
}
if (num7 > 65000.0)
{
Debug.LogError("Too many sprite tiles on Image \"" + base.name + "\". The tile size will be increased. To remove the limit on the number of tiles, convert the Sprite to an Advanced texture, remove the borders, clear the Packing tag and set the Wrap mode to Repeat.", this);
double num8 = 16250.0;
double num9;
if (this.hasBorder)
{
num9 = ((double)num5 + 2.0) / ((double)num6 + 2.0);
}
else
{
num9 = (double)num5 / (double)num6;
}
double num10 = Math.Sqrt(num8 / num9);
double num11 = num10 * num9;
if (this.hasBorder)
{
num10 -= 2.0;
num11 -= 2.0;
}
num5 = (long)Math.Floor(num10);
num6 = (long)Math.Floor(num11);
num = (num3 - x) / (float)num5;
num2 = (num4 - y) / (float)num6;
}
}
else if (this.hasBorder)
{
num5 = (long)Math.Ceiling((double)((num3 - x) / num));
num6 = (long)Math.Ceiling((double)((num4 - y) / num2));
double num12 = ((double)(num6 + num5) + 2.0) * 2.0 * 4.0;
if (num12 > 65000.0)
{
Debug.LogError("Too many sprite tiles on Image \"" + base.name + "\". The tile size will be increased. To remove the limit on the number of tiles, convert the Sprite to an Advanced texture, remove the borders, clear the Packing tag and set the Wrap mode to Repeat.", this);
double num13 = 16250.0;
double num14 = (double)num5 / (double)num6;
double num15 = (num13 - 4.0) / (2.0 * (1.0 + num14));
double num16 = num15 * num14;
num5 = (long)Math.Floor(num15);
num6 = (long)Math.Floor(num16);
num = (num3 - x) / (float)num5;
num2 = (num4 - y) / (float)num6;
}
}
else
{
num5 = (num6 = 0L);
}
if (this.m_FillCenter)
{
for (long num17 = 0L; num17 < num6; num17 += 1L)
{
float num18 = y + (float)num17 * num2;
float num19 = y + (float)(num17 + 1L) * num2;
if (num19 > num4)
{
vector7.y = vector5.y + (vector6.y - vector5.y) * (num4 - num18) / (num19 - num18);
num19 = num4;
}
vector7.x = vector6.x;
for (long num20 = 0L; num20 < num5; num20 += 1L)
{
float num21 = x + (float)num20 * num;
float num22 = x + (float)(num20 + 1L) * num;
if (num22 > num3)
{
vector7.x = vector5.x + (vector6.x - vector5.x) * (num3 - num21) / (num22 - num21);
num22 = num3;
}
Image.AddQuad(toFill, new Vector2(num21, num18) + pixelAdjustedRect.position, new Vector2(num22, num19) + pixelAdjustedRect.position, this.color, vector5, vector7);
}
}
}
if (this.hasBorder)
{
vector7 = vector6;
for (long num23 = 0L; num23 < num6; num23 += 1L)
{
float num24 = y + (float)num23 * num2;
float num25 = y + (float)(num23 + 1L) * num2;
if (num25 > num4)
{
vector7.y = vector5.y + (vector6.y - vector5.y) * (num4 - num24) / (num25 - num24);
num25 = num4;
}
Image.AddQuad(toFill, new Vector2(0f, num24) + pixelAdjustedRect.position, new Vector2(x, num25) + pixelAdjustedRect.position, this.color, new Vector2(vector.x, vector5.y), new Vector2(vector5.x, vector7.y));
Image.AddQuad(toFill, new Vector2(num3, num24) + pixelAdjustedRect.position, new Vector2(pixelAdjustedRect.width, num25) + pixelAdjustedRect.position, this.color, new Vector2(vector6.x, vector5.y), new Vector2(vector.z, vector7.y));
}
vector7 = vector6;
for (long num26 = 0L; num26 < num5; num26 += 1L)
{
float num27 = x + (float)num26 * num;
float num28 = x + (float)(num26 + 1L) * num;
if (num28 > num3)
{
vector7.x = vector5.x + (vector6.x - vector5.x) * (num3 - num27) / (num28 - num27);
num28 = num3;
}
Image.AddQuad(toFill, new Vector2(num27, 0f) + pixelAdjustedRect.position, new Vector2(num28, y) + pixelAdjustedRect.position, this.color, new Vector2(vector5.x, vector.y), new Vector2(vector7.x, vector5.y));
Image.AddQuad(toFill, new Vector2(num27, num4) + pixelAdjustedRect.position, new Vector2(num28, pixelAdjustedRect.height) + pixelAdjustedRect.position, this.color, new Vector2(vector5.x, vector6.y), new Vector2(vector7.x, vector.w));
}
Image.AddQuad(toFill, new Vector2(0f, 0f) + pixelAdjustedRect.position, new Vector2(x, y) + pixelAdjustedRect.position, this.color, new Vector2(vector.x, vector.y), new Vector2(vector5.x, vector5.y));
Image.AddQuad(toFill, new Vector2(num3, 0f) + pixelAdjustedRect.position, new Vector2(pixelAdjustedRect.width, y) + pixelAdjustedRect.position, this.color, new Vector2(vector6.x, vector.y), new Vector2(vector.z, vector5.y));
Image.AddQuad(toFill, new Vector2(0f, num4) + pixelAdjustedRect.position, new Vector2(x, pixelAdjustedRect.height) + pixelAdjustedRect.position, this.color, new Vector2(vector.x, vector6.y), new Vector2(vector5.x, vector.w));
Image.AddQuad(toFill, new Vector2(num3, num4) + pixelAdjustedRect.position, new Vector2(pixelAdjustedRect.width, pixelAdjustedRect.height) + pixelAdjustedRect.position, this.color, new Vector2(vector6.x, vector6.y), new Vector2(vector.z, vector.w));
}
}
else
{
Vector2 vector8 = new Vector2((num3 - x) / num, (num4 - y) / num2);
if (this.m_FillCenter)
{
Image.AddQuad(toFill, new Vector2(x, y) + pixelAdjustedRect.position, new Vector2(num3, num4) + pixelAdjustedRect.position, this.color, Vector2.Scale(vector5, vector8), Vector2.Scale(vector6, vector8));
}
}
}
// Token: 0x0600029A RID: 666 RVA: 0x0000E4AC File Offset: 0x0000C8AC
private static void AddQuad(VertexHelper vertexHelper, Vector3[] quadPositions, Color32 color, Vector3[] quadUVs)
{
int currentVertCount = vertexHelper.currentVertCount;
for (int i = 0; i < 4; i++)
{
vertexHelper.AddVert(quadPositions[i], color, quadUVs[i]);
}
vertexHelper.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2);
vertexHelper.AddTriangle(currentVertCount + 2, currentVertCount + 3, currentVertCount);
}
// Token: 0x0600029B RID: 667 RVA: 0x0000E514 File Offset: 0x0000C914
private static void AddQuad(VertexHelper vertexHelper, Vector2 posMin, Vector2 posMax, Color32 color, Vector2 uvMin, Vector2 uvMax)
{
int currentVertCount = vertexHelper.currentVertCount;
vertexHelper.AddVert(new Vector3(posMin.x, posMin.y, 0f), color, new Vector2(uvMin.x, uvMin.y));
vertexHelper.AddVert(new Vector3(posMin.x, posMax.y, 0f), color, new Vector2(uvMin.x, uvMax.y));
vertexHelper.AddVert(new Vector3(posMax.x, posMax.y, 0f), color, new Vector2(uvMax.x, uvMax.y));
vertexHelper.AddVert(new Vector3(posMax.x, posMin.y, 0f), color, new Vector2(uvMax.x, uvMin.y));
vertexHelper.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2);
vertexHelper.AddTriangle(currentVertCount + 2, currentVertCount + 3, currentVertCount);
}
// Token: 0x0600029C RID: 668 RVA: 0x0000E60C File Offset: 0x0000CA0C
private Vector4 GetAdjustedBorders(Vector4 border, Rect adjustedRect)
{
Rect rect = base.rectTransform.rect;
for (int i = 0; i <= 1; i++)
{
if (rect.size[i] != 0f)
{
float num = adjustedRect.size[i] / rect.size[i];
ref Vector4 ptr = ref border;
int num2;
border[num2 = i] = ptr[num2] * num;
ptr = ref border;
int num3;
border[num3 = i + 2] = ptr[num3] * num;
}
float num4 = border[i] + border[i + 2];
if (adjustedRect.size[i] < num4 && num4 != 0f)
{
float num = adjustedRect.size[i] / num4;
ref Vector4 ptr = ref border;
int num5;
border[num5 = i] = ptr[num5] * num;
ptr = ref border;
int num6;
border[num6 = i + 2] = ptr[num6] * num;
}
}
return border;
}
// Token: 0x0600029D RID: 669 RVA: 0x0000E73C File Offset: 0x0000CB3C
private void GenerateFilledSprite(VertexHelper toFill, bool preserveAspect)
{
toFill.Clear();
if (this.m_FillAmount >= 0.001f)
{
Vector4 drawingDimensions = this.GetDrawingDimensions(preserveAspect);
Vector4 vector = ((!(this.activeSprite != null)) ? Vector4.zero : DataUtility.GetOuterUV(this.activeSprite));
UIVertex simpleVert = UIVertex.simpleVert;
simpleVert.color = this.color;
float num = vector.x;
float num2 = vector.y;
float num3 = vector.z;
float num4 = vector.w;
if (this.m_FillMethod == Image.FillMethod.Horizontal || this.m_FillMethod == Image.FillMethod.Vertical)
{
if (this.fillMethod == Image.FillMethod.Horizontal)
{
float num5 = (num3 - num) * this.m_FillAmount;
if (this.m_FillOrigin == 1)
{
drawingDimensions.x = drawingDimensions.z - (drawingDimensions.z - drawingDimensions.x) * this.m_FillAmount;
num = num3 - num5;
}
else
{
drawingDimensions.z = drawingDimensions.x + (drawingDimensions.z - drawingDimensions.x) * this.m_FillAmount;
num3 = num + num5;
}
}
else if (this.fillMethod == Image.FillMethod.Vertical)
{
float num6 = (num4 - num2) * this.m_FillAmount;
if (this.m_FillOrigin == 1)
{
drawingDimensions.y = drawingDimensions.w - (drawingDimensions.w - drawingDimensions.y) * this.m_FillAmount;
num2 = num4 - num6;
}
else
{
drawingDimensions.w = drawingDimensions.y + (drawingDimensions.w - drawingDimensions.y) * this.m_FillAmount;
num4 = num2 + num6;
}
}
}
Image.s_Xy[0] = new Vector2(drawingDimensions.x, drawingDimensions.y);
Image.s_Xy[1] = new Vector2(drawingDimensions.x, drawingDimensions.w);
Image.s_Xy[2] = new Vector2(drawingDimensions.z, drawingDimensions.w);
Image.s_Xy[3] = new Vector2(drawingDimensions.z, drawingDimensions.y);
Image.s_Uv[0] = new Vector2(num, num2);
Image.s_Uv[1] = new Vector2(num, num4);
Image.s_Uv[2] = new Vector2(num3, num4);
Image.s_Uv[3] = new Vector2(num3, num2);
if (this.m_FillAmount < 1f && this.m_FillMethod != Image.FillMethod.Horizontal && this.m_FillMethod != Image.FillMethod.Vertical)
{
if (this.fillMethod == Image.FillMethod.Radial90)
{
if (Image.RadialCut(Image.s_Xy, Image.s_Uv, this.m_FillAmount, this.m_FillClockwise, this.m_FillOrigin))
{
Image.AddQuad(toFill, Image.s_Xy, this.color, Image.s_Uv);
}
}
else if (this.fillMethod == Image.FillMethod.Radial180)
{
for (int i = 0; i < 2; i++)
{
int num7 = ((this.m_FillOrigin <= 1) ? 0 : 1);
float num8;
float num9;
float num10;
float num11;
if (this.m_FillOrigin == 0 || this.m_FillOrigin == 2)
{
num8 = 0f;
num9 = 1f;
if (i == num7)
{
num10 = 0f;
num11 = 0.5f;
}
else
{
num10 = 0.5f;
num11 = 1f;
}
}
else
{
num10 = 0f;
num11 = 1f;
if (i == num7)
{
num8 = 0.5f;
num9 = 1f;
}
else
{
num8 = 0f;
num9 = 0.5f;
}
}
Image.s_Xy[0].x = Mathf.Lerp(drawingDimensions.x, drawingDimensions.z, num10);
Image.s_Xy[1].x = Image.s_Xy[0].x;
Image.s_Xy[2].x = Mathf.Lerp(drawingDimensions.x, drawingDimensions.z, num11);
Image.s_Xy[3].x = Image.s_Xy[2].x;
Image.s_Xy[0].y = Mathf.Lerp(drawingDimensions.y, drawingDimensions.w, num8);
Image.s_Xy[1].y = Mathf.Lerp(drawingDimensions.y, drawingDimensions.w, num9);
Image.s_Xy[2].y = Image.s_Xy[1].y;
Image.s_Xy[3].y = Image.s_Xy[0].y;
Image.s_Uv[0].x = Mathf.Lerp(num, num3, num10);
Image.s_Uv[1].x = Image.s_Uv[0].x;
Image.s_Uv[2].x = Mathf.Lerp(num, num3, num11);
Image.s_Uv[3].x = Image.s_Uv[2].x;
Image.s_Uv[0].y = Mathf.Lerp(num2, num4, num8);
Image.s_Uv[1].y = Mathf.Lerp(num2, num4, num9);
Image.s_Uv[2].y = Image.s_Uv[1].y;
Image.s_Uv[3].y = Image.s_Uv[0].y;
float num12 = ((!this.m_FillClockwise) ? (this.m_FillAmount * 2f - (float)(1 - i)) : (this.fillAmount * 2f - (float)i));
if (Image.RadialCut(Image.s_Xy, Image.s_Uv, Mathf.Clamp01(num12), this.m_FillClockwise, (i + this.m_FillOrigin + 3) % 4))
{
Image.AddQuad(toFill, Image.s_Xy, this.color, Image.s_Uv);
}
}
}
else if (this.fillMethod == Image.FillMethod.Radial360)
{
for (int j = 0; j < 4; j++)
{
float num13;
float num14;
if (j < 2)
{
num13 = 0f;
num14 = 0.5f;
}
else
{
num13 = 0.5f;
num14 = 1f;
}
float num15;
float num16;
if (j == 0 || j == 3)
{
num15 = 0f;
num16 = 0.5f;
}
else
{
num15 = 0.5f;
num16 = 1f;
}
Image.s_Xy[0].x = Mathf.Lerp(drawingDimensions.x, drawingDimensions.z, num13);
Image.s_Xy[1].x = Image.s_Xy[0].x;
Image.s_Xy[2].x = Mathf.Lerp(drawingDimensions.x, drawingDimensions.z, num14);
Image.s_Xy[3].x = Image.s_Xy[2].x;
Image.s_Xy[0].y = Mathf.Lerp(drawingDimensions.y, drawingDimensions.w, num15);
Image.s_Xy[1].y = Mathf.Lerp(drawingDimensions.y, drawingDimensions.w, num16);
Image.s_Xy[2].y = Image.s_Xy[1].y;
Image.s_Xy[3].y = Image.s_Xy[0].y;
Image.s_Uv[0].x = Mathf.Lerp(num, num3, num13);
Image.s_Uv[1].x = Image.s_Uv[0].x;
Image.s_Uv[2].x = Mathf.Lerp(num, num3, num14);
Image.s_Uv[3].x = Image.s_Uv[2].x;
Image.s_Uv[0].y = Mathf.Lerp(num2, num4, num15);
Image.s_Uv[1].y = Mathf.Lerp(num2, num4, num16);
Image.s_Uv[2].y = Image.s_Uv[1].y;
Image.s_Uv[3].y = Image.s_Uv[0].y;
float num17 = ((!this.m_FillClockwise) ? (this.m_FillAmount * 4f - (float)(3 - (j + this.m_FillOrigin) % 4)) : (this.m_FillAmount * 4f - (float)((j + this.m_FillOrigin) % 4)));
if (Image.RadialCut(Image.s_Xy, Image.s_Uv, Mathf.Clamp01(num17), this.m_FillClockwise, (j + 2) % 4))
{
Image.AddQuad(toFill, Image.s_Xy, this.color, Image.s_Uv);
}
}
}
}
else
{
Image.AddQuad(toFill, Image.s_Xy, this.color, Image.s_Uv);
}
}
}
// Token: 0x0600029E RID: 670 RVA: 0x0000F114 File Offset: 0x0000D514
private static bool RadialCut(Vector3[] xy, Vector3[] uv, float fill, bool invert, int corner)
{
bool flag;
if (fill < 0.001f)
{
flag = false;
}
else
{
if ((corner & 1) == 1)
{
invert = !invert;
}
if (!invert && fill > 0.999f)
{
flag = true;
}
else
{
float num = Mathf.Clamp01(fill);
if (invert)
{
num = 1f - num;
}
num *= 1.5707964f;
float num2 = Mathf.Cos(num);
float num3 = Mathf.Sin(num);
Image.RadialCut(xy, num2, num3, invert, corner);
Image.RadialCut(uv, num2, num3, invert, corner);
flag = true;
}
}
return flag;
}
// Token: 0x0600029F RID: 671 RVA: 0x0000F1A8 File Offset: 0x0000D5A8
private static void RadialCut(Vector3[] xy, float cos, float sin, bool invert, int corner)
{
int num = (corner + 1) % 4;
int num2 = (corner + 2) % 4;
int num3 = (corner + 3) % 4;
if ((corner & 1) == 1)
{
if (sin > cos)
{
cos /= sin;
sin = 1f;
if (invert)
{
xy[num].x = Mathf.Lerp(xy[corner].x, xy[num2].x, cos);
xy[num2].x = xy[num].x;
}
}
else if (cos > sin)
{
sin /= cos;
cos = 1f;
if (!invert)
{
xy[num2].y = Mathf.Lerp(xy[corner].y, xy[num2].y, sin);
xy[num3].y = xy[num2].y;
}
}
else
{
cos = 1f;
sin = 1f;
}
if (!invert)
{
xy[num3].x = Mathf.Lerp(xy[corner].x, xy[num2].x, cos);
}
else
{
xy[num].y = Mathf.Lerp(xy[corner].y, xy[num2].y, sin);
}
}
else
{
if (cos > sin)
{
sin /= cos;
cos = 1f;
if (!invert)
{
xy[num].y = Mathf.Lerp(xy[corner].y, xy[num2].y, sin);
xy[num2].y = xy[num].y;
}
}
else if (sin > cos)
{
cos /= sin;
sin = 1f;
if (invert)
{
xy[num2].x = Mathf.Lerp(xy[corner].x, xy[num2].x, cos);
xy[num3].x = xy[num2].x;
}
}
else
{
cos = 1f;
sin = 1f;
}
if (invert)
{
xy[num3].y = Mathf.Lerp(xy[corner].y, xy[num2].y, sin);
}
else
{
xy[num].x = Mathf.Lerp(xy[corner].x, xy[num2].x, cos);
}
}
}
// Token: 0x060002A0 RID: 672 RVA: 0x0000F44F File Offset: 0x0000D84F
public virtual void CalculateLayoutInputHorizontal()
{
}
// Token: 0x060002A1 RID: 673 RVA: 0x0000F452 File Offset: 0x0000D852
public virtual void CalculateLayoutInputVertical()
{
}
// Token: 0x170000B3 RID: 179
// (get) Token: 0x060002A2 RID: 674 RVA: 0x0000F458 File Offset: 0x0000D858
public virtual float minWidth
{
get
{
return 0f;
}
}
// Token: 0x170000B4 RID: 180
// (get) Token: 0x060002A3 RID: 675 RVA: 0x0000F474 File Offset: 0x0000D874
public virtual float preferredWidth
{
get
{
float num;
if (this.activeSprite == null)
{
num = 0f;
}
else if (this.type == Image.Type.Sliced || this.type == Image.Type.Tiled)
{
num = DataUtility.GetMinSize(this.activeSprite).x / this.pixelsPerUnit;
}
else
{
num = this.activeSprite.rect.size.x / this.pixelsPerUnit;
}
return num;
}
}
// Token: 0x170000B5 RID: 181
// (get) Token: 0x060002A4 RID: 676 RVA: 0x0000F500 File Offset: 0x0000D900
public virtual float flexibleWidth
{
get
{
return -1f;
}
}
// Token: 0x170000B6 RID: 182
// (get) Token: 0x060002A5 RID: 677 RVA: 0x0000F51C File Offset: 0x0000D91C
public virtual float minHeight
{
get
{
return 0f;
}
}
// Token: 0x170000B7 RID: 183
// (get) Token: 0x060002A6 RID: 678 RVA: 0x0000F538 File Offset: 0x0000D938
public virtual float preferredHeight
{
get
{
float num;
if (this.activeSprite == null)
{
num = 0f;
}
else if (this.type == Image.Type.Sliced || this.type == Image.Type.Tiled)
{
num = DataUtility.GetMinSize(this.activeSprite).y / this.pixelsPerUnit;
}
else
{
num = this.activeSprite.rect.size.y / this.pixelsPerUnit;
}
return num;
}
}
// Token: 0x170000B8 RID: 184
// (get) Token: 0x060002A7 RID: 679 RVA: 0x0000F5C4 File Offset: 0x0000D9C4
public virtual float flexibleHeight
{
get
{
return -1f;
}
}
// Token: 0x170000B9 RID: 185
// (get) Token: 0x060002A8 RID: 680 RVA: 0x0000F5E0 File Offset: 0x0000D9E0
public virtual int layoutPriority
{
get
{
return 0;
}
}
// Token: 0x060002A9 RID: 681 RVA: 0x0000F5F8 File Offset: 0x0000D9F8
public virtual bool IsRaycastLocationValid(Vector2 screenPoint, Camera eventCamera)
{
bool flag;
Vector2 vector;
if (this.alphaHitTestMinimumThreshold <= 0f)
{
flag = true;
}
else if (this.alphaHitTestMinimumThreshold > 1f)
{
flag = false;
}
else if (this.activeSprite == null)
{
flag = true;
}
else if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(base.rectTransform, screenPoint, eventCamera, out vector))
{
flag = false;
}
else
{
Rect pixelAdjustedRect = base.GetPixelAdjustedRect();
vector.x += base.rectTransform.pivot.x * pixelAdjustedRect.width;
vector.y += base.rectTransform.pivot.y * pixelAdjustedRect.height;
vector = this.MapCoordinate(vector, pixelAdjustedRect);
Rect textureRect = this.activeSprite.textureRect;
Vector2 vector2 = new Vector2(vector.x / textureRect.width, vector.y / textureRect.height);
float num = Mathf.Lerp(textureRect.x, textureRect.xMax, vector2.x) / (float)this.activeSprite.texture.width;
float num2 = Mathf.Lerp(textureRect.y, textureRect.yMax, vector2.y) / (float)this.activeSprite.texture.height;
try
{
flag = this.activeSprite.texture.GetPixelBilinear(num, num2).a >= this.alphaHitTestMinimumThreshold;
}
catch (UnityException ex)
{
Debug.LogError("Using alphaHitTestMinimumThreshold greater than 0 on Image whose sprite texture cannot be read. " + ex.Message + " Also make sure to disable sprite packing for this sprite.", this);
flag = true;
}
}
return flag;
}
// Token: 0x060002AA RID: 682 RVA: 0x0000F7C0 File Offset: 0x0000DBC0
private Vector2 MapCoordinate(Vector2 local, Rect rect)
{
Rect rect2 = this.activeSprite.rect;
Vector2 vector;
if (this.type == Image.Type.Simple || this.type == Image.Type.Filled)
{
vector = new Vector2(local.x * rect2.width / rect.width, local.y * rect2.height / rect.height);
}
else
{
Vector4 border = this.activeSprite.border;
Vector4 adjustedBorders = this.GetAdjustedBorders(border / this.pixelsPerUnit, rect);
for (int i = 0; i < 2; i++)
{
if (local[i] > adjustedBorders[i])
{
if (rect.size[i] - local[i] <= adjustedBorders[i + 2])
{
ref Vector2 ptr = ref local;
int num;
local[num = i] = ptr[num] - (rect.size[i] - rect2.size[i]);
}
else if (this.type == Image.Type.Sliced)
{
float num2 = Mathf.InverseLerp(adjustedBorders[i], rect.size[i] - adjustedBorders[i + 2], local[i]);
local[i] = Mathf.Lerp(border[i], rect2.size[i] - border[i + 2], num2);
}
else
{
ref Vector2 ptr = ref local;
int num3;
local[num3 = i] = ptr[num3] - adjustedBorders[i];
local[i] = Mathf.Repeat(local[i], rect2.size[i] - border[i] - border[i + 2]);
ptr = ref local;
int num4;
local[num4 = i] = ptr[num4] + border[i];
}
}
}
vector = local;
}
return vector;
}
// Token: 0x04000128 RID: 296
protected static Material s_ETC1DefaultUI = null;
// Token: 0x04000129 RID: 297
[FormerlySerializedAs("m_Frame")]
[SerializeField]
private Sprite m_Sprite;
// Token: 0x0400012A RID: 298
[NonSerialized]
private Sprite m_OverrideSprite;
// Token: 0x0400012B RID: 299
[SerializeField]
private Image.Type m_Type = Image.Type.Simple;
// Token: 0x0400012C RID: 300
[SerializeField]
private bool m_PreserveAspect = false;
// Token: 0x0400012D RID: 301
[SerializeField]
private bool m_FillCenter = true;
// Token: 0x0400012E RID: 302
[SerializeField]
private Image.FillMethod m_FillMethod = Image.FillMethod.Radial360;
// Token: 0x0400012F RID: 303
[Range(0f, 1f)]
[SerializeField]
private float m_FillAmount = 1f;
// Token: 0x04000130 RID: 304
[SerializeField]
private bool m_FillClockwise = true;
// Token: 0x04000131 RID: 305
[SerializeField]
private int m_FillOrigin;
// Token: 0x04000132 RID: 306
private float m_AlphaHitTestMinimumThreshold = 0f;
// Token: 0x04000133 RID: 307
private static readonly Vector2[] s_VertScratch = new Vector2[4];
// Token: 0x04000134 RID: 308
private static readonly Vector2[] s_UVScratch = new Vector2[4];
// Token: 0x04000135 RID: 309
private static readonly Vector3[] s_Xy = new Vector3[4];
// Token: 0x04000136 RID: 310
private static readonly Vector3[] s_Uv = new Vector3[4];
// Token: 0x0200004F RID: 79
public enum Type
{
// Token: 0x04000138 RID: 312
Simple,
// Token: 0x04000139 RID: 313
Sliced,
// Token: 0x0400013A RID: 314
Tiled,
// Token: 0x0400013B RID: 315
Filled
}
// Token: 0x02000050 RID: 80
public enum FillMethod
{
// Token: 0x0400013D RID: 317
Horizontal,
// Token: 0x0400013E RID: 318
Vertical,
// Token: 0x0400013F RID: 319
Radial90,
// Token: 0x04000140 RID: 320
Radial180,
// Token: 0x04000141 RID: 321
Radial360
}
// Token: 0x02000051 RID: 81
public enum OriginHorizontal
{
// Token: 0x04000143 RID: 323
Left,
// Token: 0x04000144 RID: 324
Right
}
// Token: 0x02000052 RID: 82
public enum OriginVertical
{
// Token: 0x04000146 RID: 326
Bottom,
// Token: 0x04000147 RID: 327
Top
}
// Token: 0x02000053 RID: 83
public enum Origin90
{
// Token: 0x04000149 RID: 329
BottomLeft,
// Token: 0x0400014A RID: 330
TopLeft,
// Token: 0x0400014B RID: 331
TopRight,
// Token: 0x0400014C RID: 332
BottomRight
}
// Token: 0x02000054 RID: 84
public enum Origin180
{
// Token: 0x0400014E RID: 334
Bottom,
// Token: 0x0400014F RID: 335
Left,
// Token: 0x04000150 RID: 336
Top,
// Token: 0x04000151 RID: 337
Right
}
// Token: 0x02000055 RID: 85
public enum Origin360
{
// Token: 0x04000153 RID: 339
Bottom,
// Token: 0x04000154 RID: 340
Right,
// Token: 0x04000155 RID: 341
Top,
// Token: 0x04000156 RID: 342
Left
}
}
}
+2938
View File
@@ -0,0 +1,2938 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
namespace UnityEngine.UI
{
// Token: 0x02000058 RID: 88
[AddComponentMenu("UI/Input Field", 31)]
public class InputField : Selectable, IUpdateSelectedHandler, IBeginDragHandler, IDragHandler, IEndDragHandler, IPointerClickHandler, ISubmitHandler, ICanvasElement, ILayoutElement, IEventSystemHandler
{
// Token: 0x060002AF RID: 687 RVA: 0x0000FA34 File Offset: 0x0000DE34
protected InputField()
{
this.EnforceTextHOverflow();
}
// Token: 0x170000BB RID: 187
// (get) Token: 0x060002B0 RID: 688 RVA: 0x0000FB90 File Offset: 0x0000DF90
private BaseInput input
{
get
{
BaseInput baseInput;
if (EventSystem.current && EventSystem.current.currentInputModule)
{
baseInput = EventSystem.current.currentInputModule.input;
}
else
{
baseInput = null;
}
return baseInput;
}
}
// Token: 0x170000BC RID: 188
// (get) Token: 0x060002B1 RID: 689 RVA: 0x0000FBE0 File Offset: 0x0000DFE0
private string compositionString
{
get
{
return (!(this.input != null)) ? Input.compositionString : this.input.compositionString;
}
}
// Token: 0x170000BD RID: 189
// (get) Token: 0x060002B2 RID: 690 RVA: 0x0000FC1C File Offset: 0x0000E01C
protected Mesh mesh
{
get
{
if (this.m_Mesh == null)
{
this.m_Mesh = new Mesh();
}
return this.m_Mesh;
}
}
// Token: 0x170000BE RID: 190
// (get) Token: 0x060002B3 RID: 691 RVA: 0x0000FC54 File Offset: 0x0000E054
protected TextGenerator cachedInputTextGenerator
{
get
{
if (this.m_InputTextCache == null)
{
this.m_InputTextCache = new TextGenerator();
}
return this.m_InputTextCache;
}
}
// Token: 0x170000BF RID: 191
// (get) Token: 0x060002B5 RID: 693 RVA: 0x0000FC98 File Offset: 0x0000E098
// (set) Token: 0x060002B4 RID: 692 RVA: 0x0000FC85 File Offset: 0x0000E085
public bool shouldHideMobileInput
{
get
{
RuntimePlatform platform = Application.platform;
switch (platform)
{
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.Android:
break;
default:
if (platform != RuntimePlatform.TizenPlayer && platform != RuntimePlatform.tvOS)
{
return true;
}
break;
}
return this.m_HideMobileInput;
}
set
{
SetPropertyUtility.SetStruct<bool>(ref this.m_HideMobileInput, value);
}
}
// Token: 0x170000C0 RID: 192
// (get) Token: 0x060002B6 RID: 694 RVA: 0x0000FCF0 File Offset: 0x0000E0F0
private bool shouldActivateOnSelect
{
get
{
return Application.platform != RuntimePlatform.tvOS;
}
}
// Token: 0x170000C1 RID: 193
// (get) Token: 0x060002B7 RID: 695 RVA: 0x0000FD14 File Offset: 0x0000E114
// (set) Token: 0x060002B8 RID: 696 RVA: 0x0000FD30 File Offset: 0x0000E130
public string text
{
get
{
return this.m_Text;
}
set
{
if (!(this.text == value))
{
if (value == null)
{
value = "";
}
value = value.Replace("\0", string.Empty);
if (this.m_LineType == InputField.LineType.SingleLine)
{
value = value.Replace("\n", "").Replace("\t", "");
}
if (this.onValidateInput != null || this.characterValidation != InputField.CharacterValidation.None)
{
this.m_Text = "";
InputField.OnValidateInput onValidateInput = this.onValidateInput ?? new InputField.OnValidateInput(this.Validate);
this.m_CaretPosition = (this.m_CaretSelectPosition = value.Length);
int num = ((this.characterLimit <= 0) ? value.Length : Math.Min(this.characterLimit, value.Length));
for (int i = 0; i < num; i++)
{
char c = onValidateInput(this.m_Text, this.m_Text.Length, value[i]);
if (c != '\0')
{
this.m_Text += c;
}
}
}
else
{
this.m_Text = ((this.characterLimit <= 0 || value.Length <= this.characterLimit) ? value : value.Substring(0, this.characterLimit));
}
if (this.m_Keyboard != null)
{
this.m_Keyboard.text = this.m_Text;
}
if (this.m_CaretPosition > this.m_Text.Length)
{
this.m_CaretPosition = (this.m_CaretSelectPosition = this.m_Text.Length);
}
else if (this.m_CaretSelectPosition > this.m_Text.Length)
{
this.m_CaretSelectPosition = this.m_Text.Length;
}
this.SendOnValueChangedAndUpdateLabel();
}
}
}
// Token: 0x170000C2 RID: 194
// (get) Token: 0x060002B9 RID: 697 RVA: 0x0000FF28 File Offset: 0x0000E328
public bool isFocused
{
get
{
return this.m_AllowInput;
}
}
// Token: 0x170000C3 RID: 195
// (get) Token: 0x060002BA RID: 698 RVA: 0x0000FF44 File Offset: 0x0000E344
// (set) Token: 0x060002BB RID: 699 RVA: 0x0000FF5F File Offset: 0x0000E35F
public float caretBlinkRate
{
get
{
return this.m_CaretBlinkRate;
}
set
{
if (SetPropertyUtility.SetStruct<float>(ref this.m_CaretBlinkRate, value))
{
if (this.m_AllowInput)
{
this.SetCaretActive();
}
}
}
}
// Token: 0x170000C4 RID: 196
// (get) Token: 0x060002BC RID: 700 RVA: 0x0000FF88 File Offset: 0x0000E388
// (set) Token: 0x060002BD RID: 701 RVA: 0x0000FFA3 File Offset: 0x0000E3A3
public int caretWidth
{
get
{
return this.m_CaretWidth;
}
set
{
if (SetPropertyUtility.SetStruct<int>(ref this.m_CaretWidth, value))
{
this.MarkGeometryAsDirty();
}
}
}
// Token: 0x170000C5 RID: 197
// (get) Token: 0x060002BE RID: 702 RVA: 0x0000FFC0 File Offset: 0x0000E3C0
// (set) Token: 0x060002BF RID: 703 RVA: 0x0000FFDC File Offset: 0x0000E3DC
public Text textComponent
{
get
{
return this.m_TextComponent;
}
set
{
if (this.m_TextComponent != null)
{
this.m_TextComponent.UnregisterDirtyVerticesCallback(new UnityAction(this.MarkGeometryAsDirty));
this.m_TextComponent.UnregisterDirtyVerticesCallback(new UnityAction(this.UpdateLabel));
this.m_TextComponent.UnregisterDirtyMaterialCallback(new UnityAction(this.UpdateCaretMaterial));
}
if (SetPropertyUtility.SetClass<Text>(ref this.m_TextComponent, value))
{
this.EnforceTextHOverflow();
if (this.m_TextComponent != null)
{
this.m_TextComponent.RegisterDirtyVerticesCallback(new UnityAction(this.MarkGeometryAsDirty));
this.m_TextComponent.RegisterDirtyVerticesCallback(new UnityAction(this.UpdateLabel));
this.m_TextComponent.RegisterDirtyMaterialCallback(new UnityAction(this.UpdateCaretMaterial));
}
}
}
}
// Token: 0x170000C6 RID: 198
// (get) Token: 0x060002C0 RID: 704 RVA: 0x000100B4 File Offset: 0x0000E4B4
// (set) Token: 0x060002C1 RID: 705 RVA: 0x000100CF File Offset: 0x0000E4CF
public Graphic placeholder
{
get
{
return this.m_Placeholder;
}
set
{
SetPropertyUtility.SetClass<Graphic>(ref this.m_Placeholder, value);
}
}
// Token: 0x170000C7 RID: 199
// (get) Token: 0x060002C2 RID: 706 RVA: 0x000100E0 File Offset: 0x0000E4E0
// (set) Token: 0x060002C3 RID: 707 RVA: 0x00010116 File Offset: 0x0000E516
public Color caretColor
{
get
{
return (!this.customCaretColor) ? this.textComponent.color : this.m_CaretColor;
}
set
{
if (SetPropertyUtility.SetColor(ref this.m_CaretColor, value))
{
this.MarkGeometryAsDirty();
}
}
}
// Token: 0x170000C8 RID: 200
// (get) Token: 0x060002C4 RID: 708 RVA: 0x00010130 File Offset: 0x0000E530
// (set) Token: 0x060002C5 RID: 709 RVA: 0x0001014B File Offset: 0x0000E54B
public bool customCaretColor
{
get
{
return this.m_CustomCaretColor;
}
set
{
if (this.m_CustomCaretColor != value)
{
this.m_CustomCaretColor = value;
this.MarkGeometryAsDirty();
}
}
}
// Token: 0x170000C9 RID: 201
// (get) Token: 0x060002C6 RID: 710 RVA: 0x0001016C File Offset: 0x0000E56C
// (set) Token: 0x060002C7 RID: 711 RVA: 0x00010187 File Offset: 0x0000E587
public Color selectionColor
{
get
{
return this.m_SelectionColor;
}
set
{
if (SetPropertyUtility.SetColor(ref this.m_SelectionColor, value))
{
this.MarkGeometryAsDirty();
}
}
}
// Token: 0x170000CA RID: 202
// (get) Token: 0x060002C8 RID: 712 RVA: 0x000101A4 File Offset: 0x0000E5A4
// (set) Token: 0x060002C9 RID: 713 RVA: 0x000101BF File Offset: 0x0000E5BF
public InputField.SubmitEvent onEndEdit
{
get
{
return this.m_OnEndEdit;
}
set
{
SetPropertyUtility.SetClass<InputField.SubmitEvent>(ref this.m_OnEndEdit, value);
}
}
// Token: 0x170000CB RID: 203
// (get) Token: 0x060002CA RID: 714 RVA: 0x000101D0 File Offset: 0x0000E5D0
// (set) Token: 0x060002CB RID: 715 RVA: 0x000101EB File Offset: 0x0000E5EB
[Obsolete("onValueChange has been renamed to onValueChanged")]
public InputField.OnChangeEvent onValueChange
{
get
{
return this.onValueChanged;
}
set
{
this.onValueChanged = value;
}
}
// Token: 0x170000CC RID: 204
// (get) Token: 0x060002CC RID: 716 RVA: 0x000101F8 File Offset: 0x0000E5F8
// (set) Token: 0x060002CD RID: 717 RVA: 0x00010213 File Offset: 0x0000E613
public InputField.OnChangeEvent onValueChanged
{
get
{
return this.m_OnValueChanged;
}
set
{
SetPropertyUtility.SetClass<InputField.OnChangeEvent>(ref this.m_OnValueChanged, value);
}
}
// Token: 0x170000CD RID: 205
// (get) Token: 0x060002CE RID: 718 RVA: 0x00010224 File Offset: 0x0000E624
// (set) Token: 0x060002CF RID: 719 RVA: 0x0001023F File Offset: 0x0000E63F
public InputField.OnValidateInput onValidateInput
{
get
{
return this.m_OnValidateInput;
}
set
{
SetPropertyUtility.SetClass<InputField.OnValidateInput>(ref this.m_OnValidateInput, value);
}
}
// Token: 0x170000CE RID: 206
// (get) Token: 0x060002D0 RID: 720 RVA: 0x00010250 File Offset: 0x0000E650
// (set) Token: 0x060002D1 RID: 721 RVA: 0x0001026B File Offset: 0x0000E66B
public int characterLimit
{
get
{
return this.m_CharacterLimit;
}
set
{
if (SetPropertyUtility.SetStruct<int>(ref this.m_CharacterLimit, Math.Max(0, value)))
{
this.UpdateLabel();
}
}
}
// Token: 0x170000CF RID: 207
// (get) Token: 0x060002D2 RID: 722 RVA: 0x0001028C File Offset: 0x0000E68C
// (set) Token: 0x060002D3 RID: 723 RVA: 0x000102A7 File Offset: 0x0000E6A7
public InputField.ContentType contentType
{
get
{
return this.m_ContentType;
}
set
{
if (SetPropertyUtility.SetStruct<InputField.ContentType>(ref this.m_ContentType, value))
{
this.EnforceContentType();
}
}
}
// Token: 0x170000D0 RID: 208
// (get) Token: 0x060002D4 RID: 724 RVA: 0x000102C4 File Offset: 0x0000E6C4
// (set) Token: 0x060002D5 RID: 725 RVA: 0x000102DF File Offset: 0x0000E6DF
public InputField.LineType lineType
{
get
{
return this.m_LineType;
}
set
{
if (SetPropertyUtility.SetStruct<InputField.LineType>(ref this.m_LineType, value))
{
this.SetToCustomIfContentTypeIsNot(new InputField.ContentType[]
{
InputField.ContentType.Standard,
InputField.ContentType.Autocorrected
});
this.EnforceTextHOverflow();
}
}
}
// Token: 0x170000D1 RID: 209
// (get) Token: 0x060002D6 RID: 726 RVA: 0x0001030C File Offset: 0x0000E70C
// (set) Token: 0x060002D7 RID: 727 RVA: 0x00010327 File Offset: 0x0000E727
public InputField.InputType inputType
{
get
{
return this.m_InputType;
}
set
{
if (SetPropertyUtility.SetStruct<InputField.InputType>(ref this.m_InputType, value))
{
this.SetToCustom();
}
}
}
// Token: 0x170000D2 RID: 210
// (get) Token: 0x060002D8 RID: 728 RVA: 0x00010344 File Offset: 0x0000E744
// (set) Token: 0x060002D9 RID: 729 RVA: 0x0001035F File Offset: 0x0000E75F
public TouchScreenKeyboardType keyboardType
{
get
{
return this.m_KeyboardType;
}
set
{
if (value == TouchScreenKeyboardType.NintendoNetworkAccount)
{
Debug.LogWarning("Invalid InputField.keyboardType value set. TouchScreenKeyboardType.NintendoNetworkAccount only applies to the Wii U. InputField.keyboardType will default to TouchScreenKeyboardType.Default .");
}
if (SetPropertyUtility.SetStruct<TouchScreenKeyboardType>(ref this.m_KeyboardType, value))
{
this.SetToCustom();
}
}
}
// Token: 0x170000D3 RID: 211
// (get) Token: 0x060002DA RID: 730 RVA: 0x0001038C File Offset: 0x0000E78C
// (set) Token: 0x060002DB RID: 731 RVA: 0x000103A7 File Offset: 0x0000E7A7
public InputField.CharacterValidation characterValidation
{
get
{
return this.m_CharacterValidation;
}
set
{
if (SetPropertyUtility.SetStruct<InputField.CharacterValidation>(ref this.m_CharacterValidation, value))
{
this.SetToCustom();
}
}
}
// Token: 0x170000D4 RID: 212
// (get) Token: 0x060002DC RID: 732 RVA: 0x000103C4 File Offset: 0x0000E7C4
// (set) Token: 0x060002DD RID: 733 RVA: 0x000103DF File Offset: 0x0000E7DF
public bool readOnly
{
get
{
return this.m_ReadOnly;
}
set
{
this.m_ReadOnly = value;
}
}
// Token: 0x170000D5 RID: 213
// (get) Token: 0x060002DE RID: 734 RVA: 0x000103EC File Offset: 0x0000E7EC
public bool multiLine
{
get
{
return this.m_LineType == InputField.LineType.MultiLineNewline || this.lineType == InputField.LineType.MultiLineSubmit;
}
}
// Token: 0x170000D6 RID: 214
// (get) Token: 0x060002DF RID: 735 RVA: 0x0001041C File Offset: 0x0000E81C
// (set) Token: 0x060002E0 RID: 736 RVA: 0x00010437 File Offset: 0x0000E837
public char asteriskChar
{
get
{
return this.m_AsteriskChar;
}
set
{
if (SetPropertyUtility.SetStruct<char>(ref this.m_AsteriskChar, value))
{
this.UpdateLabel();
}
}
}
// Token: 0x170000D7 RID: 215
// (get) Token: 0x060002E1 RID: 737 RVA: 0x00010454 File Offset: 0x0000E854
public bool wasCanceled
{
get
{
return this.m_WasCanceled;
}
}
// Token: 0x060002E2 RID: 738 RVA: 0x0001046F File Offset: 0x0000E86F
protected void ClampPos(ref int pos)
{
if (pos < 0)
{
pos = 0;
}
else if (pos > this.text.Length)
{
pos = this.text.Length;
}
}
// Token: 0x170000D8 RID: 216
// (get) Token: 0x060002E3 RID: 739 RVA: 0x000104A4 File Offset: 0x0000E8A4
// (set) Token: 0x060002E4 RID: 740 RVA: 0x000104CB File Offset: 0x0000E8CB
protected int caretPositionInternal
{
get
{
return this.m_CaretPosition + this.compositionString.Length;
}
set
{
this.m_CaretPosition = value;
this.ClampPos(ref this.m_CaretPosition);
}
}
// Token: 0x170000D9 RID: 217
// (get) Token: 0x060002E5 RID: 741 RVA: 0x000104E4 File Offset: 0x0000E8E4
// (set) Token: 0x060002E6 RID: 742 RVA: 0x0001050B File Offset: 0x0000E90B
protected int caretSelectPositionInternal
{
get
{
return this.m_CaretSelectPosition + this.compositionString.Length;
}
set
{
this.m_CaretSelectPosition = value;
this.ClampPos(ref this.m_CaretSelectPosition);
}
}
// Token: 0x170000DA RID: 218
// (get) Token: 0x060002E7 RID: 743 RVA: 0x00010524 File Offset: 0x0000E924
private bool hasSelection
{
get
{
return this.caretPositionInternal != this.caretSelectPositionInternal;
}
}
// Token: 0x170000DB RID: 219
// (get) Token: 0x060002E8 RID: 744 RVA: 0x0001054C File Offset: 0x0000E94C
// (set) Token: 0x060002E9 RID: 745 RVA: 0x00010573 File Offset: 0x0000E973
public int caretPosition
{
get
{
return this.m_CaretSelectPosition + this.compositionString.Length;
}
set
{
this.selectionAnchorPosition = value;
this.selectionFocusPosition = value;
}
}
// Token: 0x170000DC RID: 220
// (get) Token: 0x060002EA RID: 746 RVA: 0x00010584 File Offset: 0x0000E984
// (set) Token: 0x060002EB RID: 747 RVA: 0x000105AB File Offset: 0x0000E9AB
public int selectionAnchorPosition
{
get
{
return this.m_CaretPosition + this.compositionString.Length;
}
set
{
if (this.compositionString.Length == 0)
{
this.m_CaretPosition = value;
this.ClampPos(ref this.m_CaretPosition);
}
}
}
// Token: 0x170000DD RID: 221
// (get) Token: 0x060002EC RID: 748 RVA: 0x000105D8 File Offset: 0x0000E9D8
// (set) Token: 0x060002ED RID: 749 RVA: 0x000105FF File Offset: 0x0000E9FF
public int selectionFocusPosition
{
get
{
return this.m_CaretSelectPosition + this.compositionString.Length;
}
set
{
if (this.compositionString.Length == 0)
{
this.m_CaretSelectPosition = value;
this.ClampPos(ref this.m_CaretSelectPosition);
}
}
}
// Token: 0x060002EE RID: 750 RVA: 0x0001062C File Offset: 0x0000EA2C
protected override void OnEnable()
{
base.OnEnable();
if (this.m_Text == null)
{
this.m_Text = string.Empty;
}
this.m_DrawStart = 0;
this.m_DrawEnd = this.m_Text.Length;
if (this.m_CachedInputRenderer != null)
{
this.m_CachedInputRenderer.SetMaterial(this.m_TextComponent.GetModifiedMaterial(Graphic.defaultGraphicMaterial), Texture2D.whiteTexture);
}
if (this.m_TextComponent != null)
{
this.m_TextComponent.RegisterDirtyVerticesCallback(new UnityAction(this.MarkGeometryAsDirty));
this.m_TextComponent.RegisterDirtyVerticesCallback(new UnityAction(this.UpdateLabel));
this.m_TextComponent.RegisterDirtyMaterialCallback(new UnityAction(this.UpdateCaretMaterial));
this.UpdateLabel();
}
}
// Token: 0x060002EF RID: 751 RVA: 0x00010700 File Offset: 0x0000EB00
protected override void OnDisable()
{
this.m_BlinkCoroutine = null;
this.DeactivateInputField();
if (this.m_TextComponent != null)
{
this.m_TextComponent.UnregisterDirtyVerticesCallback(new UnityAction(this.MarkGeometryAsDirty));
this.m_TextComponent.UnregisterDirtyVerticesCallback(new UnityAction(this.UpdateLabel));
this.m_TextComponent.UnregisterDirtyMaterialCallback(new UnityAction(this.UpdateCaretMaterial));
}
CanvasUpdateRegistry.UnRegisterCanvasElementForRebuild(this);
if (this.m_CachedInputRenderer != null)
{
this.m_CachedInputRenderer.Clear();
}
if (this.m_Mesh != null)
{
Object.DestroyImmediate(this.m_Mesh);
}
this.m_Mesh = null;
base.OnDisable();
}
// Token: 0x060002F0 RID: 752 RVA: 0x000107C0 File Offset: 0x0000EBC0
private IEnumerator CaretBlink()
{
this.m_CaretVisible = true;
yield return null;
while (this.isFocused && this.m_CaretBlinkRate > 0f)
{
float blinkPeriod = 1f / this.m_CaretBlinkRate;
bool blinkState = (Time.unscaledTime - this.m_BlinkStartTime) % blinkPeriod < blinkPeriod / 2f;
if (this.m_CaretVisible != blinkState)
{
this.m_CaretVisible = blinkState;
if (!this.hasSelection)
{
this.MarkGeometryAsDirty();
}
}
yield return null;
}
this.m_BlinkCoroutine = null;
yield break;
}
// Token: 0x060002F1 RID: 753 RVA: 0x000107E2 File Offset: 0x0000EBE2
private void SetCaretVisible()
{
if (this.m_AllowInput)
{
this.m_CaretVisible = true;
this.m_BlinkStartTime = Time.unscaledTime;
this.SetCaretActive();
}
}
// Token: 0x060002F2 RID: 754 RVA: 0x00010810 File Offset: 0x0000EC10
private void SetCaretActive()
{
if (this.m_AllowInput)
{
if (this.m_CaretBlinkRate > 0f)
{
if (this.m_BlinkCoroutine == null)
{
this.m_BlinkCoroutine = base.StartCoroutine(this.CaretBlink());
}
}
else
{
this.m_CaretVisible = true;
}
}
}
// Token: 0x060002F3 RID: 755 RVA: 0x0001086C File Offset: 0x0000EC6C
private void UpdateCaretMaterial()
{
if (this.m_TextComponent != null && this.m_CachedInputRenderer != null)
{
this.m_CachedInputRenderer.SetMaterial(this.m_TextComponent.GetModifiedMaterial(Graphic.defaultGraphicMaterial), Texture2D.whiteTexture);
}
}
// Token: 0x060002F4 RID: 756 RVA: 0x000108BC File Offset: 0x0000ECBC
protected void OnFocus()
{
this.SelectAll();
}
// Token: 0x060002F5 RID: 757 RVA: 0x000108C5 File Offset: 0x0000ECC5
protected void SelectAll()
{
this.caretPositionInternal = this.text.Length;
this.caretSelectPositionInternal = 0;
}
// Token: 0x060002F6 RID: 758 RVA: 0x000108E0 File Offset: 0x0000ECE0
public void MoveTextEnd(bool shift)
{
int length = this.text.Length;
if (shift)
{
this.caretSelectPositionInternal = length;
}
else
{
this.caretPositionInternal = length;
this.caretSelectPositionInternal = this.caretPositionInternal;
}
this.UpdateLabel();
}
// Token: 0x060002F7 RID: 759 RVA: 0x0001092C File Offset: 0x0000ED2C
public void MoveTextStart(bool shift)
{
int num = 0;
if (shift)
{
this.caretSelectPositionInternal = num;
}
else
{
this.caretPositionInternal = num;
this.caretSelectPositionInternal = this.caretPositionInternal;
}
this.UpdateLabel();
}
// Token: 0x170000DE RID: 222
// (get) Token: 0x060002F8 RID: 760 RVA: 0x0001096C File Offset: 0x0000ED6C
// (set) Token: 0x060002F9 RID: 761 RVA: 0x00010986 File Offset: 0x0000ED86
private static string clipboard
{
get
{
return GUIUtility.systemCopyBuffer;
}
set
{
GUIUtility.systemCopyBuffer = value;
}
}
// Token: 0x060002FA RID: 762 RVA: 0x00010990 File Offset: 0x0000ED90
private bool InPlaceEditing()
{
return !TouchScreenKeyboard.isSupported;
}
// Token: 0x060002FB RID: 763 RVA: 0x000109B0 File Offset: 0x0000EDB0
private void UpdateCaretFromKeyboard()
{
RangeInt selection = this.m_Keyboard.selection;
int start = selection.start;
int end = selection.end;
bool flag = false;
if (this.caretPositionInternal != start)
{
flag = true;
this.caretPositionInternal = start;
}
if (this.caretSelectPositionInternal != end)
{
this.caretSelectPositionInternal = end;
flag = true;
}
if (flag)
{
this.m_BlinkStartTime = Time.unscaledTime;
this.UpdateLabel();
}
}
// Token: 0x060002FC RID: 764 RVA: 0x00010A24 File Offset: 0x0000EE24
protected virtual void LateUpdate()
{
if (this.m_ShouldActivateNextUpdate)
{
if (!this.isFocused)
{
this.ActivateInputFieldInternal();
this.m_ShouldActivateNextUpdate = false;
return;
}
this.m_ShouldActivateNextUpdate = false;
}
if (!this.InPlaceEditing() && this.isFocused)
{
this.AssignPositioningIfNeeded();
if (this.m_Keyboard == null || this.m_Keyboard.done)
{
if (this.m_Keyboard != null)
{
if (!this.m_ReadOnly)
{
this.text = this.m_Keyboard.text;
}
if (this.m_Keyboard.wasCanceled)
{
this.m_WasCanceled = true;
}
}
this.OnDeselect(null);
}
else
{
string text = this.m_Keyboard.text;
if (this.m_Text != text)
{
if (this.m_ReadOnly)
{
this.m_Keyboard.text = this.m_Text;
}
else
{
this.m_Text = "";
foreach (char c in text)
{
if (c == '\r' || c == '\u0003')
{
c = '\n';
}
if (this.onValidateInput != null)
{
c = this.onValidateInput(this.m_Text, this.m_Text.Length, c);
}
else if (this.characterValidation != InputField.CharacterValidation.None)
{
c = this.Validate(this.m_Text, this.m_Text.Length, c);
}
if (this.lineType == InputField.LineType.MultiLineSubmit && c == '\n')
{
this.m_Keyboard.text = this.m_Text;
this.OnDeselect(null);
return;
}
if (c != '\0')
{
this.m_Text += c;
}
}
if (this.characterLimit > 0 && this.m_Text.Length > this.characterLimit)
{
this.m_Text = this.m_Text.Substring(0, this.characterLimit);
}
if (this.m_Keyboard.canGetSelection)
{
this.UpdateCaretFromKeyboard();
}
else
{
int length = this.m_Text.Length;
this.caretSelectPositionInternal = length;
this.caretPositionInternal = length;
}
if (this.m_Text != text)
{
this.m_Keyboard.text = this.m_Text;
}
this.SendOnValueChangedAndUpdateLabel();
}
}
else if (this.m_Keyboard.canGetSelection)
{
this.UpdateCaretFromKeyboard();
}
if (this.m_Keyboard.done)
{
if (this.m_Keyboard.wasCanceled)
{
this.m_WasCanceled = true;
}
this.OnDeselect(null);
}
}
}
}
// Token: 0x060002FD RID: 765 RVA: 0x00010CF8 File Offset: 0x0000F0F8
[Obsolete("This function is no longer used. Please use RectTransformUtility.ScreenPointToLocalPointInRectangle() instead.")]
public Vector2 ScreenToLocal(Vector2 screen)
{
Canvas canvas = this.m_TextComponent.canvas;
Vector2 vector;
if (canvas == null)
{
vector = screen;
}
else
{
Vector3 vector2 = Vector3.zero;
if (canvas.renderMode == RenderMode.ScreenSpaceOverlay)
{
vector2 = this.m_TextComponent.transform.InverseTransformPoint(screen);
}
else if (canvas.worldCamera != null)
{
Ray ray = canvas.worldCamera.ScreenPointToRay(screen);
Plane plane = new Plane(this.m_TextComponent.transform.forward, this.m_TextComponent.transform.position);
float num;
plane.Raycast(ray, out num);
vector2 = this.m_TextComponent.transform.InverseTransformPoint(ray.GetPoint(num));
}
vector = new Vector2(vector2.x, vector2.y);
}
return vector;
}
// Token: 0x060002FE RID: 766 RVA: 0x00010DE0 File Offset: 0x0000F1E0
private int GetUnclampedCharacterLineFromPosition(Vector2 pos, TextGenerator generator)
{
int num;
if (!this.multiLine)
{
num = 0;
}
else
{
float num2 = pos.y * this.m_TextComponent.pixelsPerUnit;
float num3 = 0f;
int i = 0;
while (i < generator.lineCount)
{
float topY = generator.lines[i].topY;
float num4 = topY - (float)generator.lines[i].height;
if (num2 > topY)
{
float num5 = topY - num3;
if (num2 > topY - 0.5f * num5)
{
return i - 1;
}
return i;
}
else
{
if (num2 > num4)
{
return i;
}
num3 = num4;
i++;
}
}
num = generator.lineCount;
}
return num;
}
// Token: 0x060002FF RID: 767 RVA: 0x00010EB4 File Offset: 0x0000F2B4
protected int GetCharacterIndexFromPosition(Vector2 pos)
{
TextGenerator cachedTextGenerator = this.m_TextComponent.cachedTextGenerator;
int num;
if (cachedTextGenerator.lineCount == 0)
{
num = 0;
}
else
{
int unclampedCharacterLineFromPosition = this.GetUnclampedCharacterLineFromPosition(pos, cachedTextGenerator);
if (unclampedCharacterLineFromPosition < 0)
{
num = 0;
}
else if (unclampedCharacterLineFromPosition >= cachedTextGenerator.lineCount)
{
num = cachedTextGenerator.characterCountVisible;
}
else
{
int startCharIdx = cachedTextGenerator.lines[unclampedCharacterLineFromPosition].startCharIdx;
int lineEndPosition = InputField.GetLineEndPosition(cachedTextGenerator, unclampedCharacterLineFromPosition);
for (int i = startCharIdx; i < lineEndPosition; i++)
{
if (i >= cachedTextGenerator.characterCountVisible)
{
break;
}
UICharInfo uicharInfo = cachedTextGenerator.characters[i];
Vector2 vector = uicharInfo.cursorPos / this.m_TextComponent.pixelsPerUnit;
float num2 = pos.x - vector.x;
float num3 = vector.x + uicharInfo.charWidth / this.m_TextComponent.pixelsPerUnit - pos.x;
if (num2 < num3)
{
return i;
}
}
num = lineEndPosition;
}
}
return num;
}
// Token: 0x06000300 RID: 768 RVA: 0x00010FD4 File Offset: 0x0000F3D4
private bool MayDrag(PointerEventData eventData)
{
return this.IsActive() && this.IsInteractable() && eventData.button == PointerEventData.InputButton.Left && this.m_TextComponent != null && this.m_Keyboard == null;
}
// Token: 0x06000301 RID: 769 RVA: 0x00011027 File Offset: 0x0000F427
public virtual void OnBeginDrag(PointerEventData eventData)
{
if (this.MayDrag(eventData))
{
this.m_UpdateDrag = true;
}
}
// Token: 0x06000302 RID: 770 RVA: 0x00011044 File Offset: 0x0000F444
public virtual void OnDrag(PointerEventData eventData)
{
if (this.MayDrag(eventData))
{
Vector2 vector;
RectTransformUtility.ScreenPointToLocalPointInRectangle(this.textComponent.rectTransform, eventData.position, eventData.pressEventCamera, out vector);
this.caretSelectPositionInternal = this.GetCharacterIndexFromPosition(vector) + this.m_DrawStart;
this.MarkGeometryAsDirty();
this.m_DragPositionOutOfBounds = !RectTransformUtility.RectangleContainsScreenPoint(this.textComponent.rectTransform, eventData.position, eventData.pressEventCamera);
if (this.m_DragPositionOutOfBounds && this.m_DragCoroutine == null)
{
this.m_DragCoroutine = base.StartCoroutine(this.MouseDragOutsideRect(eventData));
}
eventData.Use();
}
}
// Token: 0x06000303 RID: 771 RVA: 0x000110F0 File Offset: 0x0000F4F0
private IEnumerator MouseDragOutsideRect(PointerEventData eventData)
{
while (this.m_UpdateDrag && this.m_DragPositionOutOfBounds)
{
Vector2 localMousePos;
RectTransformUtility.ScreenPointToLocalPointInRectangle(this.textComponent.rectTransform, eventData.position, eventData.pressEventCamera, out localMousePos);
Rect rect = this.textComponent.rectTransform.rect;
if (this.multiLine)
{
if (localMousePos.y > rect.yMax)
{
this.MoveUp(true, true);
}
else if (localMousePos.y < rect.yMin)
{
this.MoveDown(true, true);
}
}
else if (localMousePos.x < rect.xMin)
{
this.MoveLeft(true, false);
}
else if (localMousePos.x > rect.xMax)
{
this.MoveRight(true, false);
}
this.UpdateLabel();
float delay = ((!this.multiLine) ? 0.05f : 0.1f);
yield return new WaitForSecondsRealtime(delay);
}
this.m_DragCoroutine = null;
yield break;
}
// Token: 0x06000304 RID: 772 RVA: 0x00011119 File Offset: 0x0000F519
public virtual void OnEndDrag(PointerEventData eventData)
{
if (this.MayDrag(eventData))
{
this.m_UpdateDrag = false;
}
}
// Token: 0x06000305 RID: 773 RVA: 0x00011134 File Offset: 0x0000F534
public override void OnPointerDown(PointerEventData eventData)
{
if (this.MayDrag(eventData))
{
EventSystem.current.SetSelectedGameObject(base.gameObject, eventData);
bool allowInput = this.m_AllowInput;
base.OnPointerDown(eventData);
if (!this.InPlaceEditing())
{
if (this.m_Keyboard == null || !this.m_Keyboard.active)
{
this.OnSelect(eventData);
return;
}
}
if (allowInput)
{
Vector2 vector;
RectTransformUtility.ScreenPointToLocalPointInRectangle(this.textComponent.rectTransform, eventData.position, eventData.pressEventCamera, out vector);
int num = this.GetCharacterIndexFromPosition(vector) + this.m_DrawStart;
this.caretPositionInternal = num;
this.caretSelectPositionInternal = num;
}
this.UpdateLabel();
eventData.Use();
}
}
// Token: 0x06000306 RID: 774 RVA: 0x000111F8 File Offset: 0x0000F5F8
protected InputField.EditState KeyPressed(Event evt)
{
EventModifiers modifiers = evt.modifiers;
bool flag = ((SystemInfo.operatingSystemFamily != OperatingSystemFamily.MacOSX) ? ((modifiers & EventModifiers.Control) != EventModifiers.None) : ((modifiers & EventModifiers.Command) != EventModifiers.None));
bool flag2 = (modifiers & EventModifiers.Shift) != EventModifiers.None;
bool flag3 = (modifiers & EventModifiers.Alt) != EventModifiers.None;
bool flag4 = flag && !flag3 && !flag2;
KeyCode keyCode = evt.keyCode;
switch (keyCode)
{
case KeyCode.KeypadEnter:
break;
default:
switch (keyCode)
{
case KeyCode.A:
if (flag4)
{
this.SelectAll();
return InputField.EditState.Continue;
}
goto IL_24D;
default:
switch (keyCode)
{
case KeyCode.V:
if (flag4)
{
this.Append(InputField.clipboard);
return InputField.EditState.Continue;
}
goto IL_24D;
default:
if (keyCode == KeyCode.Backspace)
{
this.Backspace();
return InputField.EditState.Continue;
}
if (keyCode != KeyCode.Return)
{
if (keyCode == KeyCode.Escape)
{
this.m_WasCanceled = true;
return InputField.EditState.Finish;
}
if (keyCode != KeyCode.Delete)
{
goto IL_24D;
}
this.ForwardSpace();
return InputField.EditState.Continue;
}
break;
case KeyCode.X:
if (flag4)
{
if (this.inputType != InputField.InputType.Password)
{
InputField.clipboard = this.GetSelectedString();
}
else
{
InputField.clipboard = "";
}
this.Delete();
this.SendOnValueChangedAndUpdateLabel();
return InputField.EditState.Continue;
}
goto IL_24D;
}
break;
case KeyCode.C:
if (flag4)
{
if (this.inputType != InputField.InputType.Password)
{
InputField.clipboard = this.GetSelectedString();
}
else
{
InputField.clipboard = "";
}
return InputField.EditState.Continue;
}
goto IL_24D;
}
break;
case KeyCode.UpArrow:
this.MoveUp(flag2);
return InputField.EditState.Continue;
case KeyCode.DownArrow:
this.MoveDown(flag2);
return InputField.EditState.Continue;
case KeyCode.RightArrow:
this.MoveRight(flag2, flag);
return InputField.EditState.Continue;
case KeyCode.LeftArrow:
this.MoveLeft(flag2, flag);
return InputField.EditState.Continue;
case KeyCode.Home:
this.MoveTextStart(flag2);
return InputField.EditState.Continue;
case KeyCode.End:
this.MoveTextEnd(flag2);
return InputField.EditState.Continue;
}
if (this.lineType != InputField.LineType.MultiLineNewline)
{
return InputField.EditState.Finish;
}
IL_24D:
char c = evt.character;
InputField.EditState editState;
if (!this.multiLine && (c == '\t' || c == '\r' || c == '\n'))
{
editState = InputField.EditState.Continue;
}
else
{
if (c == '\r' || c == '\u0003')
{
c = '\n';
}
if (this.IsValidChar(c))
{
this.Append(c);
}
if (c == '\0')
{
if (this.compositionString.Length > 0)
{
this.UpdateLabel();
}
}
editState = InputField.EditState.Continue;
}
return editState;
}
// Token: 0x06000307 RID: 775 RVA: 0x000114E0 File Offset: 0x0000F8E0
private bool IsValidChar(char c)
{
return c != '\u007f' && (c == '\t' || c == '\n' || this.m_TextComponent.font.HasCharacter(c));
}
// Token: 0x06000308 RID: 776 RVA: 0x0001152C File Offset: 0x0000F92C
public void ProcessEvent(Event e)
{
this.KeyPressed(e);
}
// Token: 0x06000309 RID: 777 RVA: 0x00011538 File Offset: 0x0000F938
public virtual void OnUpdateSelected(BaseEventData eventData)
{
if (this.isFocused)
{
bool flag = false;
while (Event.PopEvent(this.m_ProcessingEvent))
{
if (this.m_ProcessingEvent.rawType == EventType.KeyDown)
{
flag = true;
InputField.EditState editState = this.KeyPressed(this.m_ProcessingEvent);
if (editState == InputField.EditState.Finish)
{
this.DeactivateInputField();
break;
}
}
EventType type = this.m_ProcessingEvent.type;
if (type == EventType.ValidateCommand || type == EventType.ExecuteCommand)
{
string commandName = this.m_ProcessingEvent.commandName;
if (commandName != null)
{
if (commandName == "SelectAll")
{
this.SelectAll();
flag = true;
}
}
}
}
if (flag)
{
this.UpdateLabel();
}
eventData.Use();
}
}
// Token: 0x0600030A RID: 778 RVA: 0x00011610 File Offset: 0x0000FA10
private string GetSelectedString()
{
string text;
if (!this.hasSelection)
{
text = "";
}
else
{
int num = this.caretPositionInternal;
int num2 = this.caretSelectPositionInternal;
if (num > num2)
{
int num3 = num;
num = num2;
num2 = num3;
}
text = this.text.Substring(num, num2 - num);
}
return text;
}
// Token: 0x0600030B RID: 779 RVA: 0x00011668 File Offset: 0x0000FA68
private int FindtNextWordBegin()
{
int num;
if (this.caretSelectPositionInternal + 1 >= this.text.Length)
{
num = this.text.Length;
}
else
{
int num2 = this.text.IndexOfAny(InputField.kSeparators, this.caretSelectPositionInternal + 1);
if (num2 == -1)
{
num2 = this.text.Length;
}
else
{
num2++;
}
num = num2;
}
return num;
}
// Token: 0x0600030C RID: 780 RVA: 0x000116DC File Offset: 0x0000FADC
private void MoveRight(bool shift, bool ctrl)
{
if (this.hasSelection && !shift)
{
int num = Mathf.Max(this.caretPositionInternal, this.caretSelectPositionInternal);
this.caretSelectPositionInternal = num;
this.caretPositionInternal = num;
}
else
{
int num2;
if (ctrl)
{
num2 = this.FindtNextWordBegin();
}
else
{
num2 = this.caretSelectPositionInternal + 1;
}
if (shift)
{
this.caretSelectPositionInternal = num2;
}
else
{
int num = num2;
this.caretPositionInternal = num;
this.caretSelectPositionInternal = num;
}
}
}
// Token: 0x0600030D RID: 781 RVA: 0x00011760 File Offset: 0x0000FB60
private int FindtPrevWordBegin()
{
int num;
if (this.caretSelectPositionInternal - 2 < 0)
{
num = 0;
}
else
{
int num2 = this.text.LastIndexOfAny(InputField.kSeparators, this.caretSelectPositionInternal - 2);
if (num2 == -1)
{
num2 = 0;
}
else
{
num2++;
}
num = num2;
}
return num;
}
// Token: 0x0600030E RID: 782 RVA: 0x000117B8 File Offset: 0x0000FBB8
private void MoveLeft(bool shift, bool ctrl)
{
if (this.hasSelection && !shift)
{
int num = Mathf.Min(this.caretPositionInternal, this.caretSelectPositionInternal);
this.caretSelectPositionInternal = num;
this.caretPositionInternal = num;
}
else
{
int num2;
if (ctrl)
{
num2 = this.FindtPrevWordBegin();
}
else
{
num2 = this.caretSelectPositionInternal - 1;
}
if (shift)
{
this.caretSelectPositionInternal = num2;
}
else
{
int num = num2;
this.caretPositionInternal = num;
this.caretSelectPositionInternal = num;
}
}
}
// Token: 0x0600030F RID: 783 RVA: 0x0001183C File Offset: 0x0000FC3C
private int DetermineCharacterLine(int charPos, TextGenerator generator)
{
for (int i = 0; i < generator.lineCount - 1; i++)
{
if (generator.lines[i + 1].startCharIdx > charPos)
{
return i;
}
}
return generator.lineCount - 1;
}
// Token: 0x06000310 RID: 784 RVA: 0x00011898 File Offset: 0x0000FC98
private int LineUpCharacterPosition(int originalPos, bool goToFirstChar)
{
int num;
if (originalPos >= this.cachedInputTextGenerator.characters.Count)
{
num = 0;
}
else
{
UICharInfo uicharInfo = this.cachedInputTextGenerator.characters[originalPos];
int num2 = this.DetermineCharacterLine(originalPos, this.cachedInputTextGenerator);
if (num2 <= 0)
{
num = ((!goToFirstChar) ? originalPos : 0);
}
else
{
int num3 = this.cachedInputTextGenerator.lines[num2].startCharIdx - 1;
for (int i = this.cachedInputTextGenerator.lines[num2 - 1].startCharIdx; i < num3; i++)
{
if (this.cachedInputTextGenerator.characters[i].cursorPos.x >= uicharInfo.cursorPos.x)
{
return i;
}
}
num = num3;
}
}
return num;
}
// Token: 0x06000311 RID: 785 RVA: 0x00011990 File Offset: 0x0000FD90
private int LineDownCharacterPosition(int originalPos, bool goToLastChar)
{
int num;
if (originalPos >= this.cachedInputTextGenerator.characterCountVisible)
{
num = this.text.Length;
}
else
{
UICharInfo uicharInfo = this.cachedInputTextGenerator.characters[originalPos];
int num2 = this.DetermineCharacterLine(originalPos, this.cachedInputTextGenerator);
if (num2 + 1 >= this.cachedInputTextGenerator.lineCount)
{
num = ((!goToLastChar) ? originalPos : this.text.Length);
}
else
{
int lineEndPosition = InputField.GetLineEndPosition(this.cachedInputTextGenerator, num2 + 1);
for (int i = this.cachedInputTextGenerator.lines[num2 + 1].startCharIdx; i < lineEndPosition; i++)
{
if (this.cachedInputTextGenerator.characters[i].cursorPos.x >= uicharInfo.cursorPos.x)
{
return i;
}
}
num = lineEndPosition;
}
}
return num;
}
// Token: 0x06000312 RID: 786 RVA: 0x00011A93 File Offset: 0x0000FE93
private void MoveDown(bool shift)
{
this.MoveDown(shift, true);
}
// Token: 0x06000313 RID: 787 RVA: 0x00011AA0 File Offset: 0x0000FEA0
private void MoveDown(bool shift, bool goToLastChar)
{
if (this.hasSelection && !shift)
{
int num = Mathf.Max(this.caretPositionInternal, this.caretSelectPositionInternal);
this.caretSelectPositionInternal = num;
this.caretPositionInternal = num;
}
int num2 = ((!this.multiLine) ? this.text.Length : this.LineDownCharacterPosition(this.caretSelectPositionInternal, goToLastChar));
if (shift)
{
this.caretSelectPositionInternal = num2;
}
else
{
int num = num2;
this.caretSelectPositionInternal = num;
this.caretPositionInternal = num;
}
}
// Token: 0x06000314 RID: 788 RVA: 0x00011B2C File Offset: 0x0000FF2C
private void MoveUp(bool shift)
{
this.MoveUp(shift, true);
}
// Token: 0x06000315 RID: 789 RVA: 0x00011B38 File Offset: 0x0000FF38
private void MoveUp(bool shift, bool goToFirstChar)
{
if (this.hasSelection && !shift)
{
int num = Mathf.Min(this.caretPositionInternal, this.caretSelectPositionInternal);
this.caretSelectPositionInternal = num;
this.caretPositionInternal = num;
}
int num2 = ((!this.multiLine) ? 0 : this.LineUpCharacterPosition(this.caretSelectPositionInternal, goToFirstChar));
if (shift)
{
this.caretSelectPositionInternal = num2;
}
else
{
int num = num2;
this.caretPositionInternal = num;
this.caretSelectPositionInternal = num;
}
}
// Token: 0x06000316 RID: 790 RVA: 0x00011BBC File Offset: 0x0000FFBC
private void Delete()
{
if (!this.m_ReadOnly)
{
if (this.caretPositionInternal != this.caretSelectPositionInternal)
{
if (this.caretPositionInternal < this.caretSelectPositionInternal)
{
this.m_Text = this.text.Substring(0, this.caretPositionInternal) + this.text.Substring(this.caretSelectPositionInternal, this.text.Length - this.caretSelectPositionInternal);
this.caretSelectPositionInternal = this.caretPositionInternal;
}
else
{
this.m_Text = this.text.Substring(0, this.caretSelectPositionInternal) + this.text.Substring(this.caretPositionInternal, this.text.Length - this.caretPositionInternal);
this.caretPositionInternal = this.caretSelectPositionInternal;
}
}
}
}
// Token: 0x06000317 RID: 791 RVA: 0x00011CA4 File Offset: 0x000100A4
private void ForwardSpace()
{
if (!this.m_ReadOnly)
{
if (this.hasSelection)
{
this.Delete();
this.SendOnValueChangedAndUpdateLabel();
}
else if (this.caretPositionInternal < this.text.Length)
{
this.m_Text = this.text.Remove(this.caretPositionInternal, 1);
this.SendOnValueChangedAndUpdateLabel();
}
}
}
// Token: 0x06000318 RID: 792 RVA: 0x00011D18 File Offset: 0x00010118
private void Backspace()
{
if (!this.m_ReadOnly)
{
if (this.hasSelection)
{
this.Delete();
this.SendOnValueChangedAndUpdateLabel();
}
else if (this.caretPositionInternal > 0)
{
this.m_Text = this.text.Remove(this.caretPositionInternal - 1, 1);
int num = this.caretPositionInternal - 1;
this.caretPositionInternal = num;
this.caretSelectPositionInternal = num;
this.SendOnValueChangedAndUpdateLabel();
}
}
}
// Token: 0x06000319 RID: 793 RVA: 0x00011D9C File Offset: 0x0001019C
private void Insert(char c)
{
if (!this.m_ReadOnly)
{
string text = c.ToString();
this.Delete();
if (this.characterLimit <= 0 || this.text.Length < this.characterLimit)
{
this.m_Text = this.text.Insert(this.m_CaretPosition, text);
this.caretSelectPositionInternal = (this.caretPositionInternal += text.Length);
this.SendOnValueChanged();
}
}
}
// Token: 0x0600031A RID: 794 RVA: 0x00011E2F File Offset: 0x0001022F
private void SendOnValueChangedAndUpdateLabel()
{
this.SendOnValueChanged();
this.UpdateLabel();
}
// Token: 0x0600031B RID: 795 RVA: 0x00011E3E File Offset: 0x0001023E
private void SendOnValueChanged()
{
UISystemProfilerApi.AddMarker("InputField.value", this);
if (this.onValueChanged != null)
{
this.onValueChanged.Invoke(this.text);
}
}
// Token: 0x0600031C RID: 796 RVA: 0x00011E68 File Offset: 0x00010268
protected void SendOnSubmit()
{
UISystemProfilerApi.AddMarker("InputField.onSubmit", this);
if (this.onEndEdit != null)
{
this.onEndEdit.Invoke(this.m_Text);
}
}
// Token: 0x0600031D RID: 797 RVA: 0x00011E94 File Offset: 0x00010294
protected virtual void Append(string input)
{
if (!this.m_ReadOnly)
{
if (this.InPlaceEditing())
{
int i = 0;
int length = input.Length;
while (i < length)
{
char c = input[i];
if (c >= ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\n')
{
this.Append(c);
}
i++;
}
}
}
}
// Token: 0x0600031E RID: 798 RVA: 0x00011F18 File Offset: 0x00010318
protected virtual void Append(char input)
{
if (!this.m_ReadOnly)
{
if (this.InPlaceEditing())
{
int num = Math.Min(this.selectionFocusPosition, this.selectionAnchorPosition);
if (this.onValidateInput != null)
{
input = this.onValidateInput(this.text, num, input);
}
else if (this.characterValidation != InputField.CharacterValidation.None)
{
input = this.Validate(this.text, num, input);
}
if (input != '\0')
{
this.Insert(input);
}
}
}
}
// Token: 0x0600031F RID: 799 RVA: 0x00011FAC File Offset: 0x000103AC
protected void UpdateLabel()
{
if (this.m_TextComponent != null && this.m_TextComponent.font != null && !this.m_PreventFontCallback)
{
this.m_PreventFontCallback = true;
string text;
if (this.compositionString.Length > 0)
{
text = this.text.Substring(0, this.m_CaretPosition) + this.compositionString + this.text.Substring(this.m_CaretPosition);
}
else
{
text = this.text;
}
string text2;
if (this.inputType == InputField.InputType.Password)
{
text2 = new string(this.asteriskChar, text.Length);
}
else
{
text2 = text;
}
bool flag = string.IsNullOrEmpty(text);
if (this.m_Placeholder != null)
{
this.m_Placeholder.enabled = flag;
}
if (!this.m_AllowInput)
{
this.m_DrawStart = 0;
this.m_DrawEnd = this.m_Text.Length;
}
if (!flag)
{
Vector2 size = this.m_TextComponent.rectTransform.rect.size;
TextGenerationSettings generationSettings = this.m_TextComponent.GetGenerationSettings(size);
generationSettings.generateOutOfBounds = true;
this.cachedInputTextGenerator.PopulateWithErrors(text2, generationSettings, base.gameObject);
this.SetDrawRangeToContainCaretPosition(this.caretSelectPositionInternal);
text2 = text2.Substring(this.m_DrawStart, Mathf.Min(this.m_DrawEnd, text2.Length) - this.m_DrawStart);
this.SetCaretVisible();
}
this.m_TextComponent.text = text2;
this.MarkGeometryAsDirty();
this.m_PreventFontCallback = false;
}
}
// Token: 0x06000320 RID: 800 RVA: 0x0001214C File Offset: 0x0001054C
private bool IsSelectionVisible()
{
return this.m_DrawStart <= this.caretPositionInternal && this.m_DrawStart <= this.caretSelectPositionInternal && this.m_DrawEnd >= this.caretPositionInternal && this.m_DrawEnd >= this.caretSelectPositionInternal;
}
// Token: 0x06000321 RID: 801 RVA: 0x000121B4 File Offset: 0x000105B4
private static int GetLineStartPosition(TextGenerator gen, int line)
{
line = Mathf.Clamp(line, 0, gen.lines.Count - 1);
return gen.lines[line].startCharIdx;
}
// Token: 0x06000322 RID: 802 RVA: 0x000121F4 File Offset: 0x000105F4
private static int GetLineEndPosition(TextGenerator gen, int line)
{
line = Mathf.Max(line, 0);
int num;
if (line + 1 < gen.lines.Count)
{
num = gen.lines[line + 1].startCharIdx - 1;
}
else
{
num = gen.characterCountVisible;
}
return num;
}
// Token: 0x06000323 RID: 803 RVA: 0x0001224C File Offset: 0x0001064C
private void SetDrawRangeToContainCaretPosition(int caretPos)
{
if (this.cachedInputTextGenerator.lineCount > 0)
{
Vector2 size = this.cachedInputTextGenerator.rectExtents.size;
if (this.multiLine)
{
IList<UILineInfo> lines = this.cachedInputTextGenerator.lines;
int num = this.DetermineCharacterLine(caretPos, this.cachedInputTextGenerator);
if (caretPos > this.m_DrawEnd)
{
this.m_DrawEnd = InputField.GetLineEndPosition(this.cachedInputTextGenerator, num);
float num2 = lines[num].topY - (float)lines[num].height;
if (num == lines.Count - 1)
{
num2 += lines[num].leading;
}
int i;
for (i = num; i > 0; i--)
{
float topY = lines[i - 1].topY;
if (topY - num2 > size.y)
{
break;
}
}
this.m_DrawStart = InputField.GetLineStartPosition(this.cachedInputTextGenerator, i);
}
else
{
if (caretPos < this.m_DrawStart)
{
this.m_DrawStart = InputField.GetLineStartPosition(this.cachedInputTextGenerator, num);
}
int j = this.DetermineCharacterLine(this.m_DrawStart, this.cachedInputTextGenerator);
int k = j;
float num3 = lines[j].topY;
float num4 = lines[k].topY - (float)lines[k].height;
if (k == lines.Count - 1)
{
num4 += lines[k].leading;
}
while (k < lines.Count - 1)
{
num4 = lines[k + 1].topY - (float)lines[k + 1].height;
if (k + 1 == lines.Count - 1)
{
num4 += lines[k + 1].leading;
}
if (num3 - num4 > size.y)
{
break;
}
k++;
}
this.m_DrawEnd = InputField.GetLineEndPosition(this.cachedInputTextGenerator, k);
while (j > 0)
{
num3 = lines[j - 1].topY;
if (num3 - num4 > size.y)
{
break;
}
j--;
}
this.m_DrawStart = InputField.GetLineStartPosition(this.cachedInputTextGenerator, j);
}
}
else
{
IList<UICharInfo> characters = this.cachedInputTextGenerator.characters;
if (this.m_DrawEnd > this.cachedInputTextGenerator.characterCountVisible)
{
this.m_DrawEnd = this.cachedInputTextGenerator.characterCountVisible;
}
float num5 = 0f;
if (caretPos > this.m_DrawEnd || (caretPos == this.m_DrawEnd && this.m_DrawStart > 0))
{
this.m_DrawEnd = caretPos;
this.m_DrawStart = this.m_DrawEnd - 1;
while (this.m_DrawStart >= 0)
{
if (num5 + characters[this.m_DrawStart].charWidth > size.x)
{
break;
}
num5 += characters[this.m_DrawStart].charWidth;
this.m_DrawStart--;
}
this.m_DrawStart++;
}
else
{
if (caretPos < this.m_DrawStart)
{
this.m_DrawStart = caretPos;
}
this.m_DrawEnd = this.m_DrawStart;
}
while (this.m_DrawEnd < this.cachedInputTextGenerator.characterCountVisible)
{
num5 += characters[this.m_DrawEnd].charWidth;
if (num5 > size.x)
{
break;
}
this.m_DrawEnd++;
}
}
}
}
// Token: 0x06000324 RID: 804 RVA: 0x00012666 File Offset: 0x00010A66
public void ForceLabelUpdate()
{
this.UpdateLabel();
}
// Token: 0x06000325 RID: 805 RVA: 0x0001266F File Offset: 0x00010A6F
private void MarkGeometryAsDirty()
{
CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this);
}
// Token: 0x06000326 RID: 806 RVA: 0x00012678 File Offset: 0x00010A78
public virtual void Rebuild(CanvasUpdate update)
{
if (update == CanvasUpdate.LatePreRender)
{
this.UpdateGeometry();
}
}
// Token: 0x06000327 RID: 807 RVA: 0x00012692 File Offset: 0x00010A92
public virtual void LayoutComplete()
{
}
// Token: 0x06000328 RID: 808 RVA: 0x00012695 File Offset: 0x00010A95
public virtual void GraphicUpdateComplete()
{
}
// Token: 0x06000329 RID: 809 RVA: 0x00012698 File Offset: 0x00010A98
private void UpdateGeometry()
{
if (this.shouldHideMobileInput)
{
if (this.m_CachedInputRenderer == null && this.m_TextComponent != null)
{
GameObject gameObject = new GameObject(base.transform.name + " Input Caret", new Type[]
{
typeof(RectTransform),
typeof(CanvasRenderer)
});
gameObject.hideFlags = HideFlags.DontSave;
gameObject.transform.SetParent(this.m_TextComponent.transform.parent);
gameObject.transform.SetAsFirstSibling();
gameObject.layer = base.gameObject.layer;
this.caretRectTrans = gameObject.GetComponent<RectTransform>();
this.m_CachedInputRenderer = gameObject.GetComponent<CanvasRenderer>();
this.m_CachedInputRenderer.SetMaterial(this.m_TextComponent.GetModifiedMaterial(Graphic.defaultGraphicMaterial), Texture2D.whiteTexture);
gameObject.AddComponent<LayoutElement>().ignoreLayout = true;
this.AssignPositioningIfNeeded();
}
if (!(this.m_CachedInputRenderer == null))
{
this.OnFillVBO(this.mesh);
this.m_CachedInputRenderer.SetMesh(this.mesh);
}
}
}
// Token: 0x0600032A RID: 810 RVA: 0x000127D4 File Offset: 0x00010BD4
private void AssignPositioningIfNeeded()
{
if (this.m_TextComponent != null && this.caretRectTrans != null && (this.caretRectTrans.localPosition != this.m_TextComponent.rectTransform.localPosition || this.caretRectTrans.localRotation != this.m_TextComponent.rectTransform.localRotation || this.caretRectTrans.localScale != this.m_TextComponent.rectTransform.localScale || this.caretRectTrans.anchorMin != this.m_TextComponent.rectTransform.anchorMin || this.caretRectTrans.anchorMax != this.m_TextComponent.rectTransform.anchorMax || this.caretRectTrans.anchoredPosition != this.m_TextComponent.rectTransform.anchoredPosition || this.caretRectTrans.sizeDelta != this.m_TextComponent.rectTransform.sizeDelta || this.caretRectTrans.pivot != this.m_TextComponent.rectTransform.pivot))
{
this.caretRectTrans.localPosition = this.m_TextComponent.rectTransform.localPosition;
this.caretRectTrans.localRotation = this.m_TextComponent.rectTransform.localRotation;
this.caretRectTrans.localScale = this.m_TextComponent.rectTransform.localScale;
this.caretRectTrans.anchorMin = this.m_TextComponent.rectTransform.anchorMin;
this.caretRectTrans.anchorMax = this.m_TextComponent.rectTransform.anchorMax;
this.caretRectTrans.anchoredPosition = this.m_TextComponent.rectTransform.anchoredPosition;
this.caretRectTrans.sizeDelta = this.m_TextComponent.rectTransform.sizeDelta;
this.caretRectTrans.pivot = this.m_TextComponent.rectTransform.pivot;
}
}
// Token: 0x0600032B RID: 811 RVA: 0x00012A08 File Offset: 0x00010E08
private void OnFillVBO(Mesh vbo)
{
using (VertexHelper vertexHelper = new VertexHelper())
{
if (!this.isFocused)
{
vertexHelper.FillMesh(vbo);
}
else
{
Vector2 vector = this.m_TextComponent.PixelAdjustPoint(Vector2.zero);
if (!this.hasSelection)
{
this.GenerateCaret(vertexHelper, vector);
}
else
{
this.GenerateHightlight(vertexHelper, vector);
}
vertexHelper.FillMesh(vbo);
}
}
}
// Token: 0x0600032C RID: 812 RVA: 0x00012A90 File Offset: 0x00010E90
private void GenerateCaret(VertexHelper vbo, Vector2 roundingOffset)
{
if (this.m_CaretVisible)
{
if (this.m_CursorVerts == null)
{
this.CreateCursorVerts();
}
float num = (float)this.m_CaretWidth;
int num2 = Mathf.Max(0, this.caretPositionInternal - this.m_DrawStart);
TextGenerator cachedTextGenerator = this.m_TextComponent.cachedTextGenerator;
if (cachedTextGenerator != null)
{
if (cachedTextGenerator.lineCount != 0)
{
Vector2 zero = Vector2.zero;
if (num2 < cachedTextGenerator.characters.Count)
{
zero.x = cachedTextGenerator.characters[num2].cursorPos.x;
}
zero.x /= this.m_TextComponent.pixelsPerUnit;
if (zero.x > this.m_TextComponent.rectTransform.rect.xMax)
{
zero.x = this.m_TextComponent.rectTransform.rect.xMax;
}
int num3 = this.DetermineCharacterLine(num2, cachedTextGenerator);
zero.y = cachedTextGenerator.lines[num3].topY / this.m_TextComponent.pixelsPerUnit;
float num4 = (float)cachedTextGenerator.lines[num3].height / this.m_TextComponent.pixelsPerUnit;
for (int i = 0; i < this.m_CursorVerts.Length; i++)
{
this.m_CursorVerts[i].color = this.caretColor;
}
this.m_CursorVerts[0].position = new Vector3(zero.x, zero.y - num4, 0f);
this.m_CursorVerts[1].position = new Vector3(zero.x + num, zero.y - num4, 0f);
this.m_CursorVerts[2].position = new Vector3(zero.x + num, zero.y, 0f);
this.m_CursorVerts[3].position = new Vector3(zero.x, zero.y, 0f);
if (roundingOffset != Vector2.zero)
{
for (int j = 0; j < this.m_CursorVerts.Length; j++)
{
UIVertex uivertex = this.m_CursorVerts[j];
uivertex.position.x = uivertex.position.x + roundingOffset.x;
uivertex.position.y = uivertex.position.y + roundingOffset.y;
}
}
vbo.AddUIVertexQuad(this.m_CursorVerts);
int num5 = Screen.height;
int targetDisplay = this.m_TextComponent.canvas.targetDisplay;
if (targetDisplay > 0 && targetDisplay < Display.displays.Length)
{
num5 = Display.displays[targetDisplay].renderingHeight;
}
zero.y = (float)num5 - zero.y;
this.input.compositionCursorPos = zero;
}
}
}
}
// Token: 0x0600032D RID: 813 RVA: 0x00012DC0 File Offset: 0x000111C0
private void CreateCursorVerts()
{
this.m_CursorVerts = new UIVertex[4];
for (int i = 0; i < this.m_CursorVerts.Length; i++)
{
this.m_CursorVerts[i] = UIVertex.simpleVert;
this.m_CursorVerts[i].uv0 = Vector2.zero;
}
}
// Token: 0x0600032E RID: 814 RVA: 0x00012E24 File Offset: 0x00011224
private void GenerateHightlight(VertexHelper vbo, Vector2 roundingOffset)
{
int num = Mathf.Max(0, this.caretPositionInternal - this.m_DrawStart);
int num2 = Mathf.Max(0, this.caretSelectPositionInternal - this.m_DrawStart);
if (num > num2)
{
int num3 = num;
num = num2;
num2 = num3;
}
num2--;
TextGenerator cachedTextGenerator = this.m_TextComponent.cachedTextGenerator;
if (cachedTextGenerator.lineCount > 0)
{
int num4 = this.DetermineCharacterLine(num, cachedTextGenerator);
int num5 = InputField.GetLineEndPosition(cachedTextGenerator, num4);
UIVertex simpleVert = UIVertex.simpleVert;
simpleVert.uv0 = Vector2.zero;
simpleVert.color = this.selectionColor;
int num6 = num;
while (num6 <= num2 && num6 < cachedTextGenerator.characterCount)
{
if (num6 == num5 || num6 == num2)
{
UICharInfo uicharInfo = cachedTextGenerator.characters[num];
UICharInfo uicharInfo2 = cachedTextGenerator.characters[num6];
Vector2 vector = new Vector2(uicharInfo.cursorPos.x / this.m_TextComponent.pixelsPerUnit, cachedTextGenerator.lines[num4].topY / this.m_TextComponent.pixelsPerUnit);
Vector2 vector2 = new Vector2((uicharInfo2.cursorPos.x + uicharInfo2.charWidth) / this.m_TextComponent.pixelsPerUnit, vector.y - (float)cachedTextGenerator.lines[num4].height / this.m_TextComponent.pixelsPerUnit);
if (vector2.x > this.m_TextComponent.rectTransform.rect.xMax || vector2.x < this.m_TextComponent.rectTransform.rect.xMin)
{
vector2.x = this.m_TextComponent.rectTransform.rect.xMax;
}
int currentVertCount = vbo.currentVertCount;
simpleVert.position = new Vector3(vector.x, vector2.y, 0f) + roundingOffset;
vbo.AddVert(simpleVert);
simpleVert.position = new Vector3(vector2.x, vector2.y, 0f) + roundingOffset;
vbo.AddVert(simpleVert);
simpleVert.position = new Vector3(vector2.x, vector.y, 0f) + roundingOffset;
vbo.AddVert(simpleVert);
simpleVert.position = new Vector3(vector.x, vector.y, 0f) + roundingOffset;
vbo.AddVert(simpleVert);
vbo.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2);
vbo.AddTriangle(currentVertCount + 2, currentVertCount + 3, currentVertCount);
num = num6 + 1;
num4++;
num5 = InputField.GetLineEndPosition(cachedTextGenerator, num4);
}
num6++;
}
}
}
// Token: 0x0600032F RID: 815 RVA: 0x0001311C File Offset: 0x0001151C
protected char Validate(string text, int pos, char ch)
{
char c;
if (this.characterValidation == InputField.CharacterValidation.None || !base.enabled)
{
c = ch;
}
else
{
if (this.characterValidation == InputField.CharacterValidation.Integer || this.characterValidation == InputField.CharacterValidation.Decimal)
{
bool flag = pos == 0 && text.Length > 0 && text[0] == '-';
bool flag2 = text.Length > 0 && text[0] == '-' && ((this.caretPositionInternal == 0 && this.caretSelectPositionInternal > 0) || (this.caretSelectPositionInternal == 0 && this.caretPositionInternal > 0));
bool flag3 = this.caretPositionInternal == 0 || this.caretSelectPositionInternal == 0;
if (!flag || flag2)
{
if (ch >= '0' && ch <= '9')
{
return ch;
}
if (ch == '-' && (pos == 0 || flag3))
{
return ch;
}
if (ch == '.' && this.characterValidation == InputField.CharacterValidation.Decimal && !text.Contains("."))
{
return ch;
}
}
}
else if (this.characterValidation == InputField.CharacterValidation.Alphanumeric)
{
if (ch >= 'A' && ch <= 'Z')
{
return ch;
}
if (ch >= 'a' && ch <= 'z')
{
return ch;
}
if (ch >= '0' && ch <= '9')
{
return ch;
}
}
else if (this.characterValidation == InputField.CharacterValidation.Name)
{
if (char.IsLetter(ch))
{
if (char.IsLower(ch) && (pos == 0 || text[pos - 1] == ' '))
{
return char.ToUpper(ch);
}
if (char.IsUpper(ch) && pos > 0 && text[pos - 1] != ' ' && text[pos - 1] != '\'')
{
return char.ToLower(ch);
}
return ch;
}
else
{
if (ch == '\'')
{
if (!text.Contains("'") && (pos <= 0 || (text[pos - 1] != ' ' && text[pos - 1] != '\'')) && (pos >= text.Length || (text[pos] != ' ' && text[pos] != '\'')))
{
return ch;
}
}
if (ch == ' ')
{
if ((pos <= 0 || (text[pos - 1] != ' ' && text[pos - 1] != '\'')) && (pos >= text.Length || (text[pos] != ' ' && text[pos] != '\'')))
{
return ch;
}
}
}
}
else if (this.characterValidation == InputField.CharacterValidation.EmailAddress)
{
if (ch >= 'A' && ch <= 'Z')
{
return ch;
}
if (ch >= 'a' && ch <= 'z')
{
return ch;
}
if (ch >= '0' && ch <= '9')
{
return ch;
}
if (ch == '@' && text.IndexOf('@') == -1)
{
return ch;
}
if ("!#$%&'*+-/=?^_`{|}~".IndexOf(ch) != -1)
{
return ch;
}
if (ch == '.')
{
char c2 = ((text.Length <= 0) ? ' ' : text[Mathf.Clamp(pos, 0, text.Length - 1)]);
char c3 = ((text.Length <= 0) ? '\n' : text[Mathf.Clamp(pos + 1, 0, text.Length - 1)]);
if (c2 != '.' && c3 != '.')
{
return ch;
}
}
}
c = '\0';
}
return c;
}
// Token: 0x06000330 RID: 816 RVA: 0x00013520 File Offset: 0x00011920
public void ActivateInputField()
{
if (!(this.m_TextComponent == null) && !(this.m_TextComponent.font == null) && this.IsActive() && this.IsInteractable())
{
if (this.isFocused)
{
if (this.m_Keyboard != null && !this.m_Keyboard.active)
{
this.m_Keyboard.active = true;
this.m_Keyboard.text = this.m_Text;
}
}
this.m_ShouldActivateNextUpdate = true;
}
}
// Token: 0x06000331 RID: 817 RVA: 0x000135C0 File Offset: 0x000119C0
private void ActivateInputFieldInternal()
{
if (!(EventSystem.current == null))
{
if (EventSystem.current.currentSelectedGameObject != base.gameObject)
{
EventSystem.current.SetSelectedGameObject(base.gameObject);
}
if (TouchScreenKeyboard.isSupported)
{
if (this.input.touchSupported)
{
TouchScreenKeyboard.hideInput = this.shouldHideMobileInput;
}
this.m_Keyboard = ((this.inputType != InputField.InputType.Password) ? TouchScreenKeyboard.Open(this.m_Text, this.keyboardType, this.inputType == InputField.InputType.AutoCorrect, this.multiLine) : TouchScreenKeyboard.Open(this.m_Text, this.keyboardType, false, this.multiLine, true));
this.MoveTextEnd(false);
}
else
{
this.input.imeCompositionMode = IMECompositionMode.On;
this.OnFocus();
}
this.m_AllowInput = true;
this.m_OriginalText = this.text;
this.m_WasCanceled = false;
this.SetCaretVisible();
this.UpdateLabel();
}
}
// Token: 0x06000332 RID: 818 RVA: 0x000136CC File Offset: 0x00011ACC
public override void OnSelect(BaseEventData eventData)
{
base.OnSelect(eventData);
if (this.shouldActivateOnSelect)
{
this.ActivateInputField();
}
}
// Token: 0x06000333 RID: 819 RVA: 0x000136E7 File Offset: 0x00011AE7
public virtual void OnPointerClick(PointerEventData eventData)
{
if (eventData.button == PointerEventData.InputButton.Left)
{
this.ActivateInputField();
}
}
// Token: 0x06000334 RID: 820 RVA: 0x00013700 File Offset: 0x00011B00
public void DeactivateInputField()
{
if (this.m_AllowInput)
{
this.m_HasDoneFocusTransition = false;
this.m_AllowInput = false;
if (this.m_Placeholder != null)
{
this.m_Placeholder.enabled = string.IsNullOrEmpty(this.m_Text);
}
if (this.m_TextComponent != null && this.IsInteractable())
{
if (this.m_WasCanceled)
{
this.text = this.m_OriginalText;
}
if (this.m_Keyboard != null)
{
this.m_Keyboard.active = false;
this.m_Keyboard = null;
}
this.m_CaretPosition = (this.m_CaretSelectPosition = 0);
this.SendOnSubmit();
this.input.imeCompositionMode = IMECompositionMode.Auto;
}
this.MarkGeometryAsDirty();
}
}
// Token: 0x06000335 RID: 821 RVA: 0x000137D0 File Offset: 0x00011BD0
public override void OnDeselect(BaseEventData eventData)
{
this.DeactivateInputField();
base.OnDeselect(eventData);
}
// Token: 0x06000336 RID: 822 RVA: 0x000137E0 File Offset: 0x00011BE0
public virtual void OnSubmit(BaseEventData eventData)
{
if (this.IsActive() && this.IsInteractable())
{
if (!this.isFocused)
{
this.m_ShouldActivateNextUpdate = true;
}
}
}
// Token: 0x06000337 RID: 823 RVA: 0x00013810 File Offset: 0x00011C10
private void EnforceContentType()
{
switch (this.contentType)
{
case InputField.ContentType.Standard:
this.m_InputType = InputField.InputType.Standard;
this.m_KeyboardType = TouchScreenKeyboardType.Default;
this.m_CharacterValidation = InputField.CharacterValidation.None;
break;
case InputField.ContentType.Autocorrected:
this.m_InputType = InputField.InputType.AutoCorrect;
this.m_KeyboardType = TouchScreenKeyboardType.Default;
this.m_CharacterValidation = InputField.CharacterValidation.None;
break;
case InputField.ContentType.IntegerNumber:
this.m_LineType = InputField.LineType.SingleLine;
this.m_InputType = InputField.InputType.Standard;
this.m_KeyboardType = TouchScreenKeyboardType.NumberPad;
this.m_CharacterValidation = InputField.CharacterValidation.Integer;
break;
case InputField.ContentType.DecimalNumber:
this.m_LineType = InputField.LineType.SingleLine;
this.m_InputType = InputField.InputType.Standard;
this.m_KeyboardType = TouchScreenKeyboardType.NumbersAndPunctuation;
this.m_CharacterValidation = InputField.CharacterValidation.Decimal;
break;
case InputField.ContentType.Alphanumeric:
this.m_LineType = InputField.LineType.SingleLine;
this.m_InputType = InputField.InputType.Standard;
this.m_KeyboardType = TouchScreenKeyboardType.ASCIICapable;
this.m_CharacterValidation = InputField.CharacterValidation.Alphanumeric;
break;
case InputField.ContentType.Name:
this.m_LineType = InputField.LineType.SingleLine;
this.m_InputType = InputField.InputType.Standard;
this.m_KeyboardType = TouchScreenKeyboardType.NamePhonePad;
this.m_CharacterValidation = InputField.CharacterValidation.Name;
break;
case InputField.ContentType.EmailAddress:
this.m_LineType = InputField.LineType.SingleLine;
this.m_InputType = InputField.InputType.Standard;
this.m_KeyboardType = TouchScreenKeyboardType.EmailAddress;
this.m_CharacterValidation = InputField.CharacterValidation.EmailAddress;
break;
case InputField.ContentType.Password:
this.m_LineType = InputField.LineType.SingleLine;
this.m_InputType = InputField.InputType.Password;
this.m_KeyboardType = TouchScreenKeyboardType.Default;
this.m_CharacterValidation = InputField.CharacterValidation.None;
break;
case InputField.ContentType.Pin:
this.m_LineType = InputField.LineType.SingleLine;
this.m_InputType = InputField.InputType.Password;
this.m_KeyboardType = TouchScreenKeyboardType.NumberPad;
this.m_CharacterValidation = InputField.CharacterValidation.Integer;
break;
}
this.EnforceTextHOverflow();
}
// Token: 0x06000338 RID: 824 RVA: 0x00013984 File Offset: 0x00011D84
private void EnforceTextHOverflow()
{
if (this.m_TextComponent != null)
{
if (this.multiLine)
{
this.m_TextComponent.horizontalOverflow = HorizontalWrapMode.Wrap;
}
else
{
this.m_TextComponent.horizontalOverflow = HorizontalWrapMode.Overflow;
}
}
}
// Token: 0x06000339 RID: 825 RVA: 0x000139C0 File Offset: 0x00011DC0
private void SetToCustomIfContentTypeIsNot(params InputField.ContentType[] allowedContentTypes)
{
if (this.contentType != InputField.ContentType.Custom)
{
for (int i = 0; i < allowedContentTypes.Length; i++)
{
if (this.contentType == allowedContentTypes[i])
{
return;
}
}
this.contentType = InputField.ContentType.Custom;
}
}
// Token: 0x0600033A RID: 826 RVA: 0x00013A0F File Offset: 0x00011E0F
private void SetToCustom()
{
if (this.contentType != InputField.ContentType.Custom)
{
this.contentType = InputField.ContentType.Custom;
}
}
// Token: 0x0600033B RID: 827 RVA: 0x00013A2C File Offset: 0x00011E2C
protected override void DoStateTransition(Selectable.SelectionState state, bool instant)
{
if (this.m_HasDoneFocusTransition)
{
state = Selectable.SelectionState.Highlighted;
}
else if (state == Selectable.SelectionState.Pressed)
{
this.m_HasDoneFocusTransition = true;
}
base.DoStateTransition(state, instant);
}
// Token: 0x0600033C RID: 828 RVA: 0x00013A58 File Offset: 0x00011E58
public virtual void CalculateLayoutInputHorizontal()
{
}
// Token: 0x0600033D RID: 829 RVA: 0x00013A5B File Offset: 0x00011E5B
public virtual void CalculateLayoutInputVertical()
{
}
// Token: 0x170000DF RID: 223
// (get) Token: 0x0600033E RID: 830 RVA: 0x00013A60 File Offset: 0x00011E60
public virtual float minWidth
{
get
{
return 0f;
}
}
// Token: 0x170000E0 RID: 224
// (get) Token: 0x0600033F RID: 831 RVA: 0x00013A7C File Offset: 0x00011E7C
public virtual float preferredWidth
{
get
{
float num;
if (this.textComponent == null)
{
num = 0f;
}
else
{
TextGenerationSettings generationSettings = this.textComponent.GetGenerationSettings(Vector2.zero);
num = this.textComponent.cachedTextGeneratorForLayout.GetPreferredWidth(this.m_Text, generationSettings) / this.textComponent.pixelsPerUnit;
}
return num;
}
}
// Token: 0x170000E1 RID: 225
// (get) Token: 0x06000340 RID: 832 RVA: 0x00013AE4 File Offset: 0x00011EE4
public virtual float flexibleWidth
{
get
{
return -1f;
}
}
// Token: 0x170000E2 RID: 226
// (get) Token: 0x06000341 RID: 833 RVA: 0x00013B00 File Offset: 0x00011F00
public virtual float minHeight
{
get
{
return 0f;
}
}
// Token: 0x170000E3 RID: 227
// (get) Token: 0x06000342 RID: 834 RVA: 0x00013B1C File Offset: 0x00011F1C
public virtual float preferredHeight
{
get
{
float num;
if (this.textComponent == null)
{
num = 0f;
}
else
{
TextGenerationSettings generationSettings = this.textComponent.GetGenerationSettings(new Vector2(this.textComponent.rectTransform.rect.size.x, 0f));
num = this.textComponent.cachedTextGeneratorForLayout.GetPreferredHeight(this.m_Text, generationSettings) / this.textComponent.pixelsPerUnit;
}
return num;
}
}
// Token: 0x170000E4 RID: 228
// (get) Token: 0x06000343 RID: 835 RVA: 0x00013BA8 File Offset: 0x00011FA8
public virtual float flexibleHeight
{
get
{
return -1f;
}
}
// Token: 0x170000E5 RID: 229
// (get) Token: 0x06000344 RID: 836 RVA: 0x00013BC4 File Offset: 0x00011FC4
public virtual int layoutPriority
{
get
{
return 1;
}
}
// Token: 0x06000346 RID: 838 RVA: 0x00013BF2 File Offset: 0x00011FF2
Transform ICanvasElement.get_transform()
{
return base.transform;
}
// Token: 0x04000157 RID: 343
protected TouchScreenKeyboard m_Keyboard;
// Token: 0x04000158 RID: 344
private static readonly char[] kSeparators = new char[] { ' ', '.', ',', '\t', '\r', '\n' };
// Token: 0x04000159 RID: 345
[SerializeField]
[FormerlySerializedAs("text")]
protected Text m_TextComponent;
// Token: 0x0400015A RID: 346
[SerializeField]
protected Graphic m_Placeholder;
// Token: 0x0400015B RID: 347
[SerializeField]
private InputField.ContentType m_ContentType = InputField.ContentType.Standard;
// Token: 0x0400015C RID: 348
[FormerlySerializedAs("inputType")]
[SerializeField]
private InputField.InputType m_InputType = InputField.InputType.Standard;
// Token: 0x0400015D RID: 349
[FormerlySerializedAs("asteriskChar")]
[SerializeField]
private char m_AsteriskChar = '*';
// Token: 0x0400015E RID: 350
[FormerlySerializedAs("keyboardType")]
[SerializeField]
private TouchScreenKeyboardType m_KeyboardType = TouchScreenKeyboardType.Default;
// Token: 0x0400015F RID: 351
[SerializeField]
private InputField.LineType m_LineType = InputField.LineType.SingleLine;
// Token: 0x04000160 RID: 352
[FormerlySerializedAs("hideMobileInput")]
[SerializeField]
private bool m_HideMobileInput = false;
// Token: 0x04000161 RID: 353
[FormerlySerializedAs("validation")]
[SerializeField]
private InputField.CharacterValidation m_CharacterValidation = InputField.CharacterValidation.None;
// Token: 0x04000162 RID: 354
[FormerlySerializedAs("characterLimit")]
[SerializeField]
private int m_CharacterLimit = 0;
// Token: 0x04000163 RID: 355
[FormerlySerializedAs("onSubmit")]
[FormerlySerializedAs("m_OnSubmit")]
[FormerlySerializedAs("m_EndEdit")]
[SerializeField]
private InputField.SubmitEvent m_OnEndEdit = new InputField.SubmitEvent();
// Token: 0x04000164 RID: 356
[FormerlySerializedAs("onValueChange")]
[FormerlySerializedAs("m_OnValueChange")]
[SerializeField]
private InputField.OnChangeEvent m_OnValueChanged = new InputField.OnChangeEvent();
// Token: 0x04000165 RID: 357
[FormerlySerializedAs("onValidateInput")]
[SerializeField]
private InputField.OnValidateInput m_OnValidateInput;
// Token: 0x04000166 RID: 358
[SerializeField]
private Color m_CaretColor = new Color(0.19607843f, 0.19607843f, 0.19607843f, 1f);
// Token: 0x04000167 RID: 359
[SerializeField]
private bool m_CustomCaretColor = false;
// Token: 0x04000168 RID: 360
[FormerlySerializedAs("selectionColor")]
[SerializeField]
private Color m_SelectionColor = new Color(0.65882355f, 0.80784315f, 1f, 0.7529412f);
// Token: 0x04000169 RID: 361
[SerializeField]
[FormerlySerializedAs("mValue")]
protected string m_Text = string.Empty;
// Token: 0x0400016A RID: 362
[SerializeField]
[Range(0f, 4f)]
private float m_CaretBlinkRate = 0.85f;
// Token: 0x0400016B RID: 363
[SerializeField]
[Range(1f, 5f)]
private int m_CaretWidth = 1;
// Token: 0x0400016C RID: 364
[SerializeField]
private bool m_ReadOnly = false;
// Token: 0x0400016D RID: 365
protected int m_CaretPosition = 0;
// Token: 0x0400016E RID: 366
protected int m_CaretSelectPosition = 0;
// Token: 0x0400016F RID: 367
private RectTransform caretRectTrans = null;
// Token: 0x04000170 RID: 368
protected UIVertex[] m_CursorVerts = null;
// Token: 0x04000171 RID: 369
private TextGenerator m_InputTextCache;
// Token: 0x04000172 RID: 370
private CanvasRenderer m_CachedInputRenderer;
// Token: 0x04000173 RID: 371
private bool m_PreventFontCallback = false;
// Token: 0x04000174 RID: 372
[NonSerialized]
protected Mesh m_Mesh;
// Token: 0x04000175 RID: 373
private bool m_AllowInput = false;
// Token: 0x04000176 RID: 374
private bool m_ShouldActivateNextUpdate = false;
// Token: 0x04000177 RID: 375
private bool m_UpdateDrag = false;
// Token: 0x04000178 RID: 376
private bool m_DragPositionOutOfBounds = false;
// Token: 0x04000179 RID: 377
private const float kHScrollSpeed = 0.05f;
// Token: 0x0400017A RID: 378
private const float kVScrollSpeed = 0.1f;
// Token: 0x0400017B RID: 379
protected bool m_CaretVisible;
// Token: 0x0400017C RID: 380
private Coroutine m_BlinkCoroutine = null;
// Token: 0x0400017D RID: 381
private float m_BlinkStartTime = 0f;
// Token: 0x0400017E RID: 382
protected int m_DrawStart = 0;
// Token: 0x0400017F RID: 383
protected int m_DrawEnd = 0;
// Token: 0x04000180 RID: 384
private Coroutine m_DragCoroutine = null;
// Token: 0x04000181 RID: 385
private string m_OriginalText = "";
// Token: 0x04000182 RID: 386
private bool m_WasCanceled = false;
// Token: 0x04000183 RID: 387
private bool m_HasDoneFocusTransition = false;
// Token: 0x04000184 RID: 388
private const string kEmailSpecialCharacters = "!#$%&'*+-/=?^_`{|}~";
// Token: 0x04000185 RID: 389
private Event m_ProcessingEvent = new Event();
// Token: 0x02000059 RID: 89
public enum ContentType
{
// Token: 0x04000187 RID: 391
Standard,
// Token: 0x04000188 RID: 392
Autocorrected,
// Token: 0x04000189 RID: 393
IntegerNumber,
// Token: 0x0400018A RID: 394
DecimalNumber,
// Token: 0x0400018B RID: 395
Alphanumeric,
// Token: 0x0400018C RID: 396
Name,
// Token: 0x0400018D RID: 397
EmailAddress,
// Token: 0x0400018E RID: 398
Password,
// Token: 0x0400018F RID: 399
Pin,
// Token: 0x04000190 RID: 400
Custom
}
// Token: 0x0200005A RID: 90
public enum InputType
{
// Token: 0x04000192 RID: 402
Standard,
// Token: 0x04000193 RID: 403
AutoCorrect,
// Token: 0x04000194 RID: 404
Password
}
// Token: 0x0200005B RID: 91
public enum CharacterValidation
{
// Token: 0x04000196 RID: 406
None,
// Token: 0x04000197 RID: 407
Integer,
// Token: 0x04000198 RID: 408
Decimal,
// Token: 0x04000199 RID: 409
Alphanumeric,
// Token: 0x0400019A RID: 410
Name,
// Token: 0x0400019B RID: 411
EmailAddress
}
// Token: 0x0200005C RID: 92
public enum LineType
{
// Token: 0x0400019D RID: 413
SingleLine,
// Token: 0x0400019E RID: 414
MultiLineSubmit,
// Token: 0x0400019F RID: 415
MultiLineNewline
}
// Token: 0x0200005D RID: 93
// (Invoke) Token: 0x06000348 RID: 840
public delegate char OnValidateInput(string text, int charIndex, char addedChar);
// Token: 0x0200005E RID: 94
[Serializable]
public class SubmitEvent : UnityEvent<string>
{
}
// Token: 0x0200005F RID: 95
[Serializable]
public class OnChangeEvent : UnityEvent<string>
{
}
// Token: 0x02000060 RID: 96
protected enum EditState
{
// Token: 0x040001A1 RID: 417
Continue,
// Token: 0x040001A2 RID: 418
Finish
}
}
}
+244
View File
@@ -0,0 +1,244 @@
using System;
using UnityEngine.EventSystems;
namespace UnityEngine.UI
{
// Token: 0x0200009A RID: 154
[AddComponentMenu("Layout/Layout Element", 140)]
[RequireComponent(typeof(RectTransform))]
[ExecuteInEditMode]
public class LayoutElement : UIBehaviour, ILayoutElement, ILayoutIgnorer
{
// Token: 0x06000564 RID: 1380 RVA: 0x0001C9E0 File Offset: 0x0001ADE0
protected LayoutElement()
{
}
// Token: 0x1700017D RID: 381
// (get) Token: 0x06000565 RID: 1381 RVA: 0x0001CA44 File Offset: 0x0001AE44
// (set) Token: 0x06000566 RID: 1382 RVA: 0x0001CA5F File Offset: 0x0001AE5F
public virtual bool ignoreLayout
{
get
{
return this.m_IgnoreLayout;
}
set
{
if (SetPropertyUtility.SetStruct<bool>(ref this.m_IgnoreLayout, value))
{
this.SetDirty();
}
}
}
// Token: 0x06000567 RID: 1383 RVA: 0x0001CA79 File Offset: 0x0001AE79
public virtual void CalculateLayoutInputHorizontal()
{
}
// Token: 0x06000568 RID: 1384 RVA: 0x0001CA7C File Offset: 0x0001AE7C
public virtual void CalculateLayoutInputVertical()
{
}
// Token: 0x1700017E RID: 382
// (get) Token: 0x06000569 RID: 1385 RVA: 0x0001CA80 File Offset: 0x0001AE80
// (set) Token: 0x0600056A RID: 1386 RVA: 0x0001CA9B File Offset: 0x0001AE9B
public virtual float minWidth
{
get
{
return this.m_MinWidth;
}
set
{
if (SetPropertyUtility.SetStruct<float>(ref this.m_MinWidth, value))
{
this.SetDirty();
}
}
}
// Token: 0x1700017F RID: 383
// (get) Token: 0x0600056B RID: 1387 RVA: 0x0001CAB8 File Offset: 0x0001AEB8
// (set) Token: 0x0600056C RID: 1388 RVA: 0x0001CAD3 File Offset: 0x0001AED3
public virtual float minHeight
{
get
{
return this.m_MinHeight;
}
set
{
if (SetPropertyUtility.SetStruct<float>(ref this.m_MinHeight, value))
{
this.SetDirty();
}
}
}
// Token: 0x17000180 RID: 384
// (get) Token: 0x0600056D RID: 1389 RVA: 0x0001CAF0 File Offset: 0x0001AEF0
// (set) Token: 0x0600056E RID: 1390 RVA: 0x0001CB0B File Offset: 0x0001AF0B
public virtual float preferredWidth
{
get
{
return this.m_PreferredWidth;
}
set
{
if (SetPropertyUtility.SetStruct<float>(ref this.m_PreferredWidth, value))
{
this.SetDirty();
}
}
}
// Token: 0x17000181 RID: 385
// (get) Token: 0x0600056F RID: 1391 RVA: 0x0001CB28 File Offset: 0x0001AF28
// (set) Token: 0x06000570 RID: 1392 RVA: 0x0001CB43 File Offset: 0x0001AF43
public virtual float preferredHeight
{
get
{
return this.m_PreferredHeight;
}
set
{
if (SetPropertyUtility.SetStruct<float>(ref this.m_PreferredHeight, value))
{
this.SetDirty();
}
}
}
// Token: 0x17000182 RID: 386
// (get) Token: 0x06000571 RID: 1393 RVA: 0x0001CB60 File Offset: 0x0001AF60
// (set) Token: 0x06000572 RID: 1394 RVA: 0x0001CB7B File Offset: 0x0001AF7B
public virtual float flexibleWidth
{
get
{
return this.m_FlexibleWidth;
}
set
{
if (SetPropertyUtility.SetStruct<float>(ref this.m_FlexibleWidth, value))
{
this.SetDirty();
}
}
}
// Token: 0x17000183 RID: 387
// (get) Token: 0x06000573 RID: 1395 RVA: 0x0001CB98 File Offset: 0x0001AF98
// (set) Token: 0x06000574 RID: 1396 RVA: 0x0001CBB3 File Offset: 0x0001AFB3
public virtual float flexibleHeight
{
get
{
return this.m_FlexibleHeight;
}
set
{
if (SetPropertyUtility.SetStruct<float>(ref this.m_FlexibleHeight, value))
{
this.SetDirty();
}
}
}
// Token: 0x17000184 RID: 388
// (get) Token: 0x06000575 RID: 1397 RVA: 0x0001CBD0 File Offset: 0x0001AFD0
// (set) Token: 0x06000576 RID: 1398 RVA: 0x0001CBEB File Offset: 0x0001AFEB
public virtual int layoutPriority
{
get
{
return this.m_LayoutPriority;
}
set
{
if (SetPropertyUtility.SetStruct<int>(ref this.m_LayoutPriority, value))
{
this.SetDirty();
}
}
}
// Token: 0x06000577 RID: 1399 RVA: 0x0001CC05 File Offset: 0x0001B005
protected override void OnEnable()
{
base.OnEnable();
this.SetDirty();
}
// Token: 0x06000578 RID: 1400 RVA: 0x0001CC14 File Offset: 0x0001B014
protected override void OnTransformParentChanged()
{
this.SetDirty();
}
// Token: 0x06000579 RID: 1401 RVA: 0x0001CC1D File Offset: 0x0001B01D
protected override void OnDisable()
{
this.SetDirty();
base.OnDisable();
}
// Token: 0x0600057A RID: 1402 RVA: 0x0001CC2C File Offset: 0x0001B02C
protected override void OnDidApplyAnimationProperties()
{
this.SetDirty();
}
// Token: 0x0600057B RID: 1403 RVA: 0x0001CC35 File Offset: 0x0001B035
protected override void OnBeforeTransformParentChanged()
{
this.SetDirty();
}
// Token: 0x0600057C RID: 1404 RVA: 0x0001CC3E File Offset: 0x0001B03E
protected void SetDirty()
{
if (this.IsActive())
{
LayoutRebuilder.MarkLayoutForRebuild(base.transform as RectTransform);
}
}
// Token: 0x0400029E RID: 670
[SerializeField]
private bool m_IgnoreLayout = false;
// Token: 0x0400029F RID: 671
[SerializeField]
private float m_MinWidth = -1f;
// Token: 0x040002A0 RID: 672
[SerializeField]
private float m_MinHeight = -1f;
// Token: 0x040002A1 RID: 673
[SerializeField]
private float m_PreferredWidth = -1f;
// Token: 0x040002A2 RID: 674
[SerializeField]
private float m_PreferredHeight = -1f;
// Token: 0x040002A3 RID: 675
[SerializeField]
private float m_FlexibleWidth = -1f;
// Token: 0x040002A4 RID: 676
[SerializeField]
private float m_FlexibleHeight = -1f;
// Token: 0x040002A5 RID: 677
[SerializeField]
private int m_LayoutPriority = 1;
}
}
+372
View File
@@ -0,0 +1,372 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
namespace UnityEngine.UI
{
// Token: 0x0200009B RID: 155
[DisallowMultipleComponent]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
public abstract class LayoutGroup : UIBehaviour, ILayoutElement, ILayoutGroup, ILayoutController
{
// Token: 0x0600057D RID: 1405 RVA: 0x0001B4B0 File Offset: 0x000198B0
protected LayoutGroup()
{
if (this.m_Padding == null)
{
this.m_Padding = new RectOffset();
}
}
// Token: 0x17000185 RID: 389
// (get) Token: 0x0600057E RID: 1406 RVA: 0x0001B518 File Offset: 0x00019918
// (set) Token: 0x0600057F RID: 1407 RVA: 0x0001B533 File Offset: 0x00019933
public RectOffset padding
{
get
{
return this.m_Padding;
}
set
{
this.SetProperty<RectOffset>(ref this.m_Padding, value);
}
}
// Token: 0x17000186 RID: 390
// (get) Token: 0x06000580 RID: 1408 RVA: 0x0001B544 File Offset: 0x00019944
// (set) Token: 0x06000581 RID: 1409 RVA: 0x0001B55F File Offset: 0x0001995F
public TextAnchor childAlignment
{
get
{
return this.m_ChildAlignment;
}
set
{
this.SetProperty<TextAnchor>(ref this.m_ChildAlignment, value);
}
}
// Token: 0x17000187 RID: 391
// (get) Token: 0x06000582 RID: 1410 RVA: 0x0001B570 File Offset: 0x00019970
protected RectTransform rectTransform
{
get
{
if (this.m_Rect == null)
{
this.m_Rect = base.GetComponent<RectTransform>();
}
return this.m_Rect;
}
}
// Token: 0x17000188 RID: 392
// (get) Token: 0x06000583 RID: 1411 RVA: 0x0001B5A8 File Offset: 0x000199A8
protected List<RectTransform> rectChildren
{
get
{
return this.m_RectChildren;
}
}
// Token: 0x06000584 RID: 1412 RVA: 0x0001B5C4 File Offset: 0x000199C4
public virtual void CalculateLayoutInputHorizontal()
{
this.m_RectChildren.Clear();
List<Component> list = ListPool<Component>.Get();
for (int i = 0; i < this.rectTransform.childCount; i++)
{
RectTransform rectTransform = this.rectTransform.GetChild(i) as RectTransform;
if (!(rectTransform == null) && rectTransform.gameObject.activeInHierarchy)
{
rectTransform.GetComponents(typeof(ILayoutIgnorer), list);
if (list.Count == 0)
{
this.m_RectChildren.Add(rectTransform);
}
else
{
for (int j = 0; j < list.Count; j++)
{
ILayoutIgnorer layoutIgnorer = (ILayoutIgnorer)list[j];
if (!layoutIgnorer.ignoreLayout)
{
this.m_RectChildren.Add(rectTransform);
break;
}
}
}
}
}
ListPool<Component>.Release(list);
this.m_Tracker.Clear();
}
// Token: 0x06000585 RID: 1413
public abstract void CalculateLayoutInputVertical();
// Token: 0x17000189 RID: 393
// (get) Token: 0x06000586 RID: 1414 RVA: 0x0001B6B8 File Offset: 0x00019AB8
public virtual float minWidth
{
get
{
return this.GetTotalMinSize(0);
}
}
// Token: 0x1700018A RID: 394
// (get) Token: 0x06000587 RID: 1415 RVA: 0x0001B6D4 File Offset: 0x00019AD4
public virtual float preferredWidth
{
get
{
return this.GetTotalPreferredSize(0);
}
}
// Token: 0x1700018B RID: 395
// (get) Token: 0x06000588 RID: 1416 RVA: 0x0001B6F0 File Offset: 0x00019AF0
public virtual float flexibleWidth
{
get
{
return this.GetTotalFlexibleSize(0);
}
}
// Token: 0x1700018C RID: 396
// (get) Token: 0x06000589 RID: 1417 RVA: 0x0001B70C File Offset: 0x00019B0C
public virtual float minHeight
{
get
{
return this.GetTotalMinSize(1);
}
}
// Token: 0x1700018D RID: 397
// (get) Token: 0x0600058A RID: 1418 RVA: 0x0001B728 File Offset: 0x00019B28
public virtual float preferredHeight
{
get
{
return this.GetTotalPreferredSize(1);
}
}
// Token: 0x1700018E RID: 398
// (get) Token: 0x0600058B RID: 1419 RVA: 0x0001B744 File Offset: 0x00019B44
public virtual float flexibleHeight
{
get
{
return this.GetTotalFlexibleSize(1);
}
}
// Token: 0x1700018F RID: 399
// (get) Token: 0x0600058C RID: 1420 RVA: 0x0001B760 File Offset: 0x00019B60
public virtual int layoutPriority
{
get
{
return 0;
}
}
// Token: 0x0600058D RID: 1421
public abstract void SetLayoutHorizontal();
// Token: 0x0600058E RID: 1422
public abstract void SetLayoutVertical();
// Token: 0x0600058F RID: 1423 RVA: 0x0001B776 File Offset: 0x00019B76
protected override void OnEnable()
{
base.OnEnable();
this.SetDirty();
}
// Token: 0x06000590 RID: 1424 RVA: 0x0001B785 File Offset: 0x00019B85
protected override void OnDisable()
{
this.m_Tracker.Clear();
LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform);
base.OnDisable();
}
// Token: 0x06000591 RID: 1425 RVA: 0x0001B7A4 File Offset: 0x00019BA4
protected override void OnDidApplyAnimationProperties()
{
this.SetDirty();
}
// Token: 0x06000592 RID: 1426 RVA: 0x0001B7B0 File Offset: 0x00019BB0
protected float GetTotalMinSize(int axis)
{
return this.m_TotalMinSize[axis];
}
// Token: 0x06000593 RID: 1427 RVA: 0x0001B7D4 File Offset: 0x00019BD4
protected float GetTotalPreferredSize(int axis)
{
return this.m_TotalPreferredSize[axis];
}
// Token: 0x06000594 RID: 1428 RVA: 0x0001B7F8 File Offset: 0x00019BF8
protected float GetTotalFlexibleSize(int axis)
{
return this.m_TotalFlexibleSize[axis];
}
// Token: 0x06000595 RID: 1429 RVA: 0x0001B81C File Offset: 0x00019C1C
protected float GetStartOffset(int axis, float requiredSpaceWithoutPadding)
{
float num = requiredSpaceWithoutPadding + (float)((axis != 0) ? this.padding.vertical : this.padding.horizontal);
float num2 = this.rectTransform.rect.size[axis];
float num3 = num2 - num;
float alignmentOnAxis = this.GetAlignmentOnAxis(axis);
return (float)((axis != 0) ? this.padding.top : this.padding.left) + num3 * alignmentOnAxis;
}
// Token: 0x06000596 RID: 1430 RVA: 0x0001B8AC File Offset: 0x00019CAC
protected float GetAlignmentOnAxis(int axis)
{
float num;
if (axis == 0)
{
num = (float)(this.childAlignment % TextAnchor.MiddleLeft) * 0.5f;
}
else
{
num = (float)(this.childAlignment / TextAnchor.MiddleLeft) * 0.5f;
}
return num;
}
// Token: 0x06000597 RID: 1431 RVA: 0x0001B8EB File Offset: 0x00019CEB
protected void SetLayoutInputForAxis(float totalMin, float totalPreferred, float totalFlexible, int axis)
{
this.m_TotalMinSize[axis] = totalMin;
this.m_TotalPreferredSize[axis] = totalPreferred;
this.m_TotalFlexibleSize[axis] = totalFlexible;
}
// Token: 0x06000598 RID: 1432 RVA: 0x0001B918 File Offset: 0x00019D18
protected void SetChildAlongAxis(RectTransform rect, int axis, float pos)
{
if (!(rect == null))
{
this.m_Tracker.Add(this, rect, DrivenTransformProperties.Anchors | ((axis != 0) ? DrivenTransformProperties.AnchoredPositionY : DrivenTransformProperties.AnchoredPositionX));
rect.SetInsetAndSizeFromParentEdge((axis != 0) ? RectTransform.Edge.Top : RectTransform.Edge.Left, pos, rect.sizeDelta[axis]);
}
}
// Token: 0x06000599 RID: 1433 RVA: 0x0001B97C File Offset: 0x00019D7C
protected void SetChildAlongAxis(RectTransform rect, int axis, float pos, float size)
{
if (!(rect == null))
{
this.m_Tracker.Add(this, rect, DrivenTransformProperties.Anchors | ((axis != 0) ? (DrivenTransformProperties.AnchoredPositionY | DrivenTransformProperties.SizeDeltaY) : (DrivenTransformProperties.AnchoredPositionX | DrivenTransformProperties.SizeDeltaX)));
rect.SetInsetAndSizeFromParentEdge((axis != 0) ? RectTransform.Edge.Top : RectTransform.Edge.Left, pos, size);
}
}
// Token: 0x17000190 RID: 400
// (get) Token: 0x0600059A RID: 1434 RVA: 0x0001B9DC File Offset: 0x00019DDC
private bool isRootLayoutGroup
{
get
{
Transform parent = base.transform.parent;
return parent == null || base.transform.parent.GetComponent(typeof(ILayoutGroup)) == null;
}
}
// Token: 0x0600059B RID: 1435 RVA: 0x0001BA30 File Offset: 0x00019E30
protected override void OnRectTransformDimensionsChange()
{
base.OnRectTransformDimensionsChange();
if (this.isRootLayoutGroup)
{
this.SetDirty();
}
}
// Token: 0x0600059C RID: 1436 RVA: 0x0001BA4A File Offset: 0x00019E4A
protected virtual void OnTransformChildrenChanged()
{
this.SetDirty();
}
// Token: 0x0600059D RID: 1437 RVA: 0x0001BA54 File Offset: 0x00019E54
protected void SetProperty<T>(ref T currentValue, T newValue)
{
if ((currentValue != null || newValue != null) && (currentValue == null || !currentValue.Equals(newValue)))
{
currentValue = newValue;
this.SetDirty();
}
}
// Token: 0x0600059E RID: 1438 RVA: 0x0001BAB6 File Offset: 0x00019EB6
protected void SetDirty()
{
if (this.IsActive())
{
if (!CanvasUpdateRegistry.IsRebuildingLayout())
{
LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform);
}
else
{
base.StartCoroutine(this.DelayedSetDirty(this.rectTransform));
}
}
}
// Token: 0x0600059F RID: 1439 RVA: 0x0001BAF8 File Offset: 0x00019EF8
private IEnumerator DelayedSetDirty(RectTransform rectTransform)
{
yield return null;
LayoutRebuilder.MarkLayoutForRebuild(rectTransform);
yield break;
}
// Token: 0x040002A6 RID: 678
[SerializeField]
protected RectOffset m_Padding = new RectOffset();
// Token: 0x040002A7 RID: 679
[FormerlySerializedAs("m_Alignment")]
[SerializeField]
protected TextAnchor m_ChildAlignment = TextAnchor.UpperLeft;
// Token: 0x040002A8 RID: 680
[NonSerialized]
private RectTransform m_Rect;
// Token: 0x040002A9 RID: 681
protected DrivenRectTransformTracker m_Tracker;
// Token: 0x040002AA RID: 682
private Vector2 m_TotalMinSize = Vector2.zero;
// Token: 0x040002AB RID: 683
private Vector2 m_TotalPreferredSize = Vector2.zero;
// Token: 0x040002AC RID: 684
private Vector2 m_TotalFlexibleSize = Vector2.zero;
// Token: 0x040002AD RID: 685
[NonSerialized]
private List<RectTransform> m_RectChildren = new List<RectTransform>();
}
}
+266
View File
@@ -0,0 +1,266 @@
using System;
using System.Collections.Generic;
using UnityEngine.Events;
namespace UnityEngine.UI
{
// Token: 0x0200009C RID: 156
public class LayoutRebuilder : ICanvasElement
{
// Token: 0x060005A0 RID: 1440 RVA: 0x0001CC61 File Offset: 0x0001B061
static LayoutRebuilder()
{
RectTransform.reapplyDrivenProperties += LayoutRebuilder.ReapplyDrivenProperties;
}
// Token: 0x060005A2 RID: 1442 RVA: 0x0001CCA5 File Offset: 0x0001B0A5
private void Initialize(RectTransform controller)
{
this.m_ToRebuild = controller;
this.m_CachedHashFromTransform = controller.GetHashCode();
}
// Token: 0x060005A3 RID: 1443 RVA: 0x0001CCBB File Offset: 0x0001B0BB
private void Clear()
{
this.m_ToRebuild = null;
this.m_CachedHashFromTransform = 0;
}
// Token: 0x060005A4 RID: 1444 RVA: 0x0001CCCC File Offset: 0x0001B0CC
private static void ReapplyDrivenProperties(RectTransform driven)
{
LayoutRebuilder.MarkLayoutForRebuild(driven);
}
// Token: 0x17000191 RID: 401
// (get) Token: 0x060005A5 RID: 1445 RVA: 0x0001CCD8 File Offset: 0x0001B0D8
public Transform transform
{
get
{
return this.m_ToRebuild;
}
}
// Token: 0x060005A6 RID: 1446 RVA: 0x0001CCF4 File Offset: 0x0001B0F4
public bool IsDestroyed()
{
return this.m_ToRebuild == null;
}
// Token: 0x060005A7 RID: 1447 RVA: 0x0001CD15 File Offset: 0x0001B115
private static void StripDisabledBehavioursFromList(List<Component> components)
{
components.RemoveAll((Component e) => e is Behaviour && !((Behaviour)e).isActiveAndEnabled);
}
// Token: 0x060005A8 RID: 1448 RVA: 0x0001CD3C File Offset: 0x0001B13C
public static void ForceRebuildLayoutImmediate(RectTransform layoutRoot)
{
LayoutRebuilder layoutRebuilder = LayoutRebuilder.s_Rebuilders.Get();
layoutRebuilder.Initialize(layoutRoot);
layoutRebuilder.Rebuild(CanvasUpdate.Layout);
LayoutRebuilder.s_Rebuilders.Release(layoutRebuilder);
}
// Token: 0x060005A9 RID: 1449 RVA: 0x0001CD70 File Offset: 0x0001B170
public void Rebuild(CanvasUpdate executing)
{
if (executing == CanvasUpdate.Layout)
{
this.PerformLayoutCalculation(this.m_ToRebuild, delegate(Component e)
{
(e as ILayoutElement).CalculateLayoutInputHorizontal();
});
this.PerformLayoutControl(this.m_ToRebuild, delegate(Component e)
{
(e as ILayoutController).SetLayoutHorizontal();
});
this.PerformLayoutCalculation(this.m_ToRebuild, delegate(Component e)
{
(e as ILayoutElement).CalculateLayoutInputVertical();
});
this.PerformLayoutControl(this.m_ToRebuild, delegate(Component e)
{
(e as ILayoutController).SetLayoutVertical();
});
}
}
// Token: 0x060005AA RID: 1450 RVA: 0x0001CE34 File Offset: 0x0001B234
private void PerformLayoutControl(RectTransform rect, UnityAction<Component> action)
{
if (!(rect == null))
{
List<Component> list = ListPool<Component>.Get();
rect.GetComponents(typeof(ILayoutController), list);
LayoutRebuilder.StripDisabledBehavioursFromList(list);
if (list.Count > 0)
{
for (int i = 0; i < list.Count; i++)
{
if (list[i] is ILayoutSelfController)
{
action(list[i]);
}
}
for (int j = 0; j < list.Count; j++)
{
if (!(list[j] is ILayoutSelfController))
{
action(list[j]);
}
}
for (int k = 0; k < rect.childCount; k++)
{
this.PerformLayoutControl(rect.GetChild(k) as RectTransform, action);
}
}
ListPool<Component>.Release(list);
}
}
// Token: 0x060005AB RID: 1451 RVA: 0x0001CF18 File Offset: 0x0001B318
private void PerformLayoutCalculation(RectTransform rect, UnityAction<Component> action)
{
if (!(rect == null))
{
List<Component> list = ListPool<Component>.Get();
rect.GetComponents(typeof(ILayoutElement), list);
LayoutRebuilder.StripDisabledBehavioursFromList(list);
if (list.Count > 0 || rect.GetComponent(typeof(ILayoutGroup)))
{
for (int i = 0; i < rect.childCount; i++)
{
this.PerformLayoutCalculation(rect.GetChild(i) as RectTransform, action);
}
for (int j = 0; j < list.Count; j++)
{
action(list[j]);
}
}
ListPool<Component>.Release(list);
}
}
// Token: 0x060005AC RID: 1452 RVA: 0x0001CFD0 File Offset: 0x0001B3D0
public static void MarkLayoutForRebuild(RectTransform rect)
{
if (!(rect == null))
{
List<Component> list = ListPool<Component>.Get();
RectTransform rectTransform = rect;
for (;;)
{
RectTransform rectTransform2 = rectTransform.parent as RectTransform;
if (!LayoutRebuilder.ValidLayoutGroup(rectTransform2, list))
{
break;
}
rectTransform = rectTransform2;
}
if (rectTransform == rect && !LayoutRebuilder.ValidController(rectTransform, list))
{
ListPool<Component>.Release(list);
}
else
{
LayoutRebuilder.MarkLayoutRootForRebuild(rectTransform);
ListPool<Component>.Release(list);
}
}
}
// Token: 0x060005AD RID: 1453 RVA: 0x0001D050 File Offset: 0x0001B450
private static bool ValidLayoutGroup(RectTransform parent, List<Component> comps)
{
bool flag;
if (parent == null)
{
flag = false;
}
else
{
parent.GetComponents(typeof(ILayoutGroup), comps);
LayoutRebuilder.StripDisabledBehavioursFromList(comps);
bool flag2 = comps.Count > 0;
flag = flag2;
}
return flag;
}
// Token: 0x060005AE RID: 1454 RVA: 0x0001D09C File Offset: 0x0001B49C
private static bool ValidController(RectTransform layoutRoot, List<Component> comps)
{
bool flag;
if (layoutRoot == null)
{
flag = false;
}
else
{
layoutRoot.GetComponents(typeof(ILayoutController), comps);
LayoutRebuilder.StripDisabledBehavioursFromList(comps);
bool flag2 = comps.Count > 0;
flag = flag2;
}
return flag;
}
// Token: 0x060005AF RID: 1455 RVA: 0x0001D0E8 File Offset: 0x0001B4E8
private static void MarkLayoutRootForRebuild(RectTransform controller)
{
if (!(controller == null))
{
LayoutRebuilder layoutRebuilder = LayoutRebuilder.s_Rebuilders.Get();
layoutRebuilder.Initialize(controller);
if (!CanvasUpdateRegistry.TryRegisterCanvasElementForLayoutRebuild(layoutRebuilder))
{
LayoutRebuilder.s_Rebuilders.Release(layoutRebuilder);
}
}
}
// Token: 0x060005B0 RID: 1456 RVA: 0x0001D12F File Offset: 0x0001B52F
public void LayoutComplete()
{
LayoutRebuilder.s_Rebuilders.Release(this);
}
// Token: 0x060005B1 RID: 1457 RVA: 0x0001D13D File Offset: 0x0001B53D
public void GraphicUpdateComplete()
{
}
// Token: 0x060005B2 RID: 1458 RVA: 0x0001D140 File Offset: 0x0001B540
public override int GetHashCode()
{
return this.m_CachedHashFromTransform;
}
// Token: 0x060005B3 RID: 1459 RVA: 0x0001D15C File Offset: 0x0001B55C
public override bool Equals(object obj)
{
return obj.GetHashCode() == this.GetHashCode();
}
// Token: 0x060005B4 RID: 1460 RVA: 0x0001D180 File Offset: 0x0001B580
public override string ToString()
{
return "(Layout Rebuilder for) " + this.m_ToRebuild;
}
// Token: 0x040002AE RID: 686
private RectTransform m_ToRebuild;
// Token: 0x040002AF RID: 687
private int m_CachedHashFromTransform;
// Token: 0x040002B0 RID: 688
private static ObjectPool<LayoutRebuilder> s_Rebuilders = new ObjectPool<LayoutRebuilder>(null, delegate(LayoutRebuilder x)
{
x.Clear();
});
}
}
+144
View File
@@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
namespace UnityEngine.UI
{
// Token: 0x0200009D RID: 157
public static class LayoutUtility
{
// Token: 0x060005BB RID: 1467 RVA: 0x0001D214 File Offset: 0x0001B614
public static float GetMinSize(RectTransform rect, int axis)
{
float num;
if (axis == 0)
{
num = LayoutUtility.GetMinWidth(rect);
}
else
{
num = LayoutUtility.GetMinHeight(rect);
}
return num;
}
// Token: 0x060005BC RID: 1468 RVA: 0x0001D244 File Offset: 0x0001B644
public static float GetPreferredSize(RectTransform rect, int axis)
{
float num;
if (axis == 0)
{
num = LayoutUtility.GetPreferredWidth(rect);
}
else
{
num = LayoutUtility.GetPreferredHeight(rect);
}
return num;
}
// Token: 0x060005BD RID: 1469 RVA: 0x0001D274 File Offset: 0x0001B674
public static float GetFlexibleSize(RectTransform rect, int axis)
{
float num;
if (axis == 0)
{
num = LayoutUtility.GetFlexibleWidth(rect);
}
else
{
num = LayoutUtility.GetFlexibleHeight(rect);
}
return num;
}
// Token: 0x060005BE RID: 1470 RVA: 0x0001D2A4 File Offset: 0x0001B6A4
public static float GetMinWidth(RectTransform rect)
{
return LayoutUtility.GetLayoutProperty(rect, (ILayoutElement e) => e.minWidth, 0f);
}
// Token: 0x060005BF RID: 1471 RVA: 0x0001D2E4 File Offset: 0x0001B6E4
public static float GetPreferredWidth(RectTransform rect)
{
return Mathf.Max(LayoutUtility.GetLayoutProperty(rect, (ILayoutElement e) => e.minWidth, 0f), LayoutUtility.GetLayoutProperty(rect, (ILayoutElement e) => e.preferredWidth, 0f));
}
// Token: 0x060005C0 RID: 1472 RVA: 0x0001D350 File Offset: 0x0001B750
public static float GetFlexibleWidth(RectTransform rect)
{
return LayoutUtility.GetLayoutProperty(rect, (ILayoutElement e) => e.flexibleWidth, 0f);
}
// Token: 0x060005C1 RID: 1473 RVA: 0x0001D390 File Offset: 0x0001B790
public static float GetMinHeight(RectTransform rect)
{
return LayoutUtility.GetLayoutProperty(rect, (ILayoutElement e) => e.minHeight, 0f);
}
// Token: 0x060005C2 RID: 1474 RVA: 0x0001D3D0 File Offset: 0x0001B7D0
public static float GetPreferredHeight(RectTransform rect)
{
return Mathf.Max(LayoutUtility.GetLayoutProperty(rect, (ILayoutElement e) => e.minHeight, 0f), LayoutUtility.GetLayoutProperty(rect, (ILayoutElement e) => e.preferredHeight, 0f));
}
// Token: 0x060005C3 RID: 1475 RVA: 0x0001D43C File Offset: 0x0001B83C
public static float GetFlexibleHeight(RectTransform rect)
{
return LayoutUtility.GetLayoutProperty(rect, (ILayoutElement e) => e.flexibleHeight, 0f);
}
// Token: 0x060005C4 RID: 1476 RVA: 0x0001D47C File Offset: 0x0001B87C
public static float GetLayoutProperty(RectTransform rect, Func<ILayoutElement, float> property, float defaultValue)
{
ILayoutElement layoutElement;
return LayoutUtility.GetLayoutProperty(rect, property, defaultValue, out layoutElement);
}
// Token: 0x060005C5 RID: 1477 RVA: 0x0001D49C File Offset: 0x0001B89C
public static float GetLayoutProperty(RectTransform rect, Func<ILayoutElement, float> property, float defaultValue, out ILayoutElement source)
{
source = null;
float num;
if (rect == null)
{
num = 0f;
}
else
{
float num2 = defaultValue;
int num3 = int.MinValue;
List<Component> list = ListPool<Component>.Get();
rect.GetComponents(typeof(ILayoutElement), list);
for (int i = 0; i < list.Count; i++)
{
ILayoutElement layoutElement = list[i] as ILayoutElement;
if (!(layoutElement is Behaviour) || ((Behaviour)layoutElement).isActiveAndEnabled)
{
int layoutPriority = layoutElement.layoutPriority;
if (layoutPriority >= num3)
{
float num4 = property(layoutElement);
if (num4 >= 0f)
{
if (layoutPriority > num3)
{
num2 = num4;
num3 = layoutPriority;
source = layoutElement;
}
else if (num4 > num2)
{
num2 = num4;
source = layoutElement;
}
}
}
}
}
ListPool<Component>.Release(list);
num = num2;
}
return num;
}
}
}
+27
View File
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
namespace UnityEngine.UI
{
// Token: 0x020000A1 RID: 161
internal static class ListPool<T>
{
// Token: 0x060005E6 RID: 1510 RVA: 0x0001DA08 File Offset: 0x0001BE08
public static List<T> Get()
{
return ListPool<T>.s_ListPool.Get();
}
// Token: 0x060005E7 RID: 1511 RVA: 0x0001DA27 File Offset: 0x0001BE27
public static void Release(List<T> toRelease)
{
ListPool<T>.s_ListPool.Release(toRelease);
}
// Token: 0x040002C1 RID: 705
private static readonly ObjectPool<List<T>> s_ListPool = new ObjectPool<List<T>>(null, delegate(List<T> l)
{
l.Clear();
});
}
}
+190
View File
@@ -0,0 +1,190 @@
using System;
using UnityEngine.EventSystems;
using UnityEngine.Rendering;
using UnityEngine.Serialization;
namespace UnityEngine.UI
{
// Token: 0x02000061 RID: 97
[AddComponentMenu("UI/Mask", 13)]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
[DisallowMultipleComponent]
public class Mask : UIBehaviour, ICanvasRaycastFilter, IMaterialModifier
{
// Token: 0x0600034D RID: 845 RVA: 0x00013FCD File Offset: 0x000123CD
protected Mask()
{
}
// Token: 0x170000E6 RID: 230
// (get) Token: 0x0600034E RID: 846 RVA: 0x00013FE0 File Offset: 0x000123E0
public RectTransform rectTransform
{
get
{
RectTransform rectTransform;
if ((rectTransform = this.m_RectTransform) == null)
{
rectTransform = (this.m_RectTransform = base.GetComponent<RectTransform>());
}
return rectTransform;
}
}
// Token: 0x170000E7 RID: 231
// (get) Token: 0x0600034F RID: 847 RVA: 0x00014014 File Offset: 0x00012414
// (set) Token: 0x06000350 RID: 848 RVA: 0x0001402F File Offset: 0x0001242F
public bool showMaskGraphic
{
get
{
return this.m_ShowMaskGraphic;
}
set
{
if (this.m_ShowMaskGraphic != value)
{
this.m_ShowMaskGraphic = value;
if (this.graphic != null)
{
this.graphic.SetMaterialDirty();
}
}
}
}
// Token: 0x170000E8 RID: 232
// (get) Token: 0x06000351 RID: 849 RVA: 0x00014068 File Offset: 0x00012468
public Graphic graphic
{
get
{
Graphic graphic;
if ((graphic = this.m_Graphic) == null)
{
graphic = (this.m_Graphic = base.GetComponent<Graphic>());
}
return graphic;
}
}
// Token: 0x06000352 RID: 850 RVA: 0x0001409C File Offset: 0x0001249C
public virtual bool MaskEnabled()
{
return this.IsActive() && this.graphic != null;
}
// Token: 0x06000353 RID: 851 RVA: 0x000140CB File Offset: 0x000124CB
[Obsolete("Not used anymore.")]
public virtual void OnSiblingGraphicEnabledDisabled()
{
}
// Token: 0x06000354 RID: 852 RVA: 0x000140CE File Offset: 0x000124CE
protected override void OnEnable()
{
base.OnEnable();
if (this.graphic != null)
{
this.graphic.canvasRenderer.hasPopInstruction = true;
this.graphic.SetMaterialDirty();
}
MaskUtilities.NotifyStencilStateChanged(this);
}
// Token: 0x06000355 RID: 853 RVA: 0x0001410C File Offset: 0x0001250C
protected override void OnDisable()
{
base.OnDisable();
if (this.graphic != null)
{
this.graphic.SetMaterialDirty();
this.graphic.canvasRenderer.hasPopInstruction = false;
this.graphic.canvasRenderer.popMaterialCount = 0;
}
StencilMaterial.Remove(this.m_MaskMaterial);
this.m_MaskMaterial = null;
StencilMaterial.Remove(this.m_UnmaskMaterial);
this.m_UnmaskMaterial = null;
MaskUtilities.NotifyStencilStateChanged(this);
}
// Token: 0x06000356 RID: 854 RVA: 0x0001418C File Offset: 0x0001258C
public virtual bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera)
{
return !base.isActiveAndEnabled || RectTransformUtility.RectangleContainsScreenPoint(this.rectTransform, sp, eventCamera);
}
// Token: 0x06000357 RID: 855 RVA: 0x000141C0 File Offset: 0x000125C0
public virtual Material GetModifiedMaterial(Material baseMaterial)
{
Material material;
if (!this.MaskEnabled())
{
material = baseMaterial;
}
else
{
Transform transform = MaskUtilities.FindRootSortOverrideCanvas(base.transform);
int stencilDepth = MaskUtilities.GetStencilDepth(base.transform, transform);
if (stencilDepth >= 8)
{
Debug.LogError("Attempting to use a stencil mask with depth > 8", base.gameObject);
material = baseMaterial;
}
else
{
int num = 1 << stencilDepth;
if (num == 1)
{
Material material2 = StencilMaterial.Add(baseMaterial, 1, StencilOp.Replace, CompareFunction.Always, (!this.m_ShowMaskGraphic) ? ((ColorWriteMask)0) : ColorWriteMask.All);
StencilMaterial.Remove(this.m_MaskMaterial);
this.m_MaskMaterial = material2;
Material material3 = StencilMaterial.Add(baseMaterial, 1, StencilOp.Zero, CompareFunction.Always, (ColorWriteMask)0);
StencilMaterial.Remove(this.m_UnmaskMaterial);
this.m_UnmaskMaterial = material3;
this.graphic.canvasRenderer.popMaterialCount = 1;
this.graphic.canvasRenderer.SetPopMaterial(this.m_UnmaskMaterial, 0);
material = this.m_MaskMaterial;
}
else
{
Material material4 = StencilMaterial.Add(baseMaterial, num | (num - 1), StencilOp.Replace, CompareFunction.Equal, (!this.m_ShowMaskGraphic) ? ((ColorWriteMask)0) : ColorWriteMask.All, num - 1, num | (num - 1));
StencilMaterial.Remove(this.m_MaskMaterial);
this.m_MaskMaterial = material4;
this.graphic.canvasRenderer.hasPopInstruction = true;
Material material5 = StencilMaterial.Add(baseMaterial, num - 1, StencilOp.Replace, CompareFunction.Equal, (ColorWriteMask)0, num - 1, num | (num - 1));
StencilMaterial.Remove(this.m_UnmaskMaterial);
this.m_UnmaskMaterial = material5;
this.graphic.canvasRenderer.popMaterialCount = 1;
this.graphic.canvasRenderer.SetPopMaterial(this.m_UnmaskMaterial, 0);
material = this.m_MaskMaterial;
}
}
}
return material;
}
// Token: 0x040001A3 RID: 419
[NonSerialized]
private RectTransform m_RectTransform;
// Token: 0x040001A4 RID: 420
[SerializeField]
[FormerlySerializedAs("m_ShowGraphic")]
private bool m_ShowMaskGraphic = true;
// Token: 0x040001A5 RID: 421
[NonSerialized]
private Graphic m_Graphic;
// Token: 0x040001A6 RID: 422
[NonSerialized]
private Material m_MaskMaterial;
// Token: 0x040001A7 RID: 423
[NonSerialized]
private Material m_UnmaskMaterial;
}
}
+202
View File
@@ -0,0 +1,202 @@
using System;
using System.Collections.Generic;
namespace UnityEngine.UI
{
// Token: 0x02000064 RID: 100
public class MaskUtilities
{
// Token: 0x0600036D RID: 877 RVA: 0x00014360 File Offset: 0x00012760
public static void Notify2DMaskStateChanged(Component mask)
{
List<Component> list = ListPool<Component>.Get();
mask.GetComponentsInChildren<Component>(list);
for (int i = 0; i < list.Count; i++)
{
if (!(list[i] == null) && !(list[i].gameObject == mask.gameObject))
{
IClippable clippable = list[i] as IClippable;
if (clippable != null)
{
clippable.RecalculateClipping();
}
}
}
ListPool<Component>.Release(list);
}
// Token: 0x0600036E RID: 878 RVA: 0x000143E8 File Offset: 0x000127E8
public static void NotifyStencilStateChanged(Component mask)
{
List<Component> list = ListPool<Component>.Get();
mask.GetComponentsInChildren<Component>(list);
for (int i = 0; i < list.Count; i++)
{
if (!(list[i] == null) && !(list[i].gameObject == mask.gameObject))
{
IMaskable maskable = list[i] as IMaskable;
if (maskable != null)
{
maskable.RecalculateMasking();
}
}
}
ListPool<Component>.Release(list);
}
// Token: 0x0600036F RID: 879 RVA: 0x00014470 File Offset: 0x00012870
public static Transform FindRootSortOverrideCanvas(Transform start)
{
List<Canvas> list = ListPool<Canvas>.Get();
start.GetComponentsInParent<Canvas>(false, list);
Canvas canvas = null;
for (int i = 0; i < list.Count; i++)
{
canvas = list[i];
if (canvas.overrideSorting)
{
break;
}
}
ListPool<Canvas>.Release(list);
return (!(canvas != null)) ? null : canvas.transform;
}
// Token: 0x06000370 RID: 880 RVA: 0x000144E4 File Offset: 0x000128E4
public static int GetStencilDepth(Transform transform, Transform stopAfter)
{
int num = 0;
int num2;
if (transform == stopAfter)
{
num2 = num;
}
else
{
Transform transform2 = transform.parent;
List<Mask> list = ListPool<Mask>.Get();
while (transform2 != null)
{
transform2.GetComponents<Mask>(list);
for (int i = 0; i < list.Count; i++)
{
if (list[i] != null && list[i].MaskEnabled() && list[i].graphic.IsActive())
{
num++;
break;
}
}
if (transform2 == stopAfter)
{
break;
}
transform2 = transform2.parent;
}
ListPool<Mask>.Release(list);
num2 = num;
}
return num2;
}
// Token: 0x06000371 RID: 881 RVA: 0x000145B8 File Offset: 0x000129B8
public static bool IsDescendantOrSelf(Transform father, Transform child)
{
bool flag;
if (father == null || child == null)
{
flag = false;
}
else if (father == child)
{
flag = true;
}
else
{
while (child.parent != null)
{
if (child.parent == father)
{
return true;
}
child = child.parent;
}
flag = false;
}
return flag;
}
// Token: 0x06000372 RID: 882 RVA: 0x00014638 File Offset: 0x00012A38
public static RectMask2D GetRectMaskForClippable(IClippable clippable)
{
List<RectMask2D> list = ListPool<RectMask2D>.Get();
List<Canvas> list2 = ListPool<Canvas>.Get();
RectMask2D rectMask2D = null;
clippable.rectTransform.GetComponentsInParent<RectMask2D>(false, list);
if (list.Count > 0)
{
for (int i = 0; i < list.Count; i++)
{
rectMask2D = list[i];
if (rectMask2D.gameObject == clippable.gameObject)
{
rectMask2D = null;
}
else
{
if (rectMask2D.isActiveAndEnabled)
{
clippable.rectTransform.GetComponentsInParent<Canvas>(false, list2);
for (int j = list2.Count - 1; j >= 0; j--)
{
if (!MaskUtilities.IsDescendantOrSelf(list2[j].transform, rectMask2D.transform) && list2[j].overrideSorting)
{
rectMask2D = null;
break;
}
}
return rectMask2D;
}
rectMask2D = null;
}
}
}
ListPool<RectMask2D>.Release(list);
ListPool<Canvas>.Release(list2);
return rectMask2D;
}
// Token: 0x06000373 RID: 883 RVA: 0x00014744 File Offset: 0x00012B44
public static void GetRectMasksForClip(RectMask2D clipper, List<RectMask2D> masks)
{
masks.Clear();
List<Canvas> list = ListPool<Canvas>.Get();
List<RectMask2D> list2 = ListPool<RectMask2D>.Get();
clipper.transform.GetComponentsInParent<RectMask2D>(false, list2);
if (list2.Count > 0)
{
clipper.transform.GetComponentsInParent<Canvas>(false, list);
for (int i = list2.Count - 1; i >= 0; i--)
{
if (list2[i].IsActive())
{
bool flag = true;
for (int j = list.Count - 1; j >= 0; j--)
{
if (!MaskUtilities.IsDescendantOrSelf(list[j].transform, list2[i].transform) && list[j].overrideSorting)
{
flag = false;
break;
}
}
if (flag)
{
masks.Add(list2[i]);
}
}
}
}
ListPool<RectMask2D>.Release(list2);
ListPool<Canvas>.Release(list);
}
}
}
+254
View File
@@ -0,0 +1,254 @@
using System;
using UnityEngine.Events;
using UnityEngine.Rendering;
namespace UnityEngine.UI
{
// Token: 0x02000062 RID: 98
public abstract class MaskableGraphic : Graphic, IClippable, IMaskable, IMaterialModifier
{
// Token: 0x170000E9 RID: 233
// (get) Token: 0x06000359 RID: 857 RVA: 0x0000C8D0 File Offset: 0x0000ACD0
// (set) Token: 0x0600035A RID: 858 RVA: 0x0000C8EB File Offset: 0x0000ACEB
public MaskableGraphic.CullStateChangedEvent onCullStateChanged
{
get
{
return this.m_OnCullStateChanged;
}
set
{
this.m_OnCullStateChanged = value;
}
}
// Token: 0x170000EA RID: 234
// (get) Token: 0x0600035B RID: 859 RVA: 0x0000C8F8 File Offset: 0x0000ACF8
// (set) Token: 0x0600035C RID: 860 RVA: 0x0000C913 File Offset: 0x0000AD13
public bool maskable
{
get
{
return this.m_Maskable;
}
set
{
if (value != this.m_Maskable)
{
this.m_Maskable = value;
this.m_ShouldRecalculateStencil = true;
this.SetMaterialDirty();
}
}
}
// Token: 0x0600035D RID: 861 RVA: 0x0000C93C File Offset: 0x0000AD3C
public virtual Material GetModifiedMaterial(Material baseMaterial)
{
Material material = baseMaterial;
if (this.m_ShouldRecalculateStencil)
{
Transform transform = MaskUtilities.FindRootSortOverrideCanvas(base.transform);
this.m_StencilValue = ((!this.maskable) ? 0 : MaskUtilities.GetStencilDepth(base.transform, transform));
this.m_ShouldRecalculateStencil = false;
}
Mask component = base.GetComponent<Mask>();
if (this.m_StencilValue > 0 && (component == null || !component.IsActive()))
{
Material material2 = StencilMaterial.Add(material, (1 << this.m_StencilValue) - 1, StencilOp.Keep, CompareFunction.Equal, ColorWriteMask.All, (1 << this.m_StencilValue) - 1, 0);
StencilMaterial.Remove(this.m_MaskMaterial);
this.m_MaskMaterial = material2;
material = this.m_MaskMaterial;
}
return material;
}
// Token: 0x0600035E RID: 862 RVA: 0x0000CA04 File Offset: 0x0000AE04
public virtual void Cull(Rect clipRect, bool validRect)
{
bool flag = !validRect || !clipRect.Overlaps(this.rootCanvasRect, true);
this.UpdateCull(flag);
}
// Token: 0x0600035F RID: 863 RVA: 0x0000CA34 File Offset: 0x0000AE34
private void UpdateCull(bool cull)
{
bool flag = base.canvasRenderer.cull != cull;
base.canvasRenderer.cull = cull;
if (flag)
{
UISystemProfilerApi.AddMarker("MaskableGraphic.cullingChanged", this);
this.m_OnCullStateChanged.Invoke(cull);
this.SetVerticesDirty();
}
}
// Token: 0x06000360 RID: 864 RVA: 0x0000CA85 File Offset: 0x0000AE85
public virtual void SetClipRect(Rect clipRect, bool validRect)
{
if (validRect)
{
base.canvasRenderer.EnableRectClipping(clipRect);
}
else
{
base.canvasRenderer.DisableRectClipping();
}
}
// Token: 0x06000361 RID: 865 RVA: 0x0000CAAA File Offset: 0x0000AEAA
protected override void OnEnable()
{
base.OnEnable();
this.m_ShouldRecalculateStencil = true;
this.UpdateClipParent();
this.SetMaterialDirty();
if (base.GetComponent<Mask>() != null)
{
MaskUtilities.NotifyStencilStateChanged(this);
}
}
// Token: 0x06000362 RID: 866 RVA: 0x0000CAE0 File Offset: 0x0000AEE0
protected override void OnDisable()
{
base.OnDisable();
this.m_ShouldRecalculateStencil = true;
this.SetMaterialDirty();
this.UpdateClipParent();
StencilMaterial.Remove(this.m_MaskMaterial);
this.m_MaskMaterial = null;
if (base.GetComponent<Mask>() != null)
{
MaskUtilities.NotifyStencilStateChanged(this);
}
}
// Token: 0x06000363 RID: 867 RVA: 0x0000CB32 File Offset: 0x0000AF32
protected override void OnTransformParentChanged()
{
base.OnTransformParentChanged();
if (base.isActiveAndEnabled)
{
this.m_ShouldRecalculateStencil = true;
this.UpdateClipParent();
this.SetMaterialDirty();
}
}
// Token: 0x06000364 RID: 868 RVA: 0x0000CB5E File Offset: 0x0000AF5E
[Obsolete("Not used anymore.", true)]
public virtual void ParentMaskStateChanged()
{
}
// Token: 0x06000365 RID: 869 RVA: 0x0000CB61 File Offset: 0x0000AF61
protected override void OnCanvasHierarchyChanged()
{
base.OnCanvasHierarchyChanged();
if (base.isActiveAndEnabled)
{
this.m_ShouldRecalculateStencil = true;
this.UpdateClipParent();
this.SetMaterialDirty();
}
}
// Token: 0x170000EB RID: 235
// (get) Token: 0x06000366 RID: 870 RVA: 0x0000CB90 File Offset: 0x0000AF90
private Rect rootCanvasRect
{
get
{
base.rectTransform.GetWorldCorners(this.m_Corners);
if (base.canvas)
{
Canvas rootCanvas = base.canvas.rootCanvas;
for (int i = 0; i < 4; i++)
{
this.m_Corners[i] = rootCanvas.transform.InverseTransformPoint(this.m_Corners[i]);
}
}
return new Rect(this.m_Corners[0].x, this.m_Corners[0].y, this.m_Corners[2].x - this.m_Corners[0].x, this.m_Corners[2].y - this.m_Corners[0].y);
}
}
// Token: 0x06000367 RID: 871 RVA: 0x0000CC80 File Offset: 0x0000B080
private void UpdateClipParent()
{
RectMask2D rectMask2D = ((!this.maskable || !this.IsActive()) ? null : MaskUtilities.GetRectMaskForClippable(this));
if (this.m_ParentMask != null && (rectMask2D != this.m_ParentMask || !rectMask2D.IsActive()))
{
this.m_ParentMask.RemoveClippable(this);
this.UpdateCull(false);
}
if (rectMask2D != null && rectMask2D.IsActive())
{
rectMask2D.AddClippable(this);
}
this.m_ParentMask = rectMask2D;
}
// Token: 0x06000368 RID: 872 RVA: 0x0000CD18 File Offset: 0x0000B118
public virtual void RecalculateClipping()
{
this.UpdateClipParent();
}
// Token: 0x06000369 RID: 873 RVA: 0x0000CD21 File Offset: 0x0000B121
public virtual void RecalculateMasking()
{
this.m_ShouldRecalculateStencil = true;
this.SetMaterialDirty();
}
// Token: 0x0600036A RID: 874 RVA: 0x0000CD31 File Offset: 0x0000B131
GameObject IClippable.get_gameObject()
{
return base.gameObject;
}
// Token: 0x040001A8 RID: 424
[NonSerialized]
protected bool m_ShouldRecalculateStencil = true;
// Token: 0x040001A9 RID: 425
[NonSerialized]
protected Material m_MaskMaterial;
// Token: 0x040001AA RID: 426
[NonSerialized]
private RectMask2D m_ParentMask;
// Token: 0x040001AB RID: 427
[NonSerialized]
private bool m_Maskable = true;
// Token: 0x040001AC RID: 428
[Obsolete("Not used anymore.", true)]
[NonSerialized]
protected bool m_IncludeForMasking = false;
// Token: 0x040001AD RID: 429
[SerializeField]
private MaskableGraphic.CullStateChangedEvent m_OnCullStateChanged = new MaskableGraphic.CullStateChangedEvent();
// Token: 0x040001AE RID: 430
[Obsolete("Not used anymore", true)]
[NonSerialized]
protected bool m_ShouldRecalculate = true;
// Token: 0x040001AF RID: 431
[NonSerialized]
protected int m_StencilValue;
// Token: 0x040001B0 RID: 432
private readonly Vector3[] m_Corners = new Vector3[4];
// Token: 0x02000063 RID: 99
[Serializable]
public class CullStateChangedEvent : UnityEvent<bool>
{
}
}
}
+45
View File
@@ -0,0 +1,45 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000065 RID: 101
internal static class Misc
{
// Token: 0x06000374 RID: 884 RVA: 0x0001483C File Offset: 0x00012C3C
public static void Destroy(Object obj)
{
if (obj != null)
{
if (Application.isPlaying)
{
if (obj is GameObject)
{
GameObject gameObject = obj as GameObject;
gameObject.transform.parent = null;
}
Object.Destroy(obj);
}
else
{
Object.DestroyImmediate(obj);
}
}
}
// Token: 0x06000375 RID: 885 RVA: 0x00014895 File Offset: 0x00012C95
public static void DestroyImmediate(Object obj)
{
if (obj != null)
{
if (Application.isEditor)
{
Object.DestroyImmediate(obj);
}
else
{
Object.Destroy(obj);
}
}
}
}
}
+145
View File
@@ -0,0 +1,145 @@
using System;
using UnityEngine.Serialization;
namespace UnityEngine.UI
{
// Token: 0x02000066 RID: 102
[Serializable]
public struct Navigation : IEquatable<Navigation>
{
// Token: 0x170000EC RID: 236
// (get) Token: 0x06000376 RID: 886 RVA: 0x000148C4 File Offset: 0x00012CC4
// (set) Token: 0x06000377 RID: 887 RVA: 0x000148DF File Offset: 0x00012CDF
public Navigation.Mode mode
{
get
{
return this.m_Mode;
}
set
{
this.m_Mode = value;
}
}
// Token: 0x170000ED RID: 237
// (get) Token: 0x06000378 RID: 888 RVA: 0x000148EC File Offset: 0x00012CEC
// (set) Token: 0x06000379 RID: 889 RVA: 0x00014907 File Offset: 0x00012D07
public Selectable selectOnUp
{
get
{
return this.m_SelectOnUp;
}
set
{
this.m_SelectOnUp = value;
}
}
// Token: 0x170000EE RID: 238
// (get) Token: 0x0600037A RID: 890 RVA: 0x00014914 File Offset: 0x00012D14
// (set) Token: 0x0600037B RID: 891 RVA: 0x0001492F File Offset: 0x00012D2F
public Selectable selectOnDown
{
get
{
return this.m_SelectOnDown;
}
set
{
this.m_SelectOnDown = value;
}
}
// Token: 0x170000EF RID: 239
// (get) Token: 0x0600037C RID: 892 RVA: 0x0001493C File Offset: 0x00012D3C
// (set) Token: 0x0600037D RID: 893 RVA: 0x00014957 File Offset: 0x00012D57
public Selectable selectOnLeft
{
get
{
return this.m_SelectOnLeft;
}
set
{
this.m_SelectOnLeft = value;
}
}
// Token: 0x170000F0 RID: 240
// (get) Token: 0x0600037E RID: 894 RVA: 0x00014964 File Offset: 0x00012D64
// (set) Token: 0x0600037F RID: 895 RVA: 0x0001497F File Offset: 0x00012D7F
public Selectable selectOnRight
{
get
{
return this.m_SelectOnRight;
}
set
{
this.m_SelectOnRight = value;
}
}
// Token: 0x170000F1 RID: 241
// (get) Token: 0x06000380 RID: 896 RVA: 0x0001498C File Offset: 0x00012D8C
public static Navigation defaultNavigation
{
get
{
return new Navigation
{
m_Mode = Navigation.Mode.Automatic
};
}
}
// Token: 0x06000381 RID: 897 RVA: 0x000149B4 File Offset: 0x00012DB4
public bool Equals(Navigation other)
{
return this.mode == other.mode && this.selectOnUp == other.selectOnUp && this.selectOnDown == other.selectOnDown && this.selectOnLeft == other.selectOnLeft && this.selectOnRight == other.selectOnRight;
}
// Token: 0x040001B1 RID: 433
[FormerlySerializedAs("mode")]
[SerializeField]
private Navigation.Mode m_Mode;
// Token: 0x040001B2 RID: 434
[FormerlySerializedAs("selectOnUp")]
[SerializeField]
private Selectable m_SelectOnUp;
// Token: 0x040001B3 RID: 435
[FormerlySerializedAs("selectOnDown")]
[SerializeField]
private Selectable m_SelectOnDown;
// Token: 0x040001B4 RID: 436
[FormerlySerializedAs("selectOnLeft")]
[SerializeField]
private Selectable m_SelectOnLeft;
// Token: 0x040001B5 RID: 437
[FormerlySerializedAs("selectOnRight")]
[SerializeField]
private Selectable m_SelectOnRight;
// Token: 0x02000067 RID: 103
[Flags]
public enum Mode
{
// Token: 0x040001B7 RID: 439
None = 0,
// Token: 0x040001B8 RID: 440
Horizontal = 1,
// Token: 0x040001B9 RID: 441
Vertical = 2,
// Token: 0x040001BA RID: 442
Automatic = 3,
// Token: 0x040001BB RID: 443
Explicit = 4
}
}
}
+85
View File
@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using UnityEngine.Events;
namespace UnityEngine.UI
{
// Token: 0x020000A2 RID: 162
internal class ObjectPool<T> where T : new()
{
// Token: 0x060005EA RID: 1514 RVA: 0x0001DA56 File Offset: 0x0001BE56
public ObjectPool(UnityAction<T> actionOnGet, UnityAction<T> actionOnRelease)
{
this.m_ActionOnGet = actionOnGet;
this.m_ActionOnRelease = actionOnRelease;
}
// Token: 0x17000195 RID: 405
// (get) Token: 0x060005EB RID: 1515 RVA: 0x0001DA78 File Offset: 0x0001BE78
// (set) Token: 0x060005EC RID: 1516 RVA: 0x0001DA92 File Offset: 0x0001BE92
public int countAll { get; private set; }
// Token: 0x17000196 RID: 406
// (get) Token: 0x060005ED RID: 1517 RVA: 0x0001DA9C File Offset: 0x0001BE9C
public int countActive
{
get
{
return this.countAll - this.countInactive;
}
}
// Token: 0x17000197 RID: 407
// (get) Token: 0x060005EE RID: 1518 RVA: 0x0001DAC0 File Offset: 0x0001BEC0
public int countInactive
{
get
{
return this.m_Stack.Count;
}
}
// Token: 0x060005EF RID: 1519 RVA: 0x0001DAE0 File Offset: 0x0001BEE0
public T Get()
{
T t;
if (this.m_Stack.Count == 0)
{
t = new T();
this.countAll++;
}
else
{
t = this.m_Stack.Pop();
}
if (this.m_ActionOnGet != null)
{
this.m_ActionOnGet(t);
}
return t;
}
// Token: 0x060005F0 RID: 1520 RVA: 0x0001DB48 File Offset: 0x0001BF48
public void Release(T element)
{
if (this.m_Stack.Count > 0 && object.ReferenceEquals(this.m_Stack.Peek(), element))
{
Debug.LogError("Internal error. Trying to destroy object that is already released to pool.");
}
if (this.m_ActionOnRelease != null)
{
this.m_ActionOnRelease(element);
}
this.m_Stack.Push(element);
}
// Token: 0x040002C2 RID: 706
private readonly Stack<T> m_Stack = new Stack<T>();
// Token: 0x040002C3 RID: 707
private readonly UnityAction<T> m_ActionOnGet;
// Token: 0x040002C4 RID: 708
private readonly UnityAction<T> m_ActionOnRelease;
}
}
+45
View File
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
namespace UnityEngine.UI
{
// Token: 0x020000AD RID: 173
[AddComponentMenu("UI/Effects/Outline", 15)]
public class Outline : Shadow
{
// Token: 0x06000622 RID: 1570 RVA: 0x0001E967 File Offset: 0x0001CD67
protected Outline()
{
}
// Token: 0x06000623 RID: 1571 RVA: 0x0001E970 File Offset: 0x0001CD70
public override void ModifyMesh(VertexHelper vh)
{
if (this.IsActive())
{
List<UIVertex> list = ListPool<UIVertex>.Get();
vh.GetUIVertexStream(list);
int num = list.Count * 5;
if (list.Capacity < num)
{
list.Capacity = num;
}
int num2 = 0;
int num3 = list.Count;
base.ApplyShadowZeroAlloc(list, base.effectColor, num2, list.Count, base.effectDistance.x, base.effectDistance.y);
num2 = num3;
num3 = list.Count;
base.ApplyShadowZeroAlloc(list, base.effectColor, num2, list.Count, base.effectDistance.x, -base.effectDistance.y);
num2 = num3;
num3 = list.Count;
base.ApplyShadowZeroAlloc(list, base.effectColor, num2, list.Count, -base.effectDistance.x, base.effectDistance.y);
num2 = num3;
num3 = list.Count;
base.ApplyShadowZeroAlloc(list, base.effectColor, num2, list.Count, -base.effectDistance.x, -base.effectDistance.y);
vh.Clear();
vh.AddUIVertexTriangleStream(list);
ListPool<UIVertex>.Release(list);
}
}
}
}
+26
View File
@@ -0,0 +1,26 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x020000AE RID: 174
[AddComponentMenu("UI/Effects/Position As UV1", 16)]
public class PositionAsUV1 : BaseMeshEffect
{
// Token: 0x06000624 RID: 1572 RVA: 0x0001EACE File Offset: 0x0001CECE
protected PositionAsUV1()
{
}
// Token: 0x06000625 RID: 1573 RVA: 0x0001EAD8 File Offset: 0x0001CED8
public override void ModifyMesh(VertexHelper vh)
{
UIVertex uivertex = default(UIVertex);
for (int i = 0; i < vh.currentVertCount; i++)
{
vh.PopulateUIVertex(ref uivertex, i);
uivertex.uv1 = new Vector2(uivertex.position.x, uivertex.position.y);
vh.SetUIVertex(uivertex, i);
}
}
}
}
+124
View File
@@ -0,0 +1,124 @@
using System;
using UnityEngine.Serialization;
namespace UnityEngine.UI
{
// Token: 0x02000068 RID: 104
[AddComponentMenu("UI/Raw Image", 12)]
public class RawImage : MaskableGraphic
{
// Token: 0x06000382 RID: 898 RVA: 0x00014A35 File Offset: 0x00012E35
protected RawImage()
{
base.useLegacyMeshGeneration = false;
}
// Token: 0x170000F2 RID: 242
// (get) Token: 0x06000383 RID: 899 RVA: 0x00014A64 File Offset: 0x00012E64
public override Texture mainTexture
{
get
{
Texture texture;
if (this.m_Texture == null)
{
if (this.material != null && this.material.mainTexture != null)
{
texture = this.material.mainTexture;
}
else
{
texture = Graphic.s_WhiteTexture;
}
}
else
{
texture = this.m_Texture;
}
return texture;
}
}
// Token: 0x170000F3 RID: 243
// (get) Token: 0x06000384 RID: 900 RVA: 0x00014AD8 File Offset: 0x00012ED8
// (set) Token: 0x06000385 RID: 901 RVA: 0x00014AF3 File Offset: 0x00012EF3
public Texture texture
{
get
{
return this.m_Texture;
}
set
{
if (!(this.m_Texture == value))
{
this.m_Texture = value;
this.SetVerticesDirty();
this.SetMaterialDirty();
}
}
}
// Token: 0x170000F4 RID: 244
// (get) Token: 0x06000386 RID: 902 RVA: 0x00014B20 File Offset: 0x00012F20
// (set) Token: 0x06000387 RID: 903 RVA: 0x00014B3B File Offset: 0x00012F3B
public Rect uvRect
{
get
{
return this.m_UVRect;
}
set
{
if (!(this.m_UVRect == value))
{
this.m_UVRect = value;
this.SetVerticesDirty();
}
}
}
// Token: 0x06000388 RID: 904 RVA: 0x00014B64 File Offset: 0x00012F64
public override void SetNativeSize()
{
Texture mainTexture = this.mainTexture;
if (mainTexture != null)
{
int num = Mathf.RoundToInt((float)mainTexture.width * this.uvRect.width);
int num2 = Mathf.RoundToInt((float)mainTexture.height * this.uvRect.height);
base.rectTransform.anchorMax = base.rectTransform.anchorMin;
base.rectTransform.sizeDelta = new Vector2((float)num, (float)num2);
}
}
// Token: 0x06000389 RID: 905 RVA: 0x00014BEC File Offset: 0x00012FEC
protected override void OnPopulateMesh(VertexHelper vh)
{
Texture mainTexture = this.mainTexture;
vh.Clear();
if (mainTexture != null)
{
Rect pixelAdjustedRect = base.GetPixelAdjustedRect();
Vector4 vector = new Vector4(pixelAdjustedRect.x, pixelAdjustedRect.y, pixelAdjustedRect.x + pixelAdjustedRect.width, pixelAdjustedRect.y + pixelAdjustedRect.height);
float num = (float)mainTexture.width * mainTexture.texelSize.x;
float num2 = (float)mainTexture.height * mainTexture.texelSize.y;
Color color = this.color;
vh.AddVert(new Vector3(vector.x, vector.y), color, new Vector2(this.m_UVRect.xMin * num, this.m_UVRect.yMin * num2));
vh.AddVert(new Vector3(vector.x, vector.w), color, new Vector2(this.m_UVRect.xMin * num, this.m_UVRect.yMax * num2));
vh.AddVert(new Vector3(vector.z, vector.w), color, new Vector2(this.m_UVRect.xMax * num, this.m_UVRect.yMax * num2));
vh.AddVert(new Vector3(vector.z, vector.y), color, new Vector2(this.m_UVRect.xMax * num, this.m_UVRect.yMin * num2));
vh.AddTriangle(0, 1, 2);
vh.AddTriangle(2, 3, 0);
}
}
// Token: 0x040001BC RID: 444
[FormerlySerializedAs("m_Tex")]
[SerializeField]
private Texture m_Texture;
// Token: 0x040001BD RID: 445
[SerializeField]
private Rect m_UVRect = new Rect(0f, 0f, 1f, 1f);
}
}
+179
View File
@@ -0,0 +1,179 @@
using System;
using System.Collections.Generic;
using UnityEngine.EventSystems;
namespace UnityEngine.UI
{
// Token: 0x02000069 RID: 105
[AddComponentMenu("UI/Rect Mask 2D", 13)]
[ExecuteInEditMode]
[DisallowMultipleComponent]
[RequireComponent(typeof(RectTransform))]
public class RectMask2D : UIBehaviour, IClipper, ICanvasRaycastFilter
{
// Token: 0x0600038A RID: 906 RVA: 0x00014D9C File Offset: 0x0001319C
protected RectMask2D()
{
}
// Token: 0x170000F5 RID: 245
// (get) Token: 0x0600038B RID: 907 RVA: 0x00014DC8 File Offset: 0x000131C8
public Rect canvasRect
{
get
{
Canvas canvas = null;
List<Canvas> list = ListPool<Canvas>.Get();
base.gameObject.GetComponentsInParent<Canvas>(false, list);
if (list.Count > 0)
{
canvas = list[list.Count - 1];
}
ListPool<Canvas>.Release(list);
return this.m_VertexClipper.GetCanvasRect(this.rectTransform, canvas);
}
}
// Token: 0x170000F6 RID: 246
// (get) Token: 0x0600038C RID: 908 RVA: 0x00014E28 File Offset: 0x00013228
public RectTransform rectTransform
{
get
{
RectTransform rectTransform;
if ((rectTransform = this.m_RectTransform) == null)
{
rectTransform = (this.m_RectTransform = base.GetComponent<RectTransform>());
}
return rectTransform;
}
}
// Token: 0x0600038D RID: 909 RVA: 0x00014E59 File Offset: 0x00013259
protected override void OnEnable()
{
base.OnEnable();
this.m_ShouldRecalculateClipRects = true;
ClipperRegistry.Register(this);
MaskUtilities.Notify2DMaskStateChanged(this);
}
// Token: 0x0600038E RID: 910 RVA: 0x00014E75 File Offset: 0x00013275
protected override void OnDisable()
{
base.OnDisable();
this.m_ClipTargets.Clear();
this.m_Clippers.Clear();
ClipperRegistry.Unregister(this);
MaskUtilities.Notify2DMaskStateChanged(this);
}
// Token: 0x0600038F RID: 911 RVA: 0x00014EA0 File Offset: 0x000132A0
public virtual bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera)
{
return !base.isActiveAndEnabled || RectTransformUtility.RectangleContainsScreenPoint(this.rectTransform, sp, eventCamera);
}
// Token: 0x06000390 RID: 912 RVA: 0x00014ED4 File Offset: 0x000132D4
public virtual void PerformClipping()
{
if (this.m_ShouldRecalculateClipRects)
{
MaskUtilities.GetRectMasksForClip(this, this.m_Clippers);
this.m_ShouldRecalculateClipRects = false;
}
bool flag = true;
Rect rect = Clipping.FindCullAndClipWorldRect(this.m_Clippers, out flag);
bool flag2 = rect != this.m_LastClipRectCanvasSpace;
if (flag2 || this.m_ForceClip)
{
foreach (IClippable clippable in this.m_ClipTargets)
{
clippable.SetClipRect(rect, flag);
}
this.m_LastClipRectCanvasSpace = rect;
this.m_LastValidClipRect = flag;
}
foreach (IClippable clippable2 in this.m_ClipTargets)
{
MaskableGraphic maskableGraphic = clippable2 as MaskableGraphic;
if (!(maskableGraphic != null) || maskableGraphic.canvasRenderer.hasMoved || flag2)
{
clippable2.Cull(this.m_LastClipRectCanvasSpace, this.m_LastValidClipRect);
}
}
}
// Token: 0x06000391 RID: 913 RVA: 0x00015020 File Offset: 0x00013420
public void AddClippable(IClippable clippable)
{
if (clippable != null)
{
this.m_ShouldRecalculateClipRects = true;
if (!this.m_ClipTargets.Contains(clippable))
{
this.m_ClipTargets.Add(clippable);
}
this.m_ForceClip = true;
}
}
// Token: 0x06000392 RID: 914 RVA: 0x0001505C File Offset: 0x0001345C
public void RemoveClippable(IClippable clippable)
{
if (clippable != null)
{
this.m_ShouldRecalculateClipRects = true;
clippable.SetClipRect(default(Rect), false);
this.m_ClipTargets.Remove(clippable);
this.m_ForceClip = true;
}
}
// Token: 0x06000393 RID: 915 RVA: 0x000150A0 File Offset: 0x000134A0
protected override void OnTransformParentChanged()
{
base.OnTransformParentChanged();
this.m_ShouldRecalculateClipRects = true;
}
// Token: 0x06000394 RID: 916 RVA: 0x000150B0 File Offset: 0x000134B0
protected override void OnCanvasHierarchyChanged()
{
base.OnCanvasHierarchyChanged();
this.m_ShouldRecalculateClipRects = true;
}
// Token: 0x040001BE RID: 446
[NonSerialized]
private readonly RectangularVertexClipper m_VertexClipper = new RectangularVertexClipper();
// Token: 0x040001BF RID: 447
[NonSerialized]
private RectTransform m_RectTransform;
// Token: 0x040001C0 RID: 448
[NonSerialized]
private HashSet<IClippable> m_ClipTargets = new HashSet<IClippable>();
// Token: 0x040001C1 RID: 449
[NonSerialized]
private bool m_ShouldRecalculateClipRects;
// Token: 0x040001C2 RID: 450
[NonSerialized]
private List<RectMask2D> m_Clippers = new List<RectMask2D>();
// Token: 0x040001C3 RID: 451
[NonSerialized]
private Rect m_LastClipRectCanvasSpace;
// Token: 0x040001C4 RID: 452
[NonSerialized]
private bool m_LastValidClipRect;
// Token: 0x040001C5 RID: 453
[NonSerialized]
private bool m_ForceClip;
}
}
@@ -0,0 +1,35 @@
using System;
namespace UnityEngine.UI
{
// Token: 0x02000086 RID: 134
internal class RectangularVertexClipper
{
// Token: 0x060004F7 RID: 1271 RVA: 0x0001A858 File Offset: 0x00018C58
public Rect GetCanvasRect(RectTransform t, Canvas c)
{
Rect rect;
if (c == null)
{
rect = default(Rect);
}
else
{
t.GetWorldCorners(this.m_WorldCorners);
Transform component = c.GetComponent<Transform>();
for (int i = 0; i < 4; i++)
{
this.m_CanvasCorners[i] = component.InverseTransformPoint(this.m_WorldCorners[i]);
}
rect = new Rect(this.m_CanvasCorners[0].x, this.m_CanvasCorners[0].y, this.m_CanvasCorners[2].x - this.m_CanvasCorners[0].x, this.m_CanvasCorners[2].y - this.m_CanvasCorners[0].y);
}
return rect;
}
// Token: 0x04000257 RID: 599
private readonly Vector3[] m_WorldCorners = new Vector3[4];
// Token: 0x04000258 RID: 600
private readonly Vector3[] m_CanvasCorners = new Vector3[4];
}
}
+102
View File
@@ -0,0 +1,102 @@
using System;
using System.Reflection;
using UnityEngineInternal;
namespace UnityEngine.UI
{
// Token: 0x020000A3 RID: 163
internal class ReflectionMethodsCache
{
// Token: 0x060005F1 RID: 1521 RVA: 0x0001DBB4 File Offset: 0x0001BFB4
public ReflectionMethodsCache()
{
MethodInfo method = typeof(Physics).GetMethod("Raycast", new Type[]
{
typeof(Ray),
typeof(RaycastHit).MakeByRefType(),
typeof(float),
typeof(int)
});
if (method != null)
{
this.raycast3D = (ReflectionMethodsCache.Raycast3DCallback)ScriptingUtils.CreateDelegate(typeof(ReflectionMethodsCache.Raycast3DCallback), method);
}
MethodInfo method2 = typeof(Physics2D).GetMethod("Raycast", new Type[]
{
typeof(Vector2),
typeof(Vector2),
typeof(float),
typeof(int)
});
if (method2 != null)
{
this.raycast2D = (ReflectionMethodsCache.Raycast2DCallback)ScriptingUtils.CreateDelegate(typeof(ReflectionMethodsCache.Raycast2DCallback), method2);
}
MethodInfo method3 = typeof(Physics).GetMethod("RaycastAll", new Type[]
{
typeof(Ray),
typeof(float),
typeof(int)
});
if (method3 != null)
{
this.raycast3DAll = (ReflectionMethodsCache.RaycastAllCallback)ScriptingUtils.CreateDelegate(typeof(ReflectionMethodsCache.RaycastAllCallback), method3);
}
MethodInfo method4 = typeof(Physics2D).GetMethod("GetRayIntersectionAll", new Type[]
{
typeof(Ray),
typeof(float),
typeof(int)
});
if (method4 != null)
{
this.getRayIntersectionAll = (ReflectionMethodsCache.GetRayIntersectionAllCallback)ScriptingUtils.CreateDelegate(typeof(ReflectionMethodsCache.GetRayIntersectionAllCallback), method4);
}
}
// Token: 0x17000198 RID: 408
// (get) Token: 0x060005F2 RID: 1522 RVA: 0x0001DD90 File Offset: 0x0001C190
public static ReflectionMethodsCache Singleton
{
get
{
if (ReflectionMethodsCache.s_ReflectionMethodsCache == null)
{
ReflectionMethodsCache.s_ReflectionMethodsCache = new ReflectionMethodsCache();
}
return ReflectionMethodsCache.s_ReflectionMethodsCache;
}
}
// Token: 0x040002C6 RID: 710
public ReflectionMethodsCache.Raycast3DCallback raycast3D = null;
// Token: 0x040002C7 RID: 711
public ReflectionMethodsCache.RaycastAllCallback raycast3DAll = null;
// Token: 0x040002C8 RID: 712
public ReflectionMethodsCache.Raycast2DCallback raycast2D = null;
// Token: 0x040002C9 RID: 713
public ReflectionMethodsCache.GetRayIntersectionAllCallback getRayIntersectionAll = null;
// Token: 0x040002CA RID: 714
private static ReflectionMethodsCache s_ReflectionMethodsCache = null;
// Token: 0x020000A4 RID: 164
// (Invoke) Token: 0x060005F5 RID: 1525
public delegate bool Raycast3DCallback(Ray r, out RaycastHit hit, float f, int i);
// Token: 0x020000A5 RID: 165
// (Invoke) Token: 0x060005F9 RID: 1529
public delegate RaycastHit2D Raycast2DCallback(Vector2 p1, Vector2 p2, float f, int i);
// Token: 0x020000A6 RID: 166
// (Invoke) Token: 0x060005FD RID: 1533
public delegate RaycastHit[] RaycastAllCallback(Ray r, float f, int i);
// Token: 0x020000A7 RID: 167
// (Invoke) Token: 0x06000601 RID: 1537
public delegate RaycastHit2D[] GetRayIntersectionAllCallback(Ray r, float f, int i);
}
}

Some files were not shown because too many files have changed in this diff Show More