CloudRegionProperty.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // --------------------------------------------------------------------------------------------------------------------
  2. // <copyright file="CloudRegionProperty.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.CloudRegion UI property.
  12. /// </summary>
  13. public class CloudRegionProperty : PropertyListenerBase
  14. {
  15. public Text Text;
  16. string _cache;
  17. void Update()
  18. {
  19. if (PhotonNetwork.CloudRegion != _cache)
  20. {
  21. _cache = PhotonNetwork.CloudRegion;
  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. }