CommandText.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using TMPro;
  6. public class CommandText : MonoBehaviour
  7. {
  8. public TextMeshProUGUI commandText;
  9. public GameObject digiXrosObject;
  10. public void Init()
  11. {
  12. Off();
  13. if (digiXrosObject != null)
  14. {
  15. digiXrosObject.SetActive(false);
  16. }
  17. }
  18. #region Open command message
  19. public void OpenCommandText(string Text, bool digiXros = false)
  20. {
  21. commandText.text = Text;
  22. this.gameObject.SetActive(true);
  23. GetComponent<Animator>().SetInteger("Close", 0);
  24. if (digiXrosObject != null)
  25. {
  26. digiXrosObject.SetActive(digiXros);
  27. }
  28. }
  29. #endregion
  30. #region Close command message
  31. public void CloseCommandText()
  32. {
  33. if (!this.gameObject.activeSelf)
  34. {
  35. return;
  36. }
  37. GetComponent<Animator>().SetInteger("Close", 1);
  38. if (digiXrosObject != null)
  39. {
  40. digiXrosObject.SetActive(false);
  41. }
  42. }
  43. public void Off()
  44. {
  45. this.gameObject.SetActive(false);
  46. }
  47. #endregion
  48. }