hch
8 天以前 cb4ec28d83ba847f362392936b20e52e17b03081
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
public class DamageLine : MonoBehaviour
{
 
    public TextEx damageTypeLabel;
 
    public TextEx damageValueLabel;
 
    public void SetDamage(int damageType, long damage)
    {
        damageTypeLabel.SetActive(false);
        damageValueLabel.text = BattleUtility.DisplayDamageNum(damage, damageType);
    }
 
    public void SetDamage(long damage)
    {
        damageTypeLabel.SetActive(false);
        damageValueLabel.text = damage.ToString();
    }
 
    public void SetDamage(BattleDmg damage)
    {
        damageTypeLabel.SetActive(false);
        damageValueLabel.text = BattleUtility.DisplayDamageNum(damage);
    }
 
    public void SetColor(Color color)
    {
        var text = GetComponent<Text>();
        if (text != null)
        {
            text.color = color;
        }
 
        var texts = GetComponentsInChildren<Text>();
        foreach (var t in texts)
        {
            t.color = color;
        }
 
        var images = GetComponentsInChildren<Image>();
        foreach (var img in images)
        {
            img.color = color;
        }
    }
}