CapersProject/Assets/02.Scripts/Ui/Title/TitleMenuButton.cs
Nam Tae Gun fb6a0a14f2 Ver 0.2.3.3 업데이트 내용
+ Title Ui 수정
+ 전투 맵 이동 위치 수정
+ 맵 입구 이미지 변경
+ 풀잎 아이템 추가에 따른 Excel, Json, So 수정
+ 타이탄 슬라임 맵에서 풀이 잘릴 때, 40% 확률로 풀잎을 드롭
+ 타이탄 슬라임 젬스톤 위치 및 재질 변경
+ AutoDropItem 프리팹 추가
2024-06-30 00:59:31 +09:00

63 lines
1.6 KiB
C#

using System;
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace BlueWater.Titles
{
public class TitleMenuButton : MonoBehaviour, ISelectHandler, IDeselectHandler, IPointerEnterHandler, IPointerExitHandler
{
[SerializeField, Required]
private Button _targetButton;
[SerializeField, Required]
private Image _selectedImage;
[SerializeField]
private Color _highlightedColor;
private Color _originalColor;
private bool _isQuitting;
private void Start()
{
_originalColor = _selectedImage.color;
}
private void OnApplicationQuit()
{
_isQuitting = true;
}
public void OnSelect(BaseEventData eventData)
{
_selectedImage.color = _originalColor;
_selectedImage.enabled = true;
}
public void OnDeselect(BaseEventData eventData)
{
_selectedImage.enabled = false;
}
public void OnPointerEnter(PointerEventData eventData)
{
if (EventSystem.current.currentSelectedGameObject == gameObject) return;
_selectedImage.color = _highlightedColor;
_selectedImage.enabled = true;
}
public void OnPointerExit(PointerEventData eventData)
{
if (_isQuitting || EventSystem.current?.currentSelectedGameObject == gameObject) return;
_selectedImage.color = _originalColor;
_selectedImage.enabled = false;
}
}
}