BestRegionInPrefsProperty.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // --------------------------------------------------------------------------------------------------------------------
  2. // <copyright file="BestRegionInPrefsProperty.cs" company="Exit Games GmbH">
  3. // Part of: Pun Cockpit
  4. // </copyright>
  5. // <author>developer@exitgames.com</author>
  6. // --------------------------------------------------------------------------------------------------------------------
  7. using UnityEngine.UI;
  8. namespace Photon.Pun.Demo.Cockpit
  9. {
  10. /// <summary>
  11. /// PhotonNetwork.BestRegionSummaryInPreferences UI property.
  12. /// </summary>
  13. public class BestRegionInPrefsProperty : PropertyListenerBase
  14. {
  15. public Text Text;
  16. string _cache;
  17. void Update()
  18. {
  19. if (PhotonNetwork.BestRegionSummaryInPreferences != _cache)
  20. {
  21. _cache = PhotonNetwork.BestRegionSummaryInPreferences;
  22. this.OnValueChanged();
  23. if (string.IsNullOrEmpty(_cache))
  24. {
  25. Text.text = "n/a";
  26. }
  27. else
  28. {
  29. Text.text = _cache;
  30. }
  31. }
  32. }
  33. }
  34. }