| | 1 | | using System; |
| | 2 | | using UnityEngine; |
| | 3 | | using UnityEngine.UI; |
| | 4 | |
|
| | 5 | | namespace DCL |
| | 6 | | { |
| | 7 | | public class NavmapZoomView : MonoBehaviour |
| | 8 | | { |
| | 9 | | [SerializeField] private ZoomInput zoomIn; |
| | 10 | | [SerializeField] private ZoomInput zoomOut; |
| | 11 | | [SerializeField] private InputAction_Measurable mouseWheelAction; |
| | 12 | |
|
| 1 | 13 | | [field: SerializeField] internal AnimationCurve normalizedZoomCurve { get; private set; } |
| 2 | 14 | | [field: SerializeField] internal Vector2Int zoomVerticalRange { get; set; } = new (28, 50); |
| 2 | 15 | | [field: SerializeField] internal float scaleDuration { get; private set; } = 0.2f; |
| | 16 | |
|
| 0 | 17 | | internal ZoomInput ZoomIn => zoomIn; |
| 0 | 18 | | internal ZoomInput ZoomOut => zoomOut; |
| 0 | 19 | | internal InputAction_Measurable MouseWheelAction => mouseWheelAction; |
| | 20 | |
|
| | 21 | | [Serializable] |
| | 22 | | internal class ZoomInput |
| | 23 | | { |
| 1 | 24 | | private static Color normalColor = new (0f, 0f, 0f, 1f); |
| 1 | 25 | | private static Color disabledColor = new (0f, 0f, 0f, 0.5f); |
| | 26 | |
|
| | 27 | | public InputAction_Hold InputAction; |
| | 28 | | public Button Button; |
| | 29 | |
|
| | 30 | | [SerializeField] private Image Image; |
| | 31 | |
|
| | 32 | | public void SetUiInteractable(bool isInteractable) |
| | 33 | | { |
| 0 | 34 | | Button.interactable = isInteractable; |
| 0 | 35 | | Image.color = isInteractable ? normalColor : disabledColor; |
| 0 | 36 | | } |
| | 37 | | } |
| | 38 | | } |
| | 39 | | } |