UI框架开发中

This commit is contained in:
2025-09-29 07:45:07 +08:00
parent 423ad80303
commit 71edbb6088
39 changed files with 1191 additions and 397 deletions

View File

@@ -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)