PdfManager.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Paroxe.PdfRenderer;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class PdfManager : BaseFilePrefabItem
  7. {
  8. private PDFViewer pdfview;
  9. public override void Init(FileConfig fileConfig)
  10. {
  11. base.Init(fileConfig);
  12. if (!string.IsNullOrEmpty(fileConfig.Url))
  13. {
  14. string url = fileConfig.Url;
  15. //LangChaoRommMinIo.Instance.getFile(MQTTManager.Instance.roomId, fileConfig.Bucket, fileConfig.ObjectName, (RoomFileData rfd) => {
  16. // Debug.Log("rfd==>" + rfd.url);
  17. // Debug.Log("rfd==>" + rfd.bytes.Length);
  18. // url = rfd.url;
  19. //});
  20. if (!fileConfig.Url.Contains("http"))
  21. {
  22. url = "https://" + fileConfig.Url;
  23. }
  24. showPDF(url);
  25. }
  26. }
  27. public void showPDF(string url)
  28. {
  29. //this.transform.localPosition = new Vector3(0,0,0.69f);
  30. pdfview = this.GetComponent<PDFViewer>();
  31. pdfview.FileURL = url;
  32. pdfview.LoadDocument();
  33. }
  34. public override void OnScaleStopped()
  35. {
  36. if (transform.localScale.x < 0.0001f)
  37. {
  38. transform.localScale = new Vector3(0.0001f, 0.0001f, 0.0001f);
  39. }
  40. }
  41. }