39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using DG.Tweening;
|
||
|
using UnityEngine.EventSystems;
|
||
|
using System;
|
||
|
using UnityEngine.UI;
|
||
|
using TMPro;
|
||
|
|
||
|
public class HoverItem : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||
|
{
|
||
|
public Action m_EnterAction;
|
||
|
public Action m_ExitAction;
|
||
|
|
||
|
private Tween m_Tween0;
|
||
|
private Tween m_Tween1;
|
||
|
public void OnPointerEnter(PointerEventData eventData)
|
||
|
{
|
||
|
m_Tween0.Kill();
|
||
|
//transform.transform.DOScale(1.2f, 0.3f);
|
||
|
m_Tween0 = GetComponent<Image>().DOFillAmount(1, .3f);
|
||
|
foreach (var ts in GetComponentsInChildren<TextMeshProUGUI>())
|
||
|
{
|
||
|
ts.fontSize *= 1.2f;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void OnPointerExit(PointerEventData eventData)
|
||
|
{
|
||
|
m_Tween0.Kill();
|
||
|
//transform.DOScale(1f, 0.1f);
|
||
|
m_Tween0 = GetComponent<Image>().DOFillAmount(0, .1f);
|
||
|
foreach (var ts in GetComponentsInChildren<TextMeshProUGUI>())
|
||
|
{
|
||
|
ts.fontSize /= 1.2f;
|
||
|
}
|
||
|
}
|
||
|
}
|