blob: 7c19bfe2ead169ca0eff7e13db021b2597687be1 (
plain)
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
52
53
54
55
56
57
58
59
60
61
|
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class CardInfoDisplayer : MonoBehaviour
{
public Color negativeColor;
public Color positiveColor;
public GameObject statObject;
public GameObject grid;
public GameObject chargeObj;
public TextMeshProUGUI effectText;
public TextMeshProUGUI nameText;
public Image icon;
public void DrawCard(CardInfoStat[] stats, string cardName, string description = "", Sprite image = null, bool charge = false)
{
if (charge)
{
chargeObj.SetActive(value: true);
chargeObj.transform.SetParent(grid.transform, worldPositionStays: true);
}
if (description != "")
{
effectText.text = description;
effectText.gameObject.SetActive(value: true);
effectText.transform.SetParent(grid.transform, worldPositionStays: true);
}
nameText.text = cardName.ToUpper();
for (int i = 0; i < stats.Length; i++)
{
GameObject obj = Object.Instantiate(statObject, grid.transform.position, grid.transform.rotation, grid.transform);
obj.SetActive(value: true);
obj.transform.localScale = Vector3.one;
TextMeshProUGUI component = obj.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
TextMeshProUGUI component2 = obj.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
component.text = stats[i].stat;
if (stats[i].simepleAmount != 0 && !Optionshandler.showCardStatNumbers)
{
component2.text = stats[i].GetSimpleAmount();
}
else
{
component2.text = stats[i].amount;
}
component2.color = (stats[i].positive ? positiveColor : negativeColor);
}
if ((bool)image)
{
icon.sprite = image;
}
effectText.transform.position += Vector3.up * 0.3f;
}
}
|