PointView.cs 932 B

12345678910111213141516171819202122232425262728293031323334
  1. using TMPro;
  2. using UnityEngine;
  3. using WS;
  4. public class PointView : View
  5. {
  6. public GameObject BasePoint;
  7. public GameObject OPPoint;
  8. public GameObject MousePoint;
  9. public TextMeshProUGUI Text;
  10. public override void LoadInit()
  11. {
  12. ShowModeType = ViewShowModeType.Screen;
  13. ReferenceCollector rc = UIGameObject.GetComponent<ReferenceCollector>();
  14. BasePoint = rc.Get<GameObject>("BasePoint");
  15. OPPoint = rc.Get<GameObject>("OPPoint");
  16. MousePoint = rc.Get<GameObject>("MousePoint");
  17. Text = rc.GetComponent<TextMeshProUGUI>("Text");
  18. }
  19. private void SetText(string text)
  20. {
  21. Text.text = text;
  22. }
  23. public void ShowPoint(int index = 0, string text = null)
  24. {
  25. SetText(text);
  26. BasePoint.gameObject.SetActive(index == 0);
  27. OPPoint.gameObject.SetActive(index == 1);
  28. MousePoint.gameObject.SetActive(index == 2);
  29. }
  30. }