ChannelSelector.cs 995 B

1234567891011121314151617181920212223242526272829303132
  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. using UnityEngine.EventSystems;
  8. using UnityEngine.UI;
  9. namespace Photon.Chat.Demo
  10. {
  11. public class ChannelSelector : MonoBehaviour, IPointerClickHandler
  12. {
  13. public string Channel;
  14. public void SetChannel(string channel)
  15. {
  16. this.Channel = channel;
  17. Text t = this.GetComponentInChildren<Text>();
  18. t.text = this.Channel;
  19. }
  20. public void OnPointerClick(PointerEventData eventData)
  21. {
  22. ChatGui handler = FindObjectOfType<ChatGui>();
  23. handler.ShowChannel(this.Channel);
  24. }
  25. }
  26. }