TemplateImage.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using System.IO;
  6. public class TemplateImage : BaseTemPlate
  7. {
  8. private Image m_Image;
  9. protected override void OnEnable()
  10. {
  11. base.OnEnable();
  12. if (GameManager.Instance.IsRuning && m_Image.sprite == null && Data != null)
  13. {
  14. DownloadManager.Instance.GetImage(Data, m_Image);
  15. }
  16. }
  17. protected override void OnAwake()
  18. {
  19. base.OnAwake();
  20. m_Image = CacheTransform.Find("Canvas/Image").GetComponent<Image>();
  21. HideCollider();
  22. }
  23. public override void SetData(MaterialObjValue value, int updateTime)
  24. {
  25. base.SetData(value, updateTime);
  26. if (!GameManager.Instance.IsRuning)
  27. {
  28. //DownloadManager.Instance.AddDownloadData(Data);
  29. }
  30. else
  31. {
  32. DownloadManager.Instance.GetImage(Data, m_Image);
  33. }
  34. }
  35. public void SetLocaImageData(MaterialObjValue value)
  36. {
  37. m_Image.sprite = ResMgr.Instance.Load<Sprite>(value.DownloadPath);
  38. }
  39. public override void HideCollider()
  40. {
  41. base.HideCollider();
  42. }
  43. }