增加事件监听

This commit is contained in:
shenjianxing 2025-04-28 09:12:21 +08:00
parent dc56dbb402
commit 5f791268ef

View File

@ -2,6 +2,8 @@ using UnityEngine;
using UnityEngine.UI;
using QFramework;
using System.Collections.Generic;
using UnityEngine.EventSystems;
using System;
namespace QFramework.Example
{
@ -52,6 +54,9 @@ namespace QFramework.Example
}
});
leftObj.OnDragEvent(leftOnDrag);
var rightObj = GameObject.Instantiate(RightItem, RightContent);
rightObj.transform.localPosition = item.pos;
rightObj.rectTransform.sizeDelta = item.size;
@ -75,6 +80,11 @@ namespace QFramework.Example
}
private void leftOnDrag(PointerEventData data)
{
data.selectedObject.transform.position = Input.mousePosition;
}
protected override void OnShow()
{
}