ZiYuanFileItem.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5. using UnityEngine.UI;
  6. public class ZiYuanFileItem : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
  7. {
  8. public Button button;
  9. public GameObject enterImage;
  10. public GameObject blueImage;
  11. public GameObject grayImage;
  12. public Text nametext;
  13. // Start is called before the first frame update
  14. void Start()
  15. {
  16. button.onClick.AddListener(ValueChange);
  17. }
  18. private void CanelLoad()
  19. {
  20. blueImage.SetActive(false);
  21. grayImage.SetActive(false);
  22. }
  23. private void ShowOrHideGray(int num)
  24. {
  25. if (!blueImage.activeSelf)
  26. {
  27. if (num >= 3)
  28. {
  29. grayImage.SetActive(true);
  30. }
  31. else
  32. {
  33. grayImage.SetActive(false);
  34. }
  35. }
  36. }
  37. private void ValueChange()
  38. {
  39. if (!blueImage.activeSelf)
  40. {
  41. blueImage.SetActive(true);
  42. UIModelManager.Instance.loadModelName = nametext.text;
  43. }
  44. else
  45. {
  46. blueImage.SetActive(false);
  47. UIModelManager.Instance.loadModelName = "";
  48. }
  49. }
  50. public void OnPointerEnter(PointerEventData eventData)
  51. {
  52. if (blueImage.activeSelf || grayImage.activeSelf)
  53. {
  54. return;
  55. }
  56. this.enterImage.SetActive(true);
  57. }
  58. public void OnPointerExit(PointerEventData eventData)
  59. {
  60. if (blueImage.activeSelf || grayImage.activeSelf)
  61. {
  62. return;
  63. }
  64. this.enterImage.SetActive(false);
  65. }
  66. }