Files
test/Assets/PerfectWorld/Scripts/UI/JumpBtn.cs
T
2026-01-09 17:06:53 +07:00

47 lines
1.1 KiB
C#

using BrewMonster.Network;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace BrewMonster.UI
{
public class JumpBtn : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
Button jumpBtn;
CECHostPlayer pHost => EC_Game.GetGameRun()?.GetHostPlayer();
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
if(jumpBtn == null)
{
jumpBtn = GetComponent<Button>();
jumpBtn.onClick.AddListener(OnClickBtnJump);
}
}
private void OnClickBtnJump()
{
}
public void OnPointerDown(PointerEventData eventData)
{
if (pHost != null)
{
pHost.isPressMoveUp = true;
pHost.OnMsgHstPushMove();
pHost.OnClickBtnJump();
}
}
public void OnPointerUp(PointerEventData eventData)
{
if (pHost != null)
{
pHost.isPressMoveUp = false;
}
}
}
}