您的位置:首页 > 其它

(个人)AR电子书系统创新实训第四周(2)

2017-06-04 11:53 295 查看

当前进展

本周前几天我已经实现了如何把服务器上的资源进行下载解压,接下来还需要让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;
}
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: