Decompiled source of RuntimeInspector v4.0.1
plugins/RuntimeInspector/DynamicPanels.Runtime.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Text; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: InternalsVisibleTo("DynamicPanels.Editor")] [assembly: AssemblyVersion("0.0.0.0")] namespace DynamicPanels; [DisallowMultipleComponent] public abstract class AnchorZoneBase : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerDownHandler, IPointerExitHandler { protected Panel m_panel; private Graphic raycastZone; private int hoveredPointerId = -98765; public Panel Panel => m_panel; public RectTransform RectTransform { get; private set; } public DynamicPanelsCanvas Canvas => m_panel.Canvas; protected void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RectTransform = (RectTransform)((Component)this).transform; raycastZone = (Graphic)(object)((Component)this).gameObject.AddComponent<NonDrawingGraphic>(); } protected void OnEnable() { hoveredPointerId = -98765; } public abstract bool Execute(PanelTab panelTab, PointerEventData eventData); public abstract bool GetAnchoredPreviewRectangleAt(PointerEventData eventData, out Rect rect); public void Initialize(Panel panel) { m_panel = panel; } public void SetActive(bool value) { hoveredPointerId = -98765; raycastZone.raycastTarget = value; } public void OnPointerEnter(PointerEventData eventData) { if (PanelManager.Instance.AnchorPreviewPanelTo(this)) { hoveredPointerId = eventData.pointerId; } } public void OnPointerDown(PointerEventData eventData) { PanelManager.Instance.CancelDraggingPanel(); } public void OnPointerExit(PointerEventData eventData) { if (eventData.pointerId == hoveredPointerId) { hoveredPointerId = -98765; PanelManager.Instance.StopAnchorPreviewPanelTo(this); } } } public class CanvasAnchorZone : AnchorZoneBase { private Direction direction; public void SetDirection(Direction direction) { this.direction = direction; } public override bool Execute(PanelTab panelTab, PointerEventData eventData) { Panel source = PanelManager.Instance.DetachPanelTab(panelTab.Panel, panelTab.Panel.GetTabIndex(panelTab)); PanelManager.Instance.AnchorPanel(source, m_panel.Canvas, direction); return true; } public override bool GetAnchoredPreviewRectangleAt(PointerEventData eventData, out Rect rect) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) Vector2 size = m_panel.Canvas.Size; if (direction == Direction.Left) { rect = new Rect(0f, 0f, size.x * 0.2f, size.y); } else if (direction == Direction.Top) { rect = new Rect(0f, size.y * 0.8f, size.x, size.y * 0.2f); } else if (direction == Direction.Right) { rect = new Rect(size.x * 0.8f, 0f, size.x * 0.2f, size.y); } else { rect = new Rect(0f, 0f, size.x, size.y * 0.2f); } ((Rect)(ref rect)).position = ((Rect)(ref rect)).position + (((Rect)(ref rect)).size - size) * 0.5f; return true; } } public class PanelAnchorZone : AnchorZoneBase { public override bool Execute(PanelTab panelTab, PointerEventData eventData) { Direction anchorDirection = GetAnchorDirection(eventData); if (anchorDirection == Direction.None) { return false; } Panel source = PanelManager.Instance.DetachPanelTab(panelTab.Panel, panelTab.Panel.GetTabIndex(panelTab)); PanelManager.Instance.AnchorPanel(source, m_panel, anchorDirection); return true; } public override bool GetAnchoredPreviewRectangleAt(PointerEventData eventData, out Rect rect) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) Direction anchorDirection = GetAnchorDirection(eventData); if (anchorDirection == Direction.None) { rect = default(Rect); return false; } Vector2 sizeDelta = m_panel.RectTransform.sizeDelta; sizeDelta.y -= m_panel.Internal.HeaderHeight; float num = Mathf.Min(m_panel.Canvas.PanelAnchorZoneLength, sizeDelta.x * m_panel.Canvas.PanelAnchorZoneLengthRatio); float num2 = Mathf.Min(m_panel.Canvas.PanelAnchorZoneLength, sizeDelta.y * m_panel.Canvas.PanelAnchorZoneLengthRatio); switch (anchorDirection) { case Direction.Left: rect = new Rect(0f, 0f, num, sizeDelta.y); break; case Direction.Top: rect = new Rect(0f, sizeDelta.y - num2, sizeDelta.x, num2); break; case Direction.Right: rect = new Rect(sizeDelta.x - num, 0f, num, sizeDelta.y); break; default: rect = new Rect(0f, 0f, sizeDelta.x, num2); break; } ((Rect)(ref rect)).position = ((Rect)(ref rect)).position + (m_panel.RectTransform.anchoredPosition + (((Rect)(ref rect)).size - m_panel.Canvas.Size) * 0.5f); return true; } private Direction GetAnchorDirection(PointerEventData eventData) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(m_panel.RectTransform, eventData.position, m_panel.Canvas.Internal.worldCamera, ref val); Vector2 sizeDelta = m_panel.RectTransform.sizeDelta; sizeDelta.y -= m_panel.Internal.HeaderHeight; float num = Mathf.Min(m_panel.Canvas.PanelAnchorZoneLength, sizeDelta.x * m_panel.Canvas.PanelAnchorZoneLengthRatio); float num2 = Mathf.Min(m_panel.Canvas.PanelAnchorZoneLength, sizeDelta.y * m_panel.Canvas.PanelAnchorZoneLengthRatio); if (val.y < num2) { return Direction.Bottom; } if (val.y > sizeDelta.y - num2) { return Direction.Top; } if (val.x < num) { return Direction.Left; } if (val.x > sizeDelta.x - num) { return Direction.Right; } return Direction.None; } } public class PanelHeaderAnchorZone : AnchorZoneBase { public override bool Execute(PanelTab panelTab, PointerEventData eventData) { Vector2 tabPreviewRect; int tabIndexAt = m_panel.Internal.GetTabIndexAt(eventData, out tabPreviewRect); m_panel.AddTab(panelTab.Content, tabIndexAt); return true; } public override bool GetAnchoredPreviewRectangleAt(PointerEventData eventData, out Rect rect) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) m_panel.Internal.GetTabIndexAt(eventData, out var tabPreviewRect); rect = new Rect(tabPreviewRect.x, m_panel.RectTransform.sizeDelta.y - m_panel.Internal.HeaderHeight, tabPreviewRect.y, m_panel.Internal.HeaderHeight); ((Rect)(ref rect)).position = ((Rect)(ref rect)).position + (m_panel.RectTransform.anchoredPosition + (((Rect)(ref rect)).size - m_panel.Canvas.Size) * 0.5f); return true; } } [DisallowMultipleComponent] public class DynamicPanelsCanvas : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, ISerializationCallbackReceiver { internal class InternalSettings { private readonly DynamicPanelsCanvas canvas; public readonly Camera worldCamera; public Panel DummyPanel => canvas.dummyPanel; public List<PanelProperties> InitialPanelsUnanchored { get { if (canvas.initialPanelsUnanchored == null) { canvas.initialPanelsUnanchored = new List<PanelProperties>(); } return canvas.initialPanelsUnanchored; } } public AnchoredPanelProperties InitialPanelsAnchored { get { if (canvas.initialPanelsAnchored == null) { canvas.initialPanelsAnchored = new AnchoredPanelProperties(); } return canvas.initialPanelsAnchored; } } public InternalSettings(DynamicPanelsCanvas canvas) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 this.canvas = canvas; if ((int)canvas.UnityCanvas.renderMode == 0 || ((int)canvas.UnityCanvas.renderMode == 1 && !Object.op_Implicit((Object)(object)canvas.UnityCanvas.worldCamera))) { worldCamera = null; } else { worldCamera = (Object.op_Implicit((Object)(object)canvas.UnityCanvas.worldCamera) ? canvas.UnityCanvas.worldCamera : Camera.main); } } public bool IsLastDockedPanel(Panel panel) { if (panel.IsDocked) { return !PanelGroupHasAnyOtherPanels(canvas.RootPanelGroup, panel); } return false; } private bool PanelGroupHasAnyOtherPanels(PanelGroup group, Panel panel) { for (int i = 0; i < group.Count; i++) { if (group[i] is Panel) { Panel panel2 = (Panel)group[i]; if ((Object)(object)panel2 != (Object)(object)panel && (Object)(object)panel2 != (Object)(object)canvas.dummyPanel) { return true; } } else if (PanelGroupHasAnyOtherPanels((PanelGroup)group[i], panel)) { return true; } } return false; } public void OnApplicationQuit() { canvas.OnApplicationQuitting(); } public void AnchorZonesSetActive(bool value) { canvas.AnchorZonesSetActive(value); } public void ReceiveRaycasts(bool value) { canvas.background.raycastTarget = value; } } [Serializable] public class PanelProperties { public List<PanelTabProperties> tabs = new List<PanelTabProperties>(); } public class AnchoredPanelProperties { public PanelProperties panel = new PanelProperties(); public Direction anchorDirection; public Vector2 initialSize; public List<AnchoredPanelProperties> subPanels = new List<AnchoredPanelProperties>(); } [Serializable] public struct SerializableAnchoredPanelProperties { public PanelProperties panel; public Direction anchorDirection; public Vector2 initialSize; public int childCount; public int indexOfFirstChild; } [Serializable] public class PanelTabProperties : ISerializationCallbackReceiver { public RectTransform content; public string id; public Vector2 minimumSize = new Vector2(250f, 300f); public string tabLabel = "Panel"; public Sprite tabIcon; void ISerializationCallbackReceiver.OnBeforeSerialize() { if (string.IsNullOrEmpty(id)) { id = Guid.NewGuid().ToString(); } } void ISerializationCallbackReceiver.OnAfterDeserialize() { } } [SerializeField] [HideInInspector] private string m_id; private Panel dummyPanel; private Graphic background; private RectTransform anchorZonesParent; private readonly CanvasAnchorZone[] anchorZones = new CanvasAnchorZone[4]; [SerializeField] private bool m_leaveFreeSpace = true; [SerializeField] private Vector2 minimumFreeSpace = new Vector2(50f, 50f); [SerializeField] private RectTransform freeSpaceTargetTransform; private Vector2 freeSpacePrevPos; private Vector2 freeSpacePrevSize; public bool PreventDetachingLastDockedPanel; [SerializeField] private float m_panelResizableAreaLength = 12f; [SerializeField] private float m_canvasAnchorZoneLength = 20f; [SerializeField] private float m_panelAnchorZoneLength = 100f; private const float m_panelAnchorZoneLengthRatio = 0.31f; [SerializeField] private List<PanelProperties> initialPanelsUnanchored; [SerializeField] [HideInInspector] private List<SerializableAnchoredPanelProperties> initialPanelsAnchoredSerialized; private AnchoredPanelProperties initialPanelsAnchored; private bool updateBounds = true; private bool isDirty; private bool isQuitting; public RectTransform RectTransform { get; private set; } public Canvas UnityCanvas { get; private set; } internal InternalSettings Internal { get; private set; } public string ID { get { return m_id; } set { m_id = value; } } public UnanchoredPanelGroup UnanchoredPanelGroup { get; private set; } public PanelGroup RootPanelGroup { get; private set; } public Vector2 Size { get; private set; } public bool LeaveFreeSpace { get { return m_leaveFreeSpace; } set { m_leaveFreeSpace = value; if (!m_leaveFreeSpace) { dummyPanel.Detach(); } else if (!dummyPanel.IsDocked) { if (RootPanelGroup.Count <= 1) { RootPanelGroup.AddElement(dummyPanel); } else { RootPanelGroup.AddElementBefore(RootPanelGroup[RootPanelGroup.Count / 2], dummyPanel); } } } } public float PanelResizableAreaLength => m_panelResizableAreaLength; public float CanvasAnchorZoneLength => m_canvasAnchorZoneLength; public float PanelAnchorZoneLength => m_panelAnchorZoneLength; public float PanelAnchorZoneLengthRatio => 0.31f; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) RectTransform = (RectTransform)((Component)this).transform; UnityCanvas = ((Component)this).GetComponentInParent<Canvas>(); Internal = new InternalSettings(this); UnanchoredPanelGroup = new UnanchoredPanelGroup(this); RectTransform.ChangePivotWithoutAffectingPosition(new Vector2(0.5f, 0.5f)); if (!Object.op_Implicit((Object)(object)((Component)this).GetComponent<RectMask2D>())) { ((Component)this).gameObject.AddComponent<RectMask2D>(); } Rect rect = RectTransform.rect; Size = ((Rect)(ref rect)).size; InitializeRootGroup(); InitializeAnchorZones(); background = ((Component)this).GetComponent<Graphic>(); if (!Object.op_Implicit((Object)(object)background)) { background = (Graphic)(object)((Component)this).gameObject.AddComponent<NonDrawingGraphic>(); background.raycastTarget = false; } PanelManager.Instance.RegisterCanvas(this); Application.quitting -= OnApplicationQuitting; Application.quitting += OnApplicationQuitting; } private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) Rect rect = RectTransform.rect; Size = ((Rect)(ref rect)).size; HashSet<Transform> hashSet = new HashSet<Transform>(); Transform val = ((Component)this).transform; while (Object.op_Implicit((Object)(object)val)) { hashSet.Add(val); val = val.parent; } Dictionary<Panel, Vector2> dictionary = null; if (initialPanelsAnchored != null) { dictionary = new Dictionary<Panel, Vector2>(initialPanelsAnchoredSerialized.Count); CreateAnchoredPanelsRecursively(initialPanelsAnchored.subPanels, dummyPanel, hashSet, dictionary); } if (initialPanelsUnanchored != null) { for (int i = 0; i < initialPanelsUnanchored.Count; i++) { CreateInitialPanel(initialPanelsUnanchored[i], null, Direction.None, hashSet); } } initialPanelsUnanchored = null; initialPanelsAnchored = null; initialPanelsAnchoredSerialized = null; if (Object.op_Implicit((Object)(object)freeSpaceTargetTransform)) { if ((Object)(object)((Transform)freeSpaceTargetTransform).parent != (Object)(object)RectTransform) { ((Transform)freeSpaceTargetTransform).SetParent((Transform)(object)RectTransform, false); } freeSpaceTargetTransform.anchorMin = Vector2.zero; freeSpaceTargetTransform.anchorMax = Vector2.zero; freeSpaceTargetTransform.pivot = Vector2.zero; ((Transform)freeSpaceTargetTransform).SetAsFirstSibling(); } LeaveFreeSpace = m_leaveFreeSpace; LateUpdate(); if (m_leaveFreeSpace) { dummyPanel.ResizeTo(new Vector2(99999f, 99999f)); } if (dictionary != null) { ResizeAnchoredPanelsRecursively(RootPanelGroup, dictionary); } } private void OnDestroy() { Application.quitting -= OnApplicationQuitting; if (!isQuitting) { PanelManager.Instance.UnregisterCanvas(this); } } private void OnApplicationQuitting() { isQuitting = true; } private void LateUpdate() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (isDirty) { PanelManager.Instance.StopCanvasOperations(this); RootPanelGroup.Internal.UpdateLayout(); UnanchoredPanelGroup.Internal.UpdateLayout(); RootPanelGroup.Internal.UpdateSurroundings(null, null, null, null); } if (updateBounds) { UpdateBounds(); updateBounds = false; } if (isDirty) { RootPanelGroup.Internal.EnsureMinimumSize(); UnanchoredPanelGroup.Internal.EnsureMinimumSize(); isDirty = false; } if (m_leaveFreeSpace && Object.op_Implicit((Object)(object)freeSpaceTargetTransform)) { Vector2 position = dummyPanel.Position; Vector2 size = dummyPanel.Size; if (position != freeSpacePrevPos || size != freeSpacePrevSize) { freeSpacePrevPos = position; freeSpacePrevSize = size; freeSpaceTargetTransform.anchoredPosition = position; freeSpaceTargetTransform.sizeDelta = size; } } } public void SetDirty() { isDirty = true; updateBounds = true; } public void ForceRebuildLayoutImmediate() { LateUpdate(); } void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData) { PanelManager.Instance.OnPointerEnteredCanvas(this, eventData); } private void OnRectTransformDimensionsChange() { updateBounds = true; } private void UpdateBounds() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Rect rect = RectTransform.rect; Size = ((Rect)(ref rect)).size; RootPanelGroup.Internal.UpdateBounds(Vector2.zero, Size); UnanchoredPanelGroup.Internal.UpdateBounds(Vector2.zero, Size); } private void CreateAnchoredPanelsRecursively(List<AnchoredPanelProperties> anchoredPanels, Panel rootPanel, HashSet<Transform> createdTabs, Dictionary<Panel, Vector2> initialSizes) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (anchoredPanels == null) { return; } for (int i = 0; i < anchoredPanels.Count; i++) { Panel panel = CreateInitialPanel(anchoredPanels[i].panel, rootPanel, anchoredPanels[i].anchorDirection, createdTabs); if ((Object)(object)panel == (Object)null) { panel = rootPanel; } else if (anchoredPanels[i].initialSize != Vector2.zero) { initialSizes[panel] = anchoredPanels[i].initialSize; } CreateAnchoredPanelsRecursively(anchoredPanels[i].subPanels, panel, createdTabs, initialSizes); } } private void ResizeAnchoredPanelsRecursively(PanelGroup group, Dictionary<Panel, Vector2> initialSizes) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (group == null) { return; } int count = group.Count; for (int i = 0; i < count; i++) { Panel panel = group[i] as Panel; if ((Object)(object)panel != (Object)null) { if (initialSizes.TryGetValue(panel, out var value)) { panel.ResizeTo(value, Direction.Right, Direction.Top); } } else { ResizeAnchoredPanelsRecursively(group[i] as PanelGroup, initialSizes); } } } private Panel CreateInitialPanel(PanelProperties properties, Panel anchor, Direction anchorDirection, HashSet<Transform> createdTabs) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) Panel panel = null; for (int i = 0; i < properties.tabs.Count; i++) { PanelTabProperties panelTabProperties = properties.tabs[i]; if (Object.op_Implicit((Object)(object)panelTabProperties.content) && !createdTabs.Contains((Transform)(object)panelTabProperties.content)) { if ((Object)(object)((Transform)panelTabProperties.content).parent != (Object)(object)RectTransform) { ((Transform)panelTabProperties.content).SetParent((Transform)(object)RectTransform, false); } PanelTab panelTab; if ((Object)(object)panel == (Object)null) { panel = PanelUtils.CreatePanelFor(panelTabProperties.content, this); panelTab = panel[0]; } else { panelTab = panel.AddTab(panelTabProperties.content); } panelTab.Icon = panelTabProperties.tabIcon; panelTab.Label = panelTabProperties.tabLabel; panelTab.MinSize = panelTabProperties.minimumSize; panelTab.ID = panelTabProperties.id; createdTabs.Add((Transform)(object)panelTabProperties.content); } } if ((Object)(object)panel != (Object)null) { panel.ActiveTab = 0; if ((Object)(object)anchor != (Object)null && anchorDirection != Direction.None) { panel.DockToPanel(anchor, anchorDirection); } } return panel; } private void InitializeRootGroup() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) dummyPanel = PanelUtils.Internal.CreatePanel(null, this); ((Object)((Component)dummyPanel).gameObject).name = "DummyPanel"; dummyPanel.CanvasGroup.alpha = 0f; dummyPanel.Internal.SetDummy(minimumFreeSpace); RootPanelGroup = new PanelGroup(this, Direction.Right); RootPanelGroup.AddElement(dummyPanel); } private void InitializeAnchorZones() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) anchorZonesParent = (RectTransform)new GameObject("CanvasAnchorZone", new Type[1] { typeof(RectTransform) }).transform; ((Transform)anchorZonesParent).SetParent((Transform)(object)RectTransform, false); anchorZonesParent.anchorMin = Vector2.zero; anchorZonesParent.anchorMax = Vector2.one; anchorZonesParent.sizeDelta = Vector2.zero; CreateAnchorZone(Direction.Left, new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(m_canvasAnchorZoneLength, 0f)); CreateAnchorZone(Direction.Top, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, m_canvasAnchorZoneLength)); CreateAnchorZone(Direction.Right, new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(m_canvasAnchorZoneLength, 0f)); CreateAnchorZone(Direction.Bottom, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, m_canvasAnchorZoneLength)); for (int i = 0; i < anchorZones.Length; i++) { anchorZones[i].SetActive(value: false); } } private void CreateAnchorZone(Direction direction, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) CanvasAnchorZone canvasAnchorZone = new GameObject("AnchorZone" + direction, new Type[1] { typeof(RectTransform) }).AddComponent<CanvasAnchorZone>(); canvasAnchorZone.Initialize(dummyPanel); canvasAnchorZone.SetDirection(direction); ((Transform)canvasAnchorZone.RectTransform).SetParent((Transform)(object)anchorZonesParent, false); canvasAnchorZone.RectTransform.pivot = anchorMin; canvasAnchorZone.RectTransform.anchorMin = anchorMin; canvasAnchorZone.RectTransform.anchorMax = anchorMax; canvasAnchorZone.RectTransform.anchoredPosition = Vector2.zero; canvasAnchorZone.RectTransform.sizeDelta = sizeDelta; anchorZones[(int)direction] = canvasAnchorZone; } private void AnchorZonesSetActive(bool value) { if (((Behaviour)this).enabled) { if (value) { ((Transform)anchorZonesParent).SetAsLastSibling(); } for (int i = 0; i < anchorZones.Length; i++) { anchorZones[i].SetActive(value); } } } [ContextMenu("Save Layout")] public void SaveLayout() { PanelSerialization.SerializeCanvas(this); } [ContextMenu("Load Layout")] public void LoadLayout() { PanelSerialization.DeserializeCanvas(this); } void ISerializationCallbackReceiver.OnBeforeSerialize() { if (initialPanelsAnchoredSerialized == null) { initialPanelsAnchoredSerialized = new List<SerializableAnchoredPanelProperties>(); } else { initialPanelsAnchoredSerialized.Clear(); } if (initialPanelsAnchored == null) { initialPanelsAnchored = new AnchoredPanelProperties(); } if (string.IsNullOrEmpty(m_id)) { m_id = Guid.NewGuid().ToString(); } AddToSerializedAnchoredPanelProperties(initialPanelsAnchored); } void ISerializationCallbackReceiver.OnAfterDeserialize() { if (initialPanelsAnchoredSerialized != null && initialPanelsAnchoredSerialized.Count > 0) { ReadFromSerializedAnchoredPanelProperties(0, out initialPanelsAnchored); } else { initialPanelsAnchored = new AnchoredPanelProperties(); } } private void AddToSerializedAnchoredPanelProperties(AnchoredPanelProperties props) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) SerializableAnchoredPanelProperties serializableAnchoredPanelProperties = default(SerializableAnchoredPanelProperties); serializableAnchoredPanelProperties.panel = props.panel; serializableAnchoredPanelProperties.anchorDirection = props.anchorDirection; serializableAnchoredPanelProperties.initialSize = props.initialSize; serializableAnchoredPanelProperties.childCount = props.subPanels.Count; serializableAnchoredPanelProperties.indexOfFirstChild = initialPanelsAnchoredSerialized.Count + 1; SerializableAnchoredPanelProperties item = serializableAnchoredPanelProperties; initialPanelsAnchoredSerialized.Add(item); for (int i = 0; i < props.subPanels.Count; i++) { AddToSerializedAnchoredPanelProperties(props.subPanels[i]); } } private int ReadFromSerializedAnchoredPanelProperties(int index, out AnchoredPanelProperties props) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) SerializableAnchoredPanelProperties serializableAnchoredPanelProperties = initialPanelsAnchoredSerialized[index]; AnchoredPanelProperties anchoredPanelProperties = new AnchoredPanelProperties { panel = serializableAnchoredPanelProperties.panel, anchorDirection = serializableAnchoredPanelProperties.anchorDirection, initialSize = serializableAnchoredPanelProperties.initialSize, subPanels = new List<AnchoredPanelProperties>() }; for (int i = 0; i != serializableAnchoredPanelProperties.childCount; i++) { index = ReadFromSerializedAnchoredPanelProperties(++index, out var props2); anchoredPanelProperties.subPanels.Add(props2); } props = anchoredPanelProperties; return index; } } public interface IPanelGroupElement { DynamicPanelsCanvas Canvas { get; } PanelGroup Group { get; } Vector2 Position { get; } Vector2 Size { get; } Vector2 MinSize { get; } void ResizeTo(Vector2 newSize, Direction horizontalDir = Direction.Right, Direction verticalDir = Direction.Bottom); void DockToRoot(Direction direction); void DockToPanel(IPanelGroupElement anchor, Direction direction); IPanelGroupElement GetSurroundingElement(Direction direction); } public class PanelGroup : IPanelGroupElement { internal class InternalSettings { private readonly PanelGroup group; public InternalSettings(PanelGroup group) { this.group = group; } public void SetDirty() { group.SetDirty(); } public void UpdateBounds(Vector2 position, Vector2 size) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) group.UpdateBounds(position, size); } public void UpdateLayout() { group.UpdateLayout(); } public void UpdateSurroundings(IPanelGroupElement left, IPanelGroupElement top, IPanelGroupElement right, IPanelGroupElement bottom) { group.UpdateSurroundings(left, top, right, bottom); } public void TryChangeSizeOf(IPanelGroupElement element, Direction direction, float deltaSize) { group.TryChangeSizeOf(element, direction, deltaSize); } public void ResizeElementTo(IPanelGroupElement element, Vector2 newSize, Direction horizontalDir, Direction verticalDir) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) group.ResizeElementTo(element, newSize, horizontalDir, verticalDir); } public void ReplaceElement(IPanelGroupElement beforeElement, IPanelGroupElement afterElement) { group.ReplaceElement(beforeElement, afterElement); } public void EnsureMinimumSize() { for (int i = 0; i < group.elements.Count; i++) { group.EnsureMinimumSizeOf(group.elements[i]); } } } private class ElementDirtyProperties { public IPanelGroupElement element; public float posX; public float posY; public float sizeX; public float sizeY; public ElementDirtyProperties() { } public ElementDirtyProperties(IPanelGroupElement element) { this.element = element; } public void Reset(IPanelGroupElement element) { this.element = element; posX = (posY = (sizeX = (sizeY = 0f))); } } protected const float MIN_SIZE_TOLERANCE = 0.0001f; protected readonly Direction direction; protected readonly List<IPanelGroupElement> elements; protected readonly IPanelGroupElement[] surroundings; private List<ElementDirtyProperties> resizeProperties; private int resizePropsIndex; protected bool isDirty; public DynamicPanelsCanvas Canvas { get; private set; } public PanelGroup Group { get; protected set; } internal InternalSettings Internal { get; private set; } public Vector2 Position { get; protected set; } public Vector2 Size { get; protected set; } public Vector2 MinSize { get; protected set; } public int Count => elements.Count; public IPanelGroupElement this[int index] => elements[index]; public PanelGroup(DynamicPanelsCanvas canvas, Direction direction) { Canvas = canvas; Internal = new InternalSettings(this); this.direction = direction; elements = new List<IPanelGroupElement>(2); surroundings = new IPanelGroupElement[4]; } public bool IsInSameDirection(Direction direction) { switch (direction) { case Direction.None: return false; case Direction.Left: case Direction.Right: if (this.direction != 0) { return this.direction == Direction.Right; } return true; default: if (this.direction != Direction.Top) { return this.direction == Direction.Bottom; } return true; } } public IPanelGroupElement GetSurroundingElement(Direction direction) { return surroundings[(int)direction]; } protected void SetDirty() { isDirty = true; for (PanelGroup group = Group; group != null; group = group.Group) { group.isDirty = true; } Canvas.SetDirty(); } protected virtual void UpdateBounds(Vector2 position, Vector2 size) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) Position = position; if (elements.Count == 1) { UpdateBoundsOf(elements[0], position, size); } else { bool flag = IsInSameDirection(Direction.Right); float num = (flag ? ((Size.x != 0f) ? (size.x / Size.x) : size.x) : ((Size.y != 0f) ? (size.y / Size.y) : size.y)); for (int i = 0; i < elements.Count; i++) { Vector2 size2 = elements[i].Size; if (flag) { size2.x *= num; size2.y = size.y; UpdateBoundsOf(elements[i], position, size2); position.x += size2.x; } else { size2.x = size.x; size2.y *= num; UpdateBoundsOf(elements[i], position, size2); position.y += size2.y; } } } Size = size; } protected virtual void UpdateLayout() { //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) if (!isDirty) { return; } elements.RemoveAll((IPanelGroupElement element) => element.IsNull() || element.Group != this); for (int num = elements.Count - 1; num >= 0; num--) { if (elements[num] is PanelGroup panelGroup) { panelGroup.UpdateLayout(); int count = panelGroup.Count; switch (count) { case 0: elements.RemoveAt(num); break; case 1: elements[num] = panelGroup.elements[0]; SetGroupFor(elements[num], this); num++; break; default: if (panelGroup.IsInSameDirection(direction)) { elements.RemoveAt(num); elements.InsertRange(num, panelGroup.elements); int num2 = 0; while (num2 < count) { SetGroupFor(elements[num], this); num2++; num++; } } break; } } } Vector2 val = Vector2.zero; Vector2 val2 = Vector2.zero; bool flag = IsInSameDirection(Direction.Right); int num3 = -1; for (int i = 0; i < elements.Count; i++) { Vector2 size = elements[i].Size; Vector2 minSize = elements[i].MinSize; bool flag2 = false; if (size.x == 0f && minSize.x > 0f) { size.x = Mathf.Min(1f, minSize.x); flag2 = true; } if (size.y == 0f && minSize.y > 0f) { size.y = Mathf.Min(1f, minSize.y); flag2 = true; } if (flag2) { UpdateBoundsOf(elements[i], elements[i].Position, size); } if (i == 0) { val = size; val2 = minSize; } else if (flag) { val.x += size.x; val2.x += minSize.x; if (size.y < val.y) { val.y = size.y; } if (minSize.y > val2.y) { val2.y = minSize.y; } } else { val.y += size.y; val2.y += minSize.y; if (size.x < val.x) { val.x = size.x; } if (minSize.x > val2.x) { val2.x = minSize.x; } } if (elements[i] is Panel && ((Panel)elements[i]).Internal.IsDummy) { num3 = i; } } if (num3 >= 0) { Vector2 zero = Vector2.zero; if (val.x < Size.x) { zero.x = Size.x - val.x; val.x = Size.x; } if (val.y < Size.y) { zero.y = Size.y - val.y; val.y = Size.y; } RectTransform rectTransform = ((Panel)elements[num3]).RectTransform; rectTransform.sizeDelta += zero; } Size = val; MinSize = val2; isDirty = false; } protected void UpdateSurroundings(IPanelGroupElement left, IPanelGroupElement top, IPanelGroupElement right, IPanelGroupElement bottom) { surroundings[0] = left; surroundings[1] = top; surroundings[2] = right; surroundings[3] = bottom; bool flag = IsInSameDirection(Direction.Right); for (int i = 0; i < elements.Count; i++) { if (flag) { left = ((i > 0) ? elements[i - 1] : surroundings[0]); right = ((i < elements.Count - 1) ? elements[i + 1] : surroundings[2]); } else { bottom = ((i > 0) ? elements[i - 1] : surroundings[3]); top = ((i < elements.Count - 1) ? elements[i + 1] : surroundings[1]); } if (elements[i] is PanelGroup panelGroup) { panelGroup.UpdateSurroundings(left, top, right, bottom); } else { ((Panel)elements[i]).Internal.UpdateSurroundings(left, top, right, bottom); } } } protected void ResizeElementTo(IPanelGroupElement element, Vector2 newSize, Direction horizontalDir, Direction verticalDir) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) if (horizontalDir != 0 && horizontalDir != Direction.Right) { horizontalDir = Direction.Right; } if (verticalDir != Direction.Bottom && verticalDir != Direction.Top) { verticalDir = Direction.Bottom; } Direction direction = horizontalDir.Opposite(); Direction direction2 = verticalDir.Opposite(); float num = newSize.x - element.Size.x; if (num > 0.0001f) { TryChangeSizeOf(element, horizontalDir, num); num = newSize.x - element.Size.x; if (num > 0.0001f) { TryChangeSizeOf(element, direction, num); } } else if (num < -0.0001f) { TryChangeSizeOf(element.GetSurroundingElement(horizontalDir), direction, 0f - num); num = newSize.x - element.Size.x; if (num < -0.0001f) { TryChangeSizeOf(element.GetSurroundingElement(direction), horizontalDir, 0f - num); } } float num2 = newSize.y - element.Size.y; if (num2 > 0.0001f) { TryChangeSizeOf(element, verticalDir, num2); num2 = newSize.y - element.Size.y; if (num2 > 0.0001f) { TryChangeSizeOf(element, direction2, num2); } } else if (num2 < -0.0001f) { TryChangeSizeOf(element.GetSurroundingElement(verticalDir), direction2, 0f - num2); num2 = newSize.y - element.Size.y; if (num2 < -0.0001f) { TryChangeSizeOf(element.GetSurroundingElement(direction2), verticalDir, 0f - num2); } } } protected virtual void EnsureMinimumSizeOf(IPanelGroupElement element) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) float num = element.Size.x - element.MinSize.x; if (num < -0.0001f) { TryChangeSizeOf(element, Direction.Right, 0f - num); num = element.Size.x - element.MinSize.x; if (num < -0.0001f) { TryChangeSizeOf(element, Direction.Left, 0f - num); } } float num2 = element.Size.y - element.MinSize.y; if (num2 < -0.0001f) { TryChangeSizeOf(element, Direction.Bottom, 0f - num2); num2 = element.Size.y - element.MinSize.y; if (num2 < -0.0001f) { TryChangeSizeOf(element, Direction.Top, 0f - num2); } } if (element is PanelGroup panelGroup) { panelGroup.Internal.EnsureMinimumSize(); } } protected void TryChangeSizeOf(IPanelGroupElement element, Direction direction, float deltaSize) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if (element.IsNull() || deltaSize <= 0.0001f || element.GetSurroundingElement(direction).IsNull()) { return; } resizePropsIndex = 0; IPanelGroupElement surroundingElement = element.GetSurroundingElement(direction); element = surroundingElement.GetSurroundingElement(direction.Opposite()); AddResizeProperty(element); float deltaSize2 = TryChangeSizeOfInternal(surroundingElement, direction, deltaSize); if (resizePropsIndex > 1) { ResizeElementHelper(0, direction, deltaSize2); for (int i = 0; i < resizePropsIndex; i++) { ElementDirtyProperties elementDirtyProperties = resizeProperties[i]; Vector2 position = elementDirtyProperties.element.Position + new Vector2(elementDirtyProperties.posX, elementDirtyProperties.posY); Vector2 size = elementDirtyProperties.element.Size + new Vector2(elementDirtyProperties.sizeX, elementDirtyProperties.sizeY); UpdateBoundsOf(elementDirtyProperties.element, position, size); } } } protected float TryChangeSizeOfInternal(IPanelGroupElement element, Direction direction, float deltaSize) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) int num = resizePropsIndex; AddResizeProperty(element); float num2 = ((direction != 0 && direction != Direction.Right) ? (element.Size.y - element.MinSize.y) : (element.Size.x - element.MinSize.x)); if (num2 > 0.0001f) { if (num2 >= deltaSize) { num2 = deltaSize; deltaSize = 0f; } else { deltaSize -= num2; } ResizeElementHelper(num, direction.Opposite(), 0f - num2); } else { num2 = 0f; } if (deltaSize > 0.0001f) { IPanelGroupElement surroundingElement = element.GetSurroundingElement(direction); if (!surroundingElement.IsNull()) { if (surroundingElement.Group != element.Group) { AddResizeProperty(surroundingElement.GetSurroundingElement(direction.Opposite())); } float num3 = TryChangeSizeOfInternal(surroundingElement, direction, deltaSize); if (num3 > 0.0001f) { if (surroundingElement.Group == element.Group) { switch (direction) { case Direction.Left: resizeProperties[num].posX -= num3; break; case Direction.Top: resizeProperties[num].posY += num3; break; case Direction.Right: resizeProperties[num].posX += num3; break; default: resizeProperties[num].posY -= num3; break; } num2 += num3; } else { ResizeElementHelper(num + 1, direction, num3); } } else if (num2 == 0f) { resizePropsIndex = num; } else { resizePropsIndex = num + 1; } } else if (num2 == 0f) { resizePropsIndex = num; } } return num2; } private void AddResizeProperty(IPanelGroupElement element) { if (resizeProperties == null) { resizeProperties = new List<ElementDirtyProperties> { new ElementDirtyProperties(element), new ElementDirtyProperties() }; } else if (resizePropsIndex == resizeProperties.Count) { resizeProperties.Add(new ElementDirtyProperties(element)); } else { resizeProperties[resizePropsIndex].Reset(element); } resizePropsIndex++; } private void ResizeElementHelper(int resizePropsIndex, Direction direction, float deltaSize) { ElementDirtyProperties elementDirtyProperties = resizeProperties[resizePropsIndex]; switch (direction) { case Direction.Left: elementDirtyProperties.posX -= deltaSize; elementDirtyProperties.sizeX += deltaSize; break; case Direction.Top: elementDirtyProperties.sizeY += deltaSize; break; case Direction.Right: elementDirtyProperties.sizeX += deltaSize; break; default: elementDirtyProperties.posY -= deltaSize; elementDirtyProperties.sizeY += deltaSize; break; } } protected void ReplaceElement(IPanelGroupElement beforeElement, IPanelGroupElement afterElement) { if (beforeElement == afterElement) { return; } if (beforeElement.IsNull() || afterElement.IsNull()) { Debug.LogError((object)"Invalid argument!"); return; } int num = elements.IndexOf(beforeElement); if (num < 0) { Debug.LogError((object)"Invalid index!"); return; } if (beforeElement.Group == this) { Canvas.UnanchoredPanelGroup.AddElement(beforeElement); } AddElementAt(num, afterElement); } public void ResizeTo(Vector2 newSize, Direction horizontalDir = Direction.Right, Direction verticalDir = Direction.Bottom) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (Group != null) { Group.ResizeElementTo(this, newSize, horizontalDir, verticalDir); } } public void DockToRoot(Direction direction) { PanelManager.Instance.AnchorPanel(this, Canvas, direction); } public void DockToPanel(IPanelGroupElement anchor, Direction direction) { PanelManager.Instance.AnchorPanel(this, anchor, direction); } public void AddElement(IPanelGroupElement element) { AddElementAt(elements.Count, element); } public void AddElementBefore(IPanelGroupElement pivot, IPanelGroupElement element) { AddElementAt(elements.IndexOf(pivot), element); } public void AddElementAfter(IPanelGroupElement pivot, IPanelGroupElement element) { AddElementAt(elements.IndexOf(pivot) + 1, element); } protected void AddElementAt(int index, IPanelGroupElement element) { if (element.IsNull()) { Debug.LogError((object)"Invalid argument!"); return; } if (index < 0 || index > elements.Count) { Debug.LogError((object)"Invalid index!"); return; } int num = elements.IndexOf(element); if (num >= 0 && element.Group != this) { if (index > num) { index--; } elements.RemoveAt(num); num = -1; } if (num == index) { return; } if (element.Group != null) { element.Group.SetDirty(); } if (num < 0) { elements.Insert(index, element); SetGroupFor(element, this); } else if (num != index) { if (num > index) { num++; } elements.Insert(index, element); elements.RemoveAt(num); } SetDirty(); } protected void SetGroupFor(IPanelGroupElement element, PanelGroup group) { Panel panel = element as Panel; if ((Object)(object)panel != (Object)null) { panel.Internal.Group = group; if ((Object)(object)((Transform)panel.RectTransform).parent != (Object)(object)group.Canvas.RectTransform) { ((Transform)panel.RectTransform).SetParent((Transform)(object)group.Canvas.RectTransform, false); } } else { ((PanelGroup)element).Group = group; } } protected void UpdateBoundsOf(IPanelGroupElement element, Vector2 position, Vector2 size) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (element is Panel) { ((Panel)element).Internal.UpdateBounds(position, size); } else { ((PanelGroup)element).UpdateBounds(position, size); } } public override string ToString() { if (direction == Direction.Left || direction == Direction.Right) { return "Horizontal Group"; } return "Vertical Group"; } public void PrintHierarchy() { Debug.Log((object)ToTree(0, new StringBuilder(500))); } private string ToTree(int depth, StringBuilder treeBuilder) { string text = string.Empty; for (int i = 0; i <= depth; i++) { text += "-"; } treeBuilder.Append(depth).Append(text).Append(' ') .Append(this) .Append(Environment.NewLine); foreach (IPanelGroupElement element in elements) { if (element is Panel) { treeBuilder.Append(depth + 1).Append(text).Append("- ") .Append(element) .Append(Environment.NewLine); } else { ((PanelGroup)element).ToTree(depth + 1, treeBuilder); } } if (depth != 0) { return null; } return treeBuilder.ToString(); } } public class UnanchoredPanelGroup : PanelGroup { public UnanchoredPanelGroup(DynamicPanelsCanvas canvas) : base(canvas, Direction.None) { } protected override void UpdateBounds(Vector2 position, Vector2 size) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < elements.Count; i++) { if (elements[i] is Panel) { RestrictPanelToBounds((Panel)elements[i], size); } } } protected override void UpdateLayout() { bool num = isDirty; base.UpdateLayout(); if (!num) { return; } for (int num2 = elements.Count - 1; num2 >= 0; num2--) { if (elements[num2] is PanelGroup panelGroup) { elements.RemoveAt(num2); int num3 = 0; while (num3 < panelGroup.Count) { elements.Insert(num2, panelGroup[num3]); SetGroupFor(elements[num2], this); num3++; num2++; } } } } protected override void EnsureMinimumSizeOf(IPanelGroupElement element) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) Panel panel = element as Panel; if (Object.op_Implicit((Object)(object)panel)) { Vector2 position = panel.Position; Vector2 size = panel.Size; Vector2 minSize = panel.MinSize; bool flag = false; float num = size.x - minSize.x; if (num < -0.0001f) { size.x -= num; position.x += num * 0.5f; flag = true; } float num2 = size.y - minSize.y; if (num2 < -0.0001f) { size.y -= num2; position.y += num2 * 0.5f; flag = true; } if (flag) { panel.Internal.UpdateBounds(position, size); RestrictPanelToBounds(panel); } } } public void RestrictPanelToBounds(Panel panel) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) RestrictPanelToBounds(panel, base.Canvas.Size); } protected void RestrictPanelToBounds(Panel panel, Vector2 canvasSize) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) Vector2 anchoredPosition = panel.RectTransform.anchoredPosition; Vector2 sizeDelta = panel.RectTransform.sizeDelta; if (anchoredPosition.y + sizeDelta.y < 50f) { anchoredPosition.y = 50f - sizeDelta.y; } else if (anchoredPosition.y + sizeDelta.y > canvasSize.y) { anchoredPosition.y = canvasSize.y - sizeDelta.y; } if (anchoredPosition.x < 0f) { anchoredPosition.x = 0f; } else if (canvasSize.x - anchoredPosition.x < 125f) { anchoredPosition.x = canvasSize.x - 125f; } panel.RectTransform.anchoredPosition = anchoredPosition; } public override string ToString() { return "Unanchored Panel Group"; } } [RequireComponent(typeof(CanvasRenderer))] public class NonDrawingGraphic : Graphic { public override void SetMaterialDirty() { } public override void SetVerticesDirty() { } protected override void OnPopulateMesh(VertexHelper vh) { vh.Clear(); } } public class PanelCursorHandler : MonoBehaviour { private static PanelCursorHandler instance; private PanelResizeHelper activeResizeHelper; private PointerEventData activeEventData; private bool isResizing; private Vector2 prevPointerPos; [SerializeField] private Texture2D horizontalCursor; [SerializeField] private Texture2D verticalCursor; [SerializeField] private Texture2D diagonalCursorTopLeft; [SerializeField] private Texture2D diagonalCursorTopRight; private void Awake() { instance = this; } public static void OnPointerEnter(PanelResizeHelper resizeHelper, PointerEventData eventData) { if (!((Object)(object)instance == (Object)null)) { instance.activeResizeHelper = resizeHelper; instance.activeEventData = eventData; } } public static void OnPointerExit(PanelResizeHelper resizeHelper) { if (!((Object)(object)instance == (Object)null) && (Object)(object)instance.activeResizeHelper == (Object)(object)resizeHelper) { instance.activeResizeHelper = null; instance.activeEventData = null; if (!instance.isResizing) { SetDefaultCursor(); } } } public static void OnBeginResize(Direction primary, Direction secondary) { if (!((Object)(object)instance == (Object)null)) { instance.isResizing = true; instance.UpdateCursor(primary, secondary); } } public static void OnEndResize() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)instance == (Object)null)) { instance.isResizing = false; if ((Object)(object)instance.activeResizeHelper == (Object)null) { SetDefaultCursor(); } else { instance.prevPointerPos = new Vector2(-1f, -1f); } } } private void Update() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (isResizing || !((Object)(object)activeResizeHelper != (Object)null)) { return; } Vector2 position = activeEventData.position; if (!(position != prevPointerPos)) { return; } if (activeEventData.dragging) { SetDefaultCursor(); } else { Direction direction = activeResizeHelper.Direction; Direction secondDirection = activeResizeHelper.GetSecondDirection(activeEventData.position); if (activeResizeHelper.Panel.CanResizeInDirection(direction)) { UpdateCursor(direction, secondDirection); } else if (secondDirection != Direction.None) { UpdateCursor(secondDirection, Direction.None); } else { SetDefaultCursor(); } } prevPointerPos = position; } private static void SetDefaultCursor() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Cursor.SetCursor((Texture2D)null, Vector2.zero, (CursorMode)0); } private void UpdateCursor(Direction primary, Direction secondary) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) Texture2D val = (Texture2D)(primary switch { Direction.Left => secondary switch { Direction.Top => diagonalCursorTopLeft, Direction.Bottom => diagonalCursorTopRight, _ => horizontalCursor, }, Direction.Right => secondary switch { Direction.Top => diagonalCursorTopRight, Direction.Bottom => diagonalCursorTopLeft, _ => horizontalCursor, }, Direction.Top => secondary switch { Direction.Left => diagonalCursorTopLeft, Direction.Right => diagonalCursorTopRight, _ => verticalCursor, }, _ => secondary switch { Direction.Left => diagonalCursorTopRight, Direction.Right => diagonalCursorTopLeft, _ => verticalCursor, }, }); Cursor.SetCursor(val, new Vector2((float)((Texture)val).width * 0.5f, (float)((Texture)val).height * 0.5f), (CursorMode)0); } } [DisallowMultipleComponent] public class PanelHeader : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler { [SerializeField] private Panel m_panel; private int pointerId = -98765; private Vector2 m_initialTouchPos; public Panel Panel => m_panel; internal Vector2 InitialTouchPos => m_initialTouchPos; private void OnEnable() { pointerId = -98765; } public void OnBeginDrag(PointerEventData eventData) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!PanelManager.Instance.OnBeginPanelTranslate(m_panel)) { eventData.pointerDrag = null; return; } pointerId = eventData.pointerId; RectTransformUtility.ScreenPointToLocalPointInRectangle(m_panel.RectTransform, eventData.position, m_panel.Canvas.Internal.worldCamera, ref m_initialTouchPos); } public void OnDrag(PointerEventData eventData) { if (eventData.pointerId != pointerId) { eventData.pointerDrag = null; } else { PanelManager.Instance.OnPanelTranslate(this, eventData); } } public void OnEndDrag(PointerEventData eventData) { if (eventData.pointerId == pointerId) { pointerId = -98765; PanelManager.Instance.OnEndPanelTranslate(m_panel); } } public void Stop() { pointerId = -98765; } } public static class PanelNotificationCenter { internal static class Internal { public static void PanelCreated(Panel panel) { if (IsPanelRegistered(panel)) { return; } panels.Add(panel); panel.Internal.ChangeCloseButtonVisibility(m_onPanelClosed != null); if (PanelNotificationCenter.OnPanelCreated != null) { PanelNotificationCenter.OnPanelCreated(panel); } if (((Component)panel).gameObject.activeInHierarchy) { if (PanelNotificationCenter.OnPanelBecameActive != null) { PanelNotificationCenter.OnPanelBecameActive(panel); } } else if (PanelNotificationCenter.OnPanelBecameInactive != null) { PanelNotificationCenter.OnPanelBecameInactive(panel); } } public static void PanelDestroyed(Panel panel) { if (panels.Remove(panel) && PanelNotificationCenter.OnPanelDestroyed != null) { PanelNotificationCenter.OnPanelDestroyed(panel); } } public static void PanelBecameActive(Panel panel) { if (IsPanelRegistered(panel) && PanelNotificationCenter.OnPanelBecameActive != null) { PanelNotificationCenter.OnPanelBecameActive(panel); } } public static void PanelBecameInactive(Panel panel) { if (IsPanelRegistered(panel) && PanelNotificationCenter.OnPanelBecameInactive != null) { PanelNotificationCenter.OnPanelBecameInactive(panel); } } public static void PanelClosed(Panel panel) { if (m_onPanelClosed != null) { m_onPanelClosed(panel); } } public static void TabDragStateChanged(PanelTab tab, bool isDragging) { if (isDragging) { if (PanelNotificationCenter.OnStartedDraggingTab != null) { PanelNotificationCenter.OnStartedDraggingTab(tab); } } else if (PanelNotificationCenter.OnStoppedDraggingTab != null) { PanelNotificationCenter.OnStoppedDraggingTab(tab); } } public static void ActiveTabChanged(PanelTab tab) { if (PanelNotificationCenter.OnActiveTabChanged != null) { PanelNotificationCenter.OnActiveTabChanged(tab); } } public static void TabIDChanged(PanelTab tab, string previousID, string newID) { if (!idToTab.ContainsValue(tab)) { tab.Internal.ChangeCloseButtonVisibility(m_onTabClosed != null); if (PanelNotificationCenter.OnTabCreated != null) { PanelNotificationCenter.OnTabCreated(tab); } } if (!string.IsNullOrEmpty(previousID) && idToTab.TryGetValue(previousID, out var value) && (Object)(object)value == (Object)(object)tab) { idToTab.Remove(previousID); } if (!string.IsNullOrEmpty(newID)) { idToTab[newID] = tab; } else if (PanelNotificationCenter.OnTabDestroyed != null) { PanelNotificationCenter.OnTabDestroyed(tab); } } public static void TabClosed(PanelTab tab) { if (m_onTabClosed != null) { m_onTabClosed(tab); } } private static bool IsPanelRegistered(Panel panel) { for (int num = panels.Count - 1; num >= 0; num--) { if ((Object)(object)panels[num] == (Object)(object)panel) { return true; } } return false; } } public delegate void PanelDelegate(Panel panel); public delegate void TabDelegate(PanelTab tab); private static PanelDelegate m_onPanelClosed; private static TabDelegate m_onTabClosed; private static readonly List<Panel> panels = new List<Panel>(32); private static readonly Dictionary<string, PanelTab> idToTab = new Dictionary<string, PanelTab>(32); public static int NumberOfPanels => panels.Count; public static event PanelDelegate OnPanelCreated; public static event PanelDelegate OnPanelDestroyed; public static event PanelDelegate OnPanelBecameActive; public static event PanelDelegate OnPanelBecameInactive; public static event TabDelegate OnTabCreated; public static event TabDelegate OnTabDestroyed; public static event TabDelegate OnActiveTabChanged; public static event TabDelegate OnStartedDraggingTab; public static event TabDelegate OnStoppedDraggingTab; public static event PanelDelegate OnPanelClosed { add { if (value == null) { return; } if (m_onPanelClosed == null) { for (int num = panels.Count - 1; num >= 0; num--) { panels[num].Internal.ChangeCloseButtonVisibility(isVisible: true); } } m_onPanelClosed = (PanelDelegate)Delegate.Combine(m_onPanelClosed, value); } remove { if (value == null || m_onPanelClosed == null) { return; } m_onPanelClosed = (PanelDelegate)Delegate.Remove(m_onPanelClosed, value); if (m_onPanelClosed == null) { for (int num = panels.Count - 1; num >= 0; num--) { panels[num].Internal.ChangeCloseButtonVisibility(isVisible: false); } } } } public static event TabDelegate OnTabClosed { add { if (value == null) { return; } if (m_onTabClosed == null) { foreach (PanelTab value2 in idToTab.Values) { value2.Internal.ChangeCloseButtonVisibility(isVisible: true); } } m_onTabClosed = (TabDelegate)Delegate.Combine(m_onTabClosed, value); } remove { if (value == null || m_onTabClosed == null) { return; } m_onTabClosed = (TabDelegate)Delegate.Remove(m_onTabClosed, value); if (m_onTabClosed != null) { return; } foreach (PanelTab value2 in idToTab.Values) { value2.Internal.ChangeCloseButtonVisibility(isVisible: false); } } } public static Panel GetPanel(int panelIndex) { if (panelIndex >= 0 && panelIndex < panels.Count) { return panels[panelIndex]; } return null; } public static bool TryGetTab(string tabID, out PanelTab tab) { if (string.IsNullOrEmpty(tabID)) { tab = null; return false; } return idToTab.TryGetValue(tabID, out tab); } } [DisallowMultipleComponent] public class PanelResizeHelper : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler, IPointerEnterHandler, IPointerExitHandler { private Panel m_panel; private Direction m_direction; private Direction secondDirection; private PanelResizeHelper helperBefore; private PanelResizeHelper helperAfter; private int pointerId = -98765; public Panel Panel => m_panel; public RectTransform RectTransform { get; private set; } public Direction Direction => m_direction; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown RectTransform = (RectTransform)((Component)this).transform; } private void OnEnable() { pointerId = -98765; } public void Initialize(Panel panel, Direction direction, PanelResizeHelper helperBefore, PanelResizeHelper helperAfter) { m_panel = panel; m_direction = direction; this.helperBefore = helperBefore; this.helperAfter = helperAfter; } public void OnPointerEnter(PointerEventData eventData) { PanelCursorHandler.OnPointerEnter(this, eventData); } public void OnPointerExit(PointerEventData eventData) { PanelCursorHandler.OnPointerExit(this); } public void OnBeginDrag(PointerEventData eventData) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!m_panel.CanResizeInDirection(m_direction)) { eventData.pointerDrag = null; return; } pointerId = eventData.pointerId; secondDirection = GetSecondDirection(eventData.pressPosition); PanelCursorHandler.OnBeginResize(m_direction, secondDirection); } public void OnDrag(PointerEventData eventData) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (eventData.pointerId == pointerId) { m_panel.Internal.OnResize(m_direction, eventData.position); if (secondDirection != Direction.None) { m_panel.Internal.OnResize(secondDirection, eventData.position); } } } public void OnEndDrag(PointerEventData eventData) { if (eventData.pointerId == pointerId) { if (!m_panel.IsDocked) { ((UnanchoredPanelGroup)m_panel.Group).RestrictPanelToBounds(m_panel); } pointerId = -98765; PanelCursorHandler.OnEndResize(); } } public Direction GetSecondDirection(Vector2 pointerPosition) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (m_panel.IsDocked) { return Direction.None; } Direction direction = (RectTransformUtility.RectangleContainsScreenPoint(helperBefore.RectTransform, pointerPosition, m_panel.Canvas.Internal.worldCamera) ? helperBefore.m_direction : ((!RectTransformUtility.RectangleContainsScreenPoint(helperAfter.RectTransform, pointerPosition, m_panel.Canvas.Internal.worldCamera)) ? Direction.None : helperAfter.m_direction)); if (!m_panel.CanResizeInDirection(direction)) { direction = Direction.None; } return direction; } public void Stop() { if (pointerId != -98765) { if (!m_panel.IsDocked) { ((UnanchoredPanelGroup)m_panel.Group).RestrictPanelToBounds(m_panel); } pointerId = -98765; PanelCursorHandler.OnEndResize(); } } } public static class PanelSerialization { [Serializable] private class SerializedCanvas { public bool active; public bool useFreeSpace; public SerializedPanelGroup rootPanelGroup; public SerializedPanelGroup unanchoredPanelGroup; } [Serializable] private abstract class ISerializedElement { public SerializedVector2 size; } [Serializable] private class SerializedPanelGroup : ISerializedElement { public bool horizontal; public ISerializedElement[] children; } [Serializable] private class SerializedDummyPanel : ISerializedElement { } [Serializable] private class SerializedPanel : ISerializedElement { public int activeTab; public SerializedPanelTab[] tabs; public SerializedVector2 floatingSize; } [Serializable] private class SerializedUnanchoredPanel : SerializedPanel { public bool active; public SerializedVector2 position; } [Serializable] private class SerializedPanelTab { public string id; } [Serializable] private struct SerializedVector2 { public float x; public float y; public static implicit operator Vector2(SerializedVector2 v) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return new Vector2(v.x, v.y); } public static implicit operator SerializedVector2(Vector2 v) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) SerializedVector2 result = default(SerializedVector2); result.x = v.x; result.y = v.y; return result; } } private struct GroupElementSizeHolder { public IPanelGroupElement element; public Vector2 size; public GroupElementSizeHolder(IPanelGroupElement element, Vector2 size) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) this.element = element; this.size = size; } } private static readonly List<SerializedPanelTab> tabsTemp = new List<SerializedPanelTab>(4); private static readonly List<GroupElementSizeHolder> sizesHolder = new List<GroupElementSizeHolder>(4); public static void SerializeCanvas(DynamicPanelsCanvas canvas) { byte[] array = SerializeCanvasToArray(canvas); if (array == null || array.Length == 0) { Debug.LogError((object)"Couldn't serialize!"); return; } PlayerPrefs.SetString(canvas.ID, Convert.ToBase64String(array)); PlayerPrefs.Save(); } public static void DeserializeCanvas(DynamicPanelsCanvas canvas) { DeserializeCanvasFromArray(canvas, Convert.FromBase64String(PlayerPrefs.GetString(canvas.ID, string.Empty))); } public static byte[] SerializeCanvasToArray(DynamicPanelsCanvas canvas) { canvas.ForceRebuildLayoutImmediate(); BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); binaryFormatter.Serialize(memoryStream, new SerializedCanvas { active = ((Component)canvas).gameObject.activeSelf, useFreeSpace = canvas.LeaveFreeSpace, rootPanelGroup = (Serialize(canvas.RootPanelGroup) as SerializedPanelGroup), unanchoredPanelGroup = (Serialize(canvas.UnanchoredPanelGroup) as SerializedPanelGroup) }); return memoryStream.ToArray(); } public static void DeserializeCanvasFromArray(DynamicPanelsCanvas canvas, byte[] data) { //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (data == null || data.Length == 0) { Debug.LogError((object)"Data is null!"); return; } BinaryFormatter binaryFormatter = new BinaryFormatter(); SerializedCanvas serializedCanvas; using (MemoryStream serializationStream = new MemoryStream(data)) { serializedCanvas = binaryFormatter.Deserialize(serializationStream) as SerializedCanvas; } if (serializedCanvas == null) { return; } sizesHolder.Clear(); canvas.LeaveFreeSpace = serializedCanvas.useFreeSpace; if (serializedCanvas.rootPanelGroup != null) { PanelGroup rootPanelGroup = canvas.RootPanelGroup; ISerializedElement[] children = serializedCanvas.rootPanelGroup.children; for (int num = children.Length - 1; num >= 0; num--) { IPanelGroupElement panelGroupElement = Deserialize(canvas, children[num]); if (panelGroupElement != null) { if (rootPanelGroup.Count == 0) { rootPanelGroup.AddElement(panelGroupElement); } else { rootPanelGroup.AddElementBefore(rootPanelGroup[0], panelGroupElement); } sizesHolder.Insert(0, new GroupElementSizeHolder(panelGroupElement, children[num].size)); } } } if (sizesHolder.Count > 0) { canvas.ForceRebuildLayoutImmediate(); for (int i = 0; i < sizesHolder.Count; i++) { sizesHolder[i].element.ResizeTo(sizesHolder[i].size, Direction.Right, Direction.Top); } } if (serializedCanvas.unanchoredPanelGroup != null) { ISerializedElement[] children2 = serializedCanvas.unanchoredPanelGroup.children; for (int j = 0; j < children2.Length; j++) { if (children2[j] is SerializedUnanchoredPanel element) { Panel panel = Deserialize(canvas, element) as Panel; if ((Object)(object)panel != (Object)null) { panel.Detach(); canvas.UnanchoredPanelGroup.RestrictPanelToBounds(panel); } } } } for (int k = 0; k < canvas.UnanchoredPanelGroup.Count; k++) { Panel panel2 = canvas.UnanchoredPanelGroup[k] as Panel; if ((Object)(object)panel2 != (Object)null) { ((Transform)panel2.RectTransform).SetAsLastSibling(); } } ((Component)canvas).gameObject.SetActive(serializedCanvas.active); } private static ISerializedElement Serialize(IPanelGroupElement element) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (element == null) { return null; } if (element is Panel) { Panel panel = (Panel)element; if (panel.Internal.IsDummy) { return new SerializedDummyPanel { size = panel.Size }; } tabsTemp.Clear(); for (int i = 0; i < panel.NumberOfTabs; i++) { PanelTab panelTab = panel[i]; tabsTemp.Add(new SerializedPanelTab { id = panelTab.ID }); } if (tabsTemp.Count == 0) { return null; } if (panel.IsDocked) { return new SerializedPanel { activeTab = panel.ActiveTab, tabs = tabsTemp.ToArray(), size = panel.Size, floatingSize = panel.FloatingSize }; } return new SerializedUnanchoredPanel { active = ((Component)panel).gameObject.activeSelf, activeTab = panel.ActiveTab, tabs = tabsTemp.ToArray(), position = panel.Position, size = panel.Size, floatingSize = panel.Size }; } PanelGroup panelGroup = (PanelGroup)element; ISerializedElement[] array = new ISerializedElement[panelGroup.Count]; for (int j = 0; j < panelGroup.Count; j++) { array[j] = Serialize(panelGroup[j]); } return new SerializedPanelGroup { horizontal = panelGroup.IsInSameDirection(Direction.Right), children = array, size = panelGroup.Size }; } private static IPanelGroupElement Deserialize(DynamicPanelsCanvas canvas, ISerializedElement element) { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) if (element == null) { return null; } if (element is SerializedDummyPanel) { return canvas.Internal.DummyPanel; } if (element is SerializedPanel) { SerializedPanel serializedPanel = (SerializedPanel)element; Panel panel = null; SerializedPanelTab[] tabs = serializedPanel.tabs; for (int i = 0; i < tabs.Length; i++) { if (PanelNotificationCenter.TryGetTab(tabs[i].id, out var tab)) { if ((Object)(object)panel == (Object)null) { panel = tab.Detach(); canvas.UnanchoredPanelGroup.AddElement(panel); } else { panel.AddTab(tab); } } } if ((Object)(object)panel != (Object)null) { if (serializedPanel.activeTab < tabs.Length) { int tabIndex = panel.GetTabIndex(tabs[serializedPanel.activeTab].id); if (tabIndex >= 0) { panel.ActiveTab = tabIndex; } } if (serializedPanel is SerializedUnanchoredPanel) { SerializedUnanchoredPanel serializedUnanchoredPanel = (SerializedUnanchoredPanel)serializedPanel; panel.RectTransform.anchoredPosition = serializedUnanchoredPanel.position; ((Component)panel).gameObject.SetActive(serializedUnanchoredPanel.active); } panel.FloatingSize = serializedPanel.floatingSize; } return panel; } if (element is SerializedPanelGroup) { SerializedPanelGroup serializedPanelGroup = (SerializedPanelGroup)element; ISerializedElement[] children = serializedPanelGroup.children; if (children == null || children.Length == 0) { return null; } PanelGroup panelGroup = new PanelGroup(canvas, (!serializedPanelGroup.horizontal) ? Direction.Top : Direction.Right); for (int j = 0; j < children.Length; j++) { if (children[j] != null) { IPanelGroupElement panelGroupElement = Deserialize(canvas, children[j]); if (panelGroupElement != null) { panelGroup.AddElement(panelGroupElement); sizesHolder.Add(new GroupElementSizeHolder(panelGroupElement, children[j].size)); } } } if (panelGroup.Count > 0) { return panelGroup; } } return null; } } [DisallowMultipleComponent] public class PanelTab : MonoBehaviour, IPointerClickHandler, IEventSystemHandler, IBeginDragHandler, IDragHandler, IEndDragHandler { internal class InternalSettings { private readonly PanelTab tab; public readonly RectTransform RectTransform; public bool IsBeingDetached => tab.pointerId != -98765; public InternalSettings(PanelTab tab) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown this.tab = tab; RectTransform = (RectTransform)((Component)tab).transform; } public void Initialize(Panel panel, RectTransform content) { tab.m_panel = panel; tab.Content = content; } public void ChangeCloseButtonVisibility(bool isVisible) { if (Object.op_Implicit((Object)(object)tab.closeButton) && isVisible != ((Component)tab.closeButton).gameObject.activeSelf) { ((Component)tab.closeButton).gameObject.SetActive(isVisible); float preferredWidth = ((Component)tab.closeButton).GetComponent<LayoutElement>().preferredWidth; LayoutElement component = ((Component)tab).GetComponent<LayoutElement>(); component.preferredWidth += (isVisible ? preferredWidth : (0f - preferredWidth)); } } public void Stop() { if (tab.pointerId != -98765) { tab.ResetBackgroundColor(); tab.pointerId = -98765; PanelNotificationCenter.Internal.TabDragStateChanged(tab, isDragging: false); } } public void SetActive(bool activeState) { tab.SetActive(activeState); } } [SerializeField] private Image background; [SerializeField] private Image iconHolder; [SerializeField] private Text nameHolder; [SerializeField] private Button closeButton; private string m_id; private Panel m_panel; private Vector2 m_minSize; private int pointerId = -98765; internal InternalSettings Internal { get; private set; } public string ID { get { return m_id; } set { if (!string.IsNullOrEmpty(value) && m_id != value) { PanelNotificationCenter.Internal.TabIDChanged(this, m_id, value); m_id = value; } } } public Panel Panel => m_panel; public int Index { get { return m_panel.GetTabIndex(this); } set { m_panel.AddTab(this, value); } } public RectTransform Content { get; private set; } public Vector2 MinSize { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return m_minSize; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (m_minSize != value) { m_minSize = value; m_panel.Internal.RecalculateMinSize(); } } } public Sprite Icon { get { if (!((Object)(object)iconHolder != (Object)null)) { return null; } return iconHolder.sprite; } set { if ((Object)(object)iconHolder != (Object)null) { ((Component)iconHolder).gameObject.SetActive((Object)(object)value != (Object)null); iconHolder.sprite = value; } } } public string Label { get { if (!((Object)(object)nameHolder != (Object)null)) { return null; } return nameHolder.text; } set { if ((Object)(object)nameHolder != (Object)null && value != null) { nameHolder.text = value; } } } private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown m_minSize = new Vector2(100f, 100f); Internal = new InternalSettings(this); iconHolder.preserveAspect = true; ((UnityEvent)closeButton.onClick).AddListener((UnityAction)delegate { PanelNotificationCenter.Internal.TabClosed(this); }); } private void Start() { if (string.IsNullOrEmpty(m_id)) { ID = Guid.NewGuid().ToString(); } } private void OnEnable() { pointerId = -98765; } private void OnDestroy() { PanelNotificationCenter.Internal.TabIDChanged(this, m_id, null); } public void AttachTo(Panel panel, int tabIndex = -1) { panel.AddTab(Content, tabIndex); } public Panel Detach() { return m_panel.DetachTab(this); } public void Destroy() { m_panel.RemoveTab(this); } private void SetActive(bool activeState) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Content)) { m_panel.Internal.RemoveTab(m_panel.GetTabIndex(this), destroyTabObject: true); return; } if (activeState) { ((Graphic)background).color = m_panel.TabSelectedColor; ((Graphic)nameHolder).color = m_panel.TabSelectedTextColor; } else { ((Graphic)background).color = m_panel.TabNormalColor; ((Graphic)nameHolder).color = m_panel.TabNormalTextColor; } ((Component)Content).gameObject.SetActive(activeState); } void IPointerClickHandler.OnPointerClick(PointerEventData eventData) { if (!Object.op_Implicit((Object)(object)Content)) { m_panel.Internal.RemoveTab(m_panel.GetTabIndex(this), destroyTabObject: true); } else { m_panel.ActiveTab = m_panel.GetTabIndex(this); } } void IBeginDragHandler.OnBeginDrag(PointerEventData eventData) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (!PanelManager.Instance.OnBeginPanelTabTranslate(this, eventData)) { eventData.pointerDrag = null; return; } pointerId = eventData.pointerId; ((Graphic)background).color = m_panel.TabDetachingColor; ((Graphic)nameHolder).color = m_panel.TabDetachingTextColor; PanelNotificationCenter.Internal.TabDragStateChanged(this, isDragging: true); } void IDragHandler.OnDrag(PointerEventData eventData) { if (eventData.pointerId != pointerId) { eventData.pointerDrag = null; } else { PanelManager.Instance.OnPanelTabTranslate(this, eventData); } } void IEndDragHandler.OnEndDrag(PointerEventData eventData) { if (eventData.pointerId == pointerId) { pointerId = -98765; ResetBackgroundColor(); PanelManager.Instance.OnEndPanelTabTranslate(this, eventData); PanelNotificationCenter.Internal.TabDragStateChanged(this, isDragging: false); } } private void ResetBackgroundColor() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (m_panel.ActiveTab == m_panel.GetTabIndex(this)) { ((Graphic)background).color = m_panel.TabSelectedColor; ((Graphic)nameHolder).color = m_panel.TabSelectedTextColor; } else { ((Graphic)background).color = m_panel.TabNormalColor; ((Graphic)nameHolder).color = m_panel.TabNormalTextColor; } } } public static class PanelUtils { internal static class Internal { public static Panel CreatePanel(RectTransform content, DynamicPanelsCanvas canvas) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown res
plugins/RuntimeInspector/RIRPlugin.dll
Decompiled 2 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using DynamicPanels; using RuntimeInspectorNamespace; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] namespace PassivePicasso.RuntimeInspectorPlugin; [BepInPlugin("com.PassivePicasso.RuntimeInspectorPlugin", "RuntimeInspectorPlugin", "4.0.1")] public class RuntimeInspectorPlugin : BaseUnityPlugin { private static FieldInfo m_typeField = typeof(VariableSet).GetField("m_type", BindingFlags.Instance | BindingFlags.NonPublic); private static FieldInfo m_variablesField = typeof(VariableSet).GetField("m_variables", BindingFlags.Instance | BindingFlags.NonPublic); private static FieldInfo m_hiddenVariablesField = typeof(RuntimeInspectorSettings).GetField("m_hiddenVariables", BindingFlags.Instance | BindingFlags.NonPublic); private static FieldInfo m_exposedVariablesField = typeof(RuntimeInspectorSettings).GetField("m_exposedVariables", BindingFlags.Instance | BindingFlags.NonPublic); private VariableSet[] hiddenVariables; private VariableSet[] exposedVariables; private Panel inspetorPanel; private Panel hierarchyPanel; private PanelTab inspectorTab; private PanelTab hierarchyTab; private AssetBundle sceneBundle; private AssetBundle inspectorBundle; private string inspectorScenePath; private RuntimeInspector inspector; private RuntimeHierarchy hierarchy; private RuntimeInspectorSettings settings; private Canvas canvas; private DynamicPanelsCanvas dynamicPanelCanvas; private bool initialized; public ConfigEntry<KeyCode> ShowInspectorKey { get; set; } public ConfigEntry<float> DefaultInspectorWidth { get; set; } public ConfigEntry<float> DefaultHierarchyWidth { get; set; } private void Awake() { ShowInspectorKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Key Bindings", "ShowInspector", (KeyCode)105, "Keycode needed to press for runtime inspector window to appear"); DefaultInspectorWidth = ((BaseUnityPlugin)this).Config.Bind<float>("Dock Settings", "DefaultInspectorWidth", 300f, "Default width of the Inspector Panels"); DefaultHierarchyWidth = ((BaseUnityPlugin)this).Config.Bind<float>("Dock Settings", "DefaultHierarchyWidth", 300f, "Default width of the Hierarchy Panels"); } private void Start() { string? directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "RIRSceneBundle"); string text2 = Path.Combine(directoryName, "RuntimeInspector"); inspectorBundle = AssetBundle.LoadFromFile(text2); InitializeSettings(); IEnumerable<GameObject> allGameObjects = inspectorBundle.LoadAllAssets().OfType<GameObject>(); RuntimeInspectorUtils.LoadObjRefPicker = () => Retrieve<ObjectReferencePicker>(allGameObjects, "ObjectReferencePicker"); RuntimeInspectorUtils.LoadColorPicker = () => Retrieve<ColorPicker>(allGameObjects, "ColorPicker"); RuntimeInspectorUtils.LoadDraggedReferenceItem = () => Retrieve<DraggedReferenceItem>(allGameObjects, "DraggedReferenceItem"); RuntimeInspectorUtils.LoadTooltip = () => Retrieve<Tooltip>(allGameObjects, "Tooltip"); PanelUtils.LoadPanel = () => Retrieve<Panel>(allGameObjects, "DynamicPanel"); PanelUtils.LoadTab = () => Retrieve<PanelTab>(allGameObjects, "DynamicPanelTab"); PanelUtils.LoadPanelPreview = () => Retrieve<RectTransform>(allGameObjects, "DynamicPanelPreview"); sceneBundle = AssetBundle.LoadFromFile(text); inspectorScenePath = sceneBundle.GetAllScenePaths()[0]; SceneManager.sceneLoaded += SceneManager_sceneLoaded; SceneManager.LoadScene(inspectorScenePath, (LoadSceneMode)1); } private void Update() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)canvas) && ((Component)canvas).gameObject.activeSelf && !initialized) { Panel obj = inspetorPanel; float value = DefaultInspectorWidth.Value; Resolution currentResolution = Screen.currentResolution; obj.ResizeTo(new Vector2(value, (float)((Resolution)(ref currentResolution)).height), (Direction)2, (Direction)3); Panel obj2 = hierarchyPanel; float value2 = DefaultHierarchyWidth.Value; currentResolution = Screen.currentResolution; obj2.ResizeTo(new Vector2(value2, (float)((Resolution)(ref currentResolution)).height), (Direction)2, (Direction)3); initialized = true; } if (Input.GetKeyDown(ShowInspectorKey.Value) && Object.op_Implicit((Object)(object)canvas)) { if (!((Component)canvas).GetComponentsInChildren<InputField>().Any((InputField input) => input.isFocused)) { ((Component)canvas).gameObject.SetActive(!((Component)canvas).gameObject.activeSelf); } if (!Object.op_Implicit((Object)(object)inspetorPanel)) { inspetorPanel = ConfigureTab(((Component)inspector).gameObject, (Direction)2, "Inspector", out inspectorTab); } if (!Object.op_Implicit((Object)(object)hierarchyPanel)) { hierarchyPanel = ConfigureTab(((Component)hierarchy).gameObject, (Direction)0, "Hierarchy", out hierarchyTab); } } } private T Retrieve<T>(IEnumerable<GameObject> gameObjects, string name) where T : Component { GameObject? obj = gameObjects.FirstOrDefault((Func<GameObject, bool>)((GameObject asset) => ((Object)asset).name == name && Object.op_Implicit((Object)(object)asset.GetComponent<T>()))); if (obj == null) { return default(T); } return obj.GetComponent<T>(); } private IEnumerable<VariableSet> GetVariableSet(params (Type type, string[] variables)[] setData) { for (int i = 0; i < setData.Length; i++) { (Type, string[]) tuple = setData[i]; VariableSet val = new VariableSet(); m_typeField.SetValue(val, tuple.Item1.AssemblyQualifiedName); m_variablesField.SetValue(val, tuple.Item2); yield return val; } } private void InitializeSettings() { settings = inspectorBundle.LoadAllAssets<RuntimeInspectorSettings>().FirstOrDefault() ?? ScriptableObject.CreateInstance<RuntimeInspectorSettings>(); if (settings.HiddenVariables == null) { hiddenVariables = GetVariableSet((typeof(Object), new string[6] { "hideFlags", "useGUILayout", "runInEditMode", "m_CachedPtr", "m_InstanceID", "m_UnityRuntimeErrorString" }), (typeof(Renderer), new string[2] { "material", "materials" }), (typeof(MeshFilter), new string[1] { "mesh" }), (typeof(Transform), new string[1] { "*" }), (typeof(Component), new string[2] { "name", "tag" }), (typeof(Collider), new string[1] { "material" }), (typeof(Collider2D), new string[1] { "material" }), (typeof(CanvasRenderer), new string[1] { "*" }), (typeof(Animator), new string[3] { "bodyPosition", "bodyRotation", "playbackTime" })).ToArray(); m_hiddenVariablesField.SetValue(settings, hiddenVariables); } if (settings.ExposedVariables == null) { exposedVariables = GetVariableSet((typeof(Transform), new string[3] { "localPosition", "localEulerAngles", "localScale" })).ToArray(); m_exposedVariablesField.SetValue(settings, exposedVariables); } } private void SceneManager_sceneLoaded(Scene loadedScene, LoadSceneMode arg1) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) if (!(((Scene)(ref loadedScene)).path != inspectorScenePath)) { SceneManager.sceneLoaded -= SceneManager_sceneLoaded; inspector = ((Scene)(ref loadedScene)).GetRootGameObjects().SelectMany((GameObject rgo) => rgo.GetComponentsInChildren<RuntimeInspector>()).First(); hierarchy = ((Scene)(ref loadedScene)).GetRootGameObjects().SelectMany((GameObject rgo) => rgo.GetComponentsInChildren<RuntimeHierarchy>()).First(); canvas = ((Scene)(ref loadedScene)).GetRootGameObjects().SelectMany((GameObject rgo) => rgo.GetComponentsInChildren<Canvas>()).First(); dynamicPanelCanvas = ((Component)canvas).GetComponent<DynamicPanelsCanvas>(); inspetorPanel = ConfigureTab(((Component)inspector).gameObject, (Direction)2, "Inspector", out inspectorTab); Panel obj = inspetorPanel; float value = DefaultInspectorWidth.Value; Resolution currentResolution = Screen.currentResolution; obj.ResizeTo(new Vector2(value, (float)((Resolution)(ref currentResolution)).height), (Direction)2, (Direction)3); hierarchyPanel = ConfigureTab(((Component)hierarchy).gameObject, (Direction)0, "Hierarchy", out hierarchyTab); Panel obj2 = hierarchyPanel; float value2 = DefaultHierarchyWidth.Value; currentResolution = Screen.currentResolution; obj2.ResizeTo(new Vector2(value2, (float)((Resolution)(ref currentResolution)).height), (Direction)2, (Direction)3); Object.DontDestroyOnLoad((Object)(object)canvas); InitializeSettings(); hierarchy.Refresh(); ((Component)canvas).gameObject.SetActive(false); } } private Panel ConfigureTab(GameObject target, Direction direction, string title, out PanelTab tab) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Panel val = PanelUtils.CreatePanelFor(target.GetComponent<RectTransform>(), dynamicPanelCanvas); val.DockToRoot(direction); tab = val.GetTab(target.GetComponent<RectTransform>()); tab.Label = title; return val; } private void OnDoubleClickedEntry(Transform selection) { GameObject val = Object.Instantiate<GameObject>(inspectorBundle.LoadAsset<GameObject>("RuntimeInspector")); val.GetComponent<RuntimeInspector>().Inspect((object)selection); ConfigureTab(val, (Direction)2, ((Object)((Component)selection).gameObject).name, out var _); } private void OnPanelClosed(Panel panel) { if (!((Object)(object)panel == (Object)(object)hierarchyPanel) && !((Object)(object)panel == (Object)(object)inspetorPanel)) { panel.Detach(); Object.Destroy((Object)(object)((Component)panel).gameObject); } } private void OnTabClosed(PanelTab tab) { if ((Object)(object)tab == (Object)(object)inspectorTab || (Object)(object)tab == (Object)(object)hierarchyTab) { return; } if (tab.Panel.NumberOfTabs == 1) { if (!((Object)(object)tab.Panel == (Object)(object)inspetorPanel) && !((Object)(object)tab.Panel == (Object)(object)hierarchyPanel)) { Object.Destroy((Object)(object)((Component)tab.Panel).gameObject); } } else { Object.Destroy((Object)(object)((Component)tab).gameObject); } } }
plugins/RuntimeInspector/RuntimeInspector.Runtime.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Text; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.Scripting; using UnityEngine.Serialization; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] namespace RuntimeInspectorNamespace; public class ColorWheelControl : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IDragHandler, IPointerUpHandler { public delegate void OnColorChangedDelegate(Color32 color); private const float RGB_CONST = 2f / (float)Math.PI; private const float G_CONST = (float)Math.PI * 2f / 3f; private const float B_CONST = 4.1887903f; private Color m_color; private RectTransform rectTransform; [SerializeField] private RectTransform SelectorOut; [SerializeField] private RectTransform SelectorIn; [SerializeField] private WindowDragHandler colorPickerWindow; private float outer; private Vector2 inner; private Material mat; private bool draggingOuter; private bool draggingInner; private float halfSize; private float halfSizeSqr; private float outerCirclePaddingSqr; private float innerSquareHalfSize; private int pointerId = -98765; public Color Color { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return m_color; } private set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (m_color != value) { m_color = value; m_color.a = Alpha; if (this.OnColorChanged != null) { this.OnColorChanged(Color32.op_Implicit(m_color)); } } } } public float Alpha { get; set; } public event OnColorChangedDelegate OnColorChanged; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown rectTransform = (RectTransform)((Component)this).transform; Image component = ((Component)this).GetComponent<Image>(); mat = new Material(((Graphic)component).material); ((Graphic)component).material = mat; UpdateProperties(); } private void OnRectTransformDimensionsChange() { if (!((Object)(object)rectTransform == (Object)null)) { UpdateProperties(); UpdateSelectors(); } } private void UpdateProperties() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Rect rect = rectTransform.rect; halfSize = ((Rect)(ref rect)).size.x * 0.5f; halfSizeSqr = halfSize * halfSize; outerCirclePaddingSqr = halfSizeSqr * 0.75f * 0.75f; innerSquareHalfSize = halfSize * 0.5f; } public void PickColor(Color c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) Alpha = c.a; float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(c, ref num, ref num2, ref num3); outer = num * 2f * (float)Math.PI; inner.x = 1f - num2; inner.y = 1f - num3; UpdateSelectors(); Color = c; mat.SetColor("_Color", GetCurrentBaseColor()); } public void OnPointerDown(PointerEventData eventData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, eventData.position, eventData.pressEventCamera, ref val)) { return; } float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; if (sqrMagnitude <= halfSizeSqr && sqrMagnitude >= outerCirclePaddingSqr) { draggingOuter = true; } else { if (!(Mathf.Abs(val.x) <= innerSquareHalfSize) || !(Mathf.Abs(val.y) <= innerSquareHalfSize)) { return; } draggingInner = true; } GetSelectedColor(val); pointerId = eventData.pointerId; } public void OnDrag(PointerEventData eventData) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (pointerId != eventData.pointerId) { eventData.pointerDrag = ((Component)colorPickerWindow).gameObject; colorPickerWindow.OnBeginDrag(eventData); } else { Vector2 pointerPos = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, eventData.position, eventData.pressEventCamera, ref pointerPos); GetSelectedColor(pointerPos); } } public void OnPointerUp(PointerEventData eventData) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (pointerId == eventData.pointerId) { Vector2 pointerPos = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, eventData.position, eventData.pressEventCamera, ref pointerPos); GetSelectedColor(pointerPos); draggingOuter = false; draggingInner = false; pointerId = -98765; } } private void GetSelectedColor(Vector2 pointerPos) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (draggingOuter) { Vector2 val = -((Vector2)(ref pointerPos)).normalized; outer = Mathf.Atan2(0f - val.x, 0f - val.y); UpdateColor(); } else if (draggingInner) { Vector2 val2 = -pointerPos; val2.x = Mathf.Clamp(val2.x, 0f - innerSquareHalfSize, innerSquareHalfSize) + innerSquareHalfSize; val2.y = Mathf.Clamp(val2.y, 0f - innerSquareHalfSize, innerSquareHalfSize) + innerSquareHalfSize; inner = val2 / halfSize; UpdateColor(); } UpdateSelectors(); } private void UpdateColor() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) Color currentBaseColor = GetCurrentBaseColor(); mat.SetColor("_Color", currentBaseColor); currentBaseColor = Color.Lerp(currentBaseColor, Color.white, inner.x); currentBaseColor = Color.Lerp(currentBaseColor, Color.black, inner.y); Color = currentBaseColor; } private Color GetCurrentBaseColor() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) Color white = Color.white; white.r = Mathf.Clamp(2f / (float)Math.PI * Mathf.Asin(Mathf.Cos(outer)) * 1.5f + 0.5f, 0f, 1f); white.g = Mathf.Clamp(2f / (float)Math.PI * Mathf.Asin(Mathf.Cos((float)Math.PI * 2f / 3f - outer)) * 1.5f + 0.5f, 0f, 1f); white.b = Mathf.Clamp(2f / (float)Math.PI * Mathf.Asin(Mathf.Cos(4.1887903f - outer)) * 1.5f + 0.5f, 0f, 1f); return white; } private void UpdateSelectors() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) SelectorOut.anchoredPosition = new Vector2(Mathf.Sin(outer) * halfSize * 0.85f, Mathf.Cos(outer) * halfSize * 0.85f); SelectorIn.anchoredPosition = new Vector2(innerSquareHalfSize - inner.x * halfSize, innerSquareHalfSize - inner.y * halfSize); } } public class RuntimeHierarchy : SkinnedWindow, IListViewAdapter, ITooltipManager { [Flags] public enum SelectOptions { None = 0, Additive = 1, FocusOnSelection = 2, ForceRevealSelection = 4 } public enum LongPressAction { None, CreateDraggedReferenceItem, ShowMultiSelectionToggles, ShowMultiSelectionTogglesThenCreateDraggedReferenceItem } public delegate void SelectionChangedDelegate(ReadOnlyCollection<Transform> selection); public delegate void DoubleClickDelegate(HierarchyData clickedItem); public delegate bool GameObjectFilterDelegate(Transform transform); [SerializeField] private float m_refreshInterval; [SerializeField] private float m_objectNamesRefreshInterval = 10f; [SerializeField] private float m_searchRefreshInterval = 5f; private float nextHierarchyRefreshTime = -1f; private float nextObjectNamesRefreshTime = -1f; private float nextSearchRefreshTime = -1f; [Space] [SerializeField] private bool m_allowMultiSelection = true; private bool m_multiSelectionToggleSelectionMode; private bool justActivatedMultiSelectionToggleSelectionMode; [Space] [SerializeField] private bool m_exposeUnityScenes = true; [SerializeField] [FormerlySerializedAs("exposedScenes")] private string[] exposedUnityScenesSubset; [SerializeField] private bool m_exposeDontDestroyOnLoadScene = true; [SerializeField] private string[] pseudoScenesOrder; [Space] [SerializeField] private LongPressAction m_pointerLongPressAction = LongPressAction.CreateDraggedReferenceItem; [SerializeField] [FormerlySerializedAs("m_draggedReferenceHoldTime")] private float m_pointerLongPressDuration = 0.4f; [SerializeField] private float m_doubleClickThreshold = 0.5f; [Space] [SerializeField] private bool m_canReorganizeItems; [SerializeField] private bool m_canDropDraggedParentOnChild; [SerializeField] private bool m_canDropDraggedObjectsToPseudoScenes; [Space] [SerializeField] private bool m_showTooltips; [SerializeField] private float m_tooltipDelay = 0.5f; [Space] [SerializeField] private bool m_showHorizontalScrollbar; private bool m_isInSearchMode; [SerializeField] private RuntimeInspector m_connectedInspector; private bool m_isLocked; [Header("Internal Variables")] [SerializeField] private ScrollRect scrollView; [SerializeField] private RectTransform drawArea; [SerializeField] private RecycledListView listView; [SerializeField] private Image background; [SerializeField] private Image verticalScrollbar; [SerializeField] private Image horizontalScrollbar; [SerializeField] private InputField searchInputField; [SerializeField] private Image searchIcon; [SerializeField] private Image searchInputFieldBackground; [SerializeField] private LayoutElement searchBarLayoutElement; [SerializeField] private Button deselectAllButton; [SerializeField] private LayoutElement deselectAllLayoutElement; [SerializeField] private Text deselectAllLabel; [SerializeField] private Image selectedPathBackground; [SerializeField] private Text selectedPathText; [SerializeField] private HierarchyDragDropListener dragDropListener; [SerializeField] private HierarchyField drawerPrefab; [SerializeField] private Sprite m_sceneDrawerBackground; [SerializeField] private Sprite m_transformDrawerBackground; private static int aliveHierarchies; private bool initialized; private readonly List<HierarchyField> drawers = new List<HierarchyField>(32); private readonly List<HierarchyDataRoot> sceneData = new List<HierarchyDataRoot>(8); private readonly List<HierarchyDataRoot> searchSceneData = new List<HierarchyDataRoot>(8); private readonly Dictionary<string, HierarchyDataRootPseudoScene> pseudoSceneDataLookup = new Dictionary<string, HierarchyDataRootPseudoScene>(); private readonly List<Transform> m_currentSelection = new List<Transform>(16); private readonly HashSet<int> currentSelectionSet = new HashSet<int>(); private readonly HashSet<int> newSelectionSet = new HashSet<int>(); private Transform multiSelectionPivotTransform; private HierarchyDataRoot multiSelectionPivotSceneData; private readonly List<int> multiSelectionPivotSiblingIndexTraversalList = new List<int>(8); private readonly Transform[] singleTransformSelection = (Transform[])(object)new Transform[1]; private int totalItemCount; private bool selectLock; private bool isListViewDirty = true; private bool shouldRecalculateContentWidth; private float lastClickTime; private HierarchyField lastClickedDrawer; private HierarchyField currentlyPressedDrawer; private float pressedDrawerDraggedReferenceCreateTime; private PointerEventData pressedDrawerActivePointer; private Canvas m_canvas; private float m_autoScrollSpeed; private PointerEventData nullPointerEventData; public SelectionChangedDelegate OnSelectionChanged; public DoubleClickDelegate OnItemDoubleClicked; private GameObjectFilterDelegate m_gameObjectDelegate; public float RefreshInterval { get { return m_refreshInterval; } set { m_refreshInterval = value; } } public float ObjectNamesRefreshInterval { get { return m_objectNamesRefreshInterval; } set { m_objectNamesRefreshInterval = value; } } public float SearchRefreshInterval { get { return m_searchRefreshInterval; } set { m_searchRefreshInterval = value; } } public bool AllowMultiSelection { get { return m_allowMultiSelection; } set { if (m_allowMultiSelection == value) { return; } m_allowMultiSelection = value; if (value) { return; } MultiSelectionToggleSelectionMode = false; if (m_currentSelection.Count <= 1) { return; } for (int num = m_currentSelection.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)m_currentSelection[num])) { singleTransformSelection[0] = m_currentSelection[num]; SelectInternal(singleTransformSelection); return; } } DeselectInternal(null); } } public bool MultiSelectionToggleSelectionMode { get { return m_multiSelectionToggleSelectionMode; } set { if (!m_allowMultiSelection) { value = false; } if (m_multiSelectionToggleSelectionMode == value) { return; } m_multiSelectionToggleSelectionMode = value; shouldRecalculateContentWidth = true; for (int num = drawers.Count - 1; num >= 0; num--) { if (((Component)drawers[num]).gameObject.activeSelf) { drawers[num].MultiSelectionToggleVisible = value; } } ((Component)deselectAllButton).gameObject.SetActive(value); if (!value) { EnsureScrollViewIsWithinBounds(); } } } public bool ExposeUnityScenes { get { return m_exposeUnityScenes; } set { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (m_exposeUnityScenes == value) { return; } m_exposeUnityScenes = value; for (int i = 0; i < SceneManager.sceneCount; i++) { if (value) { OnSceneLoaded(SceneManager.GetSceneAt(i), (LoadSceneMode)0); } else { OnSceneUnloaded(SceneManager.GetSceneAt(i)); } } } } public bool ExposeDontDestroyOnLoadScene { get { return m_exposeDontDestroyOnLoadScene; } set { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (m_exposeDontDestroyOnLoadScene != value) { m_exposeDontDestroyOnLoadScene = value; if (value) { OnSceneLoaded(GetDontDestroyOnLoadScene(), (LoadSceneMode)0); } else { OnSceneUnloaded(GetDontDestroyOnLoadScene()); } } } } public LongPressAction PointerLongPressAction { get { return m_pointerLongPressAction; } set { m_pointerLongPressAction = value; } } public float PointerLongPressDuration { get { return m_pointerLongPressDuration; } set { m_pointerLongPressDuration = value; } } public float DoubleClickThreshold { get { return m_doubleClickThreshold; } set { m_doubleClickThreshold = value; } } public bool CanReorganizeItems { get { return m_canReorganizeItems; } set { m_canReorganizeItems = value; } } public bool CanDropDraggedParentOnChild { get { return m_canDropDraggedParentOnChild; } set { m_canDropDraggedParentOnChild = value; } } public bool CanDropDraggedObjectsToPseudoScenes { get { return m_canDropDraggedObjectsToPseudoScenes; } set { m_canDropDraggedObjectsToPseudoScenes = value; } } public bool ShowTooltips => m_showTooltips; public float TooltipDelay { get { return m_tooltipDelay; } set { m_tooltipDelay = value; } } internal TooltipListener TooltipListener { get; private set; } public bool ShowHorizontalScrollbar { get { return m_showHorizontalScrollbar; } set { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (m_showHorizontalScrollbar == value) { return; } m_showHorizontalScrollbar = value; if (!value) { scrollView.content.sizeDelta = new Vector2(0f, scrollView.content.sizeDelta.y); scrollView.horizontalNormalizedPosition = 0f; } else { for (int num = drawers.Count - 1; num >= 0; num--) { if (((Component)drawers[num]).gameObject.activeSelf) { drawers[num].RefreshName(); } } shouldRecalculateContentWidth = true; } scrollView.horizontal = value; } } public string SearchTerm { get { return searchInputField.text; } set { searchInputField.text = value; } } public bool IsInSearchMode => m_isInSearchMode; public RuntimeInspector ConnectedInspector { get { return m_connectedInspector; } set { if (!((Object)(object)m_connectedInspector != (Object)(object)value)) { return; } m_connectedInspector = value; for (int num = m_currentSelection.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)m_currentSelection[num])) { m_connectedInspector.Inspect(((Component)m_currentSelection[num]).gameObject); break; } } } } public bool IsLocked { get { return m_isLocked; } set { m_isLocked = value; } } internal Sprite SceneDrawerBackground => m_sceneDrawerBackground; internal Sprite TransformDrawerBackground => m_transformDrawerBackground; public ReadOnlyCollection<Transform> CurrentSelection => m_currentSelection.AsReadOnly(); internal int ItemCount => totalItemCount; public Canvas Canvas => m_canvas; internal float AutoScrollSpeed { set { m_autoScrollSpeed = value; } } public GameObjectFilterDelegate GameObjectFilter { get { return m_gameObjectDelegate; } set { m_gameObjectDelegate = value; for (int i = 0; i < sceneData.Count; i++) { if (sceneData[i].IsExpanded) { sceneData[i].IsExpanded = false; sceneData[i].IsExpanded = true; } } if (!m_isInSearchMode) { return; } for (int j = 0; j < searchSceneData.Count; j++) { if (searchSceneData[j].IsExpanded) { searchSceneData[j].IsExpanded = false; searchSceneData[j].IsExpanded = true; } } } } int IListViewAdapter.Count => totalItemCount; float IListViewAdapter.ItemHeight => base.Skin.LineHeight; protected override void Awake() { base.Awake(); Initialize(); } private void Initialize() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown if (!initialized) { initialized = true; listView.SetAdapter(this); aliveHierarchies++; m_canvas = ((Component)this).GetComponentInParent<Canvas>(); nullPointerEventData = new PointerEventData((EventSystem)null); ((UnityEvent<string>)(object)searchInputField.onValueChanged).AddListener((UnityAction<string>)OnSearchTermChanged); ((UnityEvent)deselectAllButton.onClick).AddListener((UnityAction)delegate { DeselectInternal(null); MultiSelectionToggleSelectionMode = false; }); m_showHorizontalScrollbar = !m_showHorizontalScrollbar; ShowHorizontalScrollbar = !m_showHorizontalScrollbar; if (m_showTooltips) { TooltipListener = ((Component)this).gameObject.AddComponent<TooltipListener>(); TooltipListener.Initialize(this); } RuntimeInspectorUtils.IgnoredTransformsInHierarchy.Add((Transform)(object)drawArea); } } private void Start() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; if (ExposeUnityScenes) { for (int i = 0; i < SceneManager.sceneCount; i++) { OnSceneLoaded(SceneManager.GetSceneAt(i), (LoadSceneMode)0); } } if (ExposeDontDestroyOnLoadScene) { OnSceneLoaded(GetDontDestroyOnLoadScene(), (LoadSceneMode)0); } } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; SceneManager.sceneUnloaded -= OnSceneUnloaded; if (--aliveHierarchies == 0) { HierarchyData.ClearPool(); } RuntimeInspectorUtils.IgnoredTransformsInHierarchy.Remove((Transform)(object)drawArea); } private void OnRectTransformDimensionsChange() { shouldRecalculateContentWidth = true; } private void OnTransformParentChanged() { m_canvas = ((Component)this).GetComponentInParent<Canvas>(); } protected override void Update() { //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) base.Update(); float realtimeSinceStartup = Time.realtimeSinceStartup; if (realtimeSinceStartup > nextHierarchyRefreshTime) { Refresh(); } if (m_isInSearchMode && realtimeSinceStartup > nextSearchRefreshTime) { RefreshSearchResults(); } if (isListViewDirty) { RefreshListView(); } if (realtimeSinceStartup > nextObjectNamesRefreshTime) { nextObjectNamesRefreshTime = realtimeSinceStartup + m_objectNamesRefreshInterval; for (int num = sceneData.Count - 1; num >= 0; num--) { sceneData[num].ResetCachedNames(); } for (int num2 = searchSceneData.Count - 1; num2 >= 0; num2--) { searchSceneData[num2].ResetCachedNames(); } for (int num3 = drawers.Count - 1; num3 >= 0; num3--) { if (((Component)drawers[num3]).gameObject.activeSelf) { drawers[num3].RefreshName(); } } shouldRecalculateContentWidth = true; } if (m_showHorizontalScrollbar && shouldRecalculateContentWidth) { shouldRecalculateContentWidth = false; float num4 = 0f; for (int num5 = drawers.Count - 1; num5 >= 0; num5--) { if (((Component)drawers[num5]).gameObject.activeSelf) { float preferredWidth = drawers[num5].PreferredWidth; if (preferredWidth > num4) { num4 = preferredWidth; } } } if (m_multiSelectionToggleSelectionMode && drawers.Count > 0) { num4 += (float)base.Skin.LineHeight; } float num6 = listView.ViewportWidth + scrollView.verticalScrollbarSpacing; if (num4 > num6) { scrollView.content.sizeDelta = new Vector2(num4 - num6, scrollView.content.sizeDelta.y); } else { scrollView.content.sizeDelta = new Vector2(0f, scrollView.content.sizeDelta.y); } EnsureScrollViewIsWithinBounds(); } if (m_pointerLongPressAction != 0 && Object.op_Implicit((Object)(object)currentlyPressedDrawer) && realtimeSinceStartup > pressedDrawerDraggedReferenceCreateTime) { if (((Component)currentlyPressedDrawer).gameObject.activeSelf && Object.op_Implicit((Object)(object)currentlyPressedDrawer.Data.BoundTransform)) { if (m_pointerLongPressAction == LongPressAction.CreateDraggedReferenceItem || (m_pointerLongPressAction == LongPressAction.ShowMultiSelectionTogglesThenCreateDraggedReferenceItem && (!m_allowMultiSelection || m_multiSelectionToggleSelectionMode))) { Transform[] array = (Transform[])(currentlyPressedDrawer.IsSelected ? ((Array)m_currentSelection.ToArray()) : ((Array)new Transform[1] { currentlyPressedDrawer.Data.BoundTransform })); if (array.Length > 1) { int num7 = Array.IndexOf(array, currentlyPressedDrawer.Data.BoundTransform); if (num7 > 0) { for (int num8 = num7; num8 > 0; num8--) { array[num8] = array[num8 - 1]; } array[0] = currentlyPressedDrawer.Data.BoundTransform; } } Object[] references = (Object[])(object)array; if (Object.op_Implicit((Object)(object)RuntimeInspectorUtils.CreateDraggedReferenceItem(references, pressedDrawerActivePointer, base.Skin, m_canvas))) { ((IPointerEnterHandler)dragDropListener).OnPointerEnter(pressedDrawerActivePointer); } } else if (m_allowMultiSelection && !m_multiSelectionToggleSelectionMode) { if (currentSelectionSet.Add(((object)currentlyPressedDrawer.Data.BoundTransform).GetHashCode())) { m_currentSelection.Add(currentlyPressedDrawer.Data.BoundTransform); currentlyPressedDrawer.IsSelected = true; OnCurrentSelectionChanged(); } MultiSelectionToggleSelectionMode = true; justActivatedMultiSelectionToggleSelectionMode = true; if (Object.op_Implicit((Object)(object)TooltipListener)) { TooltipListener.OnDrawerHovered(null, null, isHovering: false); } } } currentlyPressedDrawer = null; pressedDrawerActivePointer = null; } if (m_autoScrollSpeed != 0f) { scrollView.verticalNormalizedPosition = Mathf.Clamp01(scrollView.verticalNormalizedPosition + m_autoScrollSpeed * Time.unscaledDeltaTime / (float)totalItemCount); } } public void Refresh() { nextHierarchyRefreshTime = Time.realtimeSinceStartup + m_refreshInterval; bool flag = false; for (int i = 0; i < sceneData.Count; i++) { flag |= sceneData[i].Refresh(); } if (flag) { isListViewDirty = true; return; } for (int num = drawers.Count - 1; num >= 0; num--) { if (((Component)drawers[num]).gameObject.activeSelf) { drawers[num].Refresh(); } } } private void RefreshListView() { isListViewDirty = false; totalItemCount = 0; if (!m_isInSearchMode) { for (int num = sceneData.Count - 1; num >= 0; num--) { totalItemCount += sceneData[num].Height; } } else { for (int num2 = searchSceneData.Count - 1; num2 >= 0; num2--) { totalItemCount += searchSceneData[num2].Height; } } listView.UpdateList(resetContentPosition: false); EnsureScrollViewIsWithinBounds(); } internal void SetListViewDirty() { isListViewDirty = true; } public void RefreshSearchResults() { if (!m_isInSearchMode) { return; } nextSearchRefreshTime = Time.realtimeSinceStartup + m_searchRefreshInterval; for (int i = 0; i < searchSceneData.Count; i++) { HierarchyDataRootSearch hierarchyDataRootSearch = (HierarchyDataRootSearch)searchSceneData[i]; bool canExpand = hierarchyDataRootSearch.CanExpand; hierarchyDataRootSearch.Refresh(); if (hierarchyDataRootSearch.CanExpand && !canExpand) { hierarchyDataRootSearch.IsExpanded = true; } isListViewDirty = true; } } public void RefreshNameOf(Transform target) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)target)) { return; } Scene scene = ((Component)target).gameObject.scene; for (int num = sceneData.Count - 1; num >= 0; num--) { HierarchyDataRoot hierarchyDataRoot = sceneData[num]; if (hierarchyDataRoot is HierarchyDataRootPseudoScene || ((HierarchyDataRootScene)hierarchyDataRoot).Scene == scene) { sceneData[num].RefreshNameOf(target); } } if (m_isInSearchMode) { RefreshSearchResults(); for (int num2 = searchSceneData.Count - 1; num2 >= 0; num2--) { searchSceneData[num2].RefreshNameOf(target); } } for (int num3 = drawers.Count - 1; num3 >= 0; num3--) { if (((Component)drawers[num3]).gameObject.activeSelf && (Object)(object)drawers[num3].Data.BoundTransform == (Object)(object)target) { drawers[num3].RefreshName(); } } shouldRecalculateContentWidth = true; } protected override void RefreshSkin() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) ((Graphic)background).color = base.Skin.BackgroundColor; ((Graphic)verticalScrollbar).color = base.Skin.ScrollbarColor; ((Graphic)horizontalScrollbar).color = base.Skin.ScrollbarColor; searchInputField.textComponent.SetSkinInputFieldText(base.Skin); ((Graphic)searchInputFieldBackground).color = base.Skin.InputFieldNormalBackgroundColor.Tint(0.08f); ((Graphic)searchIcon).color = base.Skin.ButtonTextColor; searchBarLayoutElement.SetHeight(base.Skin.LineHeight); deselectAllLayoutElement.SetHeight(base.Skin.LineHeight); ((Selectable)deselectAllButton).targetGraphic.color = base.Skin.InputFieldInvalidBackgroundColor; deselectAllLabel.SetSkinInputFieldText(base.Skin); ((Graphic)selectedPathBackground).color = base.Skin.BackgroundColor.Tint(0.1f); selectedPathText.SetSkinButtonText(base.Skin); Graphic placeholder = searchInputField.placeholder; Text val = (Text)(object)((placeholder is Text) ? placeholder : null); if ((Object)(object)val != (Object)null) { float a = ((Graphic)val).color.a; val.SetSkinInputFieldText(base.Skin); Color color = ((Graphic)val).color; color.a = a; ((Graphic)val).color = color; } LayoutRebuilder.ForceRebuildLayoutImmediate(drawArea); listView.ResetList(); } private void EnsureScrollViewIsWithinBounds() { if (scrollView.verticalNormalizedPosition <= Mathf.Epsilon) { scrollView.verticalNormalizedPosition = 0.0001f; } scrollView.OnScroll(nullPointerEventData); } void IListViewAdapter.SetItemContent(RecycledListItem item) { if (isListViewDirty) { RefreshListView(); } HierarchyField hierarchyField = (HierarchyField)item; HierarchyData dataAt = GetDataAt(hierarchyField.Position); if (dataAt != null) { hierarchyField.Skin = base.Skin; hierarchyField.SetContent(dataAt); hierarchyField.IsSelected = Object.op_Implicit((Object)(object)dataAt.BoundTransform) && currentSelectionSet.Contains(((object)dataAt.BoundTransform).GetHashCode()); hierarchyField.MultiSelectionToggleVisible = m_multiSelectionToggleSelectionMode; hierarchyField.Refresh(); shouldRecalculateContentWidth = true; } } void IListViewAdapter.OnItemClicked(RecycledListItem item) { HierarchyField hierarchyField = (HierarchyField)item; if (OnItemDoubleClicked != null && (Object)(object)hierarchyField == (Object)(object)lastClickedDrawer && Time.realtimeSinceStartup - lastClickTime <= m_doubleClickThreshold) { lastClickTime = 0f; OnItemDoubleClicked(lastClickedDrawer.Data); return; } lastClickTime = Time.realtimeSinceStartup; lastClickedDrawer = hierarchyField; bool flag = false; Transform boundTransform = hierarchyField.Data.BoundTransform; int item2 = (Object.op_Implicit((Object)(object)boundTransform) ? ((object)boundTransform).GetHashCode() : (-1)); if (m_allowMultiSelection && FindMultiSelectionPivotAbsoluteIndex(out var pivotAbsoluteIndex) && (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303))) { newSelectionSet.Clear(); if (Object.op_Implicit((Object)(object)boundTransform)) { newSelectionSet.Add(item2); if (currentSelectionSet.Add(item2)) { m_currentSelection.Add(boundTransform); flag = true; } } int i = pivotAbsoluteIndex; int position = hierarchyField.Position; for (int num = ((pivotAbsoluteIndex < position) ? 1 : (-1)); i != position; i += num) { Transform boundTransform2 = GetDataAt(i).BoundTransform; if (Object.op_Implicit((Object)(object)boundTransform2)) { int hashCode = ((object)boundTransform2).GetHashCode(); newSelectionSet.Add(hashCode); if (currentSelectionSet.Add(hashCode)) { m_currentSelection.Add(boundTransform2); flag = true; } } } for (int num2 = m_currentSelection.Count - 1; num2 >= 0; num2--) { Transform val = m_currentSelection[num2]; if (Object.op_Implicit((Object)(object)val)) { int hashCode2 = ((object)val).GetHashCode(); if (!newSelectionSet.Contains(hashCode2)) { m_currentSelection.RemoveAt(num2); currentSelectionSet.Remove(hashCode2); flag = true; } } } } else { multiSelectionPivotTransform = boundTransform; multiSelectionPivotSceneData = hierarchyField.Data.Root; hierarchyField.Data.GetSiblingIndexTraversalList(multiSelectionPivotSiblingIndexTraversalList); if (m_allowMultiSelection && (m_multiSelectionToggleSelectionMode || Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305))) { if (Object.op_Implicit((Object)(object)boundTransform)) { if (currentSelectionSet.Add(item2)) { m_currentSelection.Add(boundTransform); } else { m_currentSelection.Remove(boundTransform); currentSelectionSet.Remove(item2); if (m_currentSelection.Count == 0) { MultiSelectionToggleSelectionMode = false; } } flag = true; } } else if (Object.op_Implicit((Object)(object)boundTransform)) { if (m_currentSelection.Count != 1 || (Object)(object)m_currentSelection[0] != (Object)(object)boundTransform) { m_currentSelection.Clear(); currentSelectionSet.Clear(); m_currentSelection.Add(boundTransform); currentSelectionSet.Add(item2); flag = true; } } else if (m_currentSelection.Count > 0) { m_currentSelection.Clear(); currentSelectionSet.Clear(); flag = true; } } if (flag) { for (int num3 = drawers.Count - 1; num3 >= 0; num3--) { if (((Component)drawers[num3]).gameObject.activeSelf) { Transform boundTransform3 = drawers[num3].Data.BoundTransform; if (Object.op_Implicit((Object)(object)boundTransform3)) { if (drawers[num3].IsSelected != currentSelectionSet.Contains(((object)boundTransform3).GetHashCode())) { drawers[num3].IsSelected = !drawers[num3].IsSelected; } } else if (drawers[num3].IsSelected) { drawers[num3].IsSelected = false; } } } OnCurrentSelectionChanged(); } if (!m_isInSearchMode) { return; } bool flag2 = false; for (int num4 = m_currentSelection.Count - 1; num4 >= 0; num4--) { Transform val2 = m_currentSelection[num4]; if (Object.op_Implicit((Object)(object)val2)) { StringBuilder stringBuilder = RuntimeInspectorUtils.stringBuilder; stringBuilder.Length = 0; stringBuilder.AppendLine("Path:"); while (Object.op_Implicit((Object)(object)val2)) { stringBuilder.Append(" ").AppendLine(((Object)val2).name); val2 = val2.parent; } selectedPathText.text = stringBuilder.Append(" ").Append(hierarchyField.Data.Root.Name).ToString(); flag2 = true; break; } } if (((Component)selectedPathBackground).gameObject.activeSelf != flag2) { ((Component)selectedPathBackground).gameObject.SetActive(flag2); } } private bool FindMultiSelectionPivotAbsoluteIndex(out int pivotAbsoluteIndex) { pivotAbsoluteIndex = 0; if (multiSelectionPivotSceneData == null) { return false; } bool flag = false; List<HierarchyDataRoot> list = (m_isInSearchMode ? searchSceneData : sceneData); for (int i = 0; i < list.Count; i++) { if (list[i] != multiSelectionPivotSceneData) { pivotAbsoluteIndex += list[i].Height; continue; } flag = true; break; } if (!flag) { return false; } if (multiSelectionPivotSiblingIndexTraversalList.Count == 0) { return true; } if (!Object.op_Implicit((Object)(object)multiSelectionPivotTransform)) { return false; } HierarchyData hierarchyData = multiSelectionPivotSceneData.TraverseSiblingIndexList(multiSelectionPivotSiblingIndexTraversalList); if (hierarchyData != null && (Object)(object)hierarchyData.BoundTransform == (Object)(object)multiSelectionPivotTransform) { pivotAbsoluteIndex += hierarchyData.AbsoluteIndex; return true; } hierarchyData = multiSelectionPivotSceneData.FindTransformInVisibleChildren(multiSelectionPivotTransform, (multiSelectionPivotSceneData is HierarchyDataRootPseudoScene) ? multiSelectionPivotSiblingIndexTraversalList.Count : (-1)); if (hierarchyData != null) { pivotAbsoluteIndex += hierarchyData.AbsoluteIndex; return true; } if (multiSelectionPivotSceneData is HierarchyDataRootPseudoScene) { hierarchyData = multiSelectionPivotSceneData.FindTransformInVisibleChildren(multiSelectionPivotTransform); if (hierarchyData != null) { pivotAbsoluteIndex += hierarchyData.AbsoluteIndex; return true; } } return false; } internal HierarchyData GetDataAt(int index) { List<HierarchyDataRoot> list = ((!m_isInSearchMode) ? sceneData : searchSceneData); for (int i = 0; i < list.Count; i++) { if (list[i].Depth < 0) { continue; } if (index < list[i].Height) { if (index <= 0) { return list[i]; } return list[i].FindDataAtIndex(index - 1); } index -= list[i].Height; } return null; } public void OnDrawerPointerEvent(HierarchyField drawer, PointerEventData eventData, bool isPointerDown) { if (!isPointerDown) { currentlyPressedDrawer = null; pressedDrawerActivePointer = null; if (justActivatedMultiSelectionToggleSelectionMode) { justActivatedMultiSelectionToggleSelectionMode = false; eventData.eligibleForClick = false; } } else if (m_pointerLongPressAction != 0) { currentlyPressedDrawer = drawer; pressedDrawerActivePointer = eventData; pressedDrawerDraggedReferenceCreateTime = Time.realtimeSinceStartup + m_pointerLongPressDuration; } } public bool Select(Transform selection, SelectOptions selectOptions = SelectOptions.None) { singleTransformSelection[0] = selection; return Select((IList<Transform>)singleTransformSelection, selectOptions); } public bool Select(IList<Transform> selection, SelectOptions selectOptions = SelectOptions.None) { if (!m_isLocked) { return SelectInternal(selection, selectOptions); } return false; } internal bool SelectInternal(IList<Transform> selection, SelectOptions selectOptions = SelectOptions.None) { //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) if (selectLock) { return false; } if (selection.IsEmpty()) { DeselectInternal(null); return true; } Initialize(); bool flag = (selectOptions & SelectOptions.Additive) == SelectOptions.Additive; if (!m_allowMultiSelection) { flag = false; if (selection.Count > 1) { for (int num = selection.Count - 1; num >= 0; num--) { if (CanSelectTransform(selection[num])) { singleTransformSelection[0] = selection[num]; selection = singleTransformSelection; break; } } } } bool flag2 = false; if (flag) { for (int i = 0; i < selection.Count; i++) { Transform val = selection[i]; if (CanSelectTransform(val) && currentSelectionSet.Add(((object)val).GetHashCode())) { m_currentSelection.Add(val); flag2 = true; } } } else { newSelectionSet.Clear(); for (int j = 0; j < selection.Count; j++) { Transform val2 = selection[j]; if (CanSelectTransform(val2)) { int hashCode = ((object)val2).GetHashCode(); newSelectionSet.Add(hashCode); if (currentSelectionSet.Add(hashCode)) { m_currentSelection.Add(val2); flag2 = true; } } } for (int num2 = m_currentSelection.Count - 1; num2 >= 0; num2--) { Transform val3 = m_currentSelection[num2]; if (Object.op_Implicit((Object)(object)val3)) { int hashCode2 = ((object)val3).GetHashCode(); if (!newSelectionSet.Contains(hashCode2)) { m_currentSelection.RemoveAt(num2); currentSelectionSet.Remove(hashCode2); flag2 = true; } } } } if (!flag2 && (selectOptions & SelectOptions.ForceRevealSelection) != SelectOptions.ForceRevealSelection) { return true; } if (flag2) { OnCurrentSelectionChanged(); } Refresh(); RefreshSearchResults(); HierarchyDataTransform hierarchyDataTransform = null; int num3 = 0; List<HierarchyDataRoot> list = (m_isInSearchMode ? searchSceneData : sceneData); for (int k = 0; k < m_currentSelection.Count; k++) { Transform val4 = m_currentSelection[k]; if (!Object.op_Implicit((Object)(object)val4)) { continue; } Scene scene = ((Component)val4).gameObject.scene; for (int l = 0; l < list.Count; l++) { HierarchyDataRoot hierarchyDataRoot = list[l]; if (m_isInSearchMode || hierarchyDataRoot is HierarchyDataRootPseudoScene || ((HierarchyDataRootScene)hierarchyDataRoot).Scene == scene) { HierarchyDataTransform hierarchyDataTransform2 = hierarchyDataRoot.FindTransform(val4); if (hierarchyDataTransform2 != null) { hierarchyDataTransform = hierarchyDataTransform2; num3 = l; } } } } RefreshListView(); if (hierarchyDataTransform != null) { if ((selectOptions & SelectOptions.FocusOnSelection) == SelectOptions.FocusOnSelection) { int num4 = hierarchyDataTransform.AbsoluteIndex; for (int m = 0; m < num3; m++) { num4 += list[m].Height; } LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)((Component)this).transform); Rect rect = drawArea.rect; float height = ((Rect)(ref rect)).height; rect = ((RectTransform)((Transform)drawArea).parent).rect; float height2 = ((Rect)(ref rect)).height; if (height > height2) { float num5 = (float)num4 / (float)totalItemCount * height + (float)base.Skin.LineHeight * 0.5f; scrollView.verticalNormalizedPosition = 1f - Mathf.Clamp01((num5 - height2 * 0.5f) / (height - height2)); } } return true; } return false; } public void Deselect() { Deselect((IList<Transform>)null); } public void Deselect(Transform deselection) { singleTransformSelection[0] = deselection; Deselect((IList<Transform>)singleTransformSelection); } public void Deselect(IList<Transform> deselection) { if (!m_isLocked) { DeselectInternal(deselection); } } internal void DeselectInternal(IList<Transform> deselection) { if (selectLock || m_currentSelection.Count == 0) { return; } Initialize(); bool flag = false; if (deselection == null) { m_currentSelection.Clear(); currentSelectionSet.Clear(); flag = true; } else { for (int num = deselection.Count - 1; num >= 0; num--) { Transform val = deselection[num]; if (Object.op_Implicit((Object)(object)val) && currentSelectionSet.Remove(((object)val).GetHashCode())) { m_currentSelection.Remove(val); flag = true; } } } if (!flag) { return; } for (int num2 = drawers.Count - 1; num2 >= 0; num2--) { if (((Component)drawers[num2]).gameObject.activeSelf && drawers[num2].IsSelected) { drawers[num2].IsSelected = false; } } OnCurrentSelectionChanged(); } public bool IsSelected(Transform transform) { if (Object.op_Implicit((Object)(object)transform)) { return currentSelectionSet.Contains(((object)transform).GetHashCode()); } return false; } private bool CanSelectTransform(Transform transform) { if (!Object.op_Implicit((Object)(object)transform)) { return false; } if (RuntimeInspectorUtils.IgnoredTransformsInHierarchy.Contains(transform) || (m_gameObjectDelegate != null && !m_gameObjectDelegate(transform))) { return false; } Transform val = null; for (int i = 0; i < sceneData.Count; i++) { Transform nearestRootOf = sceneData[i].GetNearestRootOf(transform); if (Object.op_Implicit((Object)(object)nearestRootOf) && (!Object.op_Implicit((Object)(object)val) || nearestRootOf.IsChildOf(val))) { val = nearestRootOf; } } if (!Object.op_Implicit((Object)(object)val)) { return false; } if ((Object)(object)val != (Object)(object)transform) { Transform parent = transform.parent; while (Object.op_Implicit((Object)(object)parent) && (Object)(object)parent != (Object)(object)val) { if (RuntimeInspectorUtils.IgnoredTransformsInHierarchy.Contains(parent) || (m_gameObjectDelegate != null && !m_gameObjectDelegate(parent))) { return false; } parent = parent.parent; } } return true; } private void OnCurrentSelectionChanged() { selectLock = true; try { if (Object.op_Implicit((Object)(object)m_connectedInspector)) { for (int num = m_currentSelection.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)m_currentSelection[num])) { m_connectedInspector.Inspect(((Component)m_currentSelection[num]).gameObject); break; } } } if (OnSelectionChanged != null) { OnSelectionChanged(m_currentSelection.AsReadOnly()); } } catch (Exception ex) { Debug.LogException(ex); } finally { selectLock = false; } } private void OnSearchTermChanged(string search) { if (search != null) { search = search.Trim(); } if (string.IsNullOrEmpty(search)) { if (m_isInSearchMode) { for (int i = 0; i < searchSceneData.Count; i++) { searchSceneData[i].IsExpanded = false; } scrollView.verticalNormalizedPosition = 1f; ((Component)selectedPathBackground).gameObject.SetActive(false); isListViewDirty = true; m_isInSearchMode = false; if (m_currentSelection.Count > 0) { SelectInternal(m_currentSelection, SelectOptions.FocusOnSelection | SelectOptions.ForceRevealSelection); } } } else if (!m_isInSearchMode) { scrollView.verticalNormalizedPosition = 1f; nextSearchRefreshTime = Time.realtimeSinceStartup + m_searchRefreshInterval; isListViewDirty = true; m_isInSearchMode = true; RefreshSearchResults(); for (int j = 0; j < searchSceneData.Count; j++) { searchSceneData[j].IsExpanded = true; } } else { RefreshSearchResults(); } } private void OnSceneLoaded(Scene arg0, LoadSceneMode arg1) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (!ExposeUnityScenes || (((Scene)(ref arg0)).buildIndex >= 0 && exposedUnityScenesSubset != null && exposedUnityScenesSubset.Length != 0 && Array.IndexOf(exposedUnityScenesSubset, ((Scene)(ref arg0)).name) == -1) || !((Scene)(ref arg0)).IsValid()) { return; } for (int i = 0; i < sceneData.Count; i++) { if (sceneData[i] is HierarchyDataRootScene && ((HierarchyDataRootScene)sceneData[i]).Scene == arg0) { return; } } HierarchyDataRootScene hierarchyDataRootScene = new HierarchyDataRootScene(this, arg0); hierarchyDataRootScene.Refresh(); int index = sceneData.Count - pseudoSceneDataLookup.Count; sceneData.Insert(index, hierarchyDataRootScene); searchSceneData.Insert(index, new HierarchyDataRootSearch(this, hierarchyDataRootScene)); isListViewDirty = true; } private void OnSceneUnloaded(Scene arg0) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < sceneData.Count; i++) { if (sceneData[i] is HierarchyDataRootScene && ((HierarchyDataRootScene)sceneData[i]).Scene == arg0) { sceneData[i].IsExpanded = false; sceneData.RemoveAt(i); searchSceneData[i].IsExpanded = false; searchSceneData.RemoveAt(i); isListViewDirty = true; break; } } } private Scene GetDontDestroyOnLoadScene() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) GameObject val = null; try { val = new GameObject(); Object.DontDestroyOnLoad((Object)(object)val); Scene scene = val.scene; Object.DestroyImmediate((Object)(object)val); val = null; return scene; } catch (Exception ex) { Debug.LogException(ex); return default(Scene); } finally { if ((Object)(object)val != (Object)null) { Object.DestroyImmediate((Object)(object)val); } } } public void AddToPseudoScene(string scene, Transform transform) { GetPseudoScene(scene, createIfNotExists: true).AddChild(transform); } public void AddToPseudoScene(string scene, IEnumerable<Transform> transforms) { HierarchyDataRootPseudoScene pseudoScene = GetPseudoScene(scene, createIfNotExists: true); foreach (Transform transform in transforms) { pseudoScene.AddChild(transform); } } public void RemoveFromPseudoScene(string scene, Transform transform, bool deleteSceneIfEmpty) { HierarchyDataRootPseudoScene pseudoScene = GetPseudoScene(scene, createIfNotExists: false); if (pseudoScene != null) { pseudoScene.RemoveChild(transform); if (deleteSceneIfEmpty && pseudoScene.ChildCount == 0) { DeletePseudoScene(scene); } } } public void RemoveFromPseudoScene(string scene, IEnumerable<Transform> transforms, bool deleteSceneIfEmpty) { HierarchyDataRootPseudoScene pseudoScene = GetPseudoScene(scene, createIfNotExists: false); if (pseudoScene == null) { return; } foreach (Transform transform in transforms) { pseudoScene.RemoveChild(transform); } if (deleteSceneIfEmpty && pseudoScene.ChildCount == 0) { DeletePseudoScene(scene); } } private HierarchyDataRootPseudoScene GetPseudoScene(string scene, bool createIfNotExists) { if (pseudoSceneDataLookup.TryGetValue(scene, out var value)) { return value; } if (createIfNotExists) { return CreatePseudoSceneInternal(scene); } return null; } public void CreatePseudoScene(string scene) { if (!pseudoSceneDataLookup.ContainsKey(scene)) { CreatePseudoSceneInternal(scene); } } private HierarchyDataRootPseudoScene CreatePseudoSceneInternal(string scene) { int num = 0; if (pseudoScenesOrder.Length != 0) { for (int i = 0; i < pseudoScenesOrder.Length && !(pseudoScenesOrder[i] == scene); i++) { if (pseudoSceneDataLookup.ContainsKey(pseudoScenesOrder[i])) { num++; } } } else { num = pseudoSceneDataLookup.Count; } HierarchyDataRootPseudoScene hierarchyDataRootPseudoScene = new HierarchyDataRootPseudoScene(this, scene); num += sceneData.Count - pseudoSceneDataLookup.Count; sceneData.Insert(num, hierarchyDataRootPseudoScene); searchSceneData.Insert(num, new HierarchyDataRootSearch(this, hierarchyDataRootPseudoScene)); pseudoSceneDataLookup[scene] = hierarchyDataRootPseudoScene; isListViewDirty = true; return hierarchyDataRootPseudoScene; } public void DeleteAllPseudoScenes() { for (int num = sceneData.Count - 1; num >= 0; num--) { if (sceneData[num] is HierarchyDataRootPseudoScene) { sceneData[num].IsExpanded = false; sceneData.RemoveAt(num); searchSceneData[num].IsExpanded = false; searchSceneData.RemoveAt(num); } } pseudoSceneDataLookup.Clear(); isListViewDirty = true; } public void DeletePseudoScene(string scene) { for (int i = 0; i < sceneData.Count; i++) { if (sceneData[i] is HierarchyDataRootPseudoScene hierarchyDataRootPseudoScene && hierarchyDataRootPseudoScene.Name == scene) { pseudoSceneDataLookup.Remove(hierarchyDataRootPseudoScene.Name); sceneData[i].IsExpanded = false; sceneData.RemoveAt(i); searchSceneData[i].IsExpanded = false; searchSceneData.RemoveAt(i); isListViewDirty = true; break; } } } RecycledListItem IListViewAdapter.CreateItem(Transform parent) { HierarchyField hierarchyField = Object.Instantiate<HierarchyField>(drawerPrefab, parent, false); hierarchyField.Initialize(this); hierarchyField.Skin = base.Skin; drawers.Add(hierarchyField); return hierarchyField; } } public class HierarchyDragDropListener : MonoBehaviour, IDropHandler, IEventSystemHandler, IPointerEnterHandler, IPointerExitHandler { private const float POINTER_VALIDATE_INTERVAL = 5f; [SerializeField] private float siblingIndexModificationArea = 5f; [SerializeField] private float scrollableArea = 75f; private float _1OverScrollableArea; [SerializeField] private float scrollSpeed = 75f; [Header("Internal Variables")] [SerializeField] private RuntimeHierarchy hierarchy; [SerializeField] private RectTransform content; [SerializeField] private Image dragDropTargetVisualization; private Canvas canvas; private RectTransform rectTransform; private float height; private PointerEventData pointer; private Camera worldCamera; private float pointerLastYPos; private float nextPointerValidation; private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown rectTransform = (RectTransform)((Component)this).transform; canvas = ((Component)hierarchy).GetComponentInParent<Canvas>(); _1OverScrollableArea = 1f / scrollableArea; } private void OnRectTransformDimensionsChange() { height = 0f; } private void Update() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) if (pointer == null) { return; } nextPointerValidation -= Time.unscaledDeltaTime; if (nextPointerValidation <= 0f) { nextPointerValidation = 5f; if (!pointer.IsPointerValid()) { pointer = null; return; } } Vector2 val = default(Vector2); if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, pointer.position, worldCamera, ref val) || val.y == pointerLastYPos) { return; } pointerLastYPos = 0f - val.y; if (height <= 0f) { Rect rect = rectTransform.rect; height = ((Rect)(ref rect)).height; } float num = 0f; float num2 = pointerLastYPos; if (pointerLastYPos < scrollableArea) { num = (scrollableArea - pointerLastYPos) * _1OverScrollableArea; } else if (pointerLastYPos > height - scrollableArea) { num = (height - scrollableArea - num2) * _1OverScrollableArea; } float num3 = pointerLastYPos + content.anchoredPosition.y; if (num3 < 0f) { if (((Component)dragDropTargetVisualization).gameObject.activeSelf) { ((Component)dragDropTargetVisualization).gameObject.SetActive(false); } hierarchy.AutoScrollSpeed = 0f; return; } if (num3 < (float)(hierarchy.ItemCount * hierarchy.Skin.LineHeight)) { if (!((Component)dragDropTargetVisualization).gameObject.activeSelf) { ((Transform)((Graphic)dragDropTargetVisualization).rectTransform).SetAsLastSibling(); ((Component)dragDropTargetVisualization).gameObject.SetActive(true); } float num4 = num3 % (float)hierarchy.Skin.LineHeight; float num5 = 0f - num3 + num4; if (num4 < siblingIndexModificationArea) { ((Graphic)dragDropTargetVisualization).rectTransform.anchoredPosition = new Vector2(0f, num5 + 2f); ((Graphic)dragDropTargetVisualization).rectTransform.sizeDelta = new Vector2(20f, 4f); } else if (num4 > (float)hierarchy.Skin.LineHeight - siblingIndexModificationArea) { ((Graphic)dragDropTargetVisualization).rectTransform.anchoredPosition = new Vector2(0f, num5 - (float)hierarchy.Skin.LineHeight + 2f); ((Graphic)dragDropTargetVisualization).rectTransform.sizeDelta = new Vector2(20f, 4f); } else { ((Graphic)dragDropTargetVisualization).rectTransform.anchoredPosition = new Vector2(0f, num5); ((Graphic)dragDropTargetVisualization).rectTransform.sizeDelta = new Vector2(20f, (float)hierarchy.Skin.LineHeight); } } else if (((Component)dragDropTargetVisualization).gameObject.activeSelf) { ((Component)dragDropTargetVisualization).gameObject.SetActive(false); } hierarchy.AutoScrollSpeed = num * scrollSpeed; } void IDropHandler.OnDrop(PointerEventData eventData) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) ((IPointerExitHandler)this).OnPointerExit(eventData); if (!hierarchy.CanReorganizeItems || hierarchy.IsInSearchMode) { return; } Transform[] assignableObjectsFromDraggedReferenceItem = RuntimeInspectorUtils.GetAssignableObjectsFromDraggedReferenceItem<Transform>(eventData); if (assignableObjectsFromDraggedReferenceItem == null || assignableObjectsFromDraggedReferenceItem.Length == 0) { return; } if (assignableObjectsFromDraggedReferenceItem.Length > 1) { Array.Sort(assignableObjectsFromDraggedReferenceItem, (Transform transform1, Transform transform2) => CompareHierarchySiblingIndices(transform1, transform2)); } bool flag = false; float num = pointerLastYPos + content.anchoredPosition.y; int num2 = (int)num / hierarchy.Skin.LineHeight; HierarchyData hierarchyData = hierarchy.GetDataAt(num2); if (hierarchyData == null) { for (int i = 0; i < assignableObjectsFromDraggedReferenceItem.Length; i++) { if ((Object)(object)assignableObjectsFromDraggedReferenceItem[i].parent != (Object)null) { assignableObjectsFromDraggedReferenceItem[i].SetParent((Transform)null, true); flag = true; } } if (!flag) { return; } } else { float num3 = num % (float)hierarchy.Skin.LineHeight; int num4 = ((num3 < siblingIndexModificationArea) ? (-1) : ((num3 > (float)hierarchy.Skin.LineHeight - siblingIndexModificationArea) ? 1 : 0)); if (num4 != 0 && !(hierarchyData is HierarchyDataTransform)) { if (num4 < 0 && num2 > 0) { HierarchyData dataAt = hierarchy.GetDataAt(num2 - 1); if (dataAt != null) { hierarchyData = dataAt; num4 = 1; } } else if (num4 > 0 && num2 < hierarchy.ItemCount - 1) { HierarchyData dataAt2 = hierarchy.GetDataAt(num2 + 1); if (dataAt2 != null && dataAt2 is HierarchyDataTransform) { hierarchyData = dataAt2; num4 = -1; } } } HierarchyDataRoot newScene = null; Transform val = null; int num5 = -1; if (!(hierarchyData is HierarchyDataTransform)) { newScene = (HierarchyDataRoot)hierarchyData; } else { val = ((HierarchyDataTransform)hierarchyData).BoundTransform; if (!Object.op_Implicit((Object)(object)val)) { return; } if (num4 != 0) { if (num4 > 0 && hierarchyData.Height > 1) { num5 = 0; } else if (hierarchyData.Depth == 1 && hierarchyData.Root is HierarchyDataRootPseudoScene) { num5 = ((num4 >= 0) ? (((HierarchyDataRootPseudoScene)hierarchyData.Root).IndexOf(val) + 1) : ((HierarchyDataRootPseudoScene)hierarchyData.Root).IndexOf(val)); val = null; } else { num5 = ((num4 >= 0) ? (val.GetSiblingIndex() + 1) : val.GetSiblingIndex()); val = val.parent; } } if (!Object.op_Implicit((Object)(object)val)) { newScene = hierarchyData.Root; } } int num6 = 0; for (int j = 0; j < assignableObjectsFromDraggedReferenceItem.Length; j++) { if (DropTransformOnto(assignableObjectsFromDraggedReferenceItem[j], hierarchyData, newScene, val, (num5 >= 0) ? (num5 + num6) : num5, out var decrementSiblingIndex, out var shouldFocusObjectInHierarchy)) { num6++; flag = flag || shouldFocusObjectInHierarchy; if (decrementSiblingIndex) { num5--; } } } if (num6 == 0) { return; } } if (flag) { hierarchy.SelectInternal(assignableObjectsFromDraggedReferenceItem, RuntimeHierarchy.SelectOptions.FocusOnSelection | RuntimeHierarchy.SelectOptions.ForceRevealSelection); } else { hierarchy.Refresh(); } } private bool DropTransformOnto(Transform droppedTransform, HierarchyData target, HierarchyDataRoot newScene, Transform newParent, int newSiblingIndex, out bool decrementSiblingIndex, out bool shouldFocusObjectInHierarchy) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) shouldFocusObjectInHierarchy = false; decrementSiblingIndex = false; if ((Object)(object)droppedTransform.parent == (Object)(object)newParent) { if (Object.op_Implicit((Object)(object)newParent) || (newScene is HierarchyDataRootScene && ((HierarchyDataRootScene)newScene).Scene == ((Component)droppedTransform).gameObject.scene)) { if (newSiblingIndex > droppedTransform.GetSiblingIndex()) { newSiblingIndex--; decrementSiblingIndex = true; } } else if (newScene is HierarchyDataRootPseudoScene) { int num = newScene.IndexOf(droppedTransform); if (num >= 0 && newSiblingIndex > num) { newSiblingIndex--; decrementSiblingIndex = true; } } } if (Object.op_Implicit((Object)(object)newParent)) { if (!hierarchy.CanDropDraggedParentOnChild) { if (newParent.IsChildOf(droppedTransform)) { return false; } } else { Transform val = newParent; while ((Object)(object)val.parent != (Object)null && (Object)(object)val.parent != (Object)(object)droppedTransform) { val = val.parent; } if ((Object)(object)val.parent == (Object)(object)droppedTransform) { int index; if (target.Root is HierarchyDataRootPseudoScene hierarchyDataRootPseudoScene && (index = hierarchyDataRootPseudoScene.IndexOf(droppedTransform)) >= 0 && hierarchy.CanDropDraggedObjectsToPseudoScenes) { hierarchyDataRootPseudoScene.InsertChild(index, val); hierarchyDataRootPseudoScene.RemoveChild(droppedTransform); } int siblingIndex = droppedTransform.GetSiblingIndex(); val.SetParent(droppedTransform.parent, true); val.SetSiblingIndex(siblingIndex); shouldFocusObjectInHierarchy = true; } } droppedTransform.SetParent(newParent, true); } else if (newScene is HierarchyDataRootPseudoScene) { if (!hierarchy.CanDropDraggedObjectsToPseudoScenes) { return false; } if (newSiblingIndex < 0) { ((HierarchyDataRootPseudoScene)newScene).AddChild(droppedTransform); } else { ((HierarchyDataRootPseudoScene)newScene).InsertChild(newSiblingIndex, droppedTransform); newSiblingIndex = -1; target = newScene; } } else if (newScene is HierarchyDataRootScene) { if ((Object)(object)droppedTransform.parent != (Object)null) { droppedTransform.SetParent((Transform)null, true); } Scene scene = ((HierarchyDataRootScene)newScene).Scene; if (((Component)droppedTransform).gameObject.scene != scene) { SceneManager.MoveGameObjectToScene(((Component)droppedTransform).gameObject, scene); } if (newSiblingIndex < 0) { newSiblingIndex = ((Scene)(ref scene)).rootCount + 1; shouldFocusObjectInHierarchy = true; } } if (newSiblingIndex >= 0) { droppedTransform.SetSiblingIndex(newSiblingIndex); } shouldFocusObjectInHierarchy |= newSiblingIndex < 0 && !target.IsExpanded; return true; } private int CompareHierarchySiblingIndices(Transform t1, Transform t2) { Transform parent = t1.parent; Transform parent2 = t2.parent; if ((Object)(object)parent == (Object)(object)parent2) { return t1.GetSiblingIndex() - t2.GetSiblingIndex(); } int i = 0; while (Object.op_Implicit((Object)(object)parent)) { i++; parent = parent.parent; } while (Object.op_Implicit((Object)(object)parent2)) { i--; parent2 = parent2.parent; } while (i > 0) { t1 = t1.parent; if ((Object)(object)t1 == (Object)(object)t2) { return 1; } i--; } for (; i < 0; i++) { t2 = t2.parent; if ((Object)(object)t1 == (Object)(object)t2) { return -1; } } while ((Object)(object)t1.parent != (Object)(object)t2.parent) { t1 = t1.parent; t2 = t2.parent; } return t1.GetSiblingIndex() - t2.GetSiblingIndex(); } void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 if (hierarchy.CanReorganizeItems && !hierarchy.IsInSearchMode && Object.op_Implicit((Object)(object)RuntimeInspectorUtils.GetAssignableObjectFromDraggedReferenceItem<Transform>(eventData))) { pointer = eventData; pointerLastYPos = -1f; nextPointerValidation = 5f; if ((int)canvas.renderMode == 0 || ((int)canvas.renderMode == 1 && !Object.op_Implicit((Object)(object)canvas.worldCamera))) { worldCamera = null; } else { worldCamera = (Object.op_Implicit((Object)(object)canvas.worldCamera) ? canvas.worldCamera : Camera.main); } Update(); } } void IPointerExitHandler.OnPointerExit(PointerEventData eventData) { pointer = null; worldCamera = null; if (((Component)dragDropTargetVisualization).gameObject.activeSelf) { ((Component)dragDropTargetVisualization).gameObject.SetActive(false); } hierarchy.AutoScrollSpeed = 0f; } } public class PseudoSceneSourceTransform : MonoBehaviour { [SerializeField] private RuntimeHierarchy m_hierarchy; [SerializeField] private string m_sceneName; [SerializeField] private bool m_hideOnDisable; private HashSet<Transform> childrenCurrent = new HashSet<Transform>(); private HashSet<Transform> childrenNew = new HashSet<Transform>(); private bool updateChildren; private bool isEnabled = true; private bool isQuitting; public RuntimeHierarchy Hierarchy { get { return m_hierarchy; } set { if ((Object)(object)m_hierarchy != (Object)(object)value) { RemoveChildrenFromScene(); m_hierarchy = value; AddChildrenToScene(); } } } public string SceneName { get { return m_sceneName; } set { if (m_sceneName != value) { RemoveChildrenFromScene(); m_sceneName = value; AddChildrenToScene(); } } } public bool HideOnDisable { get { return m_hideOnDisable; } set { if (m_hideOnDisable == value) { return; } m_hideOnDisable = value; if (!isEnabled) { if (value) { RemoveChildrenFromScene(); } else { AddChildrenToScene(); } } } } private bool ShouldUpdateChildren { get { if ((isEnabled || !m_hideOnDisable) && Object.op_Implicit((Object)(object)Hierarchy)) { return !string.IsNullOrEmpty(m_sceneName); } return false; } } private void OnEnable() { isEnabled = true; updateChildren = true; } private void OnDisable() { if (!isQuitting) { isEnabled = false; if (m_hideOnDisable) { RemoveChildrenFromScene(); } } } private void OnApplicationQuit() { isQuitting = true; } private void OnTransformChildrenChanged() { updateChildren = true; } private void Update() { if (!updateChildren) { return; } updateChildren = false; if (!ShouldUpdateChildren) { return; } for (int i = 0; i < ((Component)this).transform.childCount; i++) { Transform child = ((Component)this).transform.GetChild(i); childrenNew.Add(child); if (!childrenCurrent.Remove(child)) { Hierarchy.AddToPseudoScene(m_sceneName, child); } } RemoveChildrenFromScene(); HashSet<Transform> hashSet = childrenCurrent; childrenCurrent = childrenNew; childrenNew = hashSet; } private void AddChildrenToScene() { if (!ShouldUpdateChildren) { return; } for (int i = 0; i < ((Component)this).transform.childCount; i++) { Transform child = ((Component)this).transform.GetChild(i); if (childrenCurrent.Add(child)) { Hierarchy.AddToPseudoScene(m_sceneName, child); } } } private void RemoveChildrenFromScene() { if (!Object.op_Implicit((Object)(object)Hierarchy) || string.IsNullOrEmpty(m_sceneName)) { return; } foreach (Transform item in childrenCurrent) { if (Object.op_Implicit((Object)(object)item)) { Hierarchy.RemoveFromPseudoScene(m_sceneName, item, deleteSceneIfEmpty: true); } } childrenCurrent.Clear(); } } public abstract class HierarchyData { private static readonly List<HierarchyDataTransform> transformDataPool = new List<HierarchyDataTransform>(32); private static readonly List<List<HierarchyDataTransform>> childrenListPool = new List<List<HierarchyDataTransform>>(32); protected List<HierarchyDataTransform> children; protected HierarchyData parent; protected int m_index; protected int m_height = 1; protected int m_depth; public abstract string Name { get; } public abstract bool IsActive { get; } public abstract int ChildCount { get; } public abstract Transform BoundTransform { get; } public HierarchyDataRoot Root { get { HierarchyData hierarchyData = this; while (hierarchyData.parent != null) { hierarchyData = hierarchyData.parent; } return (HierarchyDataRoot)hierarchyData; } } public int Index => m_index; public int AbsoluteIndex { get { int num = m_index; for (HierarchyData hierarchyData = parent; hierarchyData != null; hierarchyData = hierarchyData.parent) { num += hierarchyData.m_index + 1; } return num; } } public int Height => m_height; public int Depth => m_depth; public bool CanExpand => ChildCount > 0; public bool IsExpanded { get { return children != null; } set { if (IsExpanded == value) { return; } if (value) { if (ChildCount == 0) { return; } PopChildrenList(); } else { PoolChildrenList(); } int height = m_height; Refresh(); int num = m_height - height; if (num == 0) { return; } if (parent != null) { HierarchyData hierarchyData = this; for (HierarchyData hierarchyData2 = parent; hierarchyData2 != null; hierarchyData2 = hierarchyData2.parent) { List<HierarchyDataTransform> list = hierarchyData2.children; int i = list.IndexOf((HierarchyDataTransform)hierarchyData) + 1; for (int count = list.Count; i < count; i++) { list[i].m_index += num; } hierarchyData2.m_height += num; hierarchyData = hierarchyData2; } } Root?.Hierarchy.SetListViewDirty(); } } public virtual bool Refresh() { if (m_depth < 0) { return false; } m_height = 1; bool flag = false; int childCount = ChildCount; if (IsExpanded) { if (childCount != children.Count) { flag = true; } RuntimeHierarchy runtimeHierarchy = null; for (int i = 0; i < childCount; i++) { Transform child = GetChild(i); if (children.Count <= i) { if ((Object)(object)runtimeHierarchy == (Object)null) { runtimeHierarchy = Root.Hierarchy; } GenerateChildItem(child, i, runtimeHierarchy); } else if ((Object)(object)children[i].BoundTransform != (Object)(object)child) { int j; for (j = 0; j < children.Count && !((Object)(object)children[j].BoundTransform == (Object)(object)child); j++) { } if (j == children.Count) { if ((Object)(object)runtimeHierarchy == (Object)null) { runtimeHierarchy = Root.Hierarchy; } GenerateChildItem(child, i, runtimeHierarchy); } else { HierarchyDataTransform item = children[j]; children.RemoveAt(j); children.Insert(i, item); } flag = true; } flag |= children[i].Refresh(); children[i].m_index = m_height - 1; m_height += children[i].m_height; } for (int num = children.Count - 1; num >= childCount; num--) { RemoveChildItem(num); } } return flag; } public HierarchyData FindDataAtIndex(int index) { int num = children.Count - 1; if (index <= num && children[index].m_index == index) { int i; for (i = index; i < num && index == children[i + 1].m_index; i++) { } return children[i]; } int num2 = 0; int j = num; while (num2 <= j) { int k = (num2 + j) / 2; int index2 = children[k].m_index; if (index == index2) { for (; k < num && index == children[k + 1].m_index; k++) { } return children[k]; } if (index < index2) { j = k - 1; } else { num2 = k + 1; } } if (j < 0) { j = 0; } for (; j < num && index >= children[j + 1].m_index; j++) { } return children[j].FindDataAtIndex(index - 1 - children[j].m_index); } public HierarchyDataTransform FindTransform(Transform target, Transform nextInPath = null) { if (m_depth < 0) { return null; } bool flag = (Object)(object)nextInPath == (Object)null; if (flag) { nextInPath = ((this is HierarchyDataRootSearch) ? target : target.root); } int num = IndexOf(nextInPath); if (num < 0) { if (!flag || !(this is HierarchyDataRootPseudoScene)) { return null; } nextInPath = target; num = IndexOf(nextInPath); while (num < 0 && (Object)(object)nextInPath != (Object)null) { nextInPath = nextInPath.parent; num = IndexOf(nextInPath); } if (num < 0) { return null; } } if (!CanExpand) { return null; } bool isExpanded = IsExpanded; if (!isExpanded) { IsExpanded = true; } HierarchyDataTransform hierarchyDataTransform = children[num]; if ((Object)(object)hierarchyDataTransform.BoundTransform == (Object)(object)target) { return hierarchyDataTransform; } HierarchyDataTransform hierarchyDataTransform2 = null; if ((Object)(object)hierarchyDataTransform.BoundTransform == (Object)(object)nextInPath) { Transform val = target; Transform val2 = val.parent; while ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)nextInPath) { val = val2; val2 = val.parent; } if ((Object)(object)val2 != (Object)null) { hierarchyDataTransform2 = hierarchyDataTransform.FindTransform(target, val); } } if (hierarchyDataTransform2 != null && hierarchyDataTransform2.m_depth < 0) { hierarchyDataTransform2 = null; } if (hierarchyDataTransform2 == null && !isExpanded) { IsExpanded = false; } return hierarchyDataTransform2; } public virtual HierarchyDataTransform FindTransformInVisibleChildren(Transform target, int targetDepth = -1) { for (int i = 0; i < children.Count; i++) { HierarchyDataTransform hierarchyDataTransform = children[i]; if (hierarchyDataTransform.m_depth < 0) { continue; } if (hierarchyDataTransform.BoundTransform == target) { if (targetDepth <= 0 || hierarchyDataTransform.m_depth == targetDepth) { return hierarchyDataTransform; } } else if ((targetDepth <= 0 || hierarchyDataTransform.m_depth < targetDepth) && hierarchyDataTransform.IsExpanded && Object.op_Implicit((Object)(object)hierarchyDataTransform.BoundTransform) && target.IsChildOf(hierarchyDataTransform.BoundTransform)) { hierarchyDataTransform = hierarchyDataTransform.FindTransformInVisibleChildren(target, targetDepth); if (hierarchyDataTransform != null) { return hierarchyDataTransform; } } } return null; } public abstract Transform GetChild(int index); public int IndexOf(Transform transform) { for (int num = ChildCount - 1; num >= 0; num--) { if (GetChild(num) == transform) { return num; } } return -1; } public void GetSiblingIndexTraversalList(List<int> traversalList) { traversalList.Clear(); HierarchyData hierarchyData = this; while (hierarchyData.parent != null) { traversalList.Add(hierarchyData.parent.children.IndexOf((HierarchyDataTransform)hierarchyData)); hierarchyData = hierarchyData.parent; } } public HierarchyData TraverseSiblingIndexList(List<int> traversalList) { HierarchyData hierarchyData = this; for (int num = traversalList.Count - 1; num >= 0; num--) { int num2 = traversalList[num]; if (hierarchyData.children == null || num2 >= hierarchyData.children.Count) { return null; } hierarchyData = hierarchyData.children[num2]; } return hierarchyData; } private void GenerateChildItem(Transform child, int index, RuntimeHierarchy hierarchy) { bool flag = !RuntimeInspectorUtils.IgnoredTransformsInHierarchy.Contains(child); if (flag && hierarchy.GameObjectFilter != null) { flag = hierarchy.GameObjectFilter(child); } int num = transformDataPool.Count - 1; HierarchyDataTransform hierarchyDataTransform; if (num >= 0) { hierarchyDataTransform = transformDataPool[num]; transformDataPool.RemoveAt(num); } else { hierarchyDataTransform = new HierarchyDataTransform(); } hierarchyDataTransform.Initialize(child, this is HierarchyDataRootSearch); hierarchyDataTransform.parent = this; if (flag) { hierarchyDataTransform.m_depth = m_depth + 1; hierarchyDataTransform.m_height = 1; } else { hierarchyDataTransform.m_depth = -1; hierarchyDataTransform.m_height = 0; } children.Insert(index, hierarchyDataTransform); } private void RemoveChildItem(int index) { children[index].PoolData(); transformDataPool.Add(children[index]); children.RemoveAt(index); } protected void PoolChildrenList() { if (children != null) { for (int num = children.Count - 1; num >= 0; num--) { children[num].PoolData(); transformDataPool.Add(children[num]); } children.Clear(); childrenListPool.Add(children); children = null; } } protected void PopChildrenList() { int childCount = ChildCount; int num = -1; int num2 = int.MaxValue; for (int num3 = childrenListPool.Count - 1; num3 >= 0; num3--) { int num4 = childrenListPool[num3].Capacity - childCount; if (num4 < 0) { num4 = -num4; } if (num4 < num2) { num2 = num4; num = num3; } } if (num >= 0) { children = childrenListPool[num]; childrenListPool.RemoveAt(num); } else { children = new List<HierarchyDataTransform>(ChildCount); } } public static void ClearPool() { childrenListPool.Clear(); transformDataPool.Clear(); if (childrenListPool.Capacity > 128) { childrenListPool.Capacity = 128; } if (transformDataPool.Capacity > 128) { transformDataPool.Capacity = 128; } } } public abstract class HierarchyDataRoot : HierarchyData { public override Transform BoundTransform => null; public override bool IsActive => true; public RuntimeHierarchy Hierarchy { get; private set; } protected HierarchyDataRoot(RuntimeHierarchy hierarchy) { Hierarchy = hierarchy; PopChildrenList(); } public abstract Transform GetNearestRootOf(Transform target); public abstract void RefreshContent(); public override bool Refresh() { RefreshContent(); return base.Refresh(); } public override HierarchyDataTransform FindTransformInVisibleChildren(Transform target, int targetDepth = -1) { if (m_depth < 0 || !base.IsExpanded) { return null; } return base.FindTransformInVisibleChildren(target, targetDepth); } public void ResetCachedNames() { if (children != null) { for (int num = children.Count - 1; num >= 0; num--) { children[num].ResetCachedName(); } } } public void RefreshNameOf(Transform target) { if (children != null) { for (int num = children.Count - 1; num >= 0; num--) { children[num].RefreshNameOf(target); } } } } public class HierarchyDataRootPseudoScene : HierarchyDataRoot { private readonly string name; private readonly List<Transform> rootObjects = new List<Transform>(); public override string Name => name; public override int ChildCount => rootObjects.Count; public HierarchyDataRootPseudoScene(RuntimeHierarchy hierarchy, string name) : base(hierarchy) { this.name = name; } public void AddChild(Transform child) { if (!rootObjects.Contains(child)) { rootObjects.Add(child); } } public void InsertChild(int index, Transform child) { index = Mathf.Clamp(index, 0, rootObjects.Count); rootObjects.Insert(index, child); for (int num = rootObjects.Count - 1; num >= 0; num--) { if (num != index && (Object)(object)rootObjects[num] == (Object)(object)child) { rootObjects.RemoveAt(num); break; } } } public void RemoveChild(Transform child) { rootObjects.Remove(child); } public override void RefreshContent() { for (int num = rootObjects.Count - 1; num >= 0; num--) { if (!Object.op_Implicit((Object)(object)rootObjects[num])) { rootObjects.RemoveAt(num); } } } public override Transform GetChild(int index) { return rootObjects[index]; } public override Transform GetNearestRootOf(Transform target) { Transform val = null; for (int num = rootObjects.Count - 1; num >= 0; num--) { Transform val2 = rootObjects[num]; if (Object.op_Implicit((Object)(object)val2) && target.IsChildOf(val2) && (!Object.op_Implicit((Object)(object)val) || val2.IsChildOf(val))) { val = val2; } } return val; } } public class HierarchyDataRootScene : HierarchyDataRoot { private readonly List<GameObject> rootObjects = new List<GameObject>(); public override string Name { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Scene scene = Scene; return ((Scene)(ref scene)).name; } } public override int ChildCount => rootObjects.Count; public Scene Scene { get; private set; } public HierarchyDataRootScene(RuntimeHierarchy hierarchy, Scene target) : base(hierarchy) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Scene = target; } public override void RefreshContent() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) rootObjects.Clear(); Scene scene = Scene; if (((Scene)(ref scene)).isLoaded) { scene = Scene; ((Scene)(ref scene)).GetRootGameObjects(rootObjects); } } public override Transform GetChild(int index) { return rootObjects[index].transform; } public override Transform GetNearestRootOf(Transform target) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (!(((Component)target).gameObject.scene == Scene)) { return null; } return target.root; } } public class HierarchyDataRootSearch : HierarchyDataRoot { private readonly List<Transform> searchResult = new List<Transform>(); private readonly HierarchyDataRoot reference; private string searchTerm; public override string Name => reference.Name; public override int ChildCount => searchResult.Count; public HierarchyDataRootSearch(RuntimeHierarchy hierarchy, HierarchyDataRoot reference) : base(hierarchy) { this.reference = reference; } public override void RefreshContent() { if (!base.Hierarchy.IsInSearchMode) { return; } searchResult.Clear(); searchTerm = base.Hierarchy.SearchTerm; int childCount = reference.ChildCount; for (int i = 0; i < childCount; i++) { Transform child = reference.GetChild(i); if (Object.op_Implicit((Object)(object)child) && !RuntimeInspectorUtils.IgnoredTransformsInHierarchy.Contains(((Component)child).transform)) { if (((Object)child).name.IndexOf(searchTerm, StringComparison.OrdinalIgnoreCase) >= 0) { searchResult.Add(child); } SearchTransformRecursively(((Component)child).transform); } } } public override bool Refresh() { m_depth = 0; bool result = base.Refresh(); if (searchResult.Count == 0) { m_height = 0; m_depth = -1; } return result; } public override HierarchyDataTransform FindTransformInVisibleChildren(Transform target, int targetDepth = -1) { if (m_depth < 0 || targetDepth > 1 || !base.IsExpanded) { return null; } for (int num = children.Count - 1; num >= 0; num--) { if (children[num].BoundTransform == target) { return children[num]; } } return null; } private void SearchTransformRecursively(Transform obj) { for (int i = 0; i < obj.childCount; i++) { Transform child = obj.GetChild(i); if (!RuntimeInspectorUtils.IgnoredTransformsInHierarchy.Contains(child)) { if (((Object)child).name.IndexOf(searchTerm, StringComparison.OrdinalIgnoreCase) >= 0) { searchResult.Add(child); } SearchTransformRecursively(child); } } } public override Transform GetChild(int index) { return searchResult[index]; } public override Transform GetNearestRootOf(Transform target) { if (!searchResult.Contains(target)) { return null; } return target; } } public class HierarchyDataTransform : HierarchyData { private string cachedName; private Transform transform; private bool isSearchEntry; public override string Name { get { if (cachedName == null) { cachedName = (Object.op_Implicit((Object)(object)transform) ? ((Object)transform).name : "<destroyed>"); } return cachedName; } } public override int ChildCount { get { if (isSearchEntry || !Object.op_Implicit((Object)(object)transform)) { return 0; } return transform.childCount; } } public override Transform BoundTransform => transform; public override bool IsActive { get { if (!Object.op_Implicit((Object)(object)transform)) { return true; } return ((Component)transform).gameObject.activeInHierarchy; } } public void Initialize(Transform transform, bool isSearchEntry) { this.transform = transform; this.isSearchEntry = isSearchEntry; } public override Transform GetChild(int index) { return transform.GetChild(index); } public void ResetCachedName() { cachedName = null; if (children != null) { for (int num = children.Count - 1; num >= 0; num--) { children[num].ResetCachedName(); } } } public void RefreshNameOf(Transform target) { if (transform == target) { cachedName = ((Object)target).name; } else if (children != null) { for (int num = children.Count - 1; num >= 0; num--) { children[num].RefreshNameOf(target); } } } public void PoolData() { parent = null; cachedName = null; m_depth = 0; m_height = 0; PoolChildrenList(); } } public class HierarchyField : RecycledListItem, ITooltipContent { private enum ExpandedState { Collapsed, Expanded, ArrowHidden } private const float INACTIVE_ITEM_TEXT_ALPHA = 0.57f; private const float TEXT_X_OFFSET = 35f; [SerializeField] private RectTransform contentTransform; [SerializeField] private Text nameText; [SerializeField] private PointerEventListener clickListener; [SerializeField] private PointerEventListener expandToggle; [SerializeField] private Image expandArrow; [SerializeField] private Toggle multiSelectionToggle; [SerializeField] private Image multiSelectionToggleBackground; private RectTransform rectTransform; private Image background; private int m_skinVersion; private UISkin m_skin; private bool m_isSelected; private bool m_isActive; private ExpandedState m_isExpanded; public UISkin Skin { get { return m_skin; } set { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_skin != (Object)(object)value || m_skinVersion != m_skin.Version) { m_skin = value; m_skinVersion = m_skin.Version; rectTransform.sizeDelta = new Vector2(0f, (float)Skin.LineHeight); nameText.SetSkinText(Skin); ((Graphic)expandArrow).color = Skin.ExpandArrowColor; ((Graphic)nameText).rectTransform.anchoredPosition = new Vector2(Skin.ExpandArrowSpacing + (float)Skin.LineHeight * 0.75f, 0f); ((RectTransform)((Component)expandToggle).transform).sizeDelta = new Vector2((float)Skin.LineHeight, (float)Skin.LineHeight); ((RectTransform)((Component)multiSelectionToggle).transform).sizeDelta = new Vector2((float)Skin.LineHeight * 0.8f, (float)Skin.LineHeight * 0.8f); multiSelectionToggle.graphic.color = Skin.ToggleCheckmarkColor; ((Graphic)multiSelectionToggleBackground).color = Skin.InputFieldNormalBackgroundColor; } } } public bool IsSelected { get { return m_isSelected; } set { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) m_isSelected = value; Color color; if (m_isSelected) { ((Graphic)background).color = Skin.SelectedItemBackgroundColor; color = Skin.SelectedItemTextColor; } else { ((Graphic)background).color = ((Data.Depth == 0) ? Skin.BackgroundColor.Tint(0.075f) : Color.clear); color = Skin.TextColor; } color.a = (m_isActive ? 1f : 0.57f); ((Graphic)nameText).color = color; multiSelectionToggle.isOn = m_isSelected; } } private bool IsActive { get { return m_isActive; } set { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (m_isActive != value) { m_isActive = value; Color color = ((Graphic)nameText).color; color.a = (m_isActive ? 1f : 0.57f); ((Graphic)nameText).color = color; } } } public bool MultiSelectionToggleVisible { get { return ((Component)multiSelectionToggle).gameObject.activeSelf; } set { //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (Data == null || Data.Depth <= 0) { value = false; } if (((Component)multiSelectionToggle).gameObject.activeSelf != value) { ((Component)multiSelectionToggle).gameObject.SetActive(value); contentTransform.anchoredPosition = new Vector2((float)(Skin.IndentAmount * Data.Depth) + (value ? ((float)Skin.LineHeight * 0.8f) : 0f), 0f); } } } private ExpandedState IsExpanded { get { return m_isExpanded; } set { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (m_isExpanded != value) { m_isExpanded = value; if (m_isExpanded == ExpandedState.ArrowHidden) { ((Component)expandToggle).gameObject.SetActive(false); return; } ((Component)expandToggle).gameObject.SetActive(true); ((Transform)((Graphic)expandArrow).rectTransform).localEulerAngles = (Vector3)((m_isExpanded == ExpandedState.Expanded) ? new Vector3(0f, 0f, -90f) : Vector3.zero); } } } bool ITooltipContent.IsActive { get { if (Object.op_Implicit((Object)(object)this)) { return ((Component)this).gameObject.activeSelf; } return false; } } string ITooltipContent.TooltipText => Data.Name; public float PreferredWidth { get; private set; } public RuntimeHierarchy Hierarchy { get; private set; } public HierarchyData Data { get; private set; } public void Initialize(RuntimeHierarchy hierarchy) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown Hierarchy = hierarchy; rectTransform = (RectTransform)((Component)this).transform; background = ((Component)clickListener).GetComponent<Image>(); if (hierarchy.ShowTooltips) { ((Component)clickListener).gameObject.AddComponent<TooltipArea>().Initialize(hierarchy.TooltipListener, this); } expandToggle.PointerClick += delegate { ToggleExpandedState(); }; clickListener.PointerClick += delegate { OnClick(); }; clickListener.PointerDown += OnPointerDown; clickListener.PointerUp += OnPointerUp; } public void SetContent(HierarchyData data) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) Data = data; contentTransform.anchoredPosition = new Vector2((float)(Skin.IndentAmount * data.Depth) + (MultiSelectionToggleVisible ? ((float)Skin.LineHeight * 0.8f) : 0f), 0f); background.sprite = ((data.Depth == 0) ? Hierarchy.SceneDrawerBackground : Hierarchy.TransformDrawerBackground); RefreshName(); } private void ToggleExpandedState() { Data.IsExpanded = !Data.IsExpanded; } public void Refresh() { IsActive = Data.IsActive; IsExpanded = ((!Data.CanExpand) ? ExpandedState.ArrowHidden : (Data.IsExpanded ? ExpandedState.Expanded : ExpandedState.Collapsed)); } public void RefreshName() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) nameText.text = Data.Name; if (Hierarchy.ShowHorizontalScrollbar) { LayoutRebuilder.ForceRebuildLayoutImmediate(((Graphic)nameText).rectTransform); PreferredWidth = (float)(Data.Depth * m_skin.IndentAmount) + 35f + ((Graphic)nameText).rectTransform.sizeDelta.x; } } private void OnPointerDown(PointerEventData eventData) { Hierarchy.OnDrawerPointerEvent(this, eventData, isPointerDown: true); } priv