60 lines
1.5 KiB
C#
60 lines
1.5 KiB
C#
// Author: whc
|
|
// Desc:
|
|
|
|
using Game;
|
|
using Game.HotFix;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class TipLeftHintUnit : TipUnit
|
|
{
|
|
private static Color _warnColor = new Color(0.91f, 0.8f, 0.43f);
|
|
private static Color _errorColor = new Color(1f, 0.36f, 0.36f);
|
|
|
|
private RectTransform _rtfBg;
|
|
|
|
public override void Awake()
|
|
{
|
|
tmpText = transform.Find("tmpText").GetComponent<TextMeshProUGUI>();
|
|
_rtfBg = transform.GetComponent<RectTransform>();
|
|
}
|
|
|
|
public override void Refresh(TipData _Data)
|
|
{
|
|
base.Refresh(_Data);
|
|
HintData vData = _Data as HintData;
|
|
switch (vData.p_HintType)
|
|
{
|
|
case eHintType.Info:
|
|
tmpText.color = Color.white;
|
|
break;
|
|
case eHintType.Warn:
|
|
tmpText.color = _warnColor;
|
|
break;
|
|
case eHintType.Error:
|
|
tmpText.color = _errorColor;
|
|
break;
|
|
default:
|
|
Debug.LogError("not handle HintType:" + vData.p_HintType);
|
|
break;
|
|
}
|
|
|
|
LayoutRebuilder.ForceRebuildLayoutImmediate(_rtfBg);
|
|
StartCoroutine(AutoHide());
|
|
}
|
|
|
|
IEnumerator AutoHide()
|
|
{
|
|
yield return new WaitForSeconds(2f);
|
|
gameObject.SetActive(false);
|
|
|
|
//AppEntry.Event.Fire(null, ReduceTipHintEventArgs.Create(true));
|
|
Inform<bool>.Dispatch(eInformId.ReduceTipHintEventArgs, true);
|
|
}
|
|
|
|
}
|