using CodeStage.AntiCheat.ObscuredTypes; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; public class StatChangeUI : MonoBehaviourSingletonTemplate { public GameObject go_child; public TextMeshProUGUI label_statchange; Dictionary dic_StatValue_Before = new Dictionary(); private void Start() { Off(); } public void Set(bool before, Dictionary dic) { if (before) { dic_StatValue_Before.Clear(); foreach (var item in dic) dic_StatValue_Before.Add(item.Key, item.Value); } else { label_statchange.text = ""; foreach (var item in dic) { var v_before = dic_StatValue_Before[item.Key]; var v_after = dic[item.Key]; if (v_after > v_before) label_statchange.text += $"{MyText.Get_StatNameValueText(item.Key, v_before)} >> {MyText.Get_StatValueText(item.Key, v_after)}\n"; else if (v_after < v_before) label_statchange.text += $"{MyText.Get_StatNameValueText(item.Key, v_before)} >> {MyText.Get_StatValueText(item.Key, v_after)}\n"; } if (!string.IsNullOrEmpty(label_statchange.text)) { go_child.SetActive(true); if (IsInvoking("Off")) CancelInvoke(); Invoke("Off", 5f); } else Off(); } } void Off() { go_child.SetActive(false); } }