UI框架开发中
This commit is contained in:
@@ -2,14 +2,27 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.OnScreen;
|
||||
public class ScreenTest : MonoBehaviour
|
||||
{
|
||||
public InputActionReference inputAction;
|
||||
public RectTransform ParentObj;
|
||||
public OnScreenStick onScreenStick;
|
||||
Vector2 startPos;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
startPos = ParentObj.anchoredPosition;
|
||||
inputAction.action.Enable();
|
||||
inputAction.action.performed += ScreenTouchTest;
|
||||
onScreenStick.onPointerDown += () =>
|
||||
{
|
||||
ParentObj.anchoredPosition = onScreenStick.PointerDownPos;
|
||||
};
|
||||
onScreenStick.onPointerUp += () =>
|
||||
{
|
||||
ParentObj.anchoredPosition = startPos;
|
||||
};
|
||||
}
|
||||
|
||||
private void ScreenTouchTest(InputAction.CallbackContext obj)
|
||||
|
||||
Reference in New Issue
Block a user