当前进展
本周前几天我已经实现了如何把服务器上的资源进行下载解压,接下来还需要让app在解压路径下把图片和视频进行动态的绑定,可以参考第三周的那篇博客的做法:
ImageTargetManager.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using EasyAR;
using System.IO;
public class ImageTargetManager : MonoBehaviour {
public GameObject videoPrefab;
// Use this for initialization
void Awake () {
string sArrangement = File.ReadAllText(UnityEngine.Application.persistentDataPath + "/TempFiles/arrangement.txt");
AssetsArrangementInfo dstInfo = JsonUtility.FromJson<AssetsArrangementInfo>(sArrangement);
for(int i = 0; i < dstInfo.targetList.Count; ++i)
{
GameObject videoPlayer = Instantiate(videoPrefab);
var ITbehaviour = videoPlayer.GetComponent<ImageTargetBehaviour>();
ITbehaviour.Path = UnityEngine.Application.persistentDataPath + "/TempFiles/" + dstInfo.targetList[i];
ITbehaviour.Storage = StorageType.Absolute;
ITbehaviour.Bind(GameObject.Find("ImageTracker").GetComponent<ImageTrackerBehaviour>());
var VPbehaviour = videoPlayer.transform.GetChild(0).GetComponent<VideoPlayerBehaviour>();
VPbehaviour.Path = UnityEngine.Application.persistentDataPath + "/TempFiles/" + dstInfo.srcList[i];
VPbehaviour.Storage = StorageType.Absolute;
VPbehaviour.VideoScaleMode = EasyAR.VideoPlayerBaseBehaviour.ScaleMode.Fill;
VPbehaviour.EnableAutoPlay = true;
VPbehaviour.EnableLoop = true;
VPbehaviour.OpenWhenStart = true;
VPbehaviour.VideoScaleFactorBase = 0.1f;
}
}
}