ChatAppIdCheckerUI.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // --------------------------------------------------------------------------------------------------------------------
  2. // <copyright company="Exit Games GmbH"/>
  3. // <summary>Demo code for Photon Chat in Unity.</summary>
  4. // <author>developer@exitgames.com</author>
  5. // --------------------------------------------------------------------------------------------------------------------
  6. using UnityEngine;
  7. #if PHOTON_UNITY_NETWORKING
  8. using UnityEngine.UI;
  9. using Photon.Pun;
  10. namespace Photon.Chat.Demo
  11. {
  12. /// <summary>
  13. /// This is used in the Editor Splash to properly inform the developer about the chat AppId requirement.
  14. /// </summary>
  15. [ExecuteInEditMode]
  16. public class ChatAppIdCheckerUI : MonoBehaviour
  17. {
  18. public Text Description;
  19. public void Update()
  20. {
  21. if (string.IsNullOrEmpty(PhotonNetwork.PhotonServerSettings.AppSettings.AppIdChat))
  22. {
  23. if (this.Description != null)
  24. {
  25. this.Description.text = "<Color=Red>WARNING:</Color>\nPlease setup a Chat AppId in the PhotonServerSettings file.";
  26. }
  27. }
  28. else
  29. {
  30. if (this.Description != null)
  31. {
  32. this.Description.text = string.Empty;
  33. }
  34. }
  35. }
  36. }
  37. }
  38. #else
  39. namespace Photon.Chat.Demo
  40. {
  41. public class ChatAppIdCheckerUI : MonoBehaviour
  42. {
  43. // empty class. if PUN is not present, we currently don't check Chat-AppId "presence".
  44. }
  45. }
  46. #endif