mirror of
https://github.com/tym1116/BH3.git
synced 2025-12-16 16:34:41 +01:00
67 lines
1.2 KiB
C#
67 lines
1.2 KiB
C#
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
namespace MoleMole
|
|
{
|
|
public class MonoReportList : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IEventSystemHandler
|
|
{
|
|
private const float FADE_OUT_TIME = 3f;
|
|
|
|
private float _timer;
|
|
|
|
private bool _isFullColor;
|
|
|
|
public void Init()
|
|
{
|
|
DoSetFullColor(false);
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
if (_timer >= 0f)
|
|
{
|
|
_timer -= Time.unscaledDeltaTime;
|
|
if (_timer < 0f)
|
|
{
|
|
SetFullColor(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void OnPointerDown(PointerEventData eventData)
|
|
{
|
|
SetFullColor(true);
|
|
}
|
|
|
|
public void OnPointerUp(PointerEventData eventData)
|
|
{
|
|
_timer = 3f;
|
|
}
|
|
|
|
public void SetFullColor(bool fullColor)
|
|
{
|
|
if (_isFullColor != fullColor)
|
|
{
|
|
_isFullColor = fullColor;
|
|
DoSetFullColor(_isFullColor);
|
|
}
|
|
}
|
|
|
|
private void DoSetFullColor(bool fullColor)
|
|
{
|
|
MonoBattleReportRow[] componentsInChildren = base.transform.GetComponentsInChildren<MonoBattleReportRow>(true);
|
|
foreach (MonoBattleReportRow monoBattleReportRow in componentsInChildren)
|
|
{
|
|
if (fullColor)
|
|
{
|
|
monoBattleReportRow.SetFullColorText();
|
|
}
|
|
else
|
|
{
|
|
monoBattleReportRow.SetNoColorText();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|