78 lines
1.7 KiB
C#
78 lines
1.7 KiB
C#
// ***********************************************************************
|
|
// Assembly : Game
|
|
// Author : Kimch
|
|
// Created : 2020-10-13
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "ComboText" company="Kunpo"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DG.Tweening;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace G.UI
|
|
{
|
|
public class ComboText : MonoBehaviour
|
|
{
|
|
public Text comboText;
|
|
public Text comboFxText;
|
|
|
|
//float _timer = 2f;
|
|
//int _num;
|
|
//public void Update()
|
|
//{
|
|
// _timer -= Time.deltaTime;
|
|
// if (_timer < 0)
|
|
// {
|
|
// ShowNumber((_num++) + " ");
|
|
// _timer = 0.3f;
|
|
// }
|
|
//}
|
|
|
|
public void ShowNumber(string text)
|
|
{
|
|
if (string.IsNullOrEmpty(text))
|
|
{
|
|
this.gameObject.SetActive(false);
|
|
//comboText.gameObject.SetActive(false);
|
|
//comboFxText.gameObject.SetActive(false);
|
|
return;
|
|
}
|
|
|
|
this.gameObject.SetActive(true);
|
|
//comboText.gameObject.SetActive(true);
|
|
//comboFxText.gameObject.SetActive(true);
|
|
|
|
comboText.text = text;
|
|
|
|
if (!_anim)
|
|
{
|
|
_anim = true;
|
|
StartCoroutine(ShowComboText(text));
|
|
}
|
|
}
|
|
|
|
bool _anim;
|
|
|
|
IEnumerator ShowComboText(string text)
|
|
{
|
|
comboFxText.text = text;
|
|
comboFxText.color = Color.white;
|
|
comboFxText.DOFade(0, 0.8f);
|
|
|
|
comboFxText.rectTransform.localScale = Vector3.one;
|
|
comboFxText.rectTransform.DOScale(Vector3.one * 2f, 0.8f);
|
|
|
|
yield return new WaitForSeconds(0.8f);
|
|
comboFxText.text = "";
|
|
_anim = false;
|
|
}
|
|
}
|
|
}
|