using CodeStage.AntiCheat.ObscuredTypes; using System; using TMPro; using UnityEngine; using UnityEngine.UI; public class ArrowUI : MonoBehaviour { public Image[] images_unit; // 0 1, 1 10, 2 100 public TextMeshProUGUI label_count; ObscuredInt m_TotalAmount, m_MaxCount; int m_Unit, m_UnitIndex = 0, m_MinValue; Action m_Act; public void Set(Action _act, int _maxCount, bool _setMax = true, int _minvalue = 0) { m_Act = _act; m_MaxCount = _maxCount; m_MaxCount.RandomizeCryptoKey(); m_MinValue = _minvalue; OnClick_Unit(m_UnitIndex); if (_setMax) OnClick_RightMax(); else OnClick_LeftMax(); } void Set_Label() { m_TotalAmount.RandomizeCryptoKey(); label_count.text = DSUtil.GetThousandCommaText(m_TotalAmount); m_Act?.Invoke(m_TotalAmount); } public void OnClick_LeftMax() { m_TotalAmount = m_MinValue; Set_Label(); } public void OnClick_Left() { m_TotalAmount -= m_Unit; if (m_TotalAmount < m_MinValue) m_TotalAmount = m_MinValue; Set_Label(); } public void OnClick_Right() { m_TotalAmount += m_Unit; if (m_TotalAmount > m_MaxCount) m_TotalAmount = m_MaxCount; Set_Label(); } public void OnClick_RightMax() { m_TotalAmount = m_MaxCount; Set_Label(); } public int Get_TotalCount() { return m_TotalAmount; } public void OnClick_Unit(int _index) { m_UnitIndex = _index; for (int i = 0; i < images_unit.Length; i++) images_unit[i].color = new Color32(105, 125, 149, 255); images_unit[_index].color = new Color32(24, 193, 203, 255); if (m_UnitIndex == 0) m_Unit = 1; else if (m_UnitIndex == 1) m_Unit = 10; else m_Unit = 100; } }