r2mods/ilspy_dump/ror2_csproj/RoR2.UI/InfiniteTowerWaveCounter.cs

37 lines
783 B
C#

using TMPro;
using UnityEngine;
namespace RoR2.UI;
public class InfiniteTowerWaveCounter : MonoBehaviour
{
[Tooltip("The text we're setting")]
[SerializeField]
private TextMeshProUGUI counterText;
[Tooltip("The language token for the text field")]
[SerializeField]
private string token;
private InfiniteTowerRun runInstance;
private string counterTextString;
private int oldWaveIndex = -1;
private void OnEnable()
{
runInstance = Run.instance as InfiniteTowerRun;
counterTextString = Language.GetString(token);
}
private void Update()
{
if ((bool)runInstance && (bool)counterText && runInstance.waveIndex != oldWaveIndex)
{
oldWaveIndex = runInstance.waveIndex;
counterText.text = string.Format(counterTextString, runInstance.waveIndex);
}
}
}