57 lines
1.2 KiB
C#
57 lines
1.2 KiB
C#
|
using UnityEngine;
|
|||
|
using UnityEngine.EventSystems;
|
|||
|
using DG.Tweening;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
public class SilderUI : MonoBehaviour, IDragHandler, IEndDragHandler
|
|||
|
{
|
|||
|
public SceneBtn sceneBtn;
|
|||
|
private float swipeThreshold = 10f; // <20><><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
private void Start()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void OnDrag(PointerEventData eventData)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void OnEndDrag(PointerEventData eventData)
|
|||
|
{
|
|||
|
float dragDistance = eventData.pressPosition.x - eventData.position.x;
|
|||
|
Debug.Log(dragDistance);
|
|||
|
bool toNext = dragDistance > 0; // <20>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>
|
|||
|
if (toNext)
|
|||
|
{
|
|||
|
JumpScene.jumpbool += 1;
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
JumpScene.jumpbool -= 1;
|
|||
|
}
|
|||
|
|
|||
|
if (JumpScene.jumpbool < 0)
|
|||
|
{
|
|||
|
JumpScene.jumpbool = 4;
|
|||
|
}
|
|||
|
|
|||
|
if (JumpScene.jumpbool >4)
|
|||
|
{
|
|||
|
JumpScene.jumpbool = 0;
|
|||
|
}
|
|||
|
|
|||
|
if (Mathf.Abs(dragDistance) >= swipeThreshold)
|
|||
|
{
|
|||
|
sceneBtn.BeginLoad(JumpScene.jumpbool);
|
|||
|
UIScreenMgr.instance.ShowScreen(JumpScene.jumpbool);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|