From cf58771365b5953c6eac548b172aae880d1f0acd Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Sun, 19 May 2024 17:03:57 +0800 Subject: * rename --- .../Decompile/Rewired.Demos/UIPointer.cs | 98 ---------------------- 1 file changed, 98 deletions(-) delete mode 100644 Thronefall_1_57/Decompile/Rewired.Demos/UIPointer.cs (limited to 'Thronefall_1_57/Decompile/Rewired.Demos/UIPointer.cs') diff --git a/Thronefall_1_57/Decompile/Rewired.Demos/UIPointer.cs b/Thronefall_1_57/Decompile/Rewired.Demos/UIPointer.cs deleted file mode 100644 index c65fdae..0000000 --- a/Thronefall_1_57/Decompile/Rewired.Demos/UIPointer.cs +++ /dev/null @@ -1,98 +0,0 @@ -using UnityEngine; -using UnityEngine.EventSystems; -using UnityEngine.UI; - -namespace Rewired.Demos; - -[AddComponentMenu("")] -[RequireComponent(typeof(RectTransform))] -public sealed class UIPointer : UIBehaviour -{ - [Tooltip("Should the hardware pointer be hidden?")] - [SerializeField] - private bool _hideHardwarePointer = true; - - [Tooltip("Sets the pointer to the last sibling in the parent hierarchy. Do not enable this on multiple UIPointers under the same parent transform or they will constantly fight each other for dominance.")] - [SerializeField] - private bool _autoSort = true; - - private Canvas _canvas; - - public bool autoSort - { - get - { - return _autoSort; - } - set - { - if (value != _autoSort) - { - _autoSort = value; - if (value) - { - base.transform.SetAsLastSibling(); - } - } - } - } - - protected override void Awake() - { - base.Awake(); - Graphic[] componentsInChildren = GetComponentsInChildren(); - for (int i = 0; i < componentsInChildren.Length; i++) - { - componentsInChildren[i].raycastTarget = false; - } - if (_hideHardwarePointer) - { - Cursor.visible = false; - } - if (_autoSort) - { - base.transform.SetAsLastSibling(); - } - GetDependencies(); - } - - private void Update() - { - if (_autoSort && base.transform.GetSiblingIndex() < base.transform.parent.childCount - 1) - { - base.transform.SetAsLastSibling(); - } - } - - protected override void OnTransformParentChanged() - { - base.OnTransformParentChanged(); - GetDependencies(); - } - - protected override void OnCanvasGroupChanged() - { - base.OnCanvasGroupChanged(); - GetDependencies(); - } - - public void OnScreenPositionChanged(Vector2 screenPosition) - { - if (!(_canvas == null)) - { - Camera cam = null; - RenderMode renderMode = _canvas.renderMode; - if (renderMode != 0 && (uint)(renderMode - 1) <= 1u) - { - cam = _canvas.worldCamera; - } - RectTransformUtility.ScreenPointToLocalPointInRectangle(base.transform.parent as RectTransform, screenPosition, cam, out var localPoint); - base.transform.localPosition = new Vector3(localPoint.x, localPoint.y, base.transform.localPosition.z); - } - } - - private void GetDependencies() - { - _canvas = base.transform.root.GetComponentInChildren(); - } -} -- cgit v1.1-26-g67d0