diff --git a/Documentation~/zh/img/inputsystem01.png b/Documentation~/zh/img/inputsystem01.png new file mode 100644 index 00000000..c2716e63 Binary files /dev/null and b/Documentation~/zh/img/inputsystem01.png differ diff --git a/Documentation~/zh/img/inputsystem02.png b/Documentation~/zh/img/inputsystem02.png new file mode 100644 index 00000000..5178a460 Binary files /dev/null and b/Documentation~/zh/img/inputsystem02.png differ diff --git a/Documentation~/zh/img/inputsystem03.png b/Documentation~/zh/img/inputsystem03.png new file mode 100644 index 00000000..95ad50a3 Binary files /dev/null and b/Documentation~/zh/img/inputsystem03.png differ diff --git a/Documentation~/zh/inputsystem.md b/Documentation~/zh/inputsystem.md new file mode 100644 index 00000000..ce401c66 --- /dev/null +++ b/Documentation~/zh/inputsystem.md @@ -0,0 +1,17 @@ +--- +title: 入门教程:从 Input Manager 转到 Input System +sidebar_position: 1 +slug: /inputsystem +--- + +# 教程:从 Input Manager 转到 Input System + +## 1. 按图示修改项目配置中输入模式为 Input System +![Project Settings](img/inputsystem02.png) + +## 2. 使用 Unity Package Manager 安装 Input System +![UPM](img/inputsystem01.png) +## 3. 选中场景中 EventSystem 游戏对象,更换输入模组 +![Input Module](img/inputsystem03.png) + + diff --git a/README.md b/README.md index dd1d3b8a..faf54529 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ - 支持万级大数据量绘制,支持采样绘制。 - 支持`TexMeshPro`。 - 支持所有`5.6`以上的`Unity`版本。 +- 支持 Input System ([如何从 Input Manager 转 Input System](Documentation~/zh/inputsystem.md))。 ## 截图 diff --git a/Runtime/Component/DataZoom/DataZoom.cs b/Runtime/Component/DataZoom/DataZoom.cs index 030a0c52..eb1407c9 100644 --- a/Runtime/Component/DataZoom/DataZoom.cs +++ b/Runtime/Component/DataZoom/DataZoom.cs @@ -631,12 +631,12 @@ namespace XCharts.Runtime internal void UpdateStartLabelPosition(Vector3 pos) { - m_StartLabel.SetPosition(pos); + if (m_StartLabel != null) m_StartLabel.SetPosition(pos); } internal void UpdateEndLabelPosition(Vector3 pos) { - m_EndLabel.SetPosition(pos); + if (m_EndLabel != null) m_EndLabel.SetPosition(pos); } public void UpdateRuntimeData(float chartX, float chartY, float chartWidth, float chartHeight) diff --git a/Runtime/Component/DataZoom/DataZoomHandler.cs b/Runtime/Component/DataZoom/DataZoomHandler.cs index 50f9f755..54a88121 100644 --- a/Runtime/Component/DataZoom/DataZoomHandler.cs +++ b/Runtime/Component/DataZoom/DataZoomHandler.cs @@ -1,8 +1,10 @@ -using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; using XUGL; +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Runtime { diff --git a/Runtime/Component/VisualMap/VisualMapHandler.cs b/Runtime/Component/VisualMap/VisualMapHandler.cs index a6f672da..32089ea6 100644 --- a/Runtime/Component/VisualMap/VisualMapHandler.cs +++ b/Runtime/Component/VisualMap/VisualMapHandler.cs @@ -3,7 +3,9 @@ using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; using XUGL; - +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Runtime { [UnityEngine.Scripting.Preserve] diff --git a/Runtime/Internal/BaseChart.Component.cs b/Runtime/Internal/BaseChart.Component.cs index b989f2d9..62dab6a7 100644 --- a/Runtime/Internal/BaseChart.Component.cs +++ b/Runtime/Internal/BaseChart.Component.cs @@ -253,7 +253,15 @@ namespace XCharts.Runtime else return component; } - + public T EnsureChartComponent() where T : MainComponent + { + var component = GetChartComponent(); + if (component == null) + return AddChartComponent(); + else + return component; + } + public bool TryGetChartComponent(out T component, int index = 0) where T : MainComponent { diff --git a/Runtime/Internal/BaseChart.cs b/Runtime/Internal/BaseChart.cs index 10499ebb..3d90a2d3 100644 --- a/Runtime/Internal/BaseChart.cs +++ b/Runtime/Internal/BaseChart.cs @@ -11,7 +11,7 @@ namespace XCharts.Runtime { [AddComponentMenu("XCharts/EmptyChart", 10)] [ExecuteInEditMode] - [RequireComponent(typeof(RectTransform))] + [RequireComponent(typeof(RectTransform),typeof(CanvasRenderer))] [DisallowMultipleComponent] public partial class BaseChart : BaseGraph, ISerializationCallbackReceiver { diff --git a/Runtime/Internal/BaseGraph.cs b/Runtime/Internal/BaseGraph.cs index a74da86a..d5481354 100644 --- a/Runtime/Internal/BaseGraph.cs +++ b/Runtime/Internal/BaseGraph.cs @@ -2,6 +2,9 @@ using System; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Runtime { @@ -9,302 +12,303 @@ namespace XCharts.Runtime public partial class BaseGraph : MaskableGraphic, IPointerDownHandler, IPointerUpHandler, IPointerEnterHandler, IPointerExitHandler, IBeginDragHandler, IPointerClickHandler, IDragHandler, IEndDragHandler, IScrollHandler + { + [SerializeField] protected bool m_EnableTextMeshPro = false; + + protected Painter m_Painter; + protected int m_SiblingIndex; + + protected float m_GraphWidth; + protected float m_GraphHeight; + protected float m_GraphX; + protected float m_GraphY; + protected Vector3 m_GraphPosition = Vector3.zero; + protected Vector2 m_GraphMinAnchor; + protected Vector2 m_GraphMaxAnchor; + protected Vector2 m_GraphPivot; + protected Vector2 m_GraphSizeDelta; + protected Vector2 m_GraphAnchoredPosition; + protected Rect m_GraphRect = new Rect(0, 0, 0, 0); + protected bool m_RefreshChart = false; + protected bool m_ForceOpenRaycastTarget; + protected bool m_IsControlledByLayout = false; + protected bool m_PainerDirty = false; + protected bool m_IsOnValidate = false; + protected Vector3 m_LastLocalPosition; + + protected Action m_OnPointerClick; + protected Action m_OnPointerDown; + protected Action m_OnPointerUp; + protected Action m_OnPointerEnter; + protected Action m_OnPointerExit; + protected Action m_OnBeginDrag; + protected Action m_OnDrag; + protected Action m_OnEndDrag; + protected Action m_OnScroll; + + public virtual HideFlags chartHideFlags { get { return HideFlags.None; } } + + private ScrollRect m_ScrollRect; + + public Painter painter { get { return m_Painter; } } + + protected virtual void InitComponent() { - [SerializeField] protected bool m_EnableTextMeshPro = false; + InitPainter(); + } - protected Painter m_Painter; - protected int m_SiblingIndex; + protected override void Awake() + { + CheckTextMeshPro(); + m_SiblingIndex = 0; + m_LastLocalPosition = transform.localPosition; + UpdateSize(); + InitComponent(); + CheckIsInScrollRect(); + } - protected float m_GraphWidth; - protected float m_GraphHeight; - protected float m_GraphX; - protected float m_GraphY; - protected Vector3 m_GraphPosition = Vector3.zero; - protected Vector2 m_GraphMinAnchor; - protected Vector2 m_GraphMaxAnchor; - protected Vector2 m_GraphPivot; - protected Vector2 m_GraphSizeDelta; - protected Vector2 m_GraphAnchoredPosition; - protected Rect m_GraphRect = new Rect(0, 0, 0, 0); - protected bool m_RefreshChart = false; - protected bool m_ForceOpenRaycastTarget; - protected bool m_IsControlledByLayout = false; - protected bool m_PainerDirty = false; - protected bool m_IsOnValidate = false; - protected Vector3 m_LastLocalPosition; + protected override void Start() + { + m_RefreshChart = true; + } - protected Action m_OnPointerClick; - protected Action m_OnPointerDown; - protected Action m_OnPointerUp; - protected Action m_OnPointerEnter; - protected Action m_OnPointerExit; - protected Action m_OnBeginDrag; - protected Action m_OnDrag; - protected Action m_OnEndDrag; - protected Action m_OnScroll; - - public virtual HideFlags chartHideFlags { get { return HideFlags.None; } } - - private ScrollRect m_ScrollRect; - - public Painter painter { get { return m_Painter; } } - - protected virtual void InitComponent() - { - InitPainter(); - } - - protected override void Awake() + protected virtual void Update() + { + CheckSize(); + if (m_IsOnValidate) { + m_IsOnValidate = false; CheckTextMeshPro(); - m_SiblingIndex = 0; - m_LastLocalPosition = transform.localPosition; - UpdateSize(); InitComponent(); - CheckIsInScrollRect(); + RefreshGraph(); } - - protected override void Start() + else { - m_RefreshChart = true; + CheckComponent(); } + CheckPointerPos(); + CheckRefreshChart(); + CheckRefreshPainter(); + } - protected virtual void Update() - { - CheckSize(); - if (m_IsOnValidate) - { - m_IsOnValidate = false; - CheckTextMeshPro(); - InitComponent(); - RefreshGraph(); - } - else - { - CheckComponent(); - } - CheckPointerPos(); - CheckRefreshChart(); - CheckRefreshPainter(); - } - - protected virtual void SetAllComponentDirty() - { + protected virtual void SetAllComponentDirty() + { #if UNITY_EDITOR - if (!Application.isPlaying) - { - m_IsOnValidate = true; - } -#endif - m_PainerDirty = true; - } - - protected virtual void CheckComponent() - { - if (m_PainerDirty) - { - InitPainter(); - m_PainerDirty = false; - } - } - - private void CheckTextMeshPro() - { -#if dUI_TextMeshPro - var enableTextMeshPro = true; -#else - var enableTextMeshPro = false; -#endif - if (m_EnableTextMeshPro != enableTextMeshPro) - { - m_EnableTextMeshPro = enableTextMeshPro; - RebuildChartObject(); - } - } - -#if UNITY_EDITOR - protected override void Reset() { } - - protected override void OnValidate() + if (!Application.isPlaying) { m_IsOnValidate = true; } #endif + m_PainerDirty = true; + } - protected override void OnDestroy() + protected virtual void CheckComponent() + { + if (m_PainerDirty) { - for (int i = transform.childCount - 1; i >= 0; i--) - { - DestroyImmediate(transform.GetChild(i).gameObject); - } - } - - protected override void OnPopulateMesh(VertexHelper vh) - { - vh.Clear(); - } - - protected virtual void InitPainter() - { - m_Painter = ChartHelper.AddPainterObject("painter_b", transform, m_GraphMinAnchor, - m_GraphMaxAnchor, m_GraphPivot, new Vector2(m_GraphWidth, m_GraphHeight), chartHideFlags, 1); - m_Painter.type = Painter.Type.Base; - m_Painter.onPopulateMesh = OnDrawPainterBase; - m_Painter.transform.SetSiblingIndex(0); - } - - private void CheckSize() - { - var currWidth = rectTransform.rect.width; - var currHeight = rectTransform.rect.height; - - if (m_GraphWidth == 0 && m_GraphHeight == 0 && (currWidth != 0 || currHeight != 0)) - { - Awake(); - } - - if (m_GraphWidth != currWidth || - m_GraphHeight != currHeight || - m_GraphMinAnchor != rectTransform.anchorMin || - m_GraphMaxAnchor != rectTransform.anchorMax || - m_GraphAnchoredPosition != rectTransform.anchoredPosition) - { - UpdateSize(); - } - if (!ChartHelper.IsValueEqualsVector3(m_LastLocalPosition, transform.localPosition)) - { - m_LastLocalPosition = transform.localPosition; - OnLocalPositionChanged(); - } - } - - protected void UpdateSize() - { - m_GraphWidth = rectTransform.rect.width; - m_GraphHeight = rectTransform.rect.height; - - m_GraphMaxAnchor = rectTransform.anchorMax; - m_GraphMinAnchor = rectTransform.anchorMin; - m_GraphSizeDelta = rectTransform.sizeDelta; - m_GraphAnchoredPosition = rectTransform.anchoredPosition; - - rectTransform.pivot = LayerHelper.ResetChartPositionAndPivot(m_GraphMinAnchor, m_GraphMaxAnchor, - m_GraphWidth, m_GraphHeight, ref m_GraphX, ref m_GraphY); - m_GraphPivot = rectTransform.pivot; - - m_GraphRect.x = m_GraphX; - m_GraphRect.y = m_GraphY; - m_GraphRect.width = m_GraphWidth; - m_GraphRect.height = m_GraphHeight; - m_GraphPosition.x = m_GraphX; - m_GraphPosition.y = m_GraphY; - - OnSizeChanged(); - } - - private void CheckPointerPos() - { - if (!isPointerInChart) return; - if (canvas == null) return; - Vector2 local; - if (!ScreenPointToChartPoint(Input.mousePosition, out local)) - { - pointerPos = Vector2.zero; - } - else - { - pointerPos = local; - } - } - - protected virtual void CheckIsInScrollRect() - { - m_ScrollRect = GetComponentInParent(); - } - - protected virtual void CheckRefreshChart() - { - if (m_RefreshChart) - { - m_Painter.Refresh(); - m_RefreshChart = false; - } - } - - protected virtual void CheckRefreshPainter() - { - m_Painter.CheckRefresh(); - } - - internal virtual void RefreshPainter(Painter painter) - { - if (painter == null) return; - painter.Refresh(); - } - - protected virtual void OnSizeChanged() - { - m_RefreshChart = true; - } - - protected virtual void OnLocalPositionChanged() { } - - protected virtual void OnDrawPainterBase(VertexHelper vh, Painter painter) - { - DrawPainterBase(vh); - } - - protected virtual void DrawPainterBase(VertexHelper vh) { } - - public virtual void OnPointerClick(PointerEventData eventData) - { - if (m_OnPointerClick != null) m_OnPointerClick(eventData, this); - } - - public virtual void OnPointerDown(PointerEventData eventData) - { - if (m_OnPointerDown != null) m_OnPointerDown(eventData, this); - } - - public virtual void OnPointerUp(PointerEventData eventData) - { - if (m_OnPointerUp != null) m_OnPointerUp(eventData, this); - } - - public virtual void OnPointerEnter(PointerEventData eventData) - { - isPointerInChart = true; - if (m_OnPointerEnter != null) m_OnPointerEnter(eventData, this); - } - - public virtual void OnPointerExit(PointerEventData eventData) - { - isPointerInChart = false; - if (m_OnPointerExit != null) m_OnPointerExit(eventData, this); - } - - public virtual void OnBeginDrag(PointerEventData eventData) - { - if (m_ScrollRect != null) m_ScrollRect.OnBeginDrag(eventData); - if (m_OnBeginDrag != null) m_OnBeginDrag(eventData, this); - } - - public virtual void OnEndDrag(PointerEventData eventData) - { - if (m_ScrollRect != null) m_ScrollRect.OnEndDrag(eventData); - if (m_OnEndDrag != null) m_OnEndDrag(eventData, this); - } - - public virtual void OnDrag(PointerEventData eventData) - { - if (m_ScrollRect != null) m_ScrollRect.OnDrag(eventData); - if (m_OnDrag != null) m_OnDrag(eventData, this); - } - - public virtual void OnScroll(PointerEventData eventData) - { - if (m_ScrollRect != null) m_ScrollRect.OnScroll(eventData); - if (m_OnScroll != null) m_OnScroll(eventData, this); + InitPainter(); + m_PainerDirty = false; } } + + private void CheckTextMeshPro() + { +#if dUI_TextMeshPro + var enableTextMeshPro = true; +#else + var enableTextMeshPro = false; +#endif + if (m_EnableTextMeshPro != enableTextMeshPro) + { + m_EnableTextMeshPro = enableTextMeshPro; + RebuildChartObject(); + } + } + +#if UNITY_EDITOR + protected override void Reset() { } + + protected override void OnValidate() + { + m_IsOnValidate = true; + } +#endif + + protected override void OnDestroy() + { + for (int i = transform.childCount - 1; i >= 0; i--) + { + DestroyImmediate(transform.GetChild(i).gameObject); + } + } + + protected override void OnPopulateMesh(VertexHelper vh) + { + vh.Clear(); + } + + protected virtual void InitPainter() + { + m_Painter = ChartHelper.AddPainterObject("painter_b", transform, m_GraphMinAnchor, + m_GraphMaxAnchor, m_GraphPivot, new Vector2(m_GraphWidth, m_GraphHeight), chartHideFlags, 1); + m_Painter.type = Painter.Type.Base; + m_Painter.onPopulateMesh = OnDrawPainterBase; + m_Painter.transform.SetSiblingIndex(0); + } + + private void CheckSize() + { + var currWidth = rectTransform.rect.width; + var currHeight = rectTransform.rect.height; + + if (m_GraphWidth == 0 && m_GraphHeight == 0 && (currWidth != 0 || currHeight != 0)) + { + Awake(); + } + + if (m_GraphWidth != currWidth || + m_GraphHeight != currHeight || + m_GraphMinAnchor != rectTransform.anchorMin || + m_GraphMaxAnchor != rectTransform.anchorMax || + m_GraphAnchoredPosition != rectTransform.anchoredPosition) + { + UpdateSize(); + } + if (!ChartHelper.IsValueEqualsVector3(m_LastLocalPosition, transform.localPosition)) + { + m_LastLocalPosition = transform.localPosition; + OnLocalPositionChanged(); + } + } + + protected void UpdateSize() + { + m_GraphWidth = rectTransform.rect.width; + m_GraphHeight = rectTransform.rect.height; + + m_GraphMaxAnchor = rectTransform.anchorMax; + m_GraphMinAnchor = rectTransform.anchorMin; + m_GraphSizeDelta = rectTransform.sizeDelta; + m_GraphAnchoredPosition = rectTransform.anchoredPosition; + + rectTransform.pivot = LayerHelper.ResetChartPositionAndPivot(m_GraphMinAnchor, m_GraphMaxAnchor, + m_GraphWidth, m_GraphHeight, ref m_GraphX, ref m_GraphY); + m_GraphPivot = rectTransform.pivot; + + m_GraphRect.x = m_GraphX; + m_GraphRect.y = m_GraphY; + m_GraphRect.width = m_GraphWidth; + m_GraphRect.height = m_GraphHeight; + m_GraphPosition.x = m_GraphX; + m_GraphPosition.y = m_GraphY; + + OnSizeChanged(); + } + + private void CheckPointerPos() + { + if (!isPointerInChart) return; + if (canvas == null) return; + Vector2 mousePos = Input.mousePosition; + Vector2 local; + if (!ScreenPointToChartPoint(mousePos, out local)) + { + pointerPos = Vector2.zero; + } + else + { + pointerPos = local; + } + } + + protected virtual void CheckIsInScrollRect() + { + m_ScrollRect = GetComponentInParent(); + } + + protected virtual void CheckRefreshChart() + { + if (m_RefreshChart) + { + m_Painter.Refresh(); + m_RefreshChart = false; + } + } + + protected virtual void CheckRefreshPainter() + { + m_Painter.CheckRefresh(); + } + + internal virtual void RefreshPainter(Painter painter) + { + if (painter == null) return; + painter.Refresh(); + } + + protected virtual void OnSizeChanged() + { + m_RefreshChart = true; + } + + protected virtual void OnLocalPositionChanged() { } + + protected virtual void OnDrawPainterBase(VertexHelper vh, Painter painter) + { + DrawPainterBase(vh); + } + + protected virtual void DrawPainterBase(VertexHelper vh) { } + + public virtual void OnPointerClick(PointerEventData eventData) + { + if (m_OnPointerClick != null) m_OnPointerClick(eventData, this); + } + + public virtual void OnPointerDown(PointerEventData eventData) + { + if (m_OnPointerDown != null) m_OnPointerDown(eventData, this); + } + + public virtual void OnPointerUp(PointerEventData eventData) + { + if (m_OnPointerUp != null) m_OnPointerUp(eventData, this); + } + + public virtual void OnPointerEnter(PointerEventData eventData) + { + isPointerInChart = true; + if (m_OnPointerEnter != null) m_OnPointerEnter(eventData, this); + } + + public virtual void OnPointerExit(PointerEventData eventData) + { + isPointerInChart = false; + if (m_OnPointerExit != null) m_OnPointerExit(eventData, this); + } + + public virtual void OnBeginDrag(PointerEventData eventData) + { + if (m_ScrollRect != null) m_ScrollRect.OnBeginDrag(eventData); + if (m_OnBeginDrag != null) m_OnBeginDrag(eventData, this); + } + + public virtual void OnEndDrag(PointerEventData eventData) + { + if (m_ScrollRect != null) m_ScrollRect.OnEndDrag(eventData); + if (m_OnEndDrag != null) m_OnEndDrag(eventData, this); + } + + public virtual void OnDrag(PointerEventData eventData) + { + if (m_ScrollRect != null) m_ScrollRect.OnDrag(eventData); + if (m_OnDrag != null) m_OnDrag(eventData, this); + } + + public virtual void OnScroll(PointerEventData eventData) + { + if (m_ScrollRect != null) m_ScrollRect.OnScroll(eventData); + if (m_OnScroll != null) m_OnScroll(eventData, this); + } + } } \ No newline at end of file diff --git a/Runtime/Internal/Utilities/InputHelper.cs b/Runtime/Internal/Utilities/InputHelper.cs new file mode 100644 index 00000000..94870706 --- /dev/null +++ b/Runtime/Internal/Utilities/InputHelper.cs @@ -0,0 +1,111 @@ +#if INPUT_SYSTEM_ENABLED +using UnityEngine; +using UnityEngine.InputSystem; +using UnityEngine.InputSystem.LowLevel; + +namespace XCharts.Runtime +{ + public class InputHelper + { + public static Vector2 mousePosition + { + get + { + var value = Vector2.zero; + if (null != Mouse.current) + { + value = Mouse.current.position.ReadValue(); + } + else if (null != Touchscreen.current && Touchscreen.current.touches.Count > 0) + { + value = Touchscreen.current.touches[0].position.ReadValue(); + } + return value; + } + } + public static int touchCount + { + get + { + var value = 0; + if (null != Touchscreen.current) + { + value = Touchscreen.current.touches.Count; + } + return value; + } + } + + public static Touch GetTouch(int v) + { + UnityEngine.TouchPhase PhaseConvert(TouchState state) + { + UnityEngine.TouchPhase temp = UnityEngine.TouchPhase.Began; + switch (state.phase) + { + case UnityEngine.InputSystem.TouchPhase.Began: + temp = UnityEngine.TouchPhase.Began; + break; + case UnityEngine.InputSystem.TouchPhase.Moved: + temp = UnityEngine.TouchPhase.Moved; + break; + case UnityEngine.InputSystem.TouchPhase.Canceled: + temp = UnityEngine.TouchPhase.Canceled; + break; + case UnityEngine.InputSystem.TouchPhase.Stationary: + temp = UnityEngine.TouchPhase.Stationary; + break; + default: + case UnityEngine.InputSystem.TouchPhase.Ended: + case UnityEngine.InputSystem.TouchPhase.None: + temp = UnityEngine.TouchPhase.Ended; + break; + } + return temp; + } + var touch = Touchscreen.current.touches[v]; + var value = touch.ReadValue(); + //copy touchcontrol's touchstate data into touch + return new Touch + { + deltaPosition = value.delta, + fingerId = value.touchId, + position = value.position, + phase = PhaseConvert(value), + pressure = value.pressure, + radius = value.radius.magnitude, + radiusVariance = value.radius.sqrMagnitude, + type = value.isPrimaryTouch ? TouchType.Direct : TouchType.Indirect, + tapCount = value.tapCount, + deltaTime = Time.realtimeSinceStartup - (float)value.startTime, + rawPosition = value.startPosition, + }; + } + + public static bool GetKeyDown(KeyCode keyCode) + { + var value = false; + if (null != Keyboard.current) + { + var key = Keyboard.current.spaceKey; + switch (keyCode) + { + case KeyCode.Space: + key = Keyboard.current.spaceKey; + break; + case KeyCode.L: + key = Keyboard.current.lKey; + break; + default: + Debug.LogError($"{nameof(InputHelper)}: not support {keyCode} yet , please add it yourself if needed"); + break; + } + + value = key.wasPressedThisFrame; + } + return value; + } + + } +} +#endif diff --git a/Runtime/Internal/Utilities/InputHelper.cs.meta b/Runtime/Internal/Utilities/InputHelper.cs.meta new file mode 100644 index 00000000..fddfc435 --- /dev/null +++ b/Runtime/Internal/Utilities/InputHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5069defa9fe8c7a43843e1189e2d606c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/XCharts.Runtime.asmdef b/Runtime/XCharts.Runtime.asmdef index aa9babc9..64609360 100644 --- a/Runtime/XCharts.Runtime.asmdef +++ b/Runtime/XCharts.Runtime.asmdef @@ -1,13 +1,13 @@ { "name": "XCharts.Runtime", - "references": [ - ], - "optionalUnityReferences": [], + "references": [], "includePlatforms": [], "excludePlatforms": [], "allowUnsafeCode": false, "overrideReferences": false, "precompiledReferences": [], "autoReferenced": true, - "defineConstraints": [] + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false } \ No newline at end of file