2025-09-25 07:54:42 +08:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.InputSystem;
|
2025-09-29 07:45:07 +08:00
|
|
|
using UnityEngine.InputSystem.OnScreen;
|
2025-09-25 07:54:42 +08:00
|
|
|
public class ScreenTest : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public InputActionReference inputAction;
|
2025-09-29 07:45:07 +08:00
|
|
|
public RectTransform ParentObj;
|
|
|
|
|
public OnScreenStick onScreenStick;
|
|
|
|
|
Vector2 startPos;
|
2025-09-25 07:54:42 +08:00
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
2025-09-29 07:45:07 +08:00
|
|
|
startPos = ParentObj.anchoredPosition;
|
2025-09-25 07:54:42 +08:00
|
|
|
inputAction.action.Enable();
|
|
|
|
|
inputAction.action.performed += ScreenTouchTest;
|
2025-09-29 11:03:26 +08:00
|
|
|
//onScreenStick.onPointerDown += () =>
|
|
|
|
|
//{
|
|
|
|
|
// ParentObj.anchoredPosition = onScreenStick.PointerDownPos;
|
|
|
|
|
//};
|
|
|
|
|
//onScreenStick.onPointerUp += () =>
|
|
|
|
|
//{
|
|
|
|
|
// ParentObj.anchoredPosition = startPos;
|
|
|
|
|
//};
|
2025-09-25 07:54:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ScreenTouchTest(InputAction.CallbackContext obj)
|
|
|
|
|
{
|
|
|
|
|
Debug.Log(obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|