1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using static DownLoadXRManager;
- public class ImageLoadManager : MonoBehaviour
- {
- string type = "";
- public Texture2D texture2D;
- public void loadimage(string path)
- {
- type="image";
- if(path==""||path==null)
- {
- return;
- }
- Debug.Log("开始下载图片===》"+path);
- DownLoadResources dlr = new DownLoadResources();
- dlr.path = path;
-
- DownLoadXRManager.DownLoadForTexture(dlr, msg =>
- {
- texture2D=msg;
- this.transform.GetComponent<RawImage>().texture = msg;
- },(f)=>{
- });
- }
- public Texture2D pdftex;
- string pdfpath;
- public void loadPdf(string path)
- {
- type="pdf";
- if(path==""||path==null)
- {
- return;
- }
- Debug.Log("开始下载Pdf===》"+path);
- DownLoadResources dlr = new DownLoadResources();
- dlr.path = path;
-
- DownLoadXRManager.DownLoadForFilePath(dlr, msg =>
- {
- pdfpath=msg;
- this.transform.GetComponent<RawImage>().texture = pdftex;
-
- },(f)=>{
- });
- }
- public void showBigTexture()
- {
- if(type=="image")
- {
- TianJiWindowManager.Instance.showPoTexure2D(5,texture2D);
- }
- else
- {
- TianJiWindowManager.Instance.showPoPdf(6,pdfpath);
- }
- }
- void OnDestroy()
- {
- Destroy(texture2D);
- }
- }
|