LocalizationStatus.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*===============================================================================
  2. Copyright (C) 2022 Immersal - Part of Hexagon. All Rights Reserved.
  3. This file is part of the Immersal SDK.
  4. The Immersal SDK cannot be copied, distributed, or made available to
  5. third-parties for commercial purposes without written permission of Immersal Ltd.
  6. Contact sdk@immersal.com for licensing requests.
  7. ===============================================================================*/
  8. using System;
  9. using UnityEngine;
  10. using TMPro;
  11. using Immersal;
  12. namespace Immersal.Samples.Util
  13. {
  14. [RequireComponent(typeof(TextMeshProUGUI))]
  15. public class LocalizationStatus : MonoBehaviour
  16. {
  17. private const string StringFormat = "Successful localizations: {0}/{1}";
  18. private TextMeshProUGUI m_LabelText;
  19. private ImmersalSDK m_Sdk;
  20. void Start()
  21. {
  22. m_LabelText = GetComponent<TextMeshProUGUI>();
  23. m_Sdk = ImmersalSDK.Instance;
  24. }
  25. void Update()
  26. {
  27. if (m_Sdk.Localizer == null)
  28. return;
  29. m_LabelText.text = string.Format(StringFormat, m_Sdk.Localizer.stats.localizationSuccessCount, m_Sdk.Localizer.stats.localizationAttemptCount);
  30. }
  31. }
  32. }